Module: sems
Branch: master
Commit: 0b1898604f4cdab5ab12afe98b6c35f9b2a64e1d
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=0b1898604f4cdab5ab12afe98b6c35f9b2a64e1d

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Wed Oct 27 00:23:32 2010 +0200

B2B: handle failed sending INVITE in callee leg

---

 core/AmB2BSession.cpp |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp
index c3cc982..58b289c 100644
--- a/core/AmB2BSession.cpp
+++ b/core/AmB2BSession.cpp
@@ -638,10 +638,24 @@ void AmB2BCalleeSession::onB2BEvent(B2BEvent* ev)
        AmSipTransaction(SIP_METH_INVITE, co_ev->r_cseq, trans_ticket());
     }
 
-    dlg.sendRequest(SIP_METH_INVITE, 
-                   co_ev->content_type, co_ev->body,
-                   co_ev->hdrs, SIP_FLAGS_VERBATIM);
-    // todo: relay error event back if sending fails
+    if (dlg.sendRequest(SIP_METH_INVITE,
+                       co_ev->content_type, co_ev->body,
+                       co_ev->hdrs, SIP_FLAGS_VERBATIM) < 0) {
+
+      DBG("sending INVITE failed, relaying back 400 Bad Request\n");
+      AmSipReply n_reply;
+      n_reply.code = 400;
+      n_reply.reason = "Bad Request";
+      n_reply.cseq = co_ev->r_cseq;
+      n_reply.local_tag = dlg.local_tag;
+      relayEvent(new B2BSipReplyEvent(n_reply, co_ev->relayed_invite, 
SIP_METH_INVITE));
+
+      if (co_ev->relayed_invite)
+       relayed_req.erase(dlg.cseq);
+
+      setStopped();
+      return;
+    }
 
     saveSessionDescription(co_ev->content_type, co_ev->body);
 

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

Reply via email to