From 240ca25bea82ebc70c6c291ecbccb7aecdc38180 Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Thu, 11 Jan 2007 05:19:39 +0000 Subject: [PATCH] Add support to see whether NAT was detected (yay symmetric RTP) and also add a check in chan_sip so that if NAT has been detected and the reinvite behind nat option has been turned off, then just do partial bridge. (issue #8655 reported by mnicholson) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@50466 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 4 +++- include/asterisk/rtp.h | 2 ++ main/rtp.c | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 9377964068..be0228d393 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -16656,7 +16656,9 @@ static enum ast_rtp_get_result sip_get_rtp_peer(struct ast_channel *chan, struct *rtp = p->rtp; - if (ast_test_flag(&p->flags[0], SIP_CAN_REINVITE)) + if (ast_rtp_getnat(*rtp) && !ast_test_flag(&p->flags[0], SIP_CAN_REINVITE_NAT)) + res = AST_RTP_TRY_PARTIAL; + else if (ast_test_flag(&p->flags[0], SIP_CAN_REINVITE)) res = AST_RTP_TRY_NATIVE; else if (ast_test_flag(&global_jbconf, AST_JB_FORCED)) res = AST_RTP_GET_FAILED; diff --git a/include/asterisk/rtp.h b/include/asterisk/rtp.h index f6f26e942b..501068987b 100644 --- a/include/asterisk/rtp.h +++ b/include/asterisk/rtp.h @@ -180,6 +180,8 @@ char *ast_rtp_lookup_mime_multiple(char *buf, size_t size, const int capability, void ast_rtp_setnat(struct ast_rtp *rtp, int nat); +int ast_rtp_getnat(struct ast_rtp *rtp); + /*! \brief Indicate whether this RTP session is carrying DTMF or not */ void ast_rtp_setdtmf(struct ast_rtp *rtp, int dtmf); diff --git a/main/rtp.c b/main/rtp.c index e7795af639..c1285654d8 100644 --- a/main/rtp.c +++ b/main/rtp.c @@ -591,6 +591,11 @@ void ast_rtp_setnat(struct ast_rtp *rtp, int nat) rtp->nat = nat; } +int ast_rtp_getnat(struct ast_rtp *rtp) +{ + return ast_test_flag(rtp, FLAG_NAT_ACTIVE); +} + void ast_rtp_setdtmf(struct ast_rtp *rtp, int dtmf) { ast_set2_flag(rtp, dtmf ? 1 : 0, FLAG_HAS_DTMF);