[asterisk-commits] file: branch file/pimp_sip_nat r382338 - in /team/file/pimp_sip_nat: include/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 1 08:44:10 CST 2013


Author: file
Date: Fri Mar  1 08:44:07 2013
New Revision: 382338

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382338
Log:
Add media address rewriting to res_sip_nat.

Modified:
    team/file/pimp_sip_nat/include/asterisk/res_sip.h
    team/file/pimp_sip_nat/res/res_sip/config_transport.c
    team/file/pimp_sip_nat/res/res_sip_nat.c

Modified: team/file/pimp_sip_nat/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_nat/include/asterisk/res_sip.h?view=diff&rev=382338&r1=382337&r2=382338
==============================================================================
--- team/file/pimp_sip_nat/include/asterisk/res_sip.h (original)
+++ team/file/pimp_sip_nat/include/asterisk/res_sip.h Fri Mar  1 08:44:07 2013
@@ -95,6 +95,8 @@
 		AST_STRING_FIELD(password);
 		/*! External signaling address */
 		AST_STRING_FIELD(external_signaling_address);
+		/*! External media address */
+		AST_STRING_FIELD(external_media_address);
 		);
 	/*! Type of transport */
 	enum ast_sip_transport_type type;

Modified: team/file/pimp_sip_nat/res/res_sip/config_transport.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_nat/res/res_sip/config_transport.c?view=diff&rev=382338&r1=382337&r2=382338
==============================================================================
--- team/file/pimp_sip_nat/res/res_sip/config_transport.c (original)
+++ team/file/pimp_sip_nat/res/res_sip/config_transport.c Fri Mar  1 08:44:07 2013
@@ -289,6 +289,7 @@
 	ast_sorcery_object_field_register(sorcery, "transport", "password", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_transport, password));
 	ast_sorcery_object_field_register(sorcery, "transport", "external_signaling_address", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_transport, external_signaling_address));
 	ast_sorcery_object_field_register(sorcery, "transport", "external_signaling_port", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_transport, external_signaling_port));
+	ast_sorcery_object_field_register(sorcery, "transport", "external_media_address", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_transport, external_media_address));
 	ast_sorcery_object_field_register_custom(sorcery, "transport", "verify_server", "", transport_tls_bool_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register_custom(sorcery, "transport", "verify_client", "", transport_tls_bool_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register_custom(sorcery, "transport", "require_client_cert", "", transport_tls_bool_handler, NULL, 0, 0);

Modified: team/file/pimp_sip_nat/res/res_sip_nat.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_nat/res/res_sip_nat.c?view=diff&rev=382338&r1=382337&r2=382338
==============================================================================
--- team/file/pimp_sip_nat/res/res_sip_nat.c (original)
+++ team/file/pimp_sip_nat/res/res_sip_nat.c Fri Mar  1 08:44:07 2013
@@ -175,6 +175,21 @@
 		}
 	}
 
+	/* Update the SDP if relevant */
+	if (tdata->msg->body && !pj_strcmp2(&tdata->msg->body->content_type.type, "application") &&
+		!pj_strcmp2(&tdata->msg->body->content_type.subtype, "sdp") && !ast_strlen_zero(transport->external_media_address)) {
+		struct pjmedia_sdp_session *sdp = tdata->msg->body->data;
+		int stream;
+
+		if (sdp->conn) {
+			pj_strdup2(tdata->pool, &sdp->conn->addr, transport->external_media_address);
+		}
+
+		for (stream = 0; stream < sdp->media_count; ++stream) {
+			pj_strdup2(tdata->pool, &sdp->media[stream]->conn->addr, transport->external_media_address);
+		}
+	}
+
 	return PJ_SUCCESS;
 }
 




More information about the asterisk-commits mailing list