From a57f429267e6c2d3e29180f35b0527daeb6d2caa Mon Sep 17 00:00:00 2001 From: paulc Date: Fri, 15 Apr 2011 14:16:32 +0000 Subject: [PATCH] Allow embedding the notification request in the CRCX message. git-svn-id: http://voip.null.ro/svn/yate@4300 acf43c95-373e-0410-b603-e72c3f656dc1 --- conf.d/mgcpca.conf.sample | 4 ++++ modules/server/mgcpca.cpp | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/conf.d/mgcpca.conf.sample b/conf.d/mgcpca.conf.sample index 85c32b77..63624525 100644 --- a/conf.d/mgcpca.conf.sample +++ b/conf.d/mgcpca.conf.sample @@ -201,6 +201,10 @@ ; more - emit RQNT on connection and after each notification received ;req_dtmf=once +; req_embed: boolean: Embed Request Notify in the CRCX message +; This setting applies only to digital gateways, not FXS or FXO +;req_embed=yes + ; forward_rtp: bool: Support to forward RTP directly to protocols that support it ; The actual direct RTP forwarding is still negotiated in routing ;forward_rtp=yes for digital gateways, no for analogic diff --git a/modules/server/mgcpca.cpp b/modules/server/mgcpca.cpp index a0e1163a..ca9c47be 100644 --- a/modules/server/mgcpca.cpp +++ b/modules/server/mgcpca.cpp @@ -134,6 +134,8 @@ public: { return m_fxo; } inline bool fxs() const { return m_fxs; } + inline bool rqntEmbed() const + { return m_rqntEmbed; } inline RqntType rqntType() const { return m_rqntType; } inline const char* rqntStr() const @@ -161,6 +163,7 @@ private: bool m_sdpForward; bool m_fxo; bool m_fxs; + bool m_rqntEmbed; RqntType m_rqntType; String m_rqntStr; String m_notify; @@ -869,7 +872,8 @@ MGCPSpan::MGCPSpan(const NamedList& params, const char* name, const MGCPEpInfo& : SignallingCircuitSpan(params.getValue("debugname",name), static_cast(params.getObject("SignallingCircuitGroup"))), m_circuits(0), m_count(0), m_epId(ep), m_operational(false), - m_rtpForward(false), m_sdpForward(false), m_fxo(false), m_fxs(false) + m_rtpForward(false), m_sdpForward(false), m_fxo(false), m_fxs(false), + m_rqntEmbed(true), m_rqntType(RqntOnce) { Debug(&splugin,DebugAll,"MGCPSpan::MGCPSpan(%p,'%s') [%p]", ¶ms,name,this); @@ -967,6 +971,7 @@ bool MGCPSpan::init(const NamedList& params) m_rtpForward = config->getBoolValue("forward_rtp",!(m_fxo || m_fxs)); m_sdpForward = config->getBoolValue("forward_sdp",false); m_bearer = lookup(config->getIntValue("bearer",s_dict_payloads,-1),s_dict_gwbearerinfo); + m_rqntEmbed = config->getBoolValue("req_embed",true); m_rqntType = (RqntType)config->getIntValue("req_dtmf",s_dict_rqnt,RqntOnce); bool fax = config->getBoolValue("req_fax",true); bool t38 = config->getBoolValue("req_t38",fax); @@ -1321,6 +1326,11 @@ bool MGCPCircuit::setupConn(const char* mode) mm->params.addParam("C",m_callId); if (m_connId) mm->params.addParam("I",m_connId); + else if (mySpan()->rqntEmbed() && mySpan()->rqntStr() && + (mySpan()->rqntType() != MGCPSpan::RqntNone) && !(fxs() || fxo())) { + mm->params.addParam("X",m_notify); + mm->params.addParam("R",mySpan()->rqntStr()); + } if (m_gwFormatChanged && m_gwFormat) mm->params.addParam("B",m_gwFormat); if (mode) @@ -1522,7 +1532,7 @@ bool MGCPCircuit::status(Status newStat, bool sync) allowRtpChange = SignallingCircuit::status() == Connected && hasLocalRtp() && m_localRtpChanged; if (SignallingCircuit::status() != Connected) { - if (mySpan()->rqntType() != MGCPSpan::RqntNone && !(fxs() || fxo())) + if (mySpan()->rqntType() != MGCPSpan::RqntNone && !(fxs() || fxo() || mySpan()->rqntEmbed())) sendRequest(0,mySpan()->rqntStr()); sendPending(); }