]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Fire an event on successful sms delivery, as well as clearify if the delivery method...
authorWilliam King <william.king@quentustech.com>
Thu, 15 Nov 2012 00:45:32 +0000 (16:45 -0800)
committerWilliam King <william.king@quentustech.com>
Thu, 15 Nov 2012 00:45:32 +0000 (16:45 -0800)
src/mod/applications/mod_sms/mod_sms.c
src/switch_loadable_module.c

index 372e7903b5bc53c368898b1d155c5ad80c7dd65a..d90896f74d630e0b1ed55ce2612ffad86ce88b03 100644 (file)
@@ -50,6 +50,9 @@ static void event_handler(switch_event_t *event)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Delivery Failure\n");
                DUMP_EVENT(event);
 
+               return;
+       } else if ( check_failure && switch_false(check_failure) ) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SMS Delivery Success\n");
                return;
        }
 
index 26e93a8071f8c3c5dc31347f22457cb0471afe66..a94c274b6d156a87e382d2a181f52274e3d3124d 100644 (file)
@@ -512,6 +512,7 @@ static switch_status_t do_chat_send(switch_event_t *message_event)
        switch_chat_interface_t *ci;
        switch_status_t status = SWITCH_STATUS_FALSE;
        switch_hash_index_t *hi;
+       switch_event_t *dup = NULL;
        const void *var;
        void *val;
        const char *proto;
@@ -588,14 +589,20 @@ static switch_status_t do_chat_send(switch_event_t *message_event)
                }
        }
 
-       if (status != SWITCH_STATUS_SUCCESS) {
-               switch_event_t *dup;
-               switch_event_dup(&dup, message_event);
-               switch_event_add_header_string(dup, SWITCH_STACK_BOTTOM, "Delivery-Failure", "true");
-               switch_event_fire(&dup);
-       }
 
+       switch_event_dup(&dup, message_event);
+
+       if ( switch_true(switch_event_get_header(message_event, "blocking")) ) {
+               if (status == SWITCH_STATUS_SUCCESS) {
+                       switch_event_add_header_string(dup, SWITCH_STACK_BOTTOM, "Delivery-Failure", "false");
+               } else {
+                       switch_event_add_header_string(dup, SWITCH_STACK_BOTTOM, "Delivery-Failure", "true");
+               }
+       } else {
+               switch_event_add_header_string(dup, SWITCH_STACK_BOTTOM, "Nonblocking-Delivery", "true");
+       }
 
+       switch_event_fire(&dup);
        return status;
 }