Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (14120 => 14121)
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h 2009-07-02 17:38:24 UTC (rev 14120)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h 2009-07-02 17:40:16 UTC (rev 14121)
@@ -36,6 +36,8 @@
/*Defines etc..*/
/*************************************************************************************************************************************************************/
+#define MANUAL_BYE
+
#define IREG_SECONDS 30
#define GATEWAY_SECONDS 1
#define SOFIA_QUEUE_SIZE 50000
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (14120 => 14121)
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c 2009-07-02 17:38:24 UTC (rev 14120)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c 2009-07-02 17:40:16 UTC (rev 14121)
@@ -281,6 +281,10 @@
const char *tmp;
switch_channel_t *channel;
private_object_t *tech_pvt;
+#ifdef MANUAL_BYE
+ int cause;
+ char st[80] = "";
+#endif
if (!session)
return;
@@ -288,11 +292,41 @@
channel = switch_core_session_get_channel(session);
tech_pvt = switch_core_session_get_private(session);
+
+#ifdef MANUAL_BYE
+ status = 200;
+ phrase = "OK";
+
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
+
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) {
tech_pvt->q850_cause = atoi(sip->sip_reason->re_cause);
+ cause = tech_pvt->q850_cause;
+ } else {
+ cause = sofia_glue_sip_cause_to_freeswitch(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);
+
+ if (phrase) {
+ switch_channel_set_variable_partner(channel, "sip_hangup_phrase", phrase);
+ }
+
+ switch_snprintf(st, sizeof(st), "%d", cause);
+ switch_channel_set_variable(channel, "sip_term_cause", st);
+ switch_channel_hangup(channel, cause);
+ nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
+
+ if (sofia_private) {
+ sofia_private->destroy_me = 1;
+ sofia_private->destroy_nh = 1;
+ }
+#endif
+
+
if (sip->sip_user_agent && !switch_strlen_zero(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 && !switch_strlen_zero(sip->sip_server->g_string)) {
@@ -310,8 +344,8 @@
}
tech_pvt->got_bye = 1;
- switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_bye");
-
+ switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_bye");
+
return;
}
@@ -813,6 +847,9 @@
NUTAG_APPL_METHOD("OPTIONS"),
NUTAG_APPL_METHOD("NOTIFY"),
NUTAG_APPL_METHOD("INFO"),
+#ifdef MANUAL_BYE
+ NUTAG_APPL_METHOD("BYE"),
+#endif
NUTAG_AUTOANSWER(0),
NUTAG_AUTOALERT(0),
NUTAG_ENABLEMESSENGER(1),