[Freeswitch-svn] [commit] r7284 - in freeswitch/trunk/src/mod: applications/mod_commands endpoints/mod_sofia event_handlers/mod_event_socket

Freeswitch SVN anthm at freeswitch.org
Fri Jan 18 10:43:58 EST 2008


Author: anthm
Date: Fri Jan 18 10:43:57 2008
New Revision: 7284

Modified:
   freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c

Log:
cleanup

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	Fri Jan 18 10:43:57 2008
@@ -1664,9 +1664,12 @@
 	}
 
 	if (switch_event_create(&event, SWITCH_EVENT_BACKGROUND_JOB) == SWITCH_STATUS_SUCCESS) {
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Job-Command", "%s", job->cmd);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Job-Command-Arg", "%s", arg);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Job-UUID", "%s", job->uuid_str);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Job-Command", "%s", job->cmd);
+		if (arg) {
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Job-Command-Arg", "%s", arg);
+		}
+
 		switch_event_add_body(event, "%s", reply);
 		switch_event_fire(&event);
 	}
@@ -1707,7 +1710,7 @@
 	switch_threadattr_create(&thd_attr, job->pool);
 	switch_threadattr_detach_set(thd_attr, 1);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-	stream->write_function(stream, "+OK %s\n", job->uuid_str);
+	stream->write_function(stream, "+OK Job-UUID: %s\n", job->uuid_str);
 	switch_thread_create(&thread, thd_attr, bgapi_exec, job, job->pool);
 
 	return SWITCH_STATUS_SUCCESS;

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 Jan 18 10:43:57 2008
@@ -2451,21 +2451,29 @@
 					tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s>", tech_pvt->to_uri);
 				}
 			} else {
-				const char *url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url;
+				const char *url;
 
-				if (url && strchr(url, '>')) {
-					tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport));
+				if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) {
+					if (strchr(url, '>')) {
+						tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport));
+					} else {
+						tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, sofia_glue_transport2str(transport));
+					}
 				} else {
-					tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, sofia_glue_transport2str(transport));
+					switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 				}
 			}
 		} else {
-			const char *url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url;
+			const char *url;
 
-			if (strchr(url, '>')) {
-				tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport));
+			if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) {
+				if (strchr(url, '>')) {
+					tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport));
+				} else {
+					tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, sofia_glue_transport2str(transport));
+				}
 			} else {
-				tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, sofia_glue_transport2str(transport));
+				switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			}
 		}
 	}

Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	Fri Jan 18 10:43:57 2008
@@ -551,6 +551,10 @@
 
 		if (switch_event_create(&event, SWITCH_EVENT_BACKGROUND_JOB) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Job-UUID", "%s", acs->uuid_str);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Job-Command", "%s", acs->api_cmd);
+			if (acs->arg) {
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Job-Command-Arg", "%s", acs->arg);
+			}
 			switch_event_add_body(event, "%s", reply);
 			switch_event_fire(&event);
 		}



More information about the Freeswitch-svn mailing list