add sip_hangup_disposition var
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9218 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
b3720e9b10
commit
d61d5a36a5
|
@ -315,6 +315,9 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_test_flag(tech_pvt, TFLAG_ANS)) {
|
if (switch_test_flag(tech_pvt, TFLAG_ANS)) {
|
||||||
|
if (!tech_pvt->got_bye) {
|
||||||
|
switch_channel_set_variable(channel, "sip_hangup_disposition", "send_bye");
|
||||||
|
}
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
|
||||||
nua_bye(tech_pvt->nh,
|
nua_bye(tech_pvt->nh,
|
||||||
SIPTAG_REASON_STR(reason),
|
SIPTAG_REASON_STR(reason),
|
||||||
|
@ -323,6 +326,9 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||||
} else {
|
} else {
|
||||||
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
|
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", switch_channel_get_name(channel));
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", switch_channel_get_name(channel));
|
||||||
|
if (!tech_pvt->got_bye) {
|
||||||
|
switch_channel_set_variable(channel, "sip_hangup_disposition", "send_cancel");
|
||||||
|
}
|
||||||
nua_cancel(tech_pvt->nh,
|
nua_cancel(tech_pvt->nh,
|
||||||
SIPTAG_REASON_STR(reason),
|
SIPTAG_REASON_STR(reason),
|
||||||
TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
|
TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
|
||||||
|
@ -330,6 +336,9 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||||
TAG_END());
|
TAG_END());
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause);
|
switch_log_printf(SWITCH_CHANNEL_LOG, 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),
|
nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause),
|
||||||
SIPTAG_REASON_STR(reason),
|
SIPTAG_REASON_STR(reason),
|
||||||
TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
|
TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
|
||||||
|
|
|
@ -474,6 +474,7 @@ struct private_object {
|
||||||
int q850_cause;
|
int q850_cause;
|
||||||
char *remote_ip;
|
char *remote_ip;
|
||||||
int remote_port;
|
int remote_port;
|
||||||
|
int got_bye;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct callback_t {
|
struct callback_t {
|
||||||
|
|
|
@ -122,16 +122,16 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
|
||||||
{
|
{
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
|
private_object_t *tech_pvt;
|
||||||
|
|
||||||
if (!session)
|
if (!session)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
|
tech_pvt = switch_core_session_get_private(session);
|
||||||
|
|
||||||
if (sip->sip_reason && sip->sip_reason->re_protocol &&
|
if (sip->sip_reason && sip->sip_reason->re_protocol &&
|
||||||
(!strcasecmp(sip->sip_reason->re_protocol, "Q.850") || !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH")) && sip->sip_reason->re_cause) {
|
(!strcasecmp(sip->sip_reason->re_protocol, "Q.850") || !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH")) && sip->sip_reason->re_cause) {
|
||||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
|
||||||
tech_pvt->q850_cause = atoi(sip->sip_reason->re_cause);
|
tech_pvt->q850_cause = atoi(sip->sip_reason->re_cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,10 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
|
||||||
if ((tmp = sofia_glue_get_unknown_header(sip, "P-RTP-Stat"))) {
|
if ((tmp = sofia_glue_get_unknown_header(sip, "P-RTP-Stat"))) {
|
||||||
switch_channel_set_variable(channel, "sip_p_rtp_stat", tmp);
|
switch_channel_set_variable(channel, "sip_p_rtp_stat", tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tech_pvt->got_bye = 1;
|
||||||
|
switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_bye");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue