Added support for MDCX to change RTP parameters in mgcpgw.

git-svn-id: http://voip.null.ro/svn/yate@4657 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2011-10-27 17:35:18 +00:00
parent 5e46a221a6
commit b0d9f745c0
2 changed files with 29 additions and 1 deletions

View File

@ -106,6 +106,10 @@
; This allows preserving the local RTP session and port
;ignore_sdp_port=no
; ignore_sdp_addr: bool: Ignore SDP changes if only the address is different
; This allows preserving the local RTP session and port
;ignore_sdp_addr=no
;[ep PUT_NAME_HERE]
; One ep ... section is required for each of our endpoints

View File

@ -124,6 +124,9 @@ static MGCPPlugin splugin;
static YMGCPEngine* s_engine = 0;
// preserve RTP session (local addr+port) even if remote address changed
static bool s_rtp_preserve = false;
// cluster and standby support
static bool s_cluster = false;
@ -428,6 +431,7 @@ bool MGCPChan::processEvent(MGCPTransaction* tr, MGCPMessage* mm)
if (param)
m_ntfyId = *param;
rqntParams(mm);
MimeSdpBody* sdp = 0;
if (m_isRtp) {
Message m("chan.rtp");
m.addParam("mgcp_allowed",String::boolText(false));
@ -441,7 +445,26 @@ bool MGCPChan::processEvent(MGCPTransaction* tr, MGCPMessage* mm)
m_rtpId = m.getValue(YSTRING("rtpid"),m_rtpId);
}
}
tr->setResponse(200,&params);
else {
sdp = static_cast<MimeSdpBody*>(mm->sdp[0]);
if (sdp) {
String addr;
ObjList* lst = splugin.parser().parse(sdp,addr);
sdp = 0;
if (lst) {
if (m_rtpAddr != addr) {
m_rtpAddr = addr;
Debug(this,DebugAll,"New RTP addr '%s'",m_rtpAddr.c_str());
// clear all data endpoints - createRtpSDP will build new ones
if (!s_rtp_preserve)
clearEndpoint();
}
setMedia(lst);
sdp = createRtpSDP(true);
}
}
}
tr->setResponse(200,&params,sdp);
return true;
}
if (mm->name() == YSTRING("AUCX")) {
@ -660,6 +683,7 @@ void MGCPPlugin::initialize()
}
m_parser.initialize(cfg.getSection("codecs"),cfg.getSection("hacks"),
cfg.getSection("general"));
s_rtp_preserve = cfg.getBoolValue("hacks","ignore_sdp_addr",false);
}
}; // anonymous namespace