0.8.6 • Published 5 years ago

sipply v0.8.6

Weekly downloads
2
License
MIT
Repository
gitlab
Last release
5 years ago

Sipply

Simple Sip phone library based on Sip.js

Create a new account

let account = new Account()

account.domain = <domain> //sip domain (onsip.com)
account.sipUsername = <username> //username (user)
account.authName = <auth> //authname if needed
account.websocketAddress = <ws> //websocket address (wss://onsip.com)
account.sipPassword = ><pass> //sip password

Create a new Sipply Phone

let phone = new Phone()

//event fired when phone is connected to server
phone.onConnected(() => console.log("connesso")

//event fired when there are connection errors
phone.onConnectionFailed((error) =>console.log("connection failed:" +error.errorId + "- " + error.errorMessage))

phone.connect(account)

Create a new outgoing call

//you have to provide a valid audio or video HTML tag
let audioTag = document.getElementById('remoteVideo')

let call = phone.newCall("3468873421")

//event fired when sip and WebRTC connection completed
call.onCallStarted(() => this.mod = 'started a call with ' + call.sipAddress)

//event fired when the call is stopped by one of the endpoints
call.onCallEnded(() => this.mod = "call ended")

//event fired in case of sip/WebRTC errors during the call
call.onCallError((error) => this.mod ="call errror:" + error.errorId + '-' + error.errorMessage)

call.start(audioTag)

Answer to an incoming call

You have to listen to the "ringing" event fired by the phone. the event handler have to take the incoming call and register to the call events. Then you can start the call

let phone = new Phone(account)

phone.onRinging((call) => call.start(audioTag))

phone.connect()

End a call

call.end()

Transfer a call via refer sip method (your sip provider need to e configured properly)

call = phone.newCall("original_sip_endpoint")

call.start(audioTag)

//trasferimento a nuovo destinatario

phone.transfer(call).to("new_sip_endpoint")
0.8.6

5 years ago

0.8.5

5 years ago

0.8.4

5 years ago

0.8.3

5 years ago

0.8.2

5 years ago

0.8.1

5 years ago