]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
some chat fixes
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 7 Oct 2011 13:23:40 +0000 (08:23 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 7 Oct 2011 13:24:19 +0000 (08:24 -0500)
src/mod/applications/mod_dptools/mod_dptools.c
src/mod/applications/mod_sms/mod_sms.c
src/switch_loadable_module.c

index d0a6337166b9ed5d383c265db5c41a9e245b9609..011acd43c335d9f177eceed3f46c55b153cd32f7 100755 (executable)
@@ -1562,7 +1562,7 @@ SWITCH_STANDARD_API(chat_api_function)
        if (!zstr(cmd) && (lbuf = strdup(cmd))
                && (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) >= 4) {
 
-               if (switch_core_chat_send_args(argv[0], "dp", argv[1], argv[2], "", argv[3], !zstr(argv[4]) ? argv[4] : NULL, "") == SWITCH_STATUS_SUCCESS) {
+               if (switch_core_chat_send_args(argv[0], "global", argv[1], argv[2], "", argv[3], !zstr(argv[4]) ? argv[4] : NULL, "") == SWITCH_STATUS_SUCCESS) {
                        stream->write_function(stream, "Sent");
                } else {
                        stream->write_function(stream, "Error! Message Not Sent");
index 70db75a5e376a04b5a64e930a218ca69b26417f5..5c1e8c5ab5bce293a9d7a29829dbe48be2e644b8 100644 (file)
@@ -42,6 +42,7 @@ SWITCH_MODULE_DEFINITION(mod_sms, mod_sms_load, mod_sms_shutdown, NULL);
 static void event_handler(switch_event_t *event) 
 {
        const char *dest_proto = switch_event_get_header(event, "dest_proto");
+       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "skip_global_process", "true");
        switch_core_chat_send(dest_proto, event);
 }
 
index 48e9226080e421f69b61da212dfbad918fcf1530..d78890843791065b3ec81e3ad11d1d62630436b7 100644 (file)
@@ -547,10 +547,15 @@ static switch_status_t do_chat_send(switch_event_t *message_event)
        hint = switch_event_get_header(message_event, "hint");
        */
 
-       proto = switch_event_get_header(message_event, "proto");
+       if (!(proto = switch_event_get_header(message_event, "proto"))) {
+               proto = "global";
+               switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "proto", proto);
+       }
+
+
        replying = switch_event_get_header(message_event, "replying");
        
-       if (!switch_true(replying) && !switch_stristr("global", proto)) {
+       if (!switch_true(replying) && !switch_stristr("global", proto) && !switch_true(switch_event_get_header(message_event, "skip_global_process"))) {
                switch_mutex_lock(loadable_modules.mutex);
                for (hi = switch_hash_first(NULL, loadable_modules.chat_hash); hi; hi = switch_hash_next(hi)) {
                        switch_hash_this(hi, &var, NULL, &val);
@@ -741,6 +746,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_chat_send_args(const char *dest_prot
                switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "subject", subject);
                switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "type", type);
                switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "hint", hint);
+               switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "skip_global_process", "true");
                
                if (body) {
                        switch_event_add_body(message_event, "%s", body);