On this section we are showing how to use QoffeeSIP, following these steps you can easily include WebRTC features (using SIP protocol for signaling) in your website.
If you only want to include the stack features in your website, avoiding implementation "details" you only have to follow these steps:
- First of all you should get a copy of the source because examples are included on it:
- Copy "simplest-example" distribution files to your favourite web server:
cp -R /examples/webphone/dist/* /var/www
- Open two tabs of your browser and configure it with your SIP server parameters or enter a radom extension (Quobis server is going to be used automatically):
- Make a call and answer yourself in another one endpoint.
The next CoffeeScript code is translated to script.js. In this code we define two functions. The first one is for avoid page reloading on form submit.The next function is more complex. It bind the #init form submit to a callback where:
- An associative array, options, stores the values of this form to keys, server and mediaElements.
- options has another key, onopen, a function that binds the submit event from the other forms to a callback . This callback calls a QoffeeSIP method (API.register, API.call and API.hangup). This function will be executed once the websocket is open. So, we will be able to register, call or hangup being the websocket ready to send SIP messages.
- We create an API object usign options as argument of the contructor.
- We bind the event "new-state" to a callback that simply accept an incomming call. You should see our API documentation about this event. Here, we just manage state 6, that means there is an incomming call.
Enough, this simple code works. Here some steps to get it running:
- To avoid complexity the examples only can be deployed over a web server like Apache, not using node. You only have to build the app and move it from dist folder to your web server.
- To build the app:
- Install node. Developer guide includes a simple tutorial to get it compiled from sources.
- Install the dependencies:
- sudo npm install -g coffee-script
- sudo npm install -g jade
- sudo npm install -g stylus
- Clone the project:
- git clone
- Build it:
- cd QoffeeSIP/examples/webphone
- cake build
- NOTE: If you have any trouble run "cake clean" and try again.