Skip to content

Commit

Permalink
API update for click2dial.org project
Browse files Browse the repository at this point in the history
git-svn-id: http://sipml5.googlecode.com/svn/trunk@182 63d8a0da-676c-2731-e3aa-b417aa27da68
  • Loading branch information
Bossiel Thioriguel committed Mar 11, 2013
1 parent b9dbaea commit a5b3df2
Show file tree
Hide file tree
Showing 18 changed files with 409 additions and 177 deletions.
28 changes: 21 additions & 7 deletions SIPml.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,14 @@ SIPml.init = function (successCallback, errorCallback) {
SIPml.s_navigator_friendly_name = tsk_utils_get_navigator_friendly_name();
SIPml.s_system_friendly_name = tsk_utils_get_system_friendly_name();

// print webrtc4all type and version
if(SIPml.b_webrtc4all_supported){
tsk_utils_log_info("WebRTC type = " + WebRtc4all_GetType() + " version = " + tsk_utils_webrtc4all_get_version());
}
// prints whether WebSocket is supported
tsk_utils_log_info("WebSocket supported = " + (SIPml.isWebSocketSupported() ? "yes" : "no"));

// check webrtc4all version
if (tsk_utils_have_webrtc4all()) {
tsk_utils_log_info("WebRTC type = " + WebRtc4all_GetType() + " version = " + tsk_utils_webrtc4all_get_version());
if (SIPml.s_webrtc4all_version != '1.12.756') {
b_webrtc4all_plugin_outdated = true;
return;
if (SIPml.s_webrtc4all_version != '1.14.834') {
SIPml.b_webrtc4all_plugin_outdated = true;
}
}

Expand All @@ -238,6 +235,10 @@ SIPml.init = function (successCallback, errorCallback) {

// prints OS friendly name
tsk_utils_log_info("OS friendly name = " + SIPml.s_system_friendly_name);
// prints support for WebRTC (native or plugin)
tsk_utils_log_info("Have WebRTC = " + (tsk_utils_have_webrtc() ? "yes" : "false"));
// prints support for getUserMedia
tsk_utils_log_info("Have GUM = " + (tsk_utils_have_stream() ? "yes" : "false"));

// checks for WebRTC support
if (!tsk_utils_have_webrtc()) {
Expand Down Expand Up @@ -519,6 +520,9 @@ This is a good option for developers using a SIP domain name without valid DNS A
Example: <i>udp://192.168.0.12:5060</i>
@property {Boolean} [enable_rtcweb_breaker] Whether to enable the <a href="http://webrtc2sip.org/#aRTCWebBreaker" target=_blank>RTCWeb Breaker</a> module to allow calling SIP-legacy networks.
Example: <i>true</i>
@property {Boolean} [enable_click2call] Whether to enable the <a href="http://click2dial.org" target=_blank>Click2Call / Click2Dial</a> service.
<i>Available since version 1.2.181</i>.
Example: <i>true</i>
@property {Object} [events_listener] Object to subscribe to some events.
Example:
<ul>
Expand All @@ -540,6 +544,7 @@ var configuration = {
websocket_proxy_url: 'ws://192.168.0.10:5060', // optional
outbound_proxy_url: 'udp://192.168.0.12:5060', // optional
enable_rtcweb_breaker: true, // optional
enable_click2call: false, // optional
events_listener: { events: '*', listener: listenerFunc }, //optional
sip_headers: [ //optional
{name: 'User-Agent', value: 'IM-client/OMA1.0 sipML5-v1.0.89.0'},
Expand Down Expand Up @@ -572,6 +577,7 @@ var o_stack = new SIPml.Stack({
websocket_proxy_url: 'ws://192.168.0.10:5060', // optional
outbound_proxy_url: 'udp://192.168.0.12:5060', // optional
enable_rtcweb_breaker: true, // optional
enable_click2call: false, // optional
events_listener: { events: '*', listener: listenerFunc }, //optional
sip_headers: [ //optional
{name: 'User-Agent', value: 'IM-client/OMA1.0 sipML5-v1.0.89.0'},
Expand Down Expand Up @@ -972,15 +978,18 @@ SIPml.Stack.prototype.setConfiguration = function (o_conf) {
}

var b_rtcweb_breaker_enabled = !!o_conf.enable_rtcweb_breaker;
var b_click2call_enabled = !!o_conf.enable_click2call;
var o_stack = this.o_stack;
tsk_utils_log_info("s_websocket_server_url=" + (o_conf.websocket_proxy_url || "(null)"));
tsk_utils_log_info("s_sip_outboundproxy_url=" + (o_conf.outbound_proxy_url || "(null)"));
tsk_utils_log_info("b_rtcweb_breaker_enabled=" + (b_rtcweb_breaker_enabled ? "yes" : "no"));
tsk_utils_log_info("b_click2call_enabled=" + (b_click2call_enabled ? "yes" : "no"));

o_stack.set(tsip_stack.prototype.SetPassword(o_conf.password),
tsip_stack.prototype.SetDisplayName(o_conf.display_name),
tsip_stack.prototype.SetProxyOutBoundUrl(o_conf.outbound_proxy_url),
tsip_stack.prototype.SetRTCWebBreakerEnabled(b_rtcweb_breaker_enabled),
tsip_stack.prototype.SetClick2CallEnabled(b_click2call_enabled),
tsip_stack.prototype.SetSecureTransportEnabled(b_rtcweb_breaker_enabled), // always use secure transport when RTCWebBreaker
tsip_stack.prototype.SetWebsocketServerUrl(o_conf.websocket_proxy_url));

Expand Down Expand Up @@ -1125,6 +1134,7 @@ Anonymous SIP Session configuration object.
@property {HTMLVideoElement} [video_remote] <a href="https://developer.mozilla.org/en-US/docs/DOM/HTMLVideoElement">HTMLVideoElement<a> where to display the remote video stream. This propety should be only used for <a href="SIPml.Session.Call.html">video sessions</a>.
@property {HTMLAudioElement} [audio_remote] <a href="https://developer.mozilla.org/en-US/docs/DOM/HTMLAudioElement">HTMLAudioElement<a> used to playback the remote audio stream. This propety should be only used for <a href="SIPml.Session.Call.html">audio sessions</a>.
@property {Array} [sip_caps] <i>{name,value}</i> pairs defining the SIP capabilities associated to this session. The capabilities are added to the Contact header. Please refer to <a href="http://tools.ietf.org/html/rfc3840">rfc3840</a> and <a href="http://tools.ietf.org/html/rfc3841">rfc3841</a> for more information.
@property {String} [from] Set the source uri string to be used in the <i>From</i> header (available since API version 1.2.170).
@property {Array} [sip_headers] <i>{name,value,session}</i> trios defining the SIP headers associated to this session. <i>session</i> is a boolean defining whether the header have to be added to all outgoing request or not (initial only).
@example
var configuration =
Expand Down Expand Up @@ -1260,6 +1270,10 @@ SIPml.Session.prototype.setConfiguration = function(o_conf){
if (o_conf.expires) {
o_session.set(tsip_session.prototype.SetExpires(o_conf.expires));
}
// from
if (o_conf.from) {
o_session.set(tsip_session.prototype.SetFromStr(o_conf.from));
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion assets/css/bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -3987,4 +3987,4 @@ a.thumbnail:hover {
}
.invisible {
visibility: hidden;
}
}
42 changes: 28 additions & 14 deletions call.htm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
DEBUG VERSION: 'SIPml-api.js'
RELEASE VERSION: 'release/SIPml-api.js'
-->
<script src="SIPml-api.js?svn=165" type="text/javascript"> </script>
<script src="SIPml-api.js?svn=179" type="text/javascript"> </script>

<!-- Styles -->
<link href="./assets/css/bootstrap.css" rel="stylesheet" />
Expand Down Expand Up @@ -88,7 +88,18 @@
top: -1px;
*overflow: hidden;
}

.glass-panel{
z-index: 99;
position: fixed;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
top: 0;
left: 0;
opacity: 0.8;
background-color: Gray;
}

</style>
<link href="./assets/css/bootstrap-responsive.css" rel="stylesheet" />
Expand Down Expand Up @@ -178,7 +189,7 @@
function postInit() {
// check webrtc4all version
if (SIPml.isWebRtc4AllSupported() && SIPml.isWebRtc4AllPluginOutdated()) {
if (confirm("Your WebRtc4all extension is outdated. A new version with critical bug fix is available. Do you want to install it?\nIMPORTANT: You must restart your browser after the installation.")) {
if (confirm("Your WebRtc4all extension is outdated. A new version(" +SIPml.getWebRtc4AllVersion()+") with critical bug fix is available. Do you want to install it?\nIMPORTANT: You must restart your browser after the installation.")) {
window.location = 'http://code.google.com/p/webrtc4all/downloads/list';
return;
}
Expand Down Expand Up @@ -311,12 +322,12 @@
if ((s_value = window.localStorage.getItem('org.doubango.identity.realm'))) txtRealm.value = s_value;
}
else {
//txtDisplayName.value = "1060";
//txtPrivateIdentity.value = "1060";
//txtPublicIdentity.value = "sip:1060@doubango.org";
//txtPassword.value = "1060";
//txtRealm.value = "doubango.org";
//txtPhoneNumber.value = "1062";
/*txtDisplayName.value = "005";
txtPrivateIdentity.value = "005";
txtPublicIdentity.value = "sip:005@doubango.org";
txtPassword.value = "005";
txtRealm.value = "doubango.org";
txtPhoneNumber.value = "005";*/
}
};

Expand Down Expand Up @@ -367,7 +378,7 @@
enable_rtcweb_breaker: (window.localStorage ? window.localStorage.getItem('org.doubango.expert.enable_rtcweb_breaker') == "true" : false),
events_listener: { events: '*', listener: onSipEventStack },
sip_headers: [
{ name: 'User-Agent', value: 'IM-client/OMA1.0 sipML5-v1.2013.02.24' },
{ name: 'User-Agent', value: 'IM-client/OMA1.0 sipML5-v1.2013.03.11' },
{ name: 'Organization', value: 'Doubango Telecom' }
]
}
Expand Down Expand Up @@ -698,13 +709,13 @@

case 'm_permission_requested':
{
document.getElementById('divNavbarInner').setAttribute('class', 'navbar-inner-red');
divGlassPanel.style.visibility = 'visible';
break;
}
case 'm_permission_accepted':
case 'm_permission_refused':
{
document.getElementById('divNavbarInner').setAttribute('class', 'navbar-inner');
divGlassPanel.style.visibility = 'hidden';
if(e.type == 'm_permission_refused'){
uiCallTerminated('Media stream permission denied');
}
Expand All @@ -717,7 +728,7 @@

// Callback function for SIP sessions (INVITE, REGISTER, MESSAGE...)
function onSipEventSession(e /* SIPml.Session.Event */) {
if (window.console) window.console.info('==session event = ' + e.type);
tsk_utils_log_info('==session event = ' + e.type);

switch (e.type) {
case 'connecting': case 'connected':
Expand Down Expand Up @@ -975,7 +986,7 @@
<img alt="sipML5" class="brand" src="./images/sipml-34x39.png" />
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="index.html?svn=165">Home</a></li>
<li class="active"><a href="index.html?svn=179">Home</a></li>
</ul>
</div>
<!--/.nav-collapse -->
Expand Down Expand Up @@ -1132,6 +1143,9 @@ <h2>
</div>
<!-- /container -->

<!-- Glass Panel -->
<div id='divGlassPanel' class='glass-panel' style='visibility:hidden'></div>

<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
Expand Down
Loading

0 comments on commit a5b3df2

Please sign in to comment.