diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-28 14:23:34 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-28 14:23:34 +0000 |
commit | 6c25f36eb75265c539ada426e2983d776564a964 (patch) | |
tree | 3e09ebb7ce4d3438b74d9fe38e2a57d063afacdd /channels | |
parent | 5e59974560358b3b765278732493a12557f10025 (diff) |
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.4@118646 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 2bd9f9523..f270d1f12 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -795,10 +795,11 @@ struct sip_auth { #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 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req) 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 @@ 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; |