Send INVAL for all unmatched full frames except for INVAL.

git-svn-id: http://voip.null.ro/svn/yate@5538 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2013-06-11 14:03:57 +00:00
parent bda1e37157
commit 02fe6c9d32
3 changed files with 14 additions and 19 deletions

View File

@ -218,8 +218,11 @@ IAXTransaction* IAXEngine::addFrame(const SocketAddr& addr, IAXFrame* frame)
}
// Frame doesn't belong to an existing transaction
// Test if it is a full frame with an IAX control message that needs a new transaction
if (!full || frame->type() != IAXFrame::IAX)
if (!full || frame->type() != IAXFrame::IAX) {
if (full)
sendInval(full,addr);
return 0;
}
switch (full->subclass()) {
case IAXControl::New:
if (!checkCallToken(addr,*full))
@ -296,8 +299,12 @@ void IAXEngine::sendInval(IAXFullFrame* frame, const SocketAddr& addr)
{
if (!frame)
return;
DDebug(this,DebugInfo,"Sending INVAL for unmatched frame(%u,%u) with OSeq=%u ISeq=%u",frame->type(),frame->subclass(),
frame->oSeqNo(),frame->iSeqNo());
// Check for frames that should not receive INVAL
if (frame->type() == IAXFrame::IAX && frame->subclass() == IAXControl::Inval)
return;
DDebug(this,DebugInfo,
"Sending INVAL for unmatched frame(%u,%u) with OSeq=%u ISeq=%u",
frame->type(),frame->subclass(),frame->oSeqNo(),frame->iSeqNo());
IAXFullFrame* f = new IAXFullFrame(IAXFrame::IAX,IAXControl::Inval,frame->destCallNo(),
frame->sourceCallNo(),frame->iSeqNo(),frame->oSeqNo(),frame->timeStamp());
writeSocket(f->data().data(),f->data().length(),addr,f);

View File

@ -259,11 +259,12 @@ IAXTransaction* IAXTransaction::processFrame(IAXFrame* frame)
{
if (!frame)
return 0;
IAXFullFrame* full = frame->fullFrame();
if (state() == Terminated) {
sendInval();
if (full)
m_engine->sendInval(full,remoteAddr());
return 0;
}
IAXFullFrame* full = frame->fullFrame();
if (state() == Terminating) {
// Local terminate: Accept only Ack. Remote terminate: Accept none.
bool ok = false;
@ -1272,7 +1273,7 @@ IAXEvent* IAXTransaction::createEvent(u_int8_t evType, bool local, IAXFullFrame*
ev = new IAXEvent((IAXEvent::Type)evType,local,false,this,frame);
}
if (ev && ev->getList().invalidIEList()) {
sendInval();
m_engine->sendInval(frame,remoteAddr());
delete ev;
ev = waitForTerminate(IAXEvent::Invalid,local,frame);
}
@ -1699,14 +1700,6 @@ void IAXTransaction::sendAck(const IAXFullFrame* frame)
f->deref();
}
void IAXTransaction::sendInval()
{
IAXFullFrame* f = new IAXFullFrame(IAXFrame::IAX,IAXControl::Inval,localCallNo(),
remoteCallNo(),m_oSeqNo,m_iSeqNo,(u_int32_t)timeStamp());
m_engine->writeSocket(f->data().data(),f->data().length(),remoteAddr(),f);
f->deref();
}
void IAXTransaction::sendVNAK()
{
IAXFullFrame* f = new IAXFullFrame(IAXFrame::IAX,IAXControl::VNAK,localCallNo(),

View File

@ -2377,11 +2377,6 @@ protected:
*/
void sendAck(const IAXFullFrame* frame);
/**
* Send an INVAL frame
*/
void sendInval();
/**
* Send an VNAK frame
*/