[Freeswitch-svn] [commit] r4411 - in freeswitch/trunk/src: include mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Wed Feb 28 10:48:17 EST 2007


Author: anthm
Date: Wed Feb 28 10:48:17 2007
New Revision: 4411

Modified:
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c

Log:
move string to constant

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Wed Feb 28 10:48:17 2007
@@ -76,6 +76,7 @@
 #define SWITCH_GRAMMAR_DIR SWITCH_PREFIX_DIR SWITCH_PATH_SEPARATOR "grammar"
 #endif
 
+#define SWITCH_ENDPOINT_DISPOSITION_VARIABLE "endpoint_disposition"
 #define SWITCH_EXPORT_VARS_VARIABLE "export_vars"
 #define SWITCH_R_SDP_VARIABLE "switch_r_sdp"
 #define SWITCH_L_SDP_VARIABLE "switch_l_sdp"

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Wed Feb 28 10:48:17 2007
@@ -1631,7 +1631,7 @@
             return SWITCH_STATUS_FALSE;
         }
         activate_rtp(tech_pvt);
-        switch_channel_set_variable(channel, "endpoint_disposition", "EARLY MEDIA");
+        switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "EARLY MEDIA");
         switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
         switch_channel_mark_pre_answered(channel);
         return SWITCH_STATUS_SUCCESS;
@@ -1669,7 +1669,7 @@
 			if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) {
 				char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
 				if (tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
-					switch_channel_set_variable(channel, "endpoint_disposition", "CODEC NEGOTIATION ERROR");
+					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
 					nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
 					return SWITCH_STATUS_FALSE;
 				}
@@ -2084,7 +2084,7 @@
 				if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) {
 					char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
 					if (tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
-						switch_channel_set_variable(channel, "endpoint_disposition", "CODEC NEGOTIATION ERROR");
+						switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
 						nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
 						return SWITCH_STATUS_FALSE;
 					}
@@ -2873,10 +2873,10 @@
                     goto done;
 				} else {
 					if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) {
-						switch_channel_set_variable(channel, "endpoint_disposition", "DELAYED NEGOTIATION");
+						switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION");
 					} else {
 						if (tech_media(tech_pvt, (char *)r_sdp) != SWITCH_STATUS_SUCCESS) {
-							switch_channel_set_variable(channel, "endpoint_disposition", "CODEC NEGOTIATION ERROR");
+							switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
 							nua_respond(nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
 						}
 					}
@@ -2897,7 +2897,7 @@
 		if (channel) {
 			if (r_sdp) {
 				if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) {
-					switch_channel_set_variable(channel, "endpoint_disposition", "RECEIVED_NOMEDIA");
+					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOMEDIA");
 					switch_channel_set_state(channel, CS_INIT);
 					switch_set_flag_locked(tech_pvt, TFLAG_READY);
 					switch_core_session_thread_launch(session);
@@ -2920,7 +2920,7 @@
 					if (match) {
 						nua_handle_t *bnh;
 						sip_replaces_t *replaces;
-						switch_channel_set_variable(channel, "endpoint_disposition", "RECEIVED");
+						switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED");
 						switch_channel_set_state(channel, CS_INIT);
 						switch_set_flag_locked(tech_pvt, TFLAG_READY);
 
@@ -2940,14 +2940,14 @@
 
 								if (br_b) {
 									switch_ivr_uuid_bridge(br_a, br_b);
-									switch_channel_set_variable(channel, "endpoint_disposition", "ATTENDED_TRANSFER");
+									switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
 									switch_channel_hangup(channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
 								} else {
-									switch_channel_set_variable(channel, "endpoint_disposition", "ATTENDED_TRANSFER_ERROR");
+									switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
 									switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 								}
 							} else {
-								switch_channel_set_variable(channel, "endpoint_disposition", "ATTENDED_TRANSFER_ERROR");
+								switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
 								switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 							}
 							nua_handle_unref(bnh);
@@ -2955,7 +2955,7 @@
                         goto done;
 					}
 
-					switch_channel_set_variable(channel, "endpoint_disposition", "NO CODECS");
+					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "NO CODECS");
 					nua_respond(nh, SIP_488_NOT_ACCEPTABLE, 
 								TAG_END());
 				}
@@ -3061,7 +3061,7 @@
                         }
 					}
 					
-					switch_channel_set_variable(channel, "endpoint_disposition", "NO CODECS");
+					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "NO CODECS");
 					nua_respond(nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
 				}
 			}
@@ -3905,7 +3905,7 @@
                             
                         if (br_a && br_b) {
                             switch_ivr_uuid_bridge(br_a, br_b);
-                            switch_channel_set_variable(channel_b, "endpoint_disposition", "ATTENDED_TRANSFER");
+                            switch_channel_set_variable(channel_b, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
                             switch_set_flag_locked(tech_pvt, TFLAG_BYE);
                             switch_set_flag_locked(b_tech_pvt, TFLAG_BYE);
                             nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
@@ -4004,7 +4004,7 @@
                             switch_core_session_rwunlock(a_session);
                             tuuid_str = switch_core_session_get_uuid(tsession);
                             switch_ivr_uuid_bridge(br_a, tuuid_str);
-                            switch_channel_set_variable(channel_a, "endpoint_disposition", "ATTENDED_TRANSFER");
+                            switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
                             switch_set_flag_locked(tech_pvt, TFLAG_BYE);
                             nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
                                        NUTAG_SUBSTATE(nua_substate_terminated),
@@ -4017,7 +4017,7 @@
 
                     } else { error:
                         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Transfer! [%s]\n", br_a);
-                        switch_channel_set_variable(channel_a, "endpoint_disposition", "ATTENDED_TRANSFER_ERROR");
+                        switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
                         nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
                                    NUTAG_SUBSTATE(nua_substate_terminated),
                                    SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"),
@@ -4049,7 +4049,7 @@
                 switch_core_session_rwunlock(b_session);
             } 
 
-            switch_channel_set_variable(channel, "endpoint_disposition", "BLIND_TRANSFER");
+            switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "BLIND_TRANSFER");
                 
             /*
               nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
@@ -4443,7 +4443,7 @@
 	attach_private(session, profile, tech_pvt, channel_name);
 	tech_set_codecs(tech_pvt);
 
-	switch_channel_set_variable(channel, "endpoint_disposition", "INBOUND CALL");
+	switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "INBOUND CALL");
 	set_chat_hash(tech_pvt, sip);
 
 	if (switch_test_flag(tech_pvt, TFLAG_INB_NOMEDIA)) {



More information about the Freeswitch-svn mailing list