Browse code

sbc b/f: handle reINVITE within disconnected B2B call better way

thanks Stefan for reporting and investigating the problem

Václav Kubart authored on 23/12/2013 14:09:29
Showing 1 changed files
... ...
@@ -888,10 +888,26 @@ void CallLeg::onSipRequest(const AmSipRequest& req)
888 888
   // Note that setting sip_relay_only to false in this case doesn't solve the
889 889
   // problem because AmB2BSession always tries to relay the request into the
890 890
   // other leg.
891
-  if (getCallStatus() == Disconnected && getOtherId().empty()) {
891
+  if ((getCallStatus() == Disconnected || getCallStatus() == Disconnecting)
892
+        && getOtherId().empty())
893
+  {
892 894
     TRACE("handling request %s in disconnected state", req.method.c_str());
895
+
893 896
     // this is not correct but what is?
894
-    AmSession::onSipRequest(req);
897
+    // handle reINVITEs within B2B call with no other leg
898
+    if (req.method == SIP_METH_INVITE && dlg->getStatus() == AmBasicSipDialog::Connected) {
899
+      try {
900
+        AmSession::onInvite(req);
901
+        //or dlg->reply(req, 500, SIP_REPLY_SERVER_INTERNAL_ERROR); ?
902
+      }
903
+      catch(...) {
904
+        ERROR("exception when handling INVITE in disconnected state");
905
+        dlg->reply(req, 500, SIP_REPLY_SERVER_INTERNAL_ERROR);
906
+        // stop the call?
907
+      }
908
+    }
909
+    else AmSession::onSipRequest(req);
910
+
895 911
     if (req.method == SIP_METH_BYE) {
896 912
       stopCall(&req); // is this needed?
897 913
     }