aparames / sipml5

Automatically exported from code.google.com/p/sipml5
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

SIPML5 Error with multi-line support #173

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I suspect the code in tsip_transac_layer.js, quoted below, is not working as 
intended: When the code enters setTimeout(function () 
{o_transac.fsm_act(tsip_action_type_e.CANCEL, null); }, 1);} the calling object 
o_transac may be changed again by the loop _before_ the function fires; this 
happens if we at that time haven't reached the end of ao_transacs. 
This causes my issue described below with multi-line support, and may cause 
other issues. 

tsip_transac_layer.prototype.cancel_by_dialog = function (o_dialog) {
    if (!o_dialog) {
        tsk_utils_log_error("Invalid argument");
        return -1;
    }

    var o_transac = null;

    while (this.b_locked){}

    this.b_locked = true;

    for (var i = 0; i < this.ao_transacs.length; ++i) {
        o_transac = this.ao_transacs[i];
        if (o_dialog.compare(o_transac.get_dialog()) == 0) {
            // async call to avoid dealoc
            setTimeout(function () { o_transac.fsm_act(tsip_action_type_e.CANCEL, null); }, 1);
        }
    }

    this.b_locked = false;

    return 0;
};

What steps will reproduce the problem?
1.
Adapt the demo-code to allow multi-line support; in the simplest case, change 
your onSipEventStack to allow only 2 call sessions.
...
            case 'i_new_call':
                {
//e.newSession.hangup(); // comment this line for multi-line support
                    if (oSipSessionCall) {
                        oSipSessionCall2=e.newSession;
                        oSipSessionCall2.setConfiguration(oConfigCall);
                    }
                    else {
                        oSipSessionCall = e.newSession;
                        oSipSessionCall.setConfiguration(oConfigCall);
                    }
                    break;
                }
...

2.
Start the sip-stack and register. Make two calls A and B TO your 
SIPML5-sip-client. The Call A is made a few seconds before B.
3.
Hang Up (decline) Call A, // oSipSessionCall.hangup(oConfigCall);
Wait 3 seconds,
Answer Call B, // oSipSessionCall2.accept(oConfigCall);

What is the expected output? What do you see instead?

Expected: Call A should be terminated and Call B should be answered.
Actual: Call A is terminated, but trying to answer Call B results in error:

Failed to find associated server transaction. 
SIPml-api.js:1
tsk_utils_log_error SIPml-api.js:1
tsip_dialog.response_send SIPml-api.js:3
tsip_dialog_invite.send_response SIPml-api.js:3
s0000_Ringing_2_Connected_X_Accept SIPml-api.js:3
tsk_fsm.act SIPml-api.js:1
tsip_dialog.fsm_act SIPml-api.js:3
tsip_session.__action_handle SIPml-api.js:3
tsip_session.__action_any SIPml-api.js:3
tsip_session.accept SIPml-api.js:3
SIPml.Session.accept SIPml-api.js:3
sipCall indexDemo.html:307
onclick

What version of the product are you using? On what operating system?
Windows, Chrome and SIPML5 1.3.214 but same error is seen with other platforms 
and SIPML5 1.4

Please provide any additional information below.

The termination of A's dialog seemed to kill the invite-transaction associated 
to B due to the code in tsip_transac_layer.js

a quick-fix was replacing
        if (o_dialog.compare(o_transac.get_dialog()) == 0) {
            // async call to avoid dealoc
            setTimeout(function () { o_transac.fsm_act(tsip_action_type_e.CANCEL, null); }, 1);
        }
with
        if (o_dialog.compare(o_transac.get_dialog()) == 0) {
            // async call to avoid dealoc
            var tmp=o_transac
            setTimeout(function () { tmp.fsm_act(tsip_action_type_e.CANCEL, null); }, 1);
        }

Original issue reported on code.google.com by StefanEn...@gmail.com on 8 Apr 2014 at 8:30

GoogleCodeExporter commented 9 years ago

Original comment by boss...@yahoo.fr on 18 Apr 2014 at 7:56

GoogleCodeExporter commented 9 years ago
https://code.google.com/p/sipml5/source/detail?r=229

Original comment by boss...@yahoo.fr on 18 Mar 2015 at 8:56

GoogleCodeExporter commented 9 years ago
Issue 208 has been merged into this issue.

Original comment by boss...@yahoo.fr on 18 Mar 2015 at 9:03