diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 2707f0ca07cbfe28c62ed0aaa0b47a23bda8dbd9..010a4085de0daf202eef2e3d5968674e569fa24b 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -16894,7 +16894,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 2edff8cadbcdc8437659ce8d7121cfd005c152aa..85f3b19030c709873b6fb6ee12467b66cddae677 100644 --- a/include/asterisk/rtp.h +++ b/include/asterisk/rtp.h @@ -186,6 +186,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 b4c37087d9d90a6f9210ed9756067c358c01a755..e80cb3ead7a7f4f21f3e03a48d40e2c7234537fa 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);