[asterisk-commits] file: branch 1.4 r118646 - in /branches/1.4: ./ channels/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 28 09:23:35 CDT 2008


Author: file
Date: Wed May 28 09:23:34 2008
New Revision: 118646

URL: http://svn.digium.com/view/asterisk?view=rev&rev=118646
Log:
Add an option to use the source IP address of RTP as the destination IP address of UDPTL when a specific option is enabled. If the remote side is properly configured (ports forwarded) then UDPTL will flow.
(closes issue #10417)
Reported by: cstadlmann

Modified:
    branches/1.4/CHANGES
    branches/1.4/channels/chan_sip.c
    branches/1.4/configs/sip.conf.sample

Modified: branches/1.4/CHANGES
URL: http://svn.digium.com/view/asterisk/branches/1.4/CHANGES?view=diff&rev=118646&r1=118645&r2=118646
==============================================================================
--- branches/1.4/CHANGES (original)
+++ branches/1.4/CHANGES Wed May 28 09:23:34 2008
@@ -306,6 +306,7 @@
                       o canreinvite variable can also now be set to 'nonat'
                       o rtsavesysname variable added
                       o JitterBuffer support added
+                      o t38pt_usertpsource variable added
               23. skinny.conf
                       o port variable renamed to bindport
                       o JitterBuffer support added

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=118646&r1=118645&r2=118646
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Wed May 28 09:23:34 2008
@@ -795,10 +795,11 @@
 #define SIP_PAGE2_RFC2833_COMPENSATE    (1 << 25)	/*!< 25: ???? */
 #define SIP_PAGE2_BUGGY_MWI		(1 << 26)	/*!< 26: Buggy CISCO MWI fix */
 #define SIP_PAGE2_OUTGOING_CALL         (1 << 27)       /*!< 27: Is this an outgoing call? */
+#define SIP_PAGE2_UDPTL_DESTINATION     (1 << 28)       /*!< 28: Use source IP of RTP as destination if NAT is enabled */
 
 #define SIP_PAGE2_FLAGS_TO_COPY \
 	(SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_VIDEOSUPPORT | \
-	SIP_PAGE2_T38SUPPORT | SIP_PAGE2_RFC2833_COMPENSATE | SIP_PAGE2_BUGGY_MWI)
+	SIP_PAGE2_T38SUPPORT | SIP_PAGE2_RFC2833_COMPENSATE | SIP_PAGE2_BUGGY_MWI | SIP_PAGE2_UDPTL_DESTINATION)
 
 /* SIP packet flags */
 #define SIP_PKT_DEBUG		(1 << 0)	/*!< Debug this packet */
@@ -5203,6 +5204,16 @@
 	if (p->udptl) {
 		if (udptlportno > 0) {
 			sin.sin_port = htons(udptlportno);
+			if (ast_test_flag(&p->flags[0], SIP_NAT) && ast_test_flag(&p->flags[1], SIP_PAGE2_UDPTL_DESTINATION)) {
+				struct sockaddr_in peer;
+				ast_rtp_get_peer(p->rtp, &peer);
+				if (peer.sin_addr.s_addr) {
+					memcpy(&sin.sin_addr, &peer.sin_addr, sizeof(&sin.sin_addr));
+					if (debug) {
+						ast_log(LOG_DEBUG, "Peer T.38 UDPTL is set behind NAT and with destination, destination address now %s\n", ast_inet_ntoa(sin.sin_addr));
+					}
+				}
+			}
 			ast_udptl_set_peer(p->udptl, &sin);
 			if (debug)
 				ast_log(LOG_DEBUG,"Peer T.38 UDPTL is at port %s:%d\n",ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
@@ -16294,6 +16305,9 @@
 	} else if (!strcasecmp(v->name, "buggymwi")) {
 		ast_set_flag(&mask[1], SIP_PAGE2_BUGGY_MWI);
 		ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_BUGGY_MWI);
+	} else if (!strcasecmp(v->name, "t38pt_usertpsource")) {
+		ast_set_flag(&mask[1], SIP_PAGE2_UDPTL_DESTINATION);
+		ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_UDPTL_DESTINATION);
 	} else
 		res = 0;
 

Modified: branches/1.4/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/branches/1.4/configs/sip.conf.sample?view=diff&rev=118646&r1=118645&r2=118646
==============================================================================
--- branches/1.4/configs/sip.conf.sample (original)
+++ branches/1.4/configs/sip.conf.sample Wed May 28 09:23:34 2008
@@ -484,7 +484,7 @@
 ; videosupport		      videosupport
 ; maxcallbitrate	      maxcallbitrate
 ; rfc2833compensate           mailbox
-;                             username
+; t38pt_usertpsource          username
 ;                             template
 ;                             fromdomain
 ;                             regexten
@@ -498,6 +498,7 @@
 ;                             sendrpid
 ;                             outboundproxy
 ;                             rfc2833compensate
+;                             t38pt_usertpsource
 
 ;[sip_proxy]
 ; For incoming calls only. Example: FWD (Free World Dialup)
@@ -662,3 +663,7 @@
 ;host=dynamic
 ;rfc2833compensate=yes		; Compensate for pre-1.4 DTMF transmission from another Asterisk machine.
 				; You must have this turned on or DTMF reception will work improperly.
+;t38pt_usertpsource=yes         ; Use the source IP address of RTP as the destination IP address for UDPTL packets
+                                ; if the nat option is enabled. If a single RTP packet is received Asterisk will know the
+                                ; external IP address of the remote device. If port forwarding is done at the client side
+                                ; then UDPTL will flow to the remote device.




More information about the asterisk-commits mailing list