FS-10067: [mod_sofia] add update-refresher profile param and sip_update_refresher channel var to use update for session timers
This commit is contained in:
parent
2c0f5cfcbb
commit
2f4c9b363e
|
@ -931,10 +931,14 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
|||
|
||||
if ((tech_pvt->session_timeout = session_timeout)) {
|
||||
tech_pvt->session_refresher = switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND ? nua_local_refresher : nua_remote_refresher;
|
||||
if (sofia_test_pflag(tech_pvt->profile, PFLAG_UPDATE_REFRESHER) || switch_channel_var_true(tech_pvt->channel, "sip_update_refresher")) {
|
||||
tech_pvt->update_refresher = 1;
|
||||
}
|
||||
} else {
|
||||
tech_pvt->session_refresher = nua_no_refresher;
|
||||
}
|
||||
|
||||
|
||||
if (sofia_use_soa(tech_pvt)) {
|
||||
nua_respond(tech_pvt->nh, SIP_200_OK,
|
||||
NUTAG_AUTOANSWER(0),
|
||||
|
@ -943,6 +947,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
|||
TAG_IF(cid, SIPTAG_HEADER_STR(cid)),
|
||||
NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
|
||||
NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
|
||||
NUTAG_UPDATE_REFRESH(tech_pvt->update_refresher),
|
||||
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
|
||||
SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
|
||||
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
|
||||
|
@ -962,6 +967,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
|||
TAG_IF(cid, SIPTAG_HEADER_STR(cid)),
|
||||
NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
|
||||
NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
|
||||
NUTAG_UPDATE_REFRESH(tech_pvt->update_refresher),
|
||||
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
|
||||
SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
|
||||
SIPTAG_CONTENT_TYPE_STR("application/sdp"),
|
||||
|
@ -1994,6 +2000,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
nua_update(tech_pvt->nh,
|
||||
NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
|
||||
NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
|
||||
NUTAG_UPDATE_REFRESH(tech_pvt->update_refresher),
|
||||
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
|
||||
TAG_IF(!zstr(tech_pvt->route_uri), NUTAG_PROXY(tech_pvt->route_uri)),
|
||||
TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
|
||||
|
@ -2009,6 +2016,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
nua_update(tech_pvt->nh,
|
||||
NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
|
||||
NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
|
||||
NUTAG_UPDATE_REFRESH(tech_pvt->update_refresher),
|
||||
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
|
||||
TAG_IF(!zstr(tech_pvt->route_uri), NUTAG_PROXY(tech_pvt->route_uri)),
|
||||
TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
|
||||
|
@ -2067,6 +2075,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
nua_update(tech_pvt->nh,
|
||||
NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
|
||||
NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
|
||||
NUTAG_UPDATE_REFRESH(tech_pvt->update_refresher),
|
||||
TAG_IF(!zstr(tech_pvt->route_uri), NUTAG_PROXY(tech_pvt->route_uri)),
|
||||
TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END());
|
||||
|
|
|
@ -308,6 +308,7 @@ typedef enum {
|
|||
PFLAG_PROXY_MESSAGE,
|
||||
PFLAG_FIRE_BYE_RESPONSE_EVENTS,
|
||||
PFLAG_AUTO_INVITE_100,
|
||||
PFLAG_UPDATE_REFRESHER,
|
||||
|
||||
/* No new flags below this line */
|
||||
PFLAG_MAX
|
||||
|
@ -849,6 +850,7 @@ struct private_object {
|
|||
sofia_cid_type_t cid_type;
|
||||
uint32_t session_timeout;
|
||||
enum nua_session_refresher session_refresher;
|
||||
int update_refresher;
|
||||
char **watch_headers;
|
||||
char *respond_phrase;
|
||||
int respond_code;
|
||||
|
|
|
@ -5281,6 +5281,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
|
|||
} else {
|
||||
sofia_clear_pflag(profile, PFLAG_PRESENCE_PRIVACY);
|
||||
}
|
||||
} else if (!strcasecmp(var, "update-refresher")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_UPDATE_REFRESHER);
|
||||
} else {
|
||||
sofia_clear_pflag(profile, PFLAG_UPDATE_REFRESHER);
|
||||
}
|
||||
} else if (!strcasecmp(var, "manage-shared-appearance")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE);
|
||||
|
|
|
@ -1288,11 +1288,13 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
|||
|
||||
if ((tech_pvt->session_timeout = session_timeout)) {
|
||||
tech_pvt->session_refresher = switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND ? nua_local_refresher : nua_remote_refresher;
|
||||
if (sofia_test_pflag(tech_pvt->profile, PFLAG_UPDATE_REFRESHER) || switch_channel_var_true(tech_pvt->channel, "sip_update_refresher")) {
|
||||
tech_pvt->update_refresher = 1;
|
||||
}
|
||||
} else {
|
||||
tech_pvt->session_refresher = nua_no_refresher;
|
||||
}
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s sending invite version: %s\nLocal SDP:\n%s\n",
|
||||
switch_channel_get_name(tech_pvt->channel), switch_version_full_human(),
|
||||
tech_pvt->mparams.local_sdp_str ? tech_pvt->mparams.local_sdp_str : "NO SDP PRESENT\n");
|
||||
|
@ -1316,6 +1318,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
|||
NUTAG_AUTOACK(0),
|
||||
NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
|
||||
NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
|
||||
NUTAG_UPDATE_REFRESH(tech_pvt->update_refresher),
|
||||
TAG_IF(sofia_test_flag(tech_pvt, TFLAG_RECOVERED), NUTAG_INVITE_TIMER(UINT_MAX)),
|
||||
TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)),
|
||||
TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)),
|
||||
|
@ -1352,6 +1355,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
|||
NUTAG_AUTOACK(0),
|
||||
NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
|
||||
NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
|
||||
NUTAG_UPDATE_REFRESH(tech_pvt->update_refresher),
|
||||
TAG_IF(sofia_test_flag(tech_pvt, TFLAG_RECOVERED), NUTAG_INVITE_TIMER(UINT_MAX)),
|
||||
TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)),
|
||||
TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)),
|
||||
|
|
Loading…
Reference in New Issue