Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various Q931 correctness fixes #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions libs/ysig/q931.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,9 @@ bool ISDNQ931IEData::processCalledNo(ISDNQ931Message* msg, bool add,
if (add) {
ISDNQ931IE* ie = new ISDNQ931IE(ISDNQ931IE::CalledNo);
ie->addParam("number",m_calledNo);
if (!m_callerType.null())
if (!m_calledType.null())
ie->addParam("type",m_calledType);
if (!m_callerPlan.null())
if (!m_calledPlan.null())
ie->addParam("plan",m_calledPlan);
msg->appendSafe(ie);
return true;
Expand Down Expand Up @@ -1297,6 +1297,7 @@ SignallingEvent* ISDNQ931Call::processMsgSetup(ISDNQ931Message* msg)
msg->params().setParam("callednumtype",m_data.m_calledType);
msg->params().setParam("callednumplan",m_data.m_calledPlan);
msg->params().setParam("overlapped",String::boolText(m_overlap));
msg->params().setParam("transfer-cap",m_data.m_transferCapability);
return new SignallingEvent(SignallingEvent::NewCall,msg,this);
}

Expand Down Expand Up @@ -1470,6 +1471,8 @@ bool ISDNQ931Call::sendAlerting(SignallingMessage* sigMsg)
return sendReleaseComplete("congestion");
}
}
if (q931()->network())
m_data.m_channelMandatory = true;
m_data.processChannelID(msg,true,&q931()->parserData());
m_channelIDSent = true;
}
Expand All @@ -1490,6 +1493,8 @@ bool ISDNQ931Call::sendCallProceeding(SignallingMessage* sigMsg)
m_rspBearerCaps = false;
}
if (!m_channelIDSent) {
if (q931()->network())
m_data.m_channelMandatory = true;
m_data.processChannelID(msg,true);
m_channelIDSent = true;
}
Expand Down Expand Up @@ -1518,6 +1523,8 @@ bool ISDNQ931Call::sendConnect(SignallingMessage* sigMsg)
m_data.m_channelByNumber = true;
m_data.m_channelSelect = lookup(m_circuit->code(),Q931Parser::s_dict_channelIDSelect_BRI);
}
if (q931()->network())
m_data.m_channelMandatory = true;
m_data.processChannelID(msg,true,&q931()->parserData());
m_channelIDSent = true;
}
Expand Down Expand Up @@ -1655,7 +1662,7 @@ bool ISDNQ931Call::sendSetup(SignallingMessage* sigMsg)
if (q931()->parserData().flag(ISDNQ931::ForceSendComplete))
msg->appendSafe(new ISDNQ931IE(ISDNQ931IE::SendComplete));
// BearerCaps
m_data.m_transferCapability = "speech";
m_data.m_transferCapability = sigMsg->params().getValue(YSTRING("transfer-cap"), "speech");
m_data.m_transferMode = "circuit";
m_data.m_transferRate = "64kbit";
m_data.m_format = sigMsg->params().getValue(YSTRING("format"),q931()->format());
Expand Down Expand Up @@ -1741,13 +1748,15 @@ bool ISDNQ931Call::sendSetupAck()
ISDNQ931Message* msg = new ISDNQ931Message(ISDNQ931Message::SetupAck,this);
if (!m_channelIDSent) {
m_data.m_channelType = "B";
if (m_circuit)
if (m_data.m_bri && m_circuit)
m_data.m_channelSelect = lookup(m_circuit->code(),Q931Parser::s_dict_channelIDSelect_BRI);
if (!m_data.m_channelSelect) {
Debug(q931(),DebugNote,"Call(%u,%u). No voice channel available [%p]",
Q931_CALL_ID,this);
return sendReleaseComplete("congestion");
}
if (q931()->network())
m_data.m_channelMandatory = true;
m_data.processChannelID(msg,true,&q931()->parserData());
m_channelIDSent = true;
}
Expand Down
3 changes: 2 additions & 1 deletion modules/server/ysigchan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ SigChannel::SigChannel(SignallingEvent* event)
// call.preroute message
m_route = message("call.preroute",false,true);
// Parameters to be copied to call.preroute
static String params = "caller,called,callername,format,formats,callernumtype,callernumplan,callerpres,callerscreening,callednumtype,callednumplan,inn,overlapped";
static String params = "caller,called,callername,format,formats,callernumtype,callernumplan,callerpres,callerscreening,callednumtype,callednumplan,inn,overlapped,transfer-cap";
plugin.copySigMsgParams(*m_route,event,&params);
if (m_route->getBoolValue("overlapped") && !m_route->getValue("called"))
m_route->setParam("called","off-hook");
Expand Down Expand Up @@ -1237,6 +1237,7 @@ bool SigChannel::startCall(Message& msg, SigTrunk* trunk)
sigMsg->params().copyParam(msg,"callednumplan");
sigMsg->params().copyParam(msg,"inn");
sigMsg->params().copyParam(msg,"calledpointcode");
sigMsg->params().copyParam(msg,"transfer-cap");
// Copy RTP parameters
if (msg.getBoolValue("rtp_forward")) {
NamedList* tmp = new NamedList("rtp");
Expand Down