]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fire failed sms events
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 21 Feb 2012 16:00:19 +0000 (10:00 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 21 Feb 2012 16:00:19 +0000 (10:00 -0600)
src/switch_loadable_module.c

index 335e15df00899f8ecfa1fb20faee2027536c3096..36cc24b282cb67155780f285f4256b62816c498c 100644 (file)
@@ -579,14 +579,23 @@ static switch_status_t do_chat_send(switch_event_t *message_event)
        }
        
        if (!do_skip && !switch_stristr("GLOBAL", dest_proto)) {
-               if (!(ci = switch_loadable_module_get_chat_interface(dest_proto)) || !ci->chat_send) {
+               if ((ci = switch_loadable_module_get_chat_interface(dest_proto)) && ci->chat_send) {
+                       status = ci->chat_send(message_event);
+                       UNPROTECT_INTERFACE(ci);
+               } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid chat interface [%s]!\n", dest_proto);
-                       return SWITCH_STATUS_FALSE;
+                       status = SWITCH_STATUS_FALSE;
                }
-               status = ci->chat_send(message_event);
-               UNPROTECT_INTERFACE(ci);
        }
 
+       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);
+       }
+
+
        return status;
 }