support final response in response header passing

This commit is contained in:
Anthony Minessale
2011-06-28 10:30:11 -05:00
parent cce0289874
commit acd0898e32
2 changed files with 34 additions and 23 deletions
+26 -22
View File
@@ -4504,8 +4504,33 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
#endif
if ((status == 180 || status == 183 || status > 199)) {
const char *vval;
if (status > 199) {
sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_RESPONSE_HEADER_PREFIX);
} else {
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)) {
switch_core_session_t *other_session;
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
if (status > 199) {
switch_ivr_transfer_variable(session, other_session, SOFIA_SIP_RESPONSE_HEADER_PREFIX_T);
} else {
switch_ivr_transfer_variable(session, other_session, SOFIA_SIP_PROGRESS_HEADER_PREFIX_T);
}
switch_core_session_rwunlock(other_session);
}
}
}
if ((status == 180 || status == 183 || status == 200)) {
const char *x_freeswitch_support, *vval;
const char *x_freeswitch_support;
switch_channel_set_flag(channel, CF_MEDIA_ACK);
@@ -4518,28 +4543,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
} 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) {
sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_RESPONSE_HEADER_PREFIX);
} else {
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)) {
switch_core_session_t *other_session;
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
if (status == 200) {
switch_ivr_transfer_variable(session, other_session, SOFIA_SIP_RESPONSE_HEADER_PREFIX_T);
} else {
switch_ivr_transfer_variable(session, other_session, SOFIA_SIP_PROGRESS_HEADER_PREFIX_T);
}
switch_core_session_rwunlock(other_session);
}
}
sofia_update_callee_id(session, profile, sip, SWITCH_FALSE);
if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTOFIX_TIMING)) {