[Freeswitch-svn] [commit] r5817 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Fri Oct 5 13:05:31 EDT 2007


Author: anthm
Date: Fri Oct  5 13:05:31 2007
New Revision: 5817

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c

Log:
update

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Fri Oct  5 13:05:31 2007
@@ -42,6 +42,18 @@
 									 char const *phrase,
 									 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
 
+void sofia_handle_sip_i_notify(int status,
+						  char const *phrase,
+						  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+{
+	nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua),TAG_END());
+	//nua_handle_destroy(nh);
+}
+
+
+
+
+
 void sofia_event_callback(nua_event_t event,
 						   int status,
 						   char const *phrase,
@@ -136,15 +148,6 @@
 		break;
 
 	case nua_r_invite:
-		{
-			if (channel) {
-				char *val;
-				if ((val = switch_channel_get_variable(channel, "sip_auto_answer")) && switch_true(val)) {
-					nua_notify(nh, NUTAG_NEWSUB(1), NUTAG_SUBSTATE(nua_substate_active), SIPTAG_EVENT_STR("talk"), TAG_END());
-				}
-			}
-		}
-		break;
 	case nua_r_get_params:
 	case nua_r_unregister:
 	case nua_r_options:
@@ -155,7 +158,6 @@
 	case nua_r_unsubscribe:
 	case nua_r_publish:
 	case nua_r_notify:
-	case nua_i_notify:
 	case nua_i_cancel:
 	case nua_i_error:
 	case nua_i_active:
@@ -163,6 +165,9 @@
 	case nua_i_terminated:
 	case nua_r_set_params:
 		break;
+	case nua_i_notify:
+		sofia_handle_sip_i_notify(status, phrase, nua, profile, nh, sofia_private, sip, tags);
+		break;
 	case nua_r_register:
 		sofia_reg_handle_sip_r_register(status, phrase, nua, profile, nh, sofia_private, sip, tags);
 		break;
@@ -1072,6 +1077,15 @@
 	if (status == 988) {
 		goto done;
 	}
+	
+
+	if (channel && (status == 180 || status == 183)) {
+		char *val;
+		if ((val = switch_channel_get_variable(channel, "sip_auto_answer")) && switch_true(val)) {
+			nua_notify(nh, NUTAG_NEWSUB(1), NUTAG_SUBSTATE(nua_substate_active), SIPTAG_EVENT_STR("talk"), TAG_END());
+		}
+	}
+
 
 	switch ((enum nua_callstate) ss_state) {
 	case nua_callstate_init:
@@ -2106,3 +2120,4 @@
 
 
 
+



More information about the Freeswitch-svn mailing list