Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pjsip/include/pjsip/sip_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ typedef struct pjsip_cfg_t
*/
pj_bool_t accept_multiple_sdp_answers;

/**
* Don't disconnect the INVITE session after an outgoing request
* gets timed out or responded with 408 (request timeout).
*
* Default is PJ_FALSE.
*/
pj_bool_t keep_inv_after_tsx_timeout;

} endpt;

/** Transaction layer settings. */
Expand Down
4 changes: 2 additions & 2 deletions pjsip/src/pjsip-ua/sip_inv.c
Original file line number Diff line number Diff line change
Expand Up @@ -4082,8 +4082,8 @@ static pj_bool_t handle_uac_tsx_response(pjsip_inv_session *inv,
if (inv->state != PJSIP_INV_STATE_DISCONNECTED &&
((tsx->status_code == PJSIP_SC_CALL_TSX_DOES_NOT_EXIST &&
tsx->method.id != PJSIP_CANCEL_METHOD) ||
tsx->status_code == PJSIP_SC_REQUEST_TIMEOUT ||
tsx->status_code == PJSIP_SC_TSX_TIMEOUT))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so PJSIP_SC_TSX_TIMEOUT is removed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are the same, see here, and as it is defined in a public header file, it should not be changed.

(tsx->status_code == PJSIP_SC_REQUEST_TIMEOUT &&
!pjsip_cfg()->endpt.keep_inv_after_tsx_timeout)))
{
pjsip_tx_data *bye;
pj_status_t status;
Expand Down
3 changes: 2 additions & 1 deletion pjsip/src/pjsip/sip_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ pjsip_cfg_t pjsip_sip_cfg_var =
PJSIP_RESOLVE_HOSTNAME_TO_GET_INTERFACE,
0,
PJSIP_ENCODE_SHORT_HNAME,
PJSIP_ACCEPT_MULTIPLE_SDP_ANSWERS
PJSIP_ACCEPT_MULTIPLE_SDP_ANSWERS,
0
},

/* Transaction settings */
Expand Down
24 changes: 24 additions & 0 deletions pjsip/src/pjsua-lib/pjsua_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3817,6 +3817,15 @@ static void restart_listener_cb(void *user_data)
}


static void ip_change_put_back_inv_config(void *user_data)
{
PJ_UNUSED_ARG(user_data);

PJ_LOG(4,(THIS_FILE,"IP change stops ignoring request timeout"));
pjsip_cfg()->endpt.keep_inv_after_tsx_timeout = PJ_FALSE;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we revert it to the previous value instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The timer is scheduled only when the value is PJ_FALSE.

}


PJ_DEF(pj_status_t) pjsua_handle_ip_change(const pjsua_ip_change_param *param)
{
pj_status_t status = PJ_SUCCESS;
Expand All @@ -3835,6 +3844,21 @@ PJ_DEF(pj_status_t) pjsua_handle_ip_change(const pjsua_ip_change_param *param)
}

PJ_LOG(3, (THIS_FILE, "Start handling IP address change"));

/* Avoid call disconnection due to request timeout. Some requests may
* be in progress when network is changing, they may eventually get
* timed out and cause call disconnection.
*/
if (!pjsip_cfg()->endpt.keep_inv_after_tsx_timeout) {
pjsip_cfg()->endpt.keep_inv_after_tsx_timeout = PJ_TRUE;

/* Put it back after some time (transaction timeout setting value) */
pjsua_schedule_timer2(&ip_change_put_back_inv_config, NULL,
pjsip_cfg()->tsx.td);

PJ_LOG(4,(THIS_FILE,"IP change temporarily ignores request timeout"));
}

if (param->restart_listener) {
PJSUA_LOCK();
/* Restart listener/transport, handle_ip_change_on_acc() will
Expand Down