Opened 10 years ago

Last modified 21 months ago

#1049 new enhancement

PJSUA-LIB should report disconnection event immediately after pjsua_call_hangup() is called — at Initial Version

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-2.10
Component: pjsua-lib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no


There are several scenarios in which call DISCONNECTED state will only be reported later, if at all, after pjsua_call_hangup() is issued:

  • when INVITE is not responded with any responses yet (not even provisional responses), which in this case, PJSIP will continue retransmitting the request until either a response is received (and if it's not a final response, CANCEL then will be issued), or retransmission times out 32 seconds after call is initiated.
  • when BYE is issued against peer which doesn't exist; in this case, the DISCONNECTED state will be issued after the BYE transaction times out, 32 seconds after it is issued
  • when BYE is answered with failure final response; in this case, most likely call will stay as is. Note that 408 and 481 response would cause call to be terminated though.
  • when 200/OK for CANCEL is received, but the final response for the INVITE transaction never arrives; in this case, call will remain as is indefinitely (!)

In all cases above, it is desirable to have the application receives the DISCONNECTED event immediately and let PJSUA-LIB handle the call under the hood. Several scenarios that must be handled by PJSUA-LIB include:

  • sending BYE if call isn't disconnected after CANCEL is issued, possibly using a timer:
    • it is possible that the CANCEL request and 200/OK to INVITE had crossed each other in the wire; in this case, the call will get CONNECTED and the CANCEL will be rejected with 481 (please check this in the spec)
    • peer may have been malfunctioning, not disconnecting the call even after sending 200/OK response to CANCEL. We may need to have a timer for this.
  • retry sending the BYE if previous ones fail and call remains connected. If this keeps happening (the BYE request gets rejected), we'll probably need to hard-terminate the call, that is to forcefully terminate the call without relying for the BYE to succeed.

Change History (0)

Note: See TracTickets for help on using tickets.