- fixes bug where SEMS was trying to send an ACK with a BYE transaction. thx to Juha for reporting.

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@743 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Raphael Coeffic 19 years ago
parent 092ef02ec2
commit d09e9a7bbb

@ -500,14 +500,10 @@ void SipCtrlInterface::handle_sip_reply(sip_msg* msg)
reply.remote_tag = c2stlstr(((sip_from_to*)msg->to->p)->tag);
reply.local_tag = c2stlstr(((sip_from_to*)msg->from->p)->tag);
// Should i fill this one with anything
// i do not understand??? -> H_OTHER ?
//
// reply.hdrs;
if( (msg->u.reply->code >= 200 ) &&
(msg->u.reply->code < 300 )){
if( (get_cseq(msg)->method == sip_request::INVITE)
&& (msg->u.reply->code >= 200)
&& (msg->u.reply->code < 300) ){
tl->send_200_ack(msg);
}

@ -197,13 +197,13 @@ sip_trans* trans_bucket::match_request(sip_msg* msg)
continue;
sip_cseq* it_cseq = dynamic_cast<sip_cseq*>((*it)->msg->cseq->p);
if(cseq->str.len != it_cseq->str.len)
if(cseq->num_str.len != it_cseq->num_str.len)
continue;
if(memcmp(from->tag.s,it_from->tag.s,from->tag.len))
continue;
if(memcmp(cseq->str.s,it_cseq->str.s,cseq->str.len))
if(memcmp(cseq->num_str.s,it_cseq->num_str.s,cseq->num_str.len))
continue;
@ -288,22 +288,22 @@ sip_trans* trans_bucket::match_reply(sip_msg* msg)
if((*it)->msg->via_p1->branch.len != msg->via_p1->branch.len)
continue;
if(get_cseq((*it)->msg)->str.len != get_cseq(msg)->str.len)
if(get_cseq((*it)->msg)->num_str.len != get_cseq(msg)->num_str.len)
continue;
if(get_cseq((*it)->msg)->method.len != get_cseq(msg)->method.len)
if(get_cseq((*it)->msg)->method_str.len != get_cseq(msg)->method_str.len)
continue;
if(memcmp(msg->via_p1->branch.s+MAGIC_BRANCH_LEN,
branch,len))
continue;
if(memcmp(get_cseq((*it)->msg)->str.s,get_cseq(msg)->str.s,
get_cseq(msg)->str.len))
if(memcmp(get_cseq((*it)->msg)->num_str.s,get_cseq(msg)->num_str.s,
get_cseq(msg)->num_str.len))
continue;
if(memcmp(get_cseq((*it)->msg)->method.s,get_cseq(msg)->method.s,
get_cseq(msg)->method.len))
if(memcmp(get_cseq((*it)->msg)->method_str.s,get_cseq(msg)->method_str.s,
get_cseq(msg)->method_str.len))
continue;
// found matching transaction

@ -56,7 +56,7 @@ int parse_cseq(sip_cseq* cseq, char* beg, int len)
case SP:
case HTAB:
st = C_NUM_SWS;
cseq->str.set(beg, c-beg);
cseq->num_str.set(beg, c-beg);
break;
default:
@ -91,7 +91,7 @@ int parse_cseq(sip_cseq* cseq, char* beg, int len)
case SP:
case HTAB:
cseq->method.set(beg,c-beg);
cseq->method_str.set(beg,c-beg);
return 0;
}
break;
@ -102,10 +102,10 @@ int parse_cseq(sip_cseq* cseq, char* beg, int len)
case ST_CRLF:
switch(saved_st){
case C_NUM:
cseq->str.set(beg,c-(st==ST_CRLF?2:1)-beg);
cseq->num_str.set(beg,c-(st==ST_CRLF?2:1)-beg);
break;
case C_METHOD:
cseq->method.set(beg,c-beg);
cseq->method_str.set(beg,c-beg);
return 0;
}
st = saved_st;
@ -117,6 +117,12 @@ int parse_cseq(sip_cseq* cseq, char* beg, int len)
return MALFORMED_SIP_MSG;
}
cseq->method.set(beg,c-beg);
cseq->method_str.set(beg,c-beg);
if(parse_method(&cseq->method, cseq->method_str.s, cseq->method_str.len) < 0){
DBG("Cseq method parsing failed\n");
return MALFORMED_SIP_MSG;
}
return 0;
}

@ -34,9 +34,10 @@
struct sip_cseq: public sip_parsed_hdr
{
cstring str;
cstring num_str;
unsigned int num;
cstring method;
cstring method_str;
int method;
sip_cseq()
: sip_parsed_hdr(),

@ -445,8 +445,8 @@ int parse_sip_msg(sip_msg* msg)
if(!parse_cseq(cseq.get(),
msg->cseq->value.s,
msg->cseq->value.len) &&
cseq->str.len &&
cseq->method.len ) {
cseq->num_str.len &&
cseq->method_str.len ) {
// DBG("Cseq header: '%.*s' '%.*s'\n",
// cseq->str.len,cseq->str.s,

@ -504,7 +504,7 @@ int trans_layer::send_request(sip_msg* msg)
}
else {
trans_bucket* bucket = get_trans_bucket(p_msg->callid->value,
get_cseq(p_msg)->str);
get_cseq(p_msg)->num_str);
bucket->lock();
sip_trans* t = bucket->add_trans(p_msg,TT_UAC);
if(p_msg->u.request->method == sip_request::INVITE){
@ -552,7 +552,7 @@ void trans_layer::received_msg(sip_msg* msg)
DROP_MSG;
}
unsigned int h = hash(msg->callid->value, get_cseq(msg)->str);
unsigned int h = hash(msg->callid->value, get_cseq(msg)->num_str);
trans_bucket* bucket = get_trans_bucket(h);
sip_trans* t = NULL;
@ -750,6 +750,7 @@ int trans_layer::update_uac_trans(trans_bucket* bucket, sip_trans* t, sip_msg* m
t->state = TS_COMPLETED;
t->clear_timer(STIMER_E);
// TODO: timer should be 0 if reliable transport
t->reset_timer(STIMER_K, K_TIMER, bucket->get_id());
@ -877,7 +878,7 @@ void trans_layer::send_non_200_ack(sip_trans* t, sip_msg* reply)
+ copy_hdr_len(reply->to)
+ copy_hdr_len(inv->callid);
ack_len += cseq_len(get_cseq(inv)->str,method);
ack_len += cseq_len(get_cseq(inv)->num_str,method);
ack_len += 2/* EoH CRLF */;
if(!inv->route.empty())
@ -897,7 +898,7 @@ void trans_layer::send_non_200_ack(sip_trans* t, sip_msg* reply)
copy_hdr_wr(&c,reply->to);
copy_hdr_wr(&c,inv->callid);
cseq_wr(&c,get_cseq(inv)->str,method);
cseq_wr(&c,get_cseq(inv)->num_str,method);
*c++ = CR;
*c++ = LF;
@ -961,7 +962,7 @@ void trans_layer::send_200_ack(sip_msg* reply)
request_len += copy_hdr_len(reply->from);
request_len += copy_hdr_len(reply->callid);
request_len += copy_hdr_len(max_forward);
request_len += cseq_len(get_cseq(reply)->str,cstring("ACK",3));
request_len += cseq_len(get_cseq(reply)->num_str,cstring("ACK",3));
request_len += 2/* CRLF end-of-headers*/;
// Allocate new message
@ -979,7 +980,7 @@ void trans_layer::send_200_ack(sip_msg* reply)
copy_hdr_wr(&c,reply->to);
copy_hdr_wr(&c,reply->callid);
copy_hdr_wr(&c,max_forward);
cseq_wr(&c,get_cseq(reply)->str,cstring("ACK",3));
cseq_wr(&c,get_cseq(reply)->num_str,cstring("ACK",3));
*c++ = CR;
*c++ = LF;

Loading…
Cancel
Save