From: Anthony Minessale Date: Tue, 24 Mar 2009 18:01:58 +0000 (+0000) Subject: change blocking: true to async: true you can start with blocking and go async but... X-Git-Tag: v1.0.4~1392 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67984e765c165fbce761aaedbea0e372b7c6678e;p=thirdparty%2Ffreeswitch.git change blocking: true to async: true you can start with blocking and go async but not the other way around git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12759 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- 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 3be8f10d5c..d7ecbd39aa 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 @@ -1575,7 +1575,13 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even if (!strncasecmp(cmd, "sendmsg", 7)) { switch_core_session_t *session; char *uuid = cmd + 7; - + const char *async_var = switch_event_get_header(*event, "async"); + int async = switch_test_flag(listener, LFLAG_ASYNC); + + if (switch_true(async_var)) { + async = 1; + } + if (uuid) { while (*uuid == ' ') { uuid++; @@ -1592,14 +1598,11 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even uuid = switch_event_get_header(*event, "session-id"); } - if (switch_strlen_zero(uuid) && listener->session) { - const char *blocking = switch_event_get_header(*event, "blocking"); - int async = switch_test_flag(listener, LFLAG_ASYNC); - - if (blocking && switch_true(blocking)) { - async = 0; - } + if (uuid && listener->session && !strcmp(uuid, switch_core_session_get_uuid(listener->session))) { + uuid = NULL; + } + if (switch_strlen_zero(uuid) && listener->session) { if (async) { if ((status = switch_core_session_queue_private_event(listener->session, event)) == SWITCH_STATUS_SUCCESS) { switch_snprintf(reply, reply_len, "+OK");