Transaction state not propagated properly to on_call_tsx_state() cb#3614
Transaction state not propagated properly to on_call_tsx_state() cb#3614
Conversation
This will also remove support for python2
|
Most looks good so far, when applying the patch on 2.13. Note that when receiving SIP BYE: The last one is not necessary (maybe this is different in the master branch?). And after the call object is destroyed and PJSUA2 is shutting down, I get the following: Is this OK or a "leak"? |
|
Thanks for the feedback. I have fixed the issue in the latest commit:
As for the leak, I need more info. Is the transaction still ongoing? (i.e. is the BYE sending still in progress?) If yes, then it's okay, since you may have shutdown the library prior to the termination. But if the transaction should actually have completed&terminated prior to the shutdown but for some reason, it did not, then it's a leak. Perhaps you can attach a complete log so we can check. Also, it's recommended to put the timestamp in the log so we can tell how long each step took place. |
nanangizz
left a comment
There was a problem hiding this comment.
As this change introduce a rather major behavior change for existing apps (e.g: IIRC some users reported/complained about wrong order of tsx-change callbacks, so they may have applied some special "tricks" to deal with this, but now this is "fixed" and their tricks may no longer work or even harmful), perhaps we should put a 'big' note and/or add this into milestone's backward-incompatibility-changes.
Also, please make sure this passes unit-tests and Python/pjsua tests.
Okay, already put a note above.
Okay, will wait for #3612 before merging. |
Works!
Might be an issue of my testing framework. I need to do more testing (shall it be part of this PR, or would it be better to have it in a new issue?). |
If it's not related, better put it separate. |
- On windows, error EACCESS when binding/opening socket - Fix UnicodeEncodeError/UnicodeDecodeError
Potential backward incompatibility note:
sip_invon_tsx_state_changed()in pjsip level,on_call_tsx_state()in pjsua-lib, orCall::onCallTsxState()in pjsua2.PJSIP_TSX_STATE_TRYINGin the callback (previously, this event might not be reported).e->body.tsx_state.type == PJSIP_EVENT_RX_MSGfirst for the request, followed byPJSIP_EVENT_TX_MSGfor the response. Previously, the order was reversed. Thus, app that relies on the callback ordering needs to make sure that its implementation still works as expected.PR Description:
It is reported In #3605 that transaction state event may not be properly called for certain requests within a call, such as re-INVITE and BYE.
This is because in
sip_inv.c mod_inv_on_tsx_state(), we callon_tsx_state_changed()after calling the state handler, which can potentially cause a few issues:PJSIP_TSX_STATE_TRYING. This is because the state handler will send response to the request and then modify the tsx state. So, by the time we call the callback, the state has changed.PJSIP_TSX_STATE_COMPLETEDmay be reported twice.Bug fix:
This PR also seems to fix TRICKLE ICE behavior upon receiving PRACK:
In
pjsua_call.cpjsua_call_on_tsx_state_changed():Without the patch, the state TRYING seems to be lost and trickle ICE never starts:
With the patch: