Replace the connection address at the SDP level if altering the SDP with the external media address.

........

Merged revisions 400510 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400511 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp 2013-10-04 14:55:22 +00:00
parent d35b5c9cb0
commit 47da03e737
1 changed files with 13 additions and 0 deletions

View File

@ -42,6 +42,7 @@
#include "asterisk/causes.h"
#include "asterisk/sdp_srtp.h"
#include "asterisk/dsp.h"
#include "asterisk/acl.h"
#define SDP_HANDLER_BUCKETS 11
@ -2096,6 +2097,18 @@ static void session_outgoing_nat_hook(pjsip_tx_data *tdata, struct ast_sip_trans
sdp = tdata->msg->body->data;
if (sdp->conn) {
char host[NI_MAXHOST];
struct ast_sockaddr addr = { { 0, } };
ast_copy_pj_str(host, &sdp->conn->addr, sizeof(host));
ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID);
if (ast_apply_ha(transport->localnet, &addr) != AST_SENSE_ALLOW) {
pj_strdup2(tdata->pool, &sdp->conn->addr, transport->external_media_address);
}
}
for (stream = 0; stream < sdp->media_count; ++stream) {
/* See if there are registered handlers for this media stream type */
char media[20];