b/f: fixes the ACK/200 matching for transaction looped back to SEMS.

Filtering by transaction type in trans_table::match_request() is necessary to avoid matching the ACK/200 UAC transaction when receiving a self-crafted ACK/200 and looking for the UAS transaction.
sayer/1.4-spce2.6
Raphael Coeffic 15 years ago
parent 29f55f998c
commit 8f24bcfe4f

@ -1105,7 +1105,7 @@ void _trans_layer::received_msg(sip_msg* msg)
switch(msg->type){
case SIP_REQUEST:
if((t = bucket->match_request(msg)) != NULL){
if((t = bucket->match_request(msg,TT_UAS)) != NULL){
if(msg->u.request->method != t->msg->u.request->method){
// ACK matched INVITE transaction
@ -1416,7 +1416,7 @@ int _trans_layer::update_uac_request(trans_bucket* bucket, sip_trans*& t, sip_ms
}
else {
// 200 ACK
t = bucket->match_request(msg);
t = bucket->match_request(msg,TT_UAC);
if(t == NULL){
DBG("While sending 200 ACK: no matching transaction\n");
return -1;

@ -57,7 +57,7 @@ trans_bucket::~trans_bucket()
{
}
sip_trans* trans_bucket::match_request(sip_msg* msg)
sip_trans* trans_bucket::match_request(sip_msg* msg, unsigned int ttype)
{
// assert(msg && msg->cseq && msg->callid);
// sip_cseq* cseq = dynamic_cast<sip_cseq*>(msg->cseq->p);
@ -93,7 +93,8 @@ sip_trans* trans_bucket::match_request(sip_msg* msg)
trans_list::iterator it = elmts.begin();
for(;it!=elmts.end();++it) {
if( (*it)->msg->type != SIP_REQUEST ){
if( ((*it)->msg->type != SIP_REQUEST) ||
((*it)->type != ttype)){
continue;
}
@ -168,10 +169,11 @@ sip_trans* trans_bucket::match_request(sip_msg* msg)
// Cseq (number only)
// top Via
// + To-tag of reply
if( ((*it)->type != TT_UAS) ||
((*it)->msg->type != SIP_REQUEST))
if( ((*it)->msg->type != SIP_REQUEST) ||
((*it)->type != ttype)){
continue;
}
if( (msg->u.request->method != (*it)->msg->u.request->method) &&
( (msg->u.request->method != sip_request::ACK) ||
@ -394,7 +396,7 @@ sip_trans* trans_bucket::match_1xx_prack(sip_msg* msg)
return NULL;
}
sip_trans* trans_bucket::add_trans(sip_msg* msg, int ttype)
sip_trans* trans_bucket::add_trans(sip_msg* msg, unsigned int ttype)
{
sip_trans* t = new sip_trans();

@ -20,9 +20,9 @@ public:
typedef ht_bucket<sip_trans>::value_list trans_list;
// Match a request to UAS transactions
// Match a request to UAS/UAC transactions
// in this bucket
sip_trans* match_request(sip_msg* msg);
sip_trans* match_request(sip_msg* msg, unsigned int ttype);
// Match a PRACK request against transactions
// in this bucket
@ -32,7 +32,7 @@ public:
// in this bucket
sip_trans* match_reply(sip_msg* msg);
sip_trans* add_trans(sip_msg* msg, int ttype);
sip_trans* add_trans(sip_msg* msg, unsigned int ttype);
private:
sip_trans* match_200_ack(sip_trans* t,sip_msg* msg);

Loading…
Cancel
Save