]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
cleanup
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 18 Jan 2008 15:43:57 +0000 (15:43 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 18 Jan 2008 15:43:57 +0000 (15:43 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7284 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_commands/mod_commands.c
src/mod/endpoints/mod_sofia/sofia.c
src/mod/event_handlers/mod_event_socket/mod_event_socket.c

index 5a640568c968a905b20433bcf17876cec1d4b915..7b939319790b7a67da6a88642b77097475831278 100644 (file)
@@ -1664,9 +1664,12 @@ static void *SWITCH_THREAD_FUNC bgapi_exec(switch_thread_t *thread, void *obj)
        }
 
        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_STANDARD_API(bgapi_function)
        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;
index 1d302ef31cf4e8a80eebda6dccdf7714019ce6cb..980cf186c035f1627ece5d2c175ad7b5e7508b04 100644 (file)
@@ -2451,21 +2451,29 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
                                        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);
                        }
                }
        }
index 58be810188dfb902aafea80726e520888143a26f..1695ed4de02ceb0b25d0c26bad3bfa0a48672532 100644 (file)
@@ -551,6 +551,10 @@ static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t * thread, void *obj)
 
                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);
                }