diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-28 14:31:42 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-28 14:31:42 +0000 |
commit | b4923983997f0523db2d033afec9a764e60b721b (patch) | |
tree | 2ad760c1b6ce8d2492b181c04fe3a2b97f473d40 | |
parent | 3c5514262c500043fe1965e2de70875d20f54b6b (diff) |
Merged revisions 118647 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r118647 | file | 2008-05-28 11:29:01 -0300 (Wed, 28 May 2008) | 12 lines
Merged revisions 118646 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r118646 | file | 2008-05-28 11:23:34 -0300 (Wed, 28 May 2008) | 4 lines
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
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@118648 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | channels/chan_sip.c | 16 | ||||
-rw-r--r-- | configs/sip.conf.sample | 20 |
3 files changed, 28 insertions, 9 deletions
@@ -151,6 +151,7 @@ SIP changes SIP session. * Added experimental TCP and TLS support for SIP. See doc/siptls.txt and configs/sip.conf.sample for more information on how it is used. + * Added t38pt_usertpsource option. See sip.conf.sample for details. IAX2 changes ------------ diff --git a/channels/chan_sip.c b/channels/chan_sip.c index a62eeaa35..b5bf007d3 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -987,11 +987,12 @@ struct sip_auth { #define SIP_PAGE2_RFC2833_COMPENSATE (1 << 25) /*!< DP: Compensate for buggy RFC2833 implementations */ #define SIP_PAGE2_BUGGY_MWI (1 << 26) /*!< DP: Buggy CISCO MWI fix */ #define SIP_PAGE2_REGISTERTRYING (1 << 29) /*!< DP: Send 100 Trying on REGISTER attempts */ +#define SIP_PAGE2_UDPTL_DESTINATION (1 << 30) /*!< DP: 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_TEXTSUPPORT ) + SIP_PAGE2_TEXTSUPPORT | SIP_PAGE2_UDPTL_DESTINATION) /*@}*/ @@ -6556,6 +6557,16 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action 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_debug(1, "Peer T.38 UDPTL is at port %s:%d\n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port)); @@ -19286,6 +19297,9 @@ static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask } 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; diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index 0d4f92e8e..da7c94cb3 100644 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -691,14 +691,14 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ; videosupport videosupport ; maxcallbitrate maxcallbitrate ; rfc2833compensate mailbox -; session-timers busylevel +; session-timers busylevel ; session-expires -; session-minse template -; session-refresher fromdomain -; regexten -; fromuser -; host -; port +; session-minse template +; session-refresher fromdomain +; t38pt_usertpsource regexten +; fromuser +; host +; port ; qualify ; defaultip ; defaultuser @@ -716,7 +716,7 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ; timert1 ; timerb ; qualifyfreq - +; t38pt_usertpsource ;[sip_proxy] ; For incoming calls only. Example: FWD (Free World Dialup) @@ -935,3 +935,7 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ;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. |