Home
Note : Il est également possible de configurer une adresse proxy (sortante) et un nom d'utilisateur sip / nom d'utilisateur authentifié différent. Ces paramètres peuvent également être demandés sur la page de connexion de l'interface utilisateur du softphone
JavaScript API
The public JavaScript API can be found in "webphone_api.js" file, under global javascript namespace "webphone_api". To be able to use the webphone as a javascript VoIP library, just copy the webphone folder to your web project and add the webphone_api.js to your page. Simple example:
<head>
<!--include the webphone_api.js to your webpage-->
<script src="webphone_api.js"></script>
</head>
<body>
<script>
// IMPORTANT: Wait until the webphone is loaded, before calling any API functions
webphone_api.onAppStateChange(function (state) {
if (state === 'loaded') {
//set parameters (alternatively these can be also preset in your html)
webphone_api.setparameter('serveraddress', SERVERADDRESS); // Replace the word in uppercase with your SIP server IP or domain name (add also the :port number if not using the standard UDP 5060)
webphone_api.setparameter('username', USERNAME); // Replace the word in uppercase with a valid SIP extension username
webphone_api.setparameter('password', PASSWORD); // Replace the word in uppercase with the password for the above user
//see the "Parameters" section in the documentation for more options
//start the webphone (optional but recommended)
webphone_api.start();
//make a call (usually initiated by user action, such as click on a click to call button)
webphone_api.call(number);
//hangup
webphone_api.hangup();
//send instant message
webphone_api.sendchat(number, message);
}
});
</script>
</body>
For more details consult the Javascript API section in the documentation.
<!--include the webphone_api.js to your webpage-->
<script src="webphone_api.js"></script>
</head>
<body>
<script>
// IMPORTANT: Wait until the webphone is loaded, before calling any API functions
webphone_api.onAppStateChange(function (state) {
if (state === 'loaded') {
//set parameters (alternatively these can be also preset in your html)
webphone_api.setparameter('serveraddress', SERVERADDRESS); // Replace the word in uppercase with your SIP server IP or domain name (add also the :port number if not using the standard UDP 5060)
webphone_api.setparameter('username', USERNAME); // Replace the word in uppercase with a valid SIP extension username
webphone_api.setparameter('password', PASSWORD); // Replace the word in uppercase with the password for the above user
//see the "Parameters" section in the documentation for more options
//start the webphone (optional but recommended)
webphone_api.start();
//make a call (usually initiated by user action, such as click on a click to call button)
webphone_api.call(number);
//hangup
webphone_api.hangup();
//send instant message
webphone_api.sendchat(number, message);
}
});
</script>
</body>
For more details consult the Javascript API section in the documentation.
HTML URL
The webphone can load its settings also from the webpage URL and perform various actions such as initiate a call. All the documented parameters can be used, prefixed with "wp_".
Example to trigger a call with the softphone by html url parameters:
http://www.yourwebsite.com/webphonedir/softphone.html?wp_serveraddress=YOURSIPDOMAIN&wp_username=USERNAME&wp_password=PASSWORD&wp_callto=CALLEDNUMBER
Example to trigger a call with the clicktocall by html url parameters:
http://www.yourwebsite.com/webphonedir/click2call.html?wp_serveraddress=YOURSIPDOMAIN&wp_username=USERNAME&wp_password=PASSWORD&wp_callto=CALLEDNUMBER
A working example using the click to call button:
https://www.webvoipphone.com/webphone_online_demo/click2call.html?wp_serveraddress=voip.mizu-voip.com&wp_username=webphonetest1&wp_password=webphonetest1&wp_callto=testivr3&wp_autoaction=1
A working example using the softhone skin:
https://www.webvoipphone.com/webphone_online_demo/samples/click2call.html?wp_serveraddress=voip.mizu-voip.com&wp_username=webphonetest1&wp_password=webphonetest1&wp_callto=testivr3&wp_autoaction=1
Example trigger chat by html parameters
http://www.yourwebsite.com/webphonedir/softphone.html?wp_serveraddress=YOURSIPDOMAIN&wp_username=USERNAME&wp_password=PASSWORD&wp_sendchat=TEXT&wp_to=DESTINATION
Note: you should use clear text password only if the account is locked on your server (can't call costly outside numbers). Otherwise you should pass it encrypted or use MD5 instead.
Many more
There are many other ways to use the webphone. See the "Usage examples" on the home page for some suggestions.
You can create your own solutions for scratch using the WebPhone API or modify the existing examples after your needs.
There is no need for any JavaScipt or other development knowledge if you just need a web softphone or click to call solution for your website. (Use the "softphone.html" or the "click2call.html" as-is or customize them after your needs viat the webphone parameters which you can set in the "webphone_config.js" file).
You can also find various other examples from the webphone documentation. For example php voice recording upload, salesforce web sip client integration or see the "multipage_example.html" about using a single webphone instances across all web pages.
For a quick tutorial, check here.
The rest is your imagination.
You can also find various other examples from the webphone documentation. For example php voice recording upload, salesforce web sip client integration or see the "multipage_example.html" about using a single webphone instances across all web pages.
For a quick tutorial, check here.
The rest is your imagination.