[commit] r7749 - freeswitch/trunk/src/mod/event_handlers/mod_event_socket
Author: mikej Date: Tue Feb 26 16:53:48 2008 New Revision: 7749 Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Log: merge patch from MODEVENT-16 Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Tue Feb 26 16:53:48 2008 @@ -195,7 +195,7 @@ SWITCH_STANDARD_APP(socket_function) { - char *host, *port_name; + char *host, *port_name, *path; switch_socket_t *new_sock; switch_sockaddr_t *sa; switch_port_t port = 8084; @@ -203,6 +203,9 @@ int argc = 0, x = 0; char *argv[80] = { 0 }; char *mydata; + switch_channel_t *channel = NULL; + + channel = switch_core_session_get_channel(session); if (data && (mydata = switch_core_session_strdup(session, data))) { argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); @@ -220,11 +223,18 @@ return; } + switch_channel_set_variable(channel, "socket_host", host); + if ((port_name = strchr(host, ':'))) { *port_name++ = '\0'; port = (switch_port_t) atoi(port_name); } + if ((path = strchr(port_name, '/'))) { + *path++ = '\0'; + switch_channel_set_variable(channel, "socket_path", path); + } + if (switch_sockaddr_info_get(&sa, host, AF_INET, port, 0, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error!\n"); return;
participants (1)
-
Freeswitch SVN