TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)), TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END());
}
} 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);
if (!tech_pvt->got_bye) {
switch_channel_set_variable(channel, "sip_hangup_disposition", "send_refuse");
nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause),
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);
}
}
}
#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 ((status == 180 || status == 183 || status > 199)) {
+ const char *vval;
- 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);
- }
-
- if (status == 200) {
+ 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 == 200) {
+ 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;
+ 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);
if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTOFIX_TIMING)) {