Skip to end of metadata
Go to start of metadata

Methods

QoffeeSIP API has four public methods:

  • register(ext,pass): register the extension ext with the password pass. Pass field is optional.
  • call(ext): call to extension ext.
  • answer(): acept an incomming call.
  • hangup(): decline an incomming call or finish an established call.
  • unregister(): unregister the current extension.

Events

QoffeeSIP provides four events that can be binded to your own callback:

  • info
  • warning
  • error
  • new-state

Info, warning and error events

You must define a callback using API.on("info", function(type, data){}) Possible values for data are:For info event:

  • websocket created
  • websocket opened
  • websocket closed
  • RE-REGISTER answer
  • Another incomming call (BUSY)
  • Register successful
  • Unsusccessful register
  • Trying
  • Ringing
  • Establishing call
  • User not found
  • PROXY-AUTH
  • Request time out
  • Call ended
  • Hanging up
  • Call/Transaction does not exist
  • setLocalDescription
  • getUserMedia
  • Warning
  • Unexpected message
  • Server internal error
  • Error
  • websocket
  • getUserMedia
  • createOffer
  • createAnswer
  • setLocalDescription
  • setRemoteDescription

States

You must define a callback with API.on('new-state', function(state, data){} to manage this event. Possible values for state are:

  • 0. Offline.
  • 1: Registering (before challenge). QoffeeSIP has sent a message to register and it's waitting the answer to this register request.
  • 2: Registering (after challenge). Server has sent a challenge, you can't be registered directly (waiting for the re-register request).
  • 3: Registered. You are registered in the SIP server are now you can receive or make calls.
  • 4: Incomming call. QoffeeSIP has accepted an incomming call and it's waiting for the caller confirmation to establish media connection.
  • 5: Calling. QoffeeSIP has called another peer and it's waiting for the SIP server response.
  • 6: Ringing. There is an incomming call, QoffeeSIP could accept it or decline it (API.answer() or API.hangup()). When state 6 is triggered, data argument contains an asociative array like {ext: 112}, the extension number of the caller.
  • 7: Established call. Call and media connection have been stablished.
  • 8: Hanging up. QoffeeSIP has sent a request to finish an established call. QoffeeSIP is waiting for it's answer.
  • No labels