From f55f15c888aa5f7531516311b8b321198bd6993d Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sun, 15 Jul 2012 12:44:26 +0800 Subject: [PATCH] accept binary in api and bgapi --- src/mod/event_handlers/mod_erlang_event/handle_msg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index e6d0d7a5f9..618b7eb829 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -634,7 +634,7 @@ static switch_status_t handle_msg_api(listener_t *listener, erlang_msg * msg, in ei_get_type(buf->buff, &buf->index, &type, &size); arg = malloc(size + 1); - if (ei_decode_string(buf->buff, &buf->index, arg)) { + if (ei_decode_string_or_binary(buf->buff, &buf->index, size, arg)) { fail = SWITCH_TRUE; } @@ -664,7 +664,7 @@ static switch_status_t handle_msg_bgapi(listener_t *listener, erlang_msg * msg, { char api_cmd[MAXATOMLEN]; char arg[1024]; - if (arity < 3 || ei_decode_atom(buf->buff, &buf->index, api_cmd) || ei_decode_string(buf->buff, &buf->index, arg)) { + if (arity < 3 || ei_decode_atom(buf->buff, &buf->index, api_cmd) || ei_decode_string_or_binary(buf->buff, &buf->index, 1023, arg)) { ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "badarg");