From 99026e02e7b9712b2b2632b53ba70eb5a08b9754 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthony.minessale@gmail.com> Date: Sat, 21 Feb 2009 23:19:58 +0000 Subject: [PATCH] event socket / ESL improvements git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12228 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/esl/src/esl.c | 24 ++++--- libs/esl/src/esl_event.c | 6 +- libs/esl/src/esl_oop.cpp | 7 ++- libs/esl/src/include/esl.h | 13 +++- libs/esl/src/include/esl_event.h | 2 + src/include/switch_core.h | 3 +- src/include/switch_event.h | 9 ++- src/include/switch_types.h | 3 + .../mod_conference/mod_conference.c | 2 +- .../mod_event_socket/mod_event_socket.c | 63 +++++++++++++++++-- src/switch_channel.c | 6 +- src/switch_core_session.c | 4 +- src/switch_cpp.cpp | 2 +- src/switch_event.c | 49 +++++++++------ src/switch_ivr.c | 6 +- src/switch_ivr_async.c | 4 +- src/switch_ivr_bridge.c | 2 +- src/switch_ivr_play_say.c | 8 +-- 18 files changed, 156 insertions(+), 57 deletions(-) diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 2686451c20..229c5d0aa1 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -786,12 +786,11 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, esl_event_t **sav while(handle->connected) { rrval = recv(handle->sock, c, 1, 0); - if (rrval == 0) { if (++zc >= 100) { esl_disconnect(handle); esl_mutex_unlock(handle->mutex); - return ESL_FAIL; + return ESL_DISCONNECTED; } } else if (rrval < 0) { strerror_r(handle->errnum, handle->err, sizeof(handle->err)); @@ -876,21 +875,16 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, esl_event_t **sav hval = esl_event_get_header(revent, "content-type"); - if (!esl_strlen_zero(hval) && !esl_safe_strcasecmp(hval, "text/event-plain") && revent->body) { - const char *en; + if (!esl_safe_strcasecmp(hval, "text/disconnect-notice") && revent->body) { + goto fail; + } + + if (!esl_safe_strcasecmp(hval, "text/event-plain") && revent->body) { esl_event_types_t et = ESL_EVENT_COMMAND; char *body = strdup(revent->body); esl_event_safe_destroy(&handle->last_ievent); - if ((en = esl_stristr("event-name:", body))) { - en++; - while(*en == ' ') en++; - if (en) { - esl_name_event(en, &et); - } - } - esl_event_create(&handle->last_ievent, et); beg = body; @@ -914,14 +908,18 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, esl_event_t **sav if (hname && hval) { esl_url_decode(hval); esl_log(ESL_LOG_DEBUG, "RECV INNER HEADER [%s] = [%s]\n", hname, hval); + if (!strcasecmp(hname, "event-name")) { + esl_event_del_header(handle->last_ievent, "event-name"); + } esl_event_add_header_string(handle->last_ievent, ESL_STACK_BOTTOM, hname, hval); + esl_name_event(hval, &handle->last_event->event_id); } beg = c + 1; } free(body); - + if ((cl = esl_event_get_header(handle->last_ievent, "content-length"))) { esl_ssize_t sofar = 0; diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index 92b1ff69ca..20701fa717 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -118,6 +118,8 @@ static const char *EVENT_NAMES[] = { "GENERAL", "COMMAND", "SESSION_HEARTBEAT", + "CLIENT_DISCONNECTED", + "SERVER_DISCONNECTED", "ALL" }; @@ -157,10 +159,12 @@ ESL_DECLARE(esl_status_t) esl_event_create_subclass(esl_event_t **event, esl_eve (*event)->event_id = event_id; + esl_event_add_header_string(*event, ESL_STACK_BOTTOM, "Event-Name", esl_event_name((*event)->event_id)); + if (subclass_name) { (*event)->subclass_name = DUP(subclass_name); esl_event_add_header_string(*event, ESL_STACK_BOTTOM, "Event-Subclass", subclass_name); - } + } return ESL_SUCCESS; } diff --git a/libs/esl/src/esl_oop.cpp b/libs/esl/src/esl_oop.cpp index 22214d1f15..6b383a1e6b 100644 --- a/libs/esl/src/esl_oop.cpp +++ b/libs/esl/src/esl_oop.cpp @@ -163,7 +163,9 @@ ESLevent *ESLconnection::recvEvent() } } - return NULL; + last_event_obj = new ESLevent("server_disconnected"); + + return last_event_obj; } ESLevent *ESLconnection::recvEventTimed(int ms) @@ -183,7 +185,8 @@ ESLevent *ESLconnection::recvEventTimed(int ms) } } - return NULL; + last_event_obj = new ESLevent("server_disconnected"); + return last_event_obj; } int ESLconnection::filter(const char *header, const char *value) diff --git a/libs/esl/src/include/esl.h b/libs/esl/src/include/esl.h index a37c3cc868..e7b1c4528e 100644 --- a/libs/esl/src/include/esl.h +++ b/libs/esl/src/include/esl.h @@ -248,7 +248,8 @@ typedef int16_t esl_port_t; typedef enum { ESL_SUCCESS, ESL_FAIL, - ESL_BREAK + ESL_BREAK, + ESL_DISCONNECTED } esl_status_t; #include <esl_threadmutex.h> @@ -341,7 +342,15 @@ ESL_DECLARE(esl_status_t) esl_events(esl_handle_t *handle, esl_event_type_t etyp #define esl_recv(_h) esl_recv_event(_h, NULL) #define esl_recv_timed(_h, _ms) esl_recv_event_timed(_h, _ms, NULL) -#define esl_safe_strcasecmp(_s1, _s2) ((_s1) && (_s2)) ? strcasecmp((_s1), (_s2)) : 1 + +static __inline__ int esl_safe_strcasecmp(const char *s1, const char *s2) +{ + if (!(s1 && s2)) { + return 1; + } + + return strcasecmp(s1, s2); +} #ifdef __cplusplus } diff --git a/libs/esl/src/include/esl_event.h b/libs/esl/src/include/esl_event.h index 5bb30ff945..055418b10c 100644 --- a/libs/esl/src/include/esl_event.h +++ b/libs/esl/src/include/esl_event.h @@ -106,6 +106,8 @@ typedef enum { ESL_EVENT_GENERAL, ESL_EVENT_COMMAND, ESL_EVENT_SESSION_HEARTBEAT, + ESL_EVENT_CLIENT_DISCONNECTED, + ESL_EVENT_SERVER_DISCONNECTED, ESL_EVENT_ALL } esl_event_types_t; diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 3934a41b3d..b4a72cd12f 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -830,9 +830,10 @@ SWITCH_DECLARE(uint32_t) switch_core_session_event_count(_In_ switch_core_sessio \brief DE-Queue an event on a given session \param session the session to de-queue the message on \param event the de-queued event + \param force force the dequeue \return the SWITCH_STATUS_SUCCESS if the event was de-queued */ -SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(_In_ switch_core_session_t *session, _Out_ switch_event_t **event); +SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(_In_ switch_core_session_t *session, _Out_ switch_event_t **event, switch_bool_t force); /*! \brief Queue a private event on a given session diff --git a/src/include/switch_event.h b/src/include/switch_event.h index b68573ccdf..be344ffaa4 100644 --- a/src/include/switch_event.h +++ b/src/include/switch_event.h @@ -121,7 +121,10 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void); \param subclass_name the subclass name for custom event (only valid when event_id is SWITCH_EVENT_CUSTOM) \return SWITCH_STATUS_SUCCESS on success */ -SWITCH_DECLARE(switch_status_t) switch_event_create_subclass(switch_event_t **event, switch_event_types_t event_id, const char *subclass_name); +SWITCH_DECLARE(switch_status_t) switch_event_create_subclass_detailed(const char *file, const char *func, int line, + switch_event_t **event, switch_event_types_t event_id, const char *subclass_name); + +#define switch_event_create_subclass(_e, _eid, _sn) switch_event_create_subclass_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, _e, _eid, _sn) /*! \brief Set the priority of an event @@ -198,6 +201,10 @@ SWITCH_DECLARE(switch_status_t) switch_event_dup(switch_event_t **event, switch_ */ SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, const char *func, int line, switch_event_t **event, void *user_data); +SWITCH_DECLARE(void) switch_event_prep_for_delivery_detailed(const char *file, const char *func, int line, switch_event_t *event); +#define switch_event_prep_for_delivery(_event) switch_event_prep_for_delivery_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, _event) + + /*! \brief Bind an event callback to a specific event \param id an identifier token of the binder diff --git a/src/include/switch_types.h b/src/include/switch_types.h index c91b6be004..45aedde952 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -844,6 +844,7 @@ typedef enum { CF_REQ_MEDIA, CF_VERBOSE_EVENTS, CF_PAUSE_BUGS, + CF_DIVERT_EVENTS, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; @@ -1212,6 +1213,8 @@ typedef enum { SWITCH_EVENT_GENERAL, SWITCH_EVENT_COMMAND, SWITCH_EVENT_SESSION_HEARTBEAT, + SWITCH_EVENT_CLIENT_DISCONNECTED, + SWITCH_EVENT_SERVER_DISCONNECTED, SWITCH_EVENT_ALL } switch_event_types_t; diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index b707304521..967059a447 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1900,7 +1900,7 @@ static void conference_loop_output(conference_member_t *member) switch_mutex_lock(member->control_mutex); - if (switch_core_session_dequeue_event(member->session, &event) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_dequeue_event(member->session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { if (event->event_id == SWITCH_EVENT_MESSAGE) { char *from = switch_event_get_header(event, "from"); char *to = switch_event_get_header(event, "to"); diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index c1e7edf4c6..6cf3a868e4 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -218,7 +218,7 @@ static void event_handler(switch_event_t *event) if (!listen_list.ready) { return; } - + lp = listen_list.listeners; switch_mutex_lock(globals.listener_mutex); @@ -328,7 +328,6 @@ static void event_handler(switch_event_t *event) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n"); } } - } switch_mutex_unlock(globals.listener_mutex); } @@ -988,8 +987,9 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, while (listener->sock && !prefs.done) { uint8_t do_sleep = 1; mlen = 1; - status = switch_socket_recv(listener->sock, ptr, &mlen); + status = switch_socket_recv(listener->sock, ptr, &mlen); + if (prefs.done || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) { return SWITCH_STATUS_FALSE; } @@ -1129,12 +1129,26 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, } } + + if (listener->session) { + switch_channel_t *channel = switch_core_session_get_channel(listener->session); + if (switch_channel_get_state(channel) < CS_HANGUP && switch_channel_test_flag(channel, CF_DIVERT_EVENTS)) { + switch_event_t *e = NULL; + while (switch_core_session_dequeue_event(listener->session, &e, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { + if (switch_queue_trypush(listener->event_queue, e) != SWITCH_STATUS_SUCCESS) { + switch_core_session_queue_event(listener->session, &e); + break; + } + } + } + } + if (switch_test_flag(listener, LFLAG_EVENTS)) { while (switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS) { char hbuf[512]; switch_event_t *pevent = (switch_event_t *) pop; char *etype; - + do_sleep = 0; if (listener->format == EVENT_FORMAT_PLAIN) { etype = "plain"; @@ -1473,6 +1487,47 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even } + if (!strncasecmp(cmd, "divert_events", 13)) { + char *onoff = cmd + 13; + switch_channel_t *channel; + + if (!listener->session) { + switch_snprintf(reply, reply_len, "-ERR not controlling a session."); + goto done; + } + + channel = switch_core_session_get_channel(listener->session); + + if (onoff) { + while(*onoff == ' ') { + onoff++; + } + + if (*onoff == '\r' || *onoff == '\n') { + onoff = NULL; + } else { + strip_cr(onoff); + } + } + + if (switch_strlen_zero(onoff)) { + switch_snprintf(reply, reply_len, "-ERR missing value."); + goto done; + } + + + if (!strcasecmp(onoff, "on")) { + switch_snprintf(reply, reply_len, "+OK events diverted"); + switch_channel_set_flag(channel, CF_DIVERT_EVENTS); + } else { + switch_snprintf(reply, reply_len, "+OK events not diverted"); + switch_channel_clear_flag(channel, CF_DIVERT_EVENTS); + } + + goto done; + + } + if (!strncasecmp(cmd, "sendmsg", 7)) { switch_core_session_t *session; char *uuid = cmd + 7; diff --git a/src/switch_channel.c b/src/switch_channel.c index cab3efd9ff..e80bd8d504 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -373,7 +373,11 @@ SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(switch_channel_t *ch switch_channel_event_set_data(channel, event); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Digit", "%c", dtmf->digit); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Duration", "%u", dtmf->duration); - switch_event_fire(&event); + if (switch_channel_test_flag(channel, CF_DIVERT_EVENTS)) { + switch_core_session_queue_event(channel->session, &event); + } else { + switch_event_fire(&event); + } } return status; diff --git a/src/switch_core_session.c b/src/switch_core_session.c index f026aa0c09..59449b02be 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -680,14 +680,14 @@ SWITCH_DECLARE(uint32_t) switch_core_session_event_count(switch_core_session_t * return 0; } -SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(switch_core_session_t *session, switch_event_t **event) +SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(switch_core_session_t *session, switch_event_t **event, switch_bool_t force) { switch_status_t status = SWITCH_STATUS_FALSE; void *pop; switch_assert(session != NULL); - if (session->event_queue) { + if (session->event_queue && (force || !switch_channel_test_flag(session->channel, CF_DIVERT_EVENTS))) { if ((status = (switch_status_t) switch_queue_trypop(session->event_queue, &pop)) == SWITCH_STATUS_SUCCESS) { *event = (switch_event_t *) pop; } diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index d8c14a42d0..b269f6b966 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -986,7 +986,7 @@ SWITCH_DECLARE(int) CoreSession::flushEvents() } channel = switch_core_session_get_channel(session); - while (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) { + while (switch_core_session_dequeue_event(session, &event, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { switch_event_destroy(&event); } return SWITCH_STATUS_SUCCESS; diff --git a/src/switch_event.c b/src/switch_event.c index 68c8955650..31a31e5b1e 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -170,6 +170,8 @@ static char *EVENT_NAMES[] = { "GENERAL", "COMMAND", "SESSION_HEARTBEAT", + "CLIENT_DISCONNECTED", + "SERVER_DISCONNECTED", "ALL" }; @@ -589,7 +591,8 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_event_create_subclass(switch_event_t **event, switch_event_types_t event_id, const char *subclass_name) +SWITCH_DECLARE(switch_status_t) switch_event_create_subclass_detailed(const char *file, const char *func, int line, + switch_event_t **event, switch_event_types_t event_id, const char *subclass_name) { void *pop; @@ -610,6 +613,8 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_subclass(switch_event_t **ev (*event)->event_id = event_id; + switch_event_prep_for_delivery_detailed(file, func, line, *event); + if (subclass_name) { (*event)->subclass_name = DUP(subclass_name); switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Subclass", subclass_name); @@ -1054,13 +1059,37 @@ SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const ch return xml; } -SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, const char *func, int line, switch_event_t **event, void *user_data) +SWITCH_DECLARE(void) switch_event_prep_for_delivery_detailed(const char *file, const char *func, int line, switch_event_t *event) { switch_time_exp_t tm; char date[80] = ""; switch_size_t retsize; switch_time_t ts = switch_micro_time_now(); + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Name", switch_event_name(event->event_id)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Core-UUID", switch_core_get_uuid()); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Hostname", hostname); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-IPv4", guess_ip_v4); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-IPv6", guess_ip_v6); + + switch_time_exp_lt(&tm, ts); + switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Date-Local", date); + switch_rfc822_date(date, ts); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Date-GMT", date); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Date-Timestamp", "%" SWITCH_UINT64_T_FMT, (uint64_t) ts); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Calling-File", switch_cut_path(file)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Calling-Function", func); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Calling-Line-Number", "%d", line); + + +} + +SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, const char *func, int line, switch_event_t **event, void *user_data) +{ + + switch_assert(BLOCK != NULL); switch_assert(RUNTIME_POOL != NULL); switch_assert(EVENT_QUEUE_MUTEX != NULL); @@ -1072,22 +1101,6 @@ SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, con return SWITCH_STATUS_SUCCESS; } - switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Name", switch_event_name((*event)->event_id)); - switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Core-UUID", switch_core_get_uuid()); - switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Hostname", hostname); - switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "FreeSWITCH-IPv4", guess_ip_v4); - switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "FreeSWITCH-IPv6", guess_ip_v6); - - switch_time_exp_lt(&tm, ts); - switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); - switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Date-Local", date); - switch_rfc822_date(date, ts); - switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Date-GMT", date); - switch_event_add_header(*event, SWITCH_STACK_BOTTOM, "Event-Date-Timestamp", "%" SWITCH_UINT64_T_FMT, (uint64_t) ts); - switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Calling-File", switch_cut_path(file)); - switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Calling-Function", func); - switch_event_add_header(*event, SWITCH_STACK_BOTTOM, "Event-Calling-Line-Number", "%d", line); - if (user_data) { (*event)->event_user_data = user_data; } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 239e81c36f..a841796a42 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -248,7 +248,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, if (args->input_callback) { switch_event_t *event = NULL; - if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen); switch_event_destroy(&event); } @@ -783,7 +783,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, } } - if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { if (args && args->input_callback) { if ((status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { break; @@ -853,7 +853,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); } - if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen); switch_event_destroy(&event); } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 0c8852be35..69923f8367 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -126,7 +126,7 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, swi if (args->input_callback) { switch_event_t *event = NULL; - if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen); switch_event_destroy(&event); } @@ -692,7 +692,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session goto end; } - if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { char *command = switch_event_get_header(event, "eavesdrop-command"); if (command) { fcommand = command; diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index ba8deaea46..865e0e9446 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -279,7 +279,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) } } - if (switch_core_session_dequeue_event(session_a, &event) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_dequeue_event(session_a, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { if (input_callback) { status = input_callback(session_a, event, SWITCH_INPUT_TYPE_EVENT, user_data, 0); } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 9185caa4ad..a4e47bfbf4 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -575,7 +575,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se if (args->input_callback) { switch_event_t *event = NULL; - if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen); switch_event_destroy(&event); } @@ -742,7 +742,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi if (args->input_callback) { switch_event_t *event; - if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen); switch_event_destroy(&event); } @@ -1070,7 +1070,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess if (args->input_callback) { switch_event_t *event; - if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen); switch_event_destroy(&event); } @@ -1715,7 +1715,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session } if (args->input_callback) { - if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen); switch_event_destroy(&event); }