Fire an event on successful sms delivery, as well as clearify if the delivery method was blocking or not.
This commit is contained in:
parent
8b74de2d62
commit
b8f0d11a8a
|
@ -50,6 +50,9 @@ static void event_handler(switch_event_t *event)
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Delivery Failure\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Delivery Failure\n");
|
||||||
DUMP_EVENT(event);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -512,6 +512,7 @@ static switch_status_t do_chat_send(switch_event_t *message_event)
|
||||||
switch_chat_interface_t *ci;
|
switch_chat_interface_t *ci;
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
switch_hash_index_t *hi;
|
switch_hash_index_t *hi;
|
||||||
|
switch_event_t *dup = NULL;
|
||||||
const void *var;
|
const void *var;
|
||||||
void *val;
|
void *val;
|
||||||
const char *proto;
|
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_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");
|
switch_event_add_header_string(dup, SWITCH_STACK_BOTTOM, "Delivery-Failure", "true");
|
||||||
switch_event_fire(&dup);
|
}
|
||||||
|
} else {
|
||||||
|
switch_event_add_header_string(dup, SWITCH_STACK_BOTTOM, "Nonblocking-Delivery", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch_event_fire(&dup);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue