Author: sayer
Date: 2010-03-04 17:36:23 +0100 (Thu, 04 Mar 2010)
New Revision: 1650
Modified:
trunk/core/AmB2BSession.cpp
trunk/core/AmSipDialog.cpp
trunk/core/AmSipDialog.h
trunk/core/plug-in/sipctrl/trans_layer.cpp
Log:
fixes ACK handling in B2BUA, which was broken due to moving ACK handling on
user layer
(sems_trunk_fix_b2b.patch)
also fixes a bug in SIP stack transaction update (to-tag)
Modified: trunk/core/AmB2BSession.cpp
===================================================================
--- trunk/core/AmB2BSession.cpp 2010-03-03 21:26:25 UTC (rev 1649)
+++ trunk/core/AmB2BSession.cpp 2010-03-04 16:36:23 UTC (rev 1650)
@@ -167,11 +167,15 @@
AmSipReply n_reply = reply;
n_reply.cseq = t->second.cseq;
- dlg.updateStatus(reply);
+ dlg.updateStatus(reply, false);
relayEvent(new B2BSipReplyEvent(n_reply,true));
- if(reply.code >= 200)
- relayed_req.erase(t);
+ if(reply.code >= 200) {
+ if ((reply.code < 300) && (t->second.method == "INVITE")) {
+ DBG("not removing relayed INVITE transaction yet...\n");
+ } else
+ relayed_req.erase(t);
+ }
} else {
AmSession::onSipReply(reply);
relayEvent(new B2BSipReplyEvent(reply,false));
@@ -219,8 +223,27 @@
void AmB2BSession::relaySip(const AmSipRequest& req)
{
- relayed_req[dlg.cseq] = AmSipTransaction(req.method,req.cseq);
-
dlg.sendRequest(req.method,"application/sdp",req.body,req.hdrs,SIP_FLAGS_VERBATIM);
+ if (req.method != "ACK") {
+ relayed_req[dlg.cseq] = AmSipTransaction(req.method,req.cseq);
+
dlg.sendRequest(req.method,"application/sdp",req.body,req.hdrs,SIP_FLAGS_VERBATIM);
+ } else {
+ // its a (200) ACK
+ TransMap::iterator t = relayed_req.begin();
+
+ while (t != relayed_req.end()) {
+ if (t->second.cseq == req.cseq)
+ break;
+ t++;
+ }
+ if (t == relayed_req.end()) {
+ ERROR("transaction for ACK not found in relayed requests\n");
+ return;
+ }
+ DBG("sending relayed ACK\n");
+ dlg.send_200_ack(AmSipTransaction(t->second.method, t->first),
+ req.content_type, req.body, req.hdrs, SIP_FLAGS_VERBATIM);
+ relayed_req.erase(t);
+ }
}
void AmB2BSession::relaySip(const AmSipRequest& orig, const AmSipReply& reply)
Modified: trunk/core/AmSipDialog.cpp
===================================================================
--- trunk/core/AmSipDialog.cpp 2010-03-03 21:26:25 UTC (rev 1649)
+++ trunk/core/AmSipDialog.cpp 2010-03-04 16:36:23 UTC (rev 1650)
@@ -185,7 +185,7 @@
return 0;
}
-void AmSipDialog::updateStatus(const AmSipReply& reply)
+void AmSipDialog::updateStatus(const AmSipReply& reply, bool do_200_ack)
{
TransMap::iterator t_it = uac_trans.find(reply.cseq);
if(t_it == uac_trans.end()){
@@ -264,7 +264,7 @@
// TODO:
// - place this somewhere else.
// (probably in AmSession...)
- if((reply.code < 300) && (t.method == "INVITE")) {
+ if((reply.code < 300) && (t.method == "INVITE") && do_200_ack) {
send_200_ack(t);
}
Modified: trunk/core/AmSipDialog.h
===================================================================
--- trunk/core/AmSipDialog.h 2010-03-03 21:26:25 UTC (rev 1649)
+++ trunk/core/AmSipDialog.h 2010-03-04 16:36:23 UTC (rev 1650)
@@ -149,7 +149,7 @@
string getContactHdr();
void updateStatus(const AmSipRequest& req);
- void updateStatus(const AmSipReply& reply);
+ void updateStatus(const AmSipReply& reply, bool do_200_ack=true);
/** update Status from locally originated request (e.g. INVITE) */
void updateStatusFromLocalRequest(const AmSipRequest& req);
Modified: trunk/core/plug-in/sipctrl/trans_layer.cpp
===================================================================
--- trunk/core/plug-in/sipctrl/trans_layer.cpp 2010-03-03 21:26:25 UTC (rev
1649)
+++ trunk/core/plug-in/sipctrl/trans_layer.cpp 2010-03-04 16:36:23 UTC (rev
1650)
@@ -1074,14 +1074,11 @@
t->reset_timer(STIMER_L, L_TIMER, bucket->get_id());
- if (t->to_tag.len>0) {
+ if (t->to_tag.len==0) {
t->to_tag.s = new char[to_tag.len];
t->to_tag.len = to_tag.len;
memcpy((void*)t->to_tag.s,to_tag.s,to_tag.len);
- } else {
- t->to_tag.s = NULL;
- t->to_tag.len = 0;
- }
+ }
goto pass_reply;
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev