Fire an event on successful sms delivery, as well as clearify if the delivery method was blocking or not.

This commit is contained in:
William King 2012-11-14 16:45:32 -08:00
parent 8b74de2d62
commit b8f0d11a8a
2 changed files with 16 additions and 6 deletions

View 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;
}

View 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;
}