Browse Source

TT#112250 don't change ports when endpoint is talking ICE

Change-Id: I0e60534d6d3cb62d25b8d865da02c3472cf0994e
(cherry picked from commit eb1157d386)
(cherry picked from commit eb2e42fd60)
mr9.1.1
Richard Fuchs 5 years ago
parent
commit
c350c0a416
4 changed files with 29 additions and 16 deletions
  1. +7
    -0
      README.md
  2. +18
    -16
      daemon/call.c
  3. +3
    -0
      daemon/call_interfaces.c
  4. +1
    -0
      include/call_interfaces.h

+ 7
- 0
README.md View File

@ -697,6 +697,13 @@ Optionally included keys are:
Forces *rtpengine* to retain its local ports during a signalling exchange even when the
remote endpoint changes its port.
- `no port latching`
Port latching is enabled by default for endpoints which speak
ICE. With this option preset, a remote port change will result
in a local port change even for endpoints which speak ICE,
which will imply an ICE restart.
- `record call`
Identical to setting `record call` to `on` (see below).


+ 18
- 16
daemon/call.c View File

@ -824,6 +824,8 @@ static struct endpoint_map *__get_endpoint_map(struct call_media *media, unsigne
if (flags && flags->port_latching)
/* do nothing - ignore endpoint addresses */ ;
else if (MEDIA_ISSET(media, ICE) && (!flags || !flags->no_port_latching))
; // don't change endpoint address if we're talking ICE
else if (is_addr_unspecified(&ep->address) || is_addr_unspecified(&em->endpoint.address)) {
/* handle zero endpoint address: only compare ports */
if (ep->port != em->endpoint.port)
@ -885,23 +887,22 @@ next_il:
}
static void __assign_stream_fds(struct call_media *media, GQueue *intf_sfds) {
GList *l, *k;
struct packet_stream *ps;
struct stream_fd *sfd, *intf_sfd;
struct intf_list *il;
int sfd_found;
int reset_ice = 0;
for (GList *k = media->streams.head; k; k = k->next) {
struct packet_stream *ps = k->data;
for (k = media->streams.head; k; k = k->next) {
ps = k->data;
// use opaque pointer to detect changes
void *old_selected_sfd = ps->selected_sfd;
g_queue_clear(&ps->sfds);
sfd_found = 0;
intf_sfd = NULL;
int sfd_found = 0;
struct stream_fd *intf_sfd = NULL;
for (l = intf_sfds->head; l; l = l->next) {
il = l->data;
for (GList *l = intf_sfds->head; l; l = l->next) {
struct intf_list *il = l->data;
sfd = g_queue_peek_nth(&il->list, ps->component - 1);
struct stream_fd *sfd = g_queue_peek_nth(&il->list, ps->component - 1);
if (!sfd) return ;
sfd->stream = ps;
@ -920,11 +921,12 @@ static void __assign_stream_fds(struct call_media *media, GQueue *intf_sfds) {
ps->selected_sfd = g_queue_peek_nth(&ps->sfds, 0);
}
/* XXX:
* handle crypto/dtls resets by moving contexts into sfd struct.
* handle ice resets too.
*/
if (old_selected_sfd && ps->selected_sfd && old_selected_sfd != ps->selected_sfd)
reset_ice = 1;
}
if (reset_ice && media->ice_agent)
ice_restart(media->ice_agent);
}
static int __wildcard_endpoint_map(struct call_media *media, unsigned int num_ports) {


+ 3
- 0
daemon/call_interfaces.c View File

@ -789,6 +789,9 @@ static void call_ng_flags_flags(struct sdp_ng_flags *out, str *s, void *dummy) {
case CSH_LOOKUP("port-latching"):
out->port_latching = 1;
break;
case CSH_LOOKUP("no-port-latching"):
out->no_port_latching = 1;
break;
case CSH_LOOKUP("generate-mid"):
out->generate_mid = 1;
break;


+ 1
- 0
include/call_interfaces.h View File

@ -60,6 +60,7 @@ struct sdp_ng_flags {
unidirectional:1,
trust_address:1,
port_latching:1,
no_port_latching:1,
replace_origin:1,
replace_sess_conn:1,
rtcp_mux_offer:1,


Loading…
Cancel
Save