Module: sems
Branch: rco/offer_answer
Commit: 6cb1d7858fee978c01444887113d627087869fdc
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=6cb1d7858fee978c01444887113d627087869fdc

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Wed May 18 12:18:19 2011 +0200

postpone onSdpCompleted() until request/reply has been sent.

---

 core/AmSipDialog.cpp |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp
index bf83438..9d53803 100644
--- a/core/AmSipDialog.cpp
+++ b/core/AmSipDialog.cpp
@@ -277,7 +277,7 @@ int AmSipDialog::onTxSdp(const string& body)
 
   case OA_OfferRecved:
     oa_state = OA_Completed;
-    return hdl->onSdpCompleted(sdp_local, sdp_remote);
+    break;
 
   case OA_OfferSent:
     // There is already a pending offer!!!
@@ -533,7 +533,6 @@ int AmSipDialog::onTxReply(AmSipReply& reply)
     }
   }
 
-
   if (has_sdp && (onTxSdp(reply.body) != 0)) {
     
     DBG("onTxSdp() failed\n");
@@ -994,6 +993,8 @@ int AmSipDialog::reply(const AmSipTransaction& t,
     reply.contact = getContactHdr();
   }
 
+
+  OAState old_oa_state = oa_state;
   if(onTxReply(reply)){
     DBG("onTxReply failed\n");
     return -1;
@@ -1008,6 +1009,13 @@ int AmSipDialog::reply(const AmSipTransaction& t,
          reply.code,reply.reason.c_str(),reply.cseq_method.c_str(),
          reply.callid.c_str(),reply.cseq);
   }
+  else {
+    if((old_oa_state != oa_state) &&
+       (oa_state == OA_Completed)) {
+      return hdl->onSdpCompleted(sdp_local, sdp_remote);
+    }
+  }
+
   return ret;
 }
 
@@ -1365,11 +1373,15 @@ int AmSipDialog::sendRequest(const string& method,
   req.content_type = content_type;
   req.body = body;
 
+  OAState old_oa_state = oa_state;
   if(onTxRequest(req))
     return -1;
 
-  if (SipCtrlInterface::send(req, next_hop_ip, 
next_hop_port,outbound_interface))
+  if(SipCtrlInterface::send(req, next_hop_ip, 
next_hop_port,outbound_interface)) {
+    ERROR("Could not send request: method=%s; call-id=%s; cseq=%i\n",
+         req.method.c_str(),req.callid.c_str(),req.cseq);
     return -1;
+  }
  
   if(method != SIP_METH_ACK) {
     uac_trans[req_cseq] = AmSipTransaction(method,req_cseq,req.tt);
@@ -1378,6 +1390,11 @@ int AmSipDialog::sendRequest(const string& method,
     uac_trans.erase(req_cseq);
   }
 
+  if((old_oa_state != oa_state) &&
+     (oa_state == OA_Completed)) {
+    return hdl->onSdpCompleted(sdp_local, sdp_remote);
+  }
+
   return 0;
 }
 

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to