提交 acd0898e authored 作者: Anthony Minessale's avatar Anthony Minessale

support final response in response header passing

上级 cce02898
...@@ -517,6 +517,8 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) ...@@ -517,6 +517,8 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)), TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END()); TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)), TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END());
} }
} else { } else {
char *resp_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause);
if (!tech_pvt->got_bye) { if (!tech_pvt->got_bye) {
switch_channel_set_variable(channel, "sip_hangup_disposition", "send_refuse"); switch_channel_set_variable(channel, "sip_hangup_disposition", "send_refuse");
...@@ -532,7 +534,12 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) ...@@ -532,7 +534,12 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause), nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause),
TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)), TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)),
TAG_IF(cid, SIPTAG_HEADER_STR(cid)), TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END()); TAG_IF(cid, SIPTAG_HEADER_STR(cid)),
TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
TAG_IF(!zstr(resp_headers), SIPTAG_HEADER_STR(resp_headers)),
TAG_END());
switch_safe_free(resp_headers);
} }
} }
} }
......
...@@ -4504,32 +4504,22 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status ...@@ -4504,32 +4504,22 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
#endif #endif
if ((status == 180 || status == 183 || status == 200)) {
const char *x_freeswitch_support, *vval;
switch_channel_set_flag(channel, CF_MEDIA_ACK);
if ((x_freeswitch_support = sofia_glue_get_unknown_header(sip, "X-FS-Support"))) {
tech_pvt->x_freeswitch_support_remote = switch_core_session_strdup(session, x_freeswitch_support);
}
if (sip->sip_user_agent && sip->sip_user_agent->g_string) { if ((status == 180 || status == 183 || status > 199)) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string); const char *vval;
} else if (sip->sip_server && sip->sip_server->g_string) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_server->g_string);
}
if (status == 200) { if (status > 199) {
sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_RESPONSE_HEADER_PREFIX); sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_RESPONSE_HEADER_PREFIX);
} else { } else {
sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_PROGRESS_HEADER_PREFIX); sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
} }
if (!(vval = switch_channel_get_variable(channel, "sip_copy_custom_headers")) || switch_true(vval)) { if (!(vval = switch_channel_get_variable(channel, "sip_copy_custom_headers")) || switch_true(vval)) {
switch_core_session_t *other_session; switch_core_session_t *other_session;
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
if (status == 200) { if (status > 199) {
switch_ivr_transfer_variable(session, other_session, SOFIA_SIP_RESPONSE_HEADER_PREFIX_T); switch_ivr_transfer_variable(session, other_session, SOFIA_SIP_RESPONSE_HEADER_PREFIX_T);
} else { } else {
switch_ivr_transfer_variable(session, other_session, SOFIA_SIP_PROGRESS_HEADER_PREFIX_T); switch_ivr_transfer_variable(session, other_session, SOFIA_SIP_PROGRESS_HEADER_PREFIX_T);
...@@ -4537,8 +4527,22 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status ...@@ -4537,8 +4527,22 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
switch_core_session_rwunlock(other_session); switch_core_session_rwunlock(other_session);
} }
} }
}
if ((status == 180 || status == 183 || status == 200)) {
const char *x_freeswitch_support;
switch_channel_set_flag(channel, CF_MEDIA_ACK);
if ((x_freeswitch_support = sofia_glue_get_unknown_header(sip, "X-FS-Support"))) {
tech_pvt->x_freeswitch_support_remote = switch_core_session_strdup(session, x_freeswitch_support);
}
if (sip->sip_user_agent && sip->sip_user_agent->g_string) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
} else if (sip->sip_server && sip->sip_server->g_string) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_server->g_string);
}
sofia_update_callee_id(session, profile, sip, SWITCH_FALSE); sofia_update_callee_id(session, profile, sip, SWITCH_FALSE);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论