diff --git a/core/sip/trans_layer.cpp b/core/sip/trans_layer.cpp index bd584bce..3cd8aa9a 100644 --- a/core/sip/trans_layer.cpp +++ b/core/sip/trans_layer.cpp @@ -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; diff --git a/core/sip/trans_table.cpp b/core/sip/trans_table.cpp index 4ac6be48..f1442fdb 100644 --- a/core/sip/trans_table.cpp +++ b/core/sip/trans_table.cpp @@ -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(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(); diff --git a/core/sip/trans_table.h b/core/sip/trans_table.h index 1c2e0ea7..95b197e8 100644 --- a/core/sip/trans_table.h +++ b/core/sip/trans_table.h @@ -20,9 +20,9 @@ public: typedef ht_bucket::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);