Honor the requested ISDN circuit code if possible before trying other circuits.

Added the possibility of setting the Channel Exclusive flag from configuration or routing.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5294 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2012-10-15 11:50:33 +00:00
parent 33b682764b
commit 0a09fb7e63
2 changed files with 9 additions and 5 deletions

View File

@ -1675,7 +1675,8 @@ bool ISDNQ931Call::sendSetup(SignallingMessage* sigMsg)
break; break;
} }
m_circuit->updateFormat(m_data.m_format,0); m_circuit->updateFormat(m_data.m_format,0);
m_data.m_channelMandatory = false; m_data.m_channelMandatory = sigMsg->params().getBoolValue(YSTRING("channel-exclusive"),
q931()->parserData().flag(ISDNQ931::ChannelExclusive));
m_data.m_channelByNumber = true; m_data.m_channelByNumber = true;
m_data.m_channelType = "B"; m_data.m_channelType = "B";
if (m_data.m_bri) { if (m_data.m_bri) {
@ -1812,7 +1813,7 @@ bool ISDNQ931Call::reserveCircuit()
m_circuitChange = false; m_circuitChange = false;
bool anyCircuit = false; bool anyCircuit = false;
while (true) { while (true) {
// For incoming PRI calls we reserve the circuit only one time (at SETUP) // For incoming BRI calls we reserve the circuit only one time (at SETUP)
if (!(outgoing() || q931()->primaryRate())) { if (!(outgoing() || q931()->primaryRate())) {
// Check if we are a BRI NET and we should assign any channel // Check if we are a BRI NET and we should assign any channel
int briChan = lookup(m_data.m_channelSelect,Q931Parser::s_dict_channelIDSelect_BRI,3); int briChan = lookup(m_data.m_channelSelect,Q931Parser::s_dict_channelIDSelect_BRI,3);
@ -1827,15 +1828,15 @@ bool ISDNQ931Call::reserveCircuit()
m_data.m_reason = "service-not-implemented"; m_data.m_reason = "service-not-implemented";
return false; return false;
} }
int reqCircuit = m_data.m_channels.toInteger(-1);
// Check if we don't have a circuit reserved // Check if we don't have a circuit reserved
if (!m_circuit) { if (!m_circuit) {
anyCircuit = (outgoing() || !m_data.m_channelMandatory) && anyCircuit = (outgoing() || (reqCircuit < 0 && !m_data.m_channelMandatory)) &&
(m_net || q931()->primaryRate()); (m_net || q931()->primaryRate());
break; break;
} }
// Check the received circuit if any // Check the received circuit if any
if (!m_data.m_channels.null() && if ((int)m_circuit->code() == reqCircuit)
m_data.m_channels.toInteger() == (int)m_circuit->code())
return true; return true;
// We already have a circuit and received a different one: force mandatory // We already have a circuit and received a different one: force mandatory
m_data.m_channelMandatory = true; m_data.m_channelMandatory = true;
@ -2338,6 +2339,7 @@ const TokenDict ISDNQ931::s_flags[] = {
{"forcesendcomplete", ForceSendComplete}, {"forcesendcomplete", ForceSendComplete},
{"noactiveonconnect", NoActiveOnConnect}, {"noactiveonconnect", NoActiveOnConnect},
{"checknotifyind", CheckNotifyInd}, {"checknotifyind", CheckNotifyInd},
{"channelexclusive", ChannelExclusive},
{0,0}, {0,0},
}; };

View File

@ -14181,6 +14181,8 @@ public:
NoActiveOnConnect = 0x00000400, NoActiveOnConnect = 0x00000400,
// Check the validity of the notification indicator when sending a NOTIFY message // Check the validity of the notification indicator when sending a NOTIFY message
CheckNotifyInd = 0x00000800, CheckNotifyInd = 0x00000800,
// Request an outbound PRI channel to be exclusive
ChannelExclusive = 0x00001000,
}; };
/** /**