/*! \brief Returns null if we can't reinvite audio (part of RTP interface) */ static enum ast_rtp_get_result sip_get_rtp_peer(struct ast_channel *chan, struct ast_rtp **rtp) { struct sip_pvt *p = NULL; enum ast_rtp_get_result res = AST_RTP_TRY_PARTIAL; if (!(p = chan->tech_pvt)) { ast_log(LOG_NOTICE, "HIT: !(p = chan->tech_pvt)"); return AST_RTP_GET_FAILED; } /* PATCH TEST FROM Asterisk Admin FILE - BUG ID 0010647 */ /* Disable early RTP bridge */ if (chan->_state != AST_STATE_UP && !global_directrtpsetup) { ast_log(LOG_NOTICE, "HIT: chan->_state != AST_STATE_UP && !global_directrtpsetup"); return AST_RTP_GET_FAILED; } /* END New Patch Test */ ast_mutex_lock(&p->lock); if (!(p->rtp)) { ast_log(LOG_NOTICE, "HIT: !(p->rtp)"); ast_mutex_unlock(&p->lock); return AST_RTP_GET_FAILED; } *rtp = p->rtp; if (ast_rtp_getnat(*rtp) && !ast_test_flag(&p->flags[0], SIP_CAN_REINVITE_NAT)) { ast_log(LOG_NOTICE, "HIT: 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)) { ast_log(LOG_NOTICE, "HIT: ast_test_flag(&p->flags[0], SIP_CAN_REINVITE"); res = AST_RTP_TRY_NATIVE; } else if (ast_test_flag(&global_jbconf, AST_JB_FORCED)) { ast_log(LOG_NOTICE, "HIT: (ast_test_flag(&global_jbconf, AST_JB_FORCED)"); res = AST_RTP_GET_FAILED; } ast_mutex_unlock(&p->lock); return res; }