Skip to content

Commit

Permalink
Assertion in sending BYE after transaction timeout (pjsip#4107)
Browse files Browse the repository at this point in the history
* Fix assertion in sending BYE for a timeout transaction.
* Add Reason header to BYE.
  • Loading branch information
nanangizz authored Oct 22, 2024
1 parent e8eab5e commit 9c134f4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pjsip/src/pjsip-ua/sip_inv.c
Original file line number Diff line number Diff line change
Expand Up @@ -4664,11 +4664,19 @@ static pj_bool_t handle_uac_tsx_response(pjsip_inv_session *inv,
pj_status_t status;

inv_set_cause(inv, tsx->status_code, &tsx->status_text);
inv_set_state(inv, PJSIP_INV_STATE_DISCONNECTED, e);

/* Do not shift state to DISCONNECTED here, as it will destroy the
* invite session and the BYE sending below will raise an assertion.
*/
//inv_set_state(inv, PJSIP_INV_STATE_DISCONNECTED, e);

/* Send BYE */
status = pjsip_dlg_create_request(inv->dlg, pjsip_get_bye_method(),
-1, &bye);
if (status == PJ_SUCCESS && tsx->status_text.slen) {
status = add_reason_warning_hdr(bye, tsx->status_code,
&tsx->status_text);
}
if (status == PJ_SUCCESS) {
pjsip_inv_send_msg(inv, bye);
}
Expand Down Expand Up @@ -5381,6 +5389,10 @@ static void inv_on_state_connecting( pjsip_inv_session *inv, pjsip_event *e)
status = pjsip_dlg_create_request(inv->dlg,
pjsip_get_bye_method(),
-1, &bye);
if (status == PJ_SUCCESS && tsx->status_text.slen) {
status = add_reason_warning_hdr(bye, tsx->status_code,
&tsx->status_text);
}
if (status == PJ_SUCCESS) {
pjsip_inv_send_msg(inv, bye);

Expand Down

0 comments on commit 9c134f4

Please sign in to comment.