[asterisk-commits] file: branch 12 r400510 - /branches/12/res/res_pjsip_session.c

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


Author: file
Date: Fri Oct  4 09:54:32 2013
New Revision: 400510

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400510
Log:
Replace the connection address at the SDP level if altering the SDP with the external media address.

Modified:
    branches/12/res/res_pjsip_session.c

Modified: branches/12/res/res_pjsip_session.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_session.c?view=diff&rev=400510&r1=400509&r2=400510
==============================================================================
--- branches/12/res/res_pjsip_session.c (original)
+++ branches/12/res/res_pjsip_session.c Fri Oct  4 09:54:32 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