Skip to content

Commit

Permalink
2022.02.10 by jgullo - This is a huge commit as I had to mix all my c…
Browse files Browse the repository at this point in the history
…hanges in; I will no longer be with the org and need to get things to a stopping point for handoff. We figured out and fixed a bug that prevented subsequent hold/resumes based on a flawed webRTC call, it took us a very long time to suss out but it's now fixed. Much infrastructure has been put in place to support multi-line calling, however we haven't gotten it to work consistently; the things need to happen in sequence, but the api was not written to be aware of asynchronous javascript so we have emulated it by holding state in a flag and proceeding based on a switch statement tracking the state. While this remains unfinished, the bones are in place.
  • Loading branch information
L1kMakes committed Feb 11, 2022
1 parent f0432ec commit 6fd731d
Show file tree
Hide file tree
Showing 13 changed files with 443 additions and 111 deletions.
32 changes: 20 additions & 12 deletions release/SIPml-api.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -3739,7 +3739,8 @@ function tsk_fsm_entry_compare(o_entry1, o_entry2) {
}

return 0
}/*
}
/*
* Copyright (C) 2012-2016 Doubango Telecom <http://www.doubango.org>
* License: BSD
* This file is part of Open Source sipML5 solution <http://www.sipml5.org>
Expand Down Expand Up @@ -5471,7 +5472,8 @@ tmedia_session_mgr.prototype.hold = function (e_type) {
for (var i = 0; i < this.ao_sessions.length; ++i) {
if (!e_type || (this.ao_sessions[i].e_type.i_id & e_type.i_id)) {
this.b_state_changed = true;
if (i_ret = this.ao_sessions[i].hold()) {
i_ret = this.ao_sessions[i].hold();
if ( i_ret ) {
return i_ret;
}
this.ao_sessions[i].b_lo_held = true;
Expand All @@ -5485,7 +5487,8 @@ tmedia_session_mgr.prototype.resume = function (e_type) {
for (var i = 0; i < this.ao_sessions.length; ++i) {
if (!e_type || (this.ao_sessions[i].e_type.i_id & e_type.i_id)) {
this.b_state_changed = true;
if (i_ret = this.ao_sessions[i].resume()) {
i_ret = this.ao_sessions[i].resume();
if ( i_ret ) {
return i_ret;
}
this.ao_sessions[i].b_lo_held = false;
Expand Down Expand Up @@ -5810,7 +5813,7 @@ tmedia_session_jsep.prototype.decorate_lo = function () {
/* Session name for debugging - Requires by webrtc2sip to set RTCWeb type */
var o_hdr_S;
if ((o_hdr_S = this.o_sdp_lo.get_header(tsdp_header_type_e.S))) {
o_hdr_S.s_value = "Cloudonix WebRTC Client - " + tsk_utils_get_navigator_friendly_name();
o_hdr_S.s_value = "Doubango/Cloudonix/SEIULocal1000 WebRTC Client - " + tsk_utils_get_navigator_friendly_name();
}

// BUGFIX: [asterisk] remove first a=sendrecv
Expand Down Expand Up @@ -5932,7 +5935,6 @@ tmedia_session_jsep.prototype.decorate_ro = function (b_remove_bundle) {
//!\ firefox nighly: DTLS-SRTP only, chrome: SDES-SRTP
var b_fingerprint = !!this.o_sdp_ro.get_header_a("fingerprint"); // session-level fingerprint
while ((o_hdr_M = this.o_sdp_ro.get_header_at(tsdp_header_type_e.M, i_index++))) {

// https://support.mozilla.org/en-US/questions/1234227
// https://www.fxsitecompat.com/en-CA/docs/2018/webrtc-sdp-offer-now-requires-mid-property/
if ((! o_hdr_M.find_a("mid")) && (this.a_mid[i_index]) ) {
Expand Down Expand Up @@ -6051,6 +6053,7 @@ tmedia_session_jsep.prototype.__hold = function () {
this.b_sdp_ro_pending = true;

if (this.o_pc && this.o_local_stream) {

this.o_pc.getSenders().forEach(function(sender){
This.o_local_stream.getTracks().forEach(function(track){
if(track == sender.track){
Expand All @@ -6060,7 +6063,6 @@ tmedia_session_jsep.prototype.__hold = function () {
})
});
}

return 0;
}

Expand All @@ -6080,11 +6082,17 @@ tmedia_session_jsep.prototype.__resume = function () {
this.b_sdp_ro_pending = true;

if (this.o_pc && this.o_local_stream) {
this.o_local_stream.getTracks().forEach(function(track){
return This.o_pc.addTrack(track, This.o_local_stream);
});
const sender = this.o_pc.getSenders()[0];
const track = This.o_local_stream.getTracks()[0];
sender.replaceTrack(track)
.then(() => {
tsk_utils_log_info('sender.replaceTrack(track)');
})
.catch( e => {
tsk_utils_log_error(e);
});
this.o_pc.getTransceivers()[0].direction = "sendrecv";
}

return 0;
}

Expand Down Expand Up @@ -11937,7 +11945,8 @@ tsip_session_invite.prototype.set_mute = function (s_media, b_mute) {
return this.__action_handle(o_action);
}
return -3;
}/*
}
/*
* Copyright (C) 2012-2016 Doubango Telecom <http://www.doubango.org>
* License: BSD
* This file is part of Open Source sipML5 solution <http://www.sipml5.org>
Expand Down Expand Up @@ -18477,7 +18486,6 @@ function x0102_Connected_2_Resuming_X_oResume(ao_args){
tsk_utils_log_warn("Media Session manager is Null");
return 0;
}

/* Resume both */
i_ret = o_dialog.o_msession_mgr.resume(o_action.media.e_type, true);
i_ret = o_dialog.o_msession_mgr.resume(o_action.media.e_type, false);
Expand Down
2 changes: 1 addition & 1 deletion release/SIPml-api.mini.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/tinyMEDIA/src/tmedia_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,8 @@ tmedia_session_mgr.prototype.hold = function (e_type) {
for (var i = 0; i < this.ao_sessions.length; ++i) {
if (!e_type || (this.ao_sessions[i].e_type.i_id & e_type.i_id)) {
this.b_state_changed = true;
if (i_ret = this.ao_sessions[i].hold()) {
i_ret = this.ao_sessions[i].hold();
if ( i_ret ) {
return i_ret;
}
this.ao_sessions[i].b_lo_held = true;
Expand All @@ -511,7 +512,8 @@ tmedia_session_mgr.prototype.resume = function (e_type) {
for (var i = 0; i < this.ao_sessions.length; ++i) {
if (!e_type || (this.ao_sessions[i].e_type.i_id & e_type.i_id)) {
this.b_state_changed = true;
if (i_ret = this.ao_sessions[i].resume()) {
i_ret = this.ao_sessions[i].resume();
if ( i_ret ) {
return i_ret;
}
this.ao_sessions[i].b_lo_held = false;
Expand Down
19 changes: 12 additions & 7 deletions src/tinyMEDIA/src/tmedia_session_jsep.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ tmedia_session_jsep.prototype.decorate_lo = function () {
/* Session name for debugging - Requires by webrtc2sip to set RTCWeb type */
var o_hdr_S;
if ((o_hdr_S = this.o_sdp_lo.get_header(tsdp_header_type_e.S))) {
o_hdr_S.s_value = "Cloudonix WebRTC Client - " + tsk_utils_get_navigator_friendly_name();
o_hdr_S.s_value = "Doubango/Cloudonix/SEIULocal1000 WebRTC Client - " + tsk_utils_get_navigator_friendly_name();
}

// BUGFIX: [asterisk] remove first a=sendrecv
Expand Down Expand Up @@ -300,7 +300,6 @@ tmedia_session_jsep.prototype.decorate_ro = function (b_remove_bundle) {
//!\ firefox nighly: DTLS-SRTP only, chrome: SDES-SRTP
var b_fingerprint = !!this.o_sdp_ro.get_header_a("fingerprint"); // session-level fingerprint
while ((o_hdr_M = this.o_sdp_ro.get_header_at(tsdp_header_type_e.M, i_index++))) {

// https://support.mozilla.org/en-US/questions/1234227
// https://www.fxsitecompat.com/en-CA/docs/2018/webrtc-sdp-offer-now-requires-mid-property/
if ((! o_hdr_M.find_a("mid")) && (this.a_mid[i_index]) ) {
Expand Down Expand Up @@ -419,6 +418,7 @@ tmedia_session_jsep.prototype.__hold = function () {
this.b_sdp_ro_pending = true;

if (this.o_pc && this.o_local_stream) {

this.o_pc.getSenders().forEach(function(sender){
This.o_local_stream.getTracks().forEach(function(track){
if(track == sender.track){
Expand All @@ -428,7 +428,6 @@ tmedia_session_jsep.prototype.__hold = function () {
})
});
}

return 0;
}

Expand All @@ -448,11 +447,17 @@ tmedia_session_jsep.prototype.__resume = function () {
this.b_sdp_ro_pending = true;

if (this.o_pc && this.o_local_stream) {
this.o_local_stream.getTracks().forEach(function(track){
return This.o_pc.addTrack(track, This.o_local_stream);
});
const sender = this.o_pc.getSenders()[0];
const track = This.o_local_stream.getTracks()[0];
sender.replaceTrack(track)
.then(() => {
tsk_utils_log_info('sender.replaceTrack(track)');
})
.catch( e => {
tsk_utils_log_error(e);
});
this.o_pc.getTransceivers()[0].direction = "sendrecv";
}

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/tinySAK/src/tsk_fsm.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,4 @@ function tsk_fsm_entry_compare(o_entry1, o_entry2) {
}

return 0
}
}
Binary file added src/tinySDP/src/headers/.tsdp_header_M.js.swp
Binary file not shown.
2 changes: 1 addition & 1 deletion src/tinySIP/src/api/tsip_api_invite.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,4 +375,4 @@ tsip_session_invite.prototype.set_mute = function (s_media, b_mute) {
return this.__action_handle(o_action);
}
return -3;
}
}
1 change: 0 additions & 1 deletion src/tinySIP/src/dialogs/tsip_dialog_invite__hold.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ function x0102_Connected_2_Resuming_X_oResume(ao_args){
tsk_utils_log_warn("Media Session manager is Null");
return 0;
}

/* Resume both */
i_ret = o_dialog.o_msession_mgr.resume(o_action.media.e_type, true);
i_ret = o_dialog.o_msession_mgr.resume(o_action.media.e_type, false);
Expand Down
52 changes: 27 additions & 25 deletions web/includes/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,31 +307,33 @@ function selectContact(event) {
<h3 class="mb-0">Registration</h3>
</header>
<div class="p-3">
<label style="height: 100%">
Display Name:
</label>
<input type="text" style="width: 100%; height: 100%" id="txtDisplayName" value="<?php echo $fullName; ?>" placeholder="<?php echo $fullName; ?>" />
<br />
<label style="height: 100%">
Private Identity<sup>*</sup>:
</label>
<input type="text" style="width: 100%; height: 100%" id="txtPrivateIdentity" value="<?php echo $privIdValue; ?>" placeholder="<?php echo $privIdPlaceholder; ?>" />
<br />
<label style="height: 100%">
Public Identity<sup>*</sup>:
</label>
<input type="text" style="width: 100%; height: 100%" id="txtPublicIdentity" value="<?php echo $pubIdValue; ?>" placeholder="<?php echo $pubIdPlaceholder; ?>" />
<br />
<label style="height: 100%">Password:</label>
<input type="password" style="width: 100%; height: 100%" id="txtPassword" value="" name="sipPassword" autocomplete="off" />
<br />
<label style="height: 100%">Realm<sup>*</sup>:</label>
<input type="text" style="width: 100%; height: 100%" id="txtRealm" value="<?php echo $realm; ?>" placeholder="<?php echo $realm;?>" />
<br /><br />
<input type="button" class="btn btn-success" id="btnRegister" value="LogIn" disabled onclick='sipRegister();' />
&nbsp;
<input type="button" class="btn btn-danger" id="btnUnRegister" value="LogOut" disabled onclick='sipUnRegister();' />
<p class="small"><sup>*</sup> <i>Mandatory Field</i></p>
<form>
<label style="height: 100%">
Display Name:
</label>
<input type="text" style="width: 100%; height: 100%" id="txtDisplayName" value="<?php echo $fullName; ?>" placeholder="<?php echo $fullName; ?>" />
<br />
<label style="height: 100%">
Private Identity<sup>*</sup>:
</label>
<input type="text" style="width: 100%; height: 100%" id="txtPrivateIdentity" value="<?php echo $privIdValue; ?>" placeholder="<?php echo $privIdPlaceholder; ?>" />
<br />
<label style="height: 100%">
Public Identity<sup>*</sup>:
</label>
<input type="text" style="width: 100%; height: 100%" id="txtPublicIdentity" value="<?php echo $pubIdValue; ?>" placeholder="<?php echo $pubIdPlaceholder; ?>" />
<br />
<label style="height: 100%">Password:</label>
<input type="password" style="width: 100%; height: 100%" id="txtPassword" value="" name="sipPassword" autocomplete="off" />
<br />
<label style="height: 100%">Realm<sup>*</sup>:</label>
<input type="text" style="width: 100%; height: 100%" id="txtRealm" value="<?php echo $realm; ?>" placeholder="<?php echo $realm;?>" />
<br /><br />
<input type="button" class="btn btn-success" id="btnRegister" value="LogIn" disabled onclick='sipRegister();' />
&nbsp;
<input type="button" class="btn btn-danger" id="btnUnRegister" value="LogOut" disabled onclick='sipUnRegister();' />
<p class="small"><sup>*</sup> <i>Mandatory Field</i></p>
</form>
<br />
<h2> Expert settings</h2>
<label style="height: 100%">Disable Video:</label>
Expand Down
3 changes: 3 additions & 0 deletions web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@
<input type="button" class="btn" style="" id="btnHoldResume" value="Hold" onclick='sipToggleHoldResume();' /> &nbsp;
<input type="button" class="btn" style="" id="btnTransfer" value="Transfer" onclick='sipTransfer();' /> &nbsp;
</div>
<div id='divCallList' class='call-options'>
<p>Call List</p>
</div>
<div id="divVideo" class="div-video">
<div id="divVideoRemoteWrapper"></div>
<div id="divVideoLocalWrapper"></div>
Expand Down
Binary file removed web/js/.mainPhone.js.swp
Binary file not shown.
2 changes: 1 addition & 1 deletion web/js/SIPml-api.js

Large diffs are not rendered by default.

Loading

0 comments on commit 6fd731d

Please sign in to comment.