diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 071e8c54d8..32b4ef8fa2 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1598,9 +1598,14 @@ new_socket: switch_mutex_init(&listener->flag_mutex, SWITCH_MUTEX_NESTED, listener->pool); - switch_socket_addr_get(&listener->sa, SWITCH_TRUE, listener->sock); - switch_get_addr(listener->remote_ip, sizeof(listener->remote_ip), listener->sa); - listener->remote_port = switch_sockaddr_get_port(listener->sa); + switch_socket_addr_get(&listener->remote_sa, SWITCH_TRUE, listener->sock); + switch_get_addr(listener->remote_ip, sizeof(listener->remote_ip), listener->remote_sa); + listener->remote_port = switch_sockaddr_get_port(listener->remote_sa); + + switch_socket_addr_get(&listener->local_sa, SWITCH_FALSE, listener->sock); + switch_get_addr(listener->local_ip, sizeof(listener->local_ip), listener->local_sa); + listener->local_port = switch_sockaddr_get_port(listener->local_sa); + launch_listener_thread(listener); } diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index 20d68faba5..bf59c673e6 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -143,11 +143,14 @@ struct listener { switch_socket_t *sock; switch_memory_pool_t *pool; switch_thread_rwlock_t *rwlock; - switch_sockaddr_t *sa; + switch_sockaddr_t *remote_sa; char remote_ip[50]; + switch_port_t remote_port; + switch_sockaddr_t *local_sa; + char local_ip[50]; + switch_port_t local_port; switch_mutex_t *flag_mutex; uint32_t flags; - switch_port_t remote_port; uint32_t id; time_t expire_time; struct listener *next; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 538100359f..0aafb9859d 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1660,12 +1660,12 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste goto end; } + tech_pvt->local_sdp_audio_ip = listener->local_ip; /* Request a local port from the core's allocator */ - if (!(tech_pvt->local_sdp_audio_port = switch_rtp_request_port(listener->profile->ip))) { + if (!(tech_pvt->local_sdp_audio_port = switch_rtp_request_port(tech_pvt->local_sdp_audio_ip))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_CRIT, "No RTP ports available!\n"); return SWITCH_STATUS_FALSE; } - tech_pvt->local_sdp_audio_ip = switch_core_strdup(switch_core_session_get_pool(session), listener->profile->ip); tech_pvt->remote_sdp_audio_ip = inet_ntoa(request->data.open_receive_channel_ack.ip); tech_pvt->remote_sdp_audio_port = request->data.open_receive_channel_ack.port;