Tweak some stuff, make the registered process name an atom, return baduuid if the requested uuid isn't found

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11395 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Andrew Thompson 2009-01-22 21:20:36 +00:00
parent 092ff4058a
commit 2b348e7ff3
2 changed files with 6 additions and 9 deletions

View File

@ -167,7 +167,7 @@ switch_status_t initialise_ei(struct ei_cnode_s *ec)
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ei initialized at %s\n", thisnodename); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ei initialized node at %s\n", thisnodename);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }

View File

@ -523,28 +523,25 @@ static switch_status_t handle_msg_handlecall(listener_t *listener, int arity, ei
if (arity != 3 || if (arity != 3 ||
ei_decode_string(buf->buff, &buf->index, uuid_str) || ei_decode_string(buf->buff, &buf->index, uuid_str) ||
ei_decode_string(buf->buff, &buf->index, reg_name)) { ei_decode_atom(buf->buff, &buf->index, reg_name)) {
ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_tuple_header(rbuf, 2);
ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "error");
ei_x_encode_atom(rbuf, "badarg"); ei_x_encode_atom(rbuf, "badarg");
} } else {
else {
switch_core_session_t *session; switch_core_session_t *session;
if (!switch_strlen_zero(uuid_str) && (session = switch_core_session_locate(uuid_str))) { if (!switch_strlen_zero(uuid_str) && (session = switch_core_session_locate(uuid_str))) {
/* create a new sesion list element and attach it to this listener */ /* create a new sesion list element and attach it to this listener */
if (attach_call_to_listener(listener,reg_name,session)) { if (attach_call_to_listener(listener,reg_name,session)) {
ei_x_encode_atom(rbuf, "ok"); ei_x_encode_atom(rbuf, "ok");
} } else {
else {
ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_tuple_header(rbuf, 2);
ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "error");
ei_x_encode_atom(rbuf, "badsession"); ei_x_encode_atom(rbuf, "badsession");
} }
} } else {
else {
ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_tuple_header(rbuf, 2);
ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "error");
ei_x_encode_atom(rbuf, "badarg"); ei_x_encode_atom(rbuf, "baduuid");
} }
} }
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;