let sip calls pass the exact response status across a bridge

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8237 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-05-01 18:35:45 +00:00
parent 9b30341170
commit 8c352ce5b9
3 changed files with 11 additions and 1 deletions

View File

@ -102,6 +102,7 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_PATH_SEPARATOR "/"
#endif
#define SWITCH_URL_SEPARATOR "://"
#define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause"
#define SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE "execute_on_answer"
#define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout"
#define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid"

View File

@ -222,7 +222,14 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_call_cause_t cause = switch_channel_get_cause(channel);
int sip_cause = hangup_cause_to_sip(cause);
const char *ps_cause = switch_channel_get_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE);
if (!switch_strlen_zero(ps_cause) && !strncasecmp(ps_cause, "sip:", 4)) {
int new_cause = atoi(ps_cause + 4);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Overriding SIP cause %d with %d from the other leg\n",
switch_channel_get_name(channel), sip_cause, new_cause);
sip_cause = new_cause;
}
if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
const char *buuid;

View File

@ -2106,6 +2106,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
}
switch_snprintf(st, sizeof(st), "%d", status);
switch_channel_set_variable(channel, "sip_term_status", st);
switch_snprintf(st, sizeof(st), "sip:%d", status);
switch_channel_set_variable_partner(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, st);
switch_snprintf(st, sizeof(st), "%d", cause);
switch_channel_set_variable(channel, "sip_term_cause", st);
switch_channel_hangup(channel, cause);