[asterisk-commits] file: trunk r400511 - in /trunk: ./ res/res_pjsip_session.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 4 09:55:24 CDT 2013


Author: file
Date: Fri Oct  4 09:55:22 2013
New Revision: 400511

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400511
Log:
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

Modified:
    trunk/   (props changed)
    trunk/res/res_pjsip_session.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/res/res_pjsip_session.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_session.c?view=diff&rev=400511&r1=400510&r2=400511
==============================================================================
--- trunk/res/res_pjsip_session.c (original)
+++ trunk/res/res_pjsip_session.c Fri Oct  4 09:55:22 2013
@@ -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 @@
 
 	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];




More information about the asterisk-commits mailing list