diff --git a/conf.d/mgcpca.conf.sample b/conf.d/mgcpca.conf.sample index 1de4ddf2..fc3d58e0 100644 --- a/conf.d/mgcpca.conf.sample +++ b/conf.d/mgcpca.conf.sample @@ -164,6 +164,13 @@ ; clearconn: bool: Clear all connections of remote endpoints when initialized ;clearconn=no +; bearer: keyword: Default bearer encoding +; Allowed values: mulaw, alaw +; If bearer is set a default encoding is assumed on the circuit side and a +; B: e:mu or B: e:A line is added only if the circuit data format changes +; Normally the default bearer is not set so a B: line is added when needed +;bearer= + ; 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 f2d0df2a..69904b80 100644 --- a/modules/server/mgcpca.cpp +++ b/modules/server/mgcpca.cpp @@ -104,6 +104,8 @@ public: { return m_operational; } inline const String& address() const { return m_address; } + inline const String& bearer() const + { return m_bearer; } inline const char* version() const { return m_version.null() ? "MGCP 1.0" : m_version.c_str(); } inline bool fxo() const @@ -136,6 +138,7 @@ private: String m_notify; String m_address; String m_version; + String m_bearer; }; class MGCPCircuit : public SignallingCircuit, public SDPSession @@ -900,6 +903,7 @@ bool MGCPSpan::init(const NamedList& params) m_increment = config->getIntValue("increment",m_increment); 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); bool clear = config->getBoolValue("clearconn",false); m_circuits = new MGCPCircuit*[m_count]; unsigned int i; @@ -1158,6 +1162,7 @@ MGCPCircuit::MGCPCircuit(unsigned int code, MGCPSpan* span, const char* id) m_callId.hexify(this,sizeof(this)); m_callId += m_notify; m_notify = span->ntfyId() + m_notify; + m_gwFormat = span->bearer(); } MGCPCircuit::~MGCPCircuit() @@ -1284,7 +1289,7 @@ void MGCPCircuit::clearConn(bool force) if (!force) mm->params.addParam("C",m_callId); else { - m_gwFormat.clear(); + m_gwFormat = mySpan()->bearer(); m_gwFormatChanged = false; } m_connId.clear(); @@ -1678,7 +1683,7 @@ void MGCPCircuit::processDelete(MGCPMessage* mm, const String& error) Debug(&splugin,DebugWarn,"Gateway deleted connection '%s' on circuit %u [%p]", m_connId.c_str(),code(),this); m_connId.clear(); - m_gwFormat.clear(); + m_gwFormat = mySpan()->bearer(); m_gwFormatChanged = false; cleanupRtp(); m_changing = false;