mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 20:50:41 +00:00
merge patch from MODEVENT-16
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7749 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
2cdafeeba1
commit
bcae062ac8
@ -195,7 +195,7 @@ static void event_handler(switch_event_t *event)
|
|||||||
|
|
||||||
SWITCH_STANDARD_APP(socket_function)
|
SWITCH_STANDARD_APP(socket_function)
|
||||||
{
|
{
|
||||||
char *host, *port_name;
|
char *host, *port_name, *path;
|
||||||
switch_socket_t *new_sock;
|
switch_socket_t *new_sock;
|
||||||
switch_sockaddr_t *sa;
|
switch_sockaddr_t *sa;
|
||||||
switch_port_t port = 8084;
|
switch_port_t port = 8084;
|
||||||
@ -203,6 +203,9 @@ SWITCH_STANDARD_APP(socket_function)
|
|||||||
int argc = 0, x = 0;
|
int argc = 0, x = 0;
|
||||||
char *argv[80] = { 0 };
|
char *argv[80] = { 0 };
|
||||||
char *mydata;
|
char *mydata;
|
||||||
|
switch_channel_t *channel = NULL;
|
||||||
|
|
||||||
|
channel = switch_core_session_get_channel(session);
|
||||||
|
|
||||||
if (data && (mydata = switch_core_session_strdup(session, data))) {
|
if (data && (mydata = switch_core_session_strdup(session, data))) {
|
||||||
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||||
@ -220,11 +223,18 @@ SWITCH_STANDARD_APP(socket_function)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch_channel_set_variable(channel, "socket_host", host);
|
||||||
|
|
||||||
if ((port_name = strchr(host, ':'))) {
|
if ((port_name = strchr(host, ':'))) {
|
||||||
*port_name++ = '\0';
|
*port_name++ = '\0';
|
||||||
port = (switch_port_t) atoi(port_name);
|
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) {
|
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");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error!\n");
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user