Skinny: don't crash when requesting an RTP port while the profile is listening on all ips
And store some more ip infos in the listener struct
This commit is contained in:
parent
e318e3eb91
commit
0f7682a27c
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue