]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Fixed outbound H.323 calls correctly marking call as answered when fast connect used.
authorRobert Jongbloed <robertj@voxlucida.com.au>
Thu, 6 Sep 2012 02:45:25 +0000 (12:45 +1000)
committerRobert Jongbloed <robertj@voxlucida.com.au>
Wed, 19 Sep 2012 02:32:26 +0000 (12:32 +1000)
Fixed correct media "frames/packet" for G.711, default to 20ms worth.

src/mod/endpoints/mod_opal/mod_opal.cpp
src/mod/endpoints/mod_opal/mod_opal.h

index a6a6f44dfd79939607e2edbbd60d3c39c2b0d674..e9beeb93fe7e263044baad552b2b9a50b139ef6f 100644 (file)
@@ -310,9 +310,12 @@ bool FSManager::Initialise(switch_loadable_module_interface_t *iface)
     OpalMediaFormatList allCodecs = OpalMediaFormat::GetAllRegisteredMediaFormats();\r
     for (OpalMediaFormatList::iterator it = allCodecs.begin(); it != allCodecs.end(); ++it) {\r
       if (it->GetMediaType() == OpalMediaType::Audio()) {\r
-        it->SetOptionInteger(OpalAudioFormat::RxFramesPerPacketOption(), 1);\r
-        it->SetOptionInteger(OpalAudioFormat::TxFramesPerPacketOption(), 1);\r
+        int ms_per_frame = it->GetFrameTime()/it->GetTimeUnits();\r
+        int frames_in_20_ms = (ms_per_frame+19)/ms_per_frame;\r
+        it->SetOptionInteger(OpalAudioFormat::RxFramesPerPacketOption(), frames_in_20_ms);\r
+        it->SetOptionInteger(OpalAudioFormat::TxFramesPerPacketOption(), frames_in_20_ms);\r
         OpalMediaFormat::SetRegisteredMediaFormat(*it);\r
+        PTRACE(4, "mod_opal\tSet " << *it << " to " << frames_in_20_ms << "frames/packet");\r
       }\r
     }\r
 #endif // IMPLEMENT_MULTI_FAME_AUDIO\r
@@ -602,6 +605,20 @@ bool FSConnection::OnIncoming()
 }\r
 \r
 \r
+void FSConnection::OnEstablished()\r
+{\r
+  OpalLocalConnection::OnEstablished();\r
+\r
+  if (switch_channel_direction(m_fsChannel) == SWITCH_CALL_DIRECTION_OUTBOUND) {\r
+    PTRACE(4, "mod_opal\tOnEstablished for outbound call, checking for media");\r
+    if (GetMediaStream(OpalMediaType::Audio(), true) != NULL && GetMediaStream(OpalMediaType::Audio(), false) != NULL) {\r
+      PTRACE(3, "mod_opal\tOnEstablished for outbound call, making call answered");\r
+      switch_channel_mark_answered(m_fsChannel);\r
+    }\r
+  }\r
+}\r
+\r
+\r
 void FSConnection::OnReleased()\r
 {\r
     m_rxAudioOpened.Signal();   // Just in case\r
@@ -786,18 +803,26 @@ void FSConnection::OnPatchMediaStream(PBoolean isSource, OpalMediaPatch & patch)
         return;\r
 \r
     if (switch_channel_direction(m_fsChannel) == SWITCH_CALL_DIRECTION_INBOUND) {\r
+        PTRACE(4, "mod_opal\tOnPatchMediaStream for inbound call, flagging media opened");\r
         if (isSource)\r
             m_rxAudioOpened.Signal();\r
         else\r
             m_txAudioOpened.Signal();\r
     }\r
-    else if (GetMediaStream(OpalMediaType::Audio(), !isSource) != NULL) {\r
+    else {\r
+      PTRACE(4, "mod_opal\tOnPatchMediaStream for outbound call, checking media");\r
+      if (GetMediaStream(OpalMediaType::Audio(), !isSource) != NULL) {\r
           // Have open media in both directions.\r
-        if (IsEstablished())\r
+          if (IsEstablished()) {\r
+              PTRACE(3, "mod_opal\tOnPatchMediaStream for outbound call, making call answered");\r
               switch_channel_mark_answered(m_fsChannel);\r
-        else if (!IsReleased())\r
+          }\r
+          else if (!IsReleased()) {\r
+              PTRACE(3, "mod_opal\tOnPatchMediaStream for outbound call, making call pre-answered");\r
               switch_channel_mark_pre_answered(m_fsChannel);\r
           }\r
+      }\r
+    }\r
 }\r
 \r
 \r
index 2dd627a8221d5125a64585548ac0f71c7cbadc4c..db66c323814025d5559a7ea2169b3d64993987c9 100644 (file)
@@ -248,6 +248,7 @@ class FSConnection : public OpalLocalConnection
 \r
     virtual bool OnOutgoingSetUp();\r
     virtual bool OnIncoming();\r
+    virtual void OnEstablished();\r
     virtual void OnReleased();\r
     virtual PBoolean SetAlerting(const PString & calleeName, PBoolean withMedia);\r
     virtual OpalMediaStream *CreateMediaStream(const OpalMediaFormat &, unsigned, PBoolean);\r