From: Alexander Traud Date: Tue, 11 Oct 2016 11:55:13 +0000 (+0200) Subject: chan_sip: Support nat=auto_comedia or nat=force_rport,auto_comedia. X-Git-Tag: 11.25.0-rc1~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68c8373a0e3aa12110bc6527fe980ed26c95a0df;p=thirdparty%2Fasterisk.git chan_sip: Support nat=auto_comedia or nat=force_rport,auto_comedia. In the SIP channel driver chan_sip, auto_comedia was expected to be used in tandem with auto_force_rport. Or stated differently: Only when auto_force_rport was chosen (the default), auto_comedia worked. This change allows auto_comedia to be set independently of the state of (auto_)force_rport. For example, nat=force_rport,auto_comedia is useful for IPv4/IPv6 Dual Stack deployments when IPv6 clients are behind a Firewall. ASTERISK-26457 #close Change-Id: Ib29d66c6dbb61648e371e01fc36c6978ddae5bc2 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 556db57eef..260a6bd78a 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -30211,9 +30211,10 @@ static struct ast_channel *sip_request_call(const char *type, struct ast_format_ if (p->relatedpeer) { if (!ast_strlen_zero(p->relatedpeer->fullcontact) && !p->natdetected && - (ast_test_flag(&p->flags[2], SIP_PAGE3_NAT_AUTO_RPORT) && !ast_test_flag(&p->flags[0], SIP_NAT_FORCE_RPORT))) { + ((ast_test_flag(&p->flags[2], SIP_PAGE3_NAT_AUTO_RPORT) && !ast_test_flag(&p->flags[0], SIP_NAT_FORCE_RPORT)) || + (ast_test_flag(&p->flags[2], SIP_PAGE3_NAT_AUTO_COMEDIA) && !ast_test_flag(&p->flags[1], SIP_PAGE2_SYMMETRICRTP)))) { /* We need to make an attempt to determine if a peer is behind NAT - if the peer has the auto_force_rport flag set. */ + if the peer has the flags auto_force_rport or auto_comedia set. */ struct ast_sockaddr tmpaddr; __set_address_from_contact(p->relatedpeer->fullcontact, &tmpaddr, 0);