Hello, When a 401/407 challenge is received after a "BYE" request is sent, sometimes (for instance in asterisk) the library doesn't have the required credentials. So it's not appropriate to terminate the session. Without the enclosed patch, asterisk cannot answer to the challenge request because the session is already terminated (PJSIP_INV_STATE_DISCONNECTED) and the sip trunk doesn't hangup when needed (see https://issues.asterisk.org/jira/browse/ASTERISK-26363). Regards, --yas |
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c index fbc8ebe..ec13a6d 100644 --- a/pjsip/src/pjsip-ua/sip_inv.c +++ b/pjsip/src/pjsip-ua/sip_inv.c @@ -3384,10 +3384,13 @@ static void inv_handle_bye_response( pjsip_inv_session *inv, if (status != PJ_SUCCESS) { /* Does not have proper credentials. - * End the session anyway. + * It's not a good idea to terminate the session since it can be + * authenticated later. */ + /* inv_set_cause(inv, PJSIP_SC_OK, NULL); inv_set_state(inv, PJSIP_INV_STATE_DISCONNECTED, e); + */ } else { struct tsx_inv_data *tsx_inv_data;
_______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@xxxxxxxxxxxxxxx http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org