On 20.05.11 12:37, Juha Heinanen wrote:
Raphael Coeffic writes:
the issue should now be fixed in 1.4 and master. The funny thing is: it
would have worked without syn_branch=0 in your sip-router config. In
this case, sip-router sends a via with branch=0, for which the
pre-RFC3261 request matching code in SEMS works perfectly ;-)
raphael,
thank you very much for the fix. branch=0 thing explains why i had not
seen this problem before. i namely included that command into my config
just a couple of months ago.
i still have some servers running sems 1.2. i'll take a look if i can
backport the fix to it.
Here is the patch for 1.2 (git format).
-Raphael.
commit 726bbfc15c1f1f645eb053c30ebe1404e514a806
Author: Raphael Coeffic <[email protected]>
Date: Fri May 20 09:06:23 2011 +0200
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.
diff --git a/core/plug-in/sipctrl/hash_table.cpp b/core/plug-in/sipctrl/hash_table.cpp
index b4d1281..b20a8dc 100644
--- a/core/plug-in/sipctrl/hash_table.cpp
+++ b/core/plug-in/sipctrl/hash_table.cpp
@@ -70,8 +70,7 @@ void trans_bucket::unlock()
pthread_mutex_unlock(&m);
}
-
-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);
@@ -107,7 +106,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;
}
@@ -181,10 +181,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) ||
@@ -348,7 +349,7 @@ sip_trans* trans_bucket::match_200_ack(sip_trans* t, sip_msg* msg)
return t;
}
-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/plug-in/sipctrl/trans_layer.cpp b/core/plug-in/sipctrl/trans_layer.cpp
index e6a4340..f60a6af 100644
--- a/core/plug-in/sipctrl/trans_layer.cpp
+++ b/core/plug-in/sipctrl/trans_layer.cpp
@@ -874,7 +874,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
@@ -1150,7 +1150,7 @@ int trans_layer::update_uac_request(trans_bucket* bucket, sip_trans*& t, sip_msg
}
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;
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems