Send an INVAL frame when receiving a frame for an unknown transaction.

git-svn-id: http://yate.null.ro/svn/yate/trunk@5193 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
oana 2012-07-13 13:27:02 +00:00
parent d1fe8b9c3f
commit d0bfba4d78
2 changed files with 24 additions and 5 deletions

View File

@ -219,22 +219,22 @@ IAXTransaction* IAXEngine::addFrame(const SocketAddr& addr, IAXFrame* frame)
case IAXControl::Poke:
break;
case IAXControl::Inval:
case IAXControl::FwDownl:
case IAXControl::TxCnt:
case IAXControl::TxAcc:
// These are often used as keepalives
return 0;
case IAXControl::FwDownl:
default:
#ifdef DEBUG
if (fullFrame) {
if (fullFrame->destCallNo() == 0)
Debug(this,DebugAll,"Unsupported incoming transaction Frame(%u,%u). Source call no: %u",
frame->type(),fullFrame->subclass(),fullFrame->sourceCallNo());
#ifdef XDEBUG
else
Debug(this,DebugAll,"Unmatched Frame(%u,%u) for (%u,%u)",
frame->type(),fullFrame->subclass(),fullFrame->destCallNo(),fullFrame->sourceCallNo());
#endif
sendInval(fullFrame,addr);
}
#endif
return 0;
}
// Generate local number
@ -268,6 +268,18 @@ IAXTransaction* IAXEngine::addFrame(const SocketAddr& addr, const unsigned char*
return tr;
}
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());
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);
f->deref();
}
bool IAXEngine::process()
{
bool ok = false;

View File

@ -2615,6 +2615,13 @@ public:
*/
void removeTrunkFrame(IAXMetaTrunkFrame* metaFrame);
/**
* Send an INVAL frame
* @param frame Frame for which to send an INVAL frame
* @param addr The address from where the call request was received
*/
void sendInval(IAXFullFrame* frame, const SocketAddr& addr);
/**
* Send a trunk frame
* @param metaFrame The trunk meta frame to sent