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
... ...
@@ -914,10 +914,26 @@ void CallLeg::onSipRequest(const AmSipRequest& req)
914 914
   // Note that setting sip_relay_only to false in this case doesn't solve the
915 915
   // problem because AmB2BSession always tries to relay the request into the
916 916
   // other leg.
917
-  if (getCallStatus() == Disconnected && getOtherId().empty()) {
917
+  if ((getCallStatus() == Disconnected || getCallStatus() == Disconnecting)
918
+        && getOtherId().empty())
919
+  {
918 920
     TRACE("handling request %s in disconnected state", req.method.c_str());
921
+
919 922
     // this is not correct but what is?
920
-    AmSession::onSipRequest(req);
923
+    // handle reINVITEs within B2B call with no other leg
924
+    if (req.method == SIP_METH_INVITE && dlg->getStatus() == AmBasicSipDialog::Connected) {
925
+      try {
926
+        AmSession::onInvite(req);
927
+        //or dlg->reply(req, 500, SIP_REPLY_SERVER_INTERNAL_ERROR); ?
928
+      }
929
+      catch(...) {
930
+        ERROR("exception when handling INVITE in disconnected state");
931
+        dlg->reply(req, 500, SIP_REPLY_SERVER_INTERNAL_ERROR);
932
+        // stop the call?
933
+      }
934
+    }
935
+    else AmSession::onSipRequest(req);
936
+
921 937
     if (req.method == SIP_METH_BYE) {
922 938
       stopCall(&req); // is this needed?
923 939
     }