11.07.2015 Views

Mizu Webphone - Mizu Voip

Mizu Webphone - Mizu Voip

Mizu Webphone - Mizu Voip

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

1. write a function named “webphonetojs” to catch all messages from the applet. Regarding the incoming messages you can display the status of thephone (registered,ringing,in-call,etc), the most important events and alert the user about incoming calls or chat messages.2. load the applet with the webpage using the applet tags or with the “toolkit” method3. get a handle for the applet4. call the API_Register automatically or when the user click on the “Connect” button (or similar)5. call the API_Call function when the user clicks on your “Call” or “Dial” button6. popup a window (or enable an “accept” button) when you receive notifications about incoming calls to your “webphonetojs” function. Then callAPI_Accept or API_Reject according the user action7. if you will present a dial pad for the users, call the API_Dtmf function whenever the user presses a button8. you might put additional buttons or other controls on your interface for the following functions: audio settings, logout, hold, mute, redial, transfer andconference.Example call-flowObtain the webphone handle (see the initcheck in our javascript examples or just use document.applets[0])API_ServerInit(“11.12.13.14”); //remove java security restrictions –this can be skipped from version 3.6API_Register(“11.12.13.14”, “username”, “xxxx”); //connect to the serverAPI_Call(-1, “+363012345678”); //make a new call//wait for connect message by checking the message received on the webphonetojs function//notify the user when the call is ringing or connectedAPI_Mute(-2,true,0); //can be called when the user press a buttonAPI_Mute(-2,false,0); //reenable audio when the user press a buttonAPI_Hangup(-2); //disconnect all calls...also call the API_HTTPKeepAlive in every 5 minute to avoid session timeout (defined by the httpsessiontimeout applet parameter)Java SDK***Read this only if you are a Java developer. Otherwise this is not needed for the websipphone normal usage****Using the <strong>Mizu</strong>Tech webphone you can easily add VoIP functionality to any JVM (java) application.This section describes how to use the webphone as an SDK so you can embed it into your project.All the settings and API calls are described in the webphone documentation (JavaScript API section). You can use the exact same settings and functionsalso from your java code, only the following changes are needed:-add the webphone.jar lib to your project-listen on UDP port 51100 (localhost:51100) for the sipstack messages and parse them (as described in the "JavaScript Notifications" section)-instantiate a webphone object (webphone webphoneobj = new webphone())-call the API_SetParameter() to pass any settings (applet parameters)-call the API_Start() to start the sipstack-call any other functions as described in the JavaScript APINote: all API_ calls are thread safe and will not throw exceptions (on exception they will send an ERROR message and/or return false/-1 depending onthe context)Example code:--------------------------------------YourCode.java--------------------------------------import webphone.*;webphone webphoneobj = null;SIPNotifications sipnotifications = null;sipnotifications = new SIPNotifications();sipnotifications.Start();webphoneobj = new webphone();webphoneobj.API_SetParameter("serveraddress", "127.0.0.1");webphoneobj.API_SetParameter("username", "sipusername");

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!