]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add mod_commands
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 4 Apr 2006 22:03:59 +0000 (22:03 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 4 Apr 2006 22:03:59 +0000 (22:03 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1045 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/freeswitch.conf
src/mod/applications/mod_commands/mod_commands.c [new file with mode: 0644]
src/mod/applications/mod_commands/mod_commands.vcproj [new file with mode: 0644]
src/mod/endpoints/mod_exosip/mod_exosip.c

index 59808ed81338a22280609a20b34ddd8dc05d9102..7fd1d4aff4b1e7312472f6ff14214cde99c6ad45 100644 (file)
@@ -32,6 +32,7 @@ load => mod_bridgecall
 load => mod_echo
 ;load => mod_ivrtest
 load => mod_playback
+load => mod_commands
 
 ; Dialplan Interfaces
 load => mod_dialplan_demo
diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c
new file mode 100644 (file)
index 0000000..eefa93c
--- /dev/null
@@ -0,0 +1,83 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct@yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthmct@yahoo.com>
+ *
+ *
+ * mod_commands.c -- Raw Audio File Streaming Application Module
+ *
+ */
+#include <switch.h>
+
+static const char modname[] = "mod_commands";
+
+
+static switch_status kill_function(char *dest, char *out, size_t outlen)
+{
+       switch_core_session *session = NULL;
+
+       if ((session = switch_core_session_locate(dest))) {
+               switch_channel *channel = switch_core_session_get_channel(session);
+               switch_core_session_kill_channel(session, SWITCH_SIG_KILL);
+               switch_channel_hangup(channel);
+               snprintf(out, outlen, "OK\n");
+       } else {
+               snprintf(out, outlen, "No Such Channel!\n");
+       }
+
+       return SWITCH_STATUS_SUCCESS;
+}
+
+
+static struct switch_api_interface commands_api_interface = {
+       /*.interface_name */ "killchan",
+       /*.desc */ "Kill Channel",
+       /*.function */ kill_function,
+       /*.next */ NULL
+};
+
+
+static const switch_loadable_module_interface mod_commands_module_interface = {
+       /*.module_name */ modname,
+       /*.endpoint_interface */ NULL,
+       /*.timer_interface */ NULL,
+       /*.dialplan_interface */ NULL,
+       /*.codec_interface */ NULL,
+       /*.application_interface */ NULL,
+       /*.api_interface */ &commands_api_interface
+};
+
+
+SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename)
+{
+
+       /* connect my internal structure to the blank pointer passed to me */
+       *interface = &mod_commands_module_interface;
+
+
+       /* indicate that the module should continue to be loaded */
+       return SWITCH_STATUS_SUCCESS;
+}
+
diff --git a/src/mod/applications/mod_commands/mod_commands.vcproj b/src/mod/applications/mod_commands/mod_commands.vcproj
new file mode 100644 (file)
index 0000000..b2b36a2
--- /dev/null
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="8.00"\r
+       Name="mod_commands"\r
+       ProjectGUID="{78100236-7CEA-4948-96CC-E8ED3160329C}"\r
+       RootNamespace="mod_commands"\r
+       Keyword="Win32Proj"\r
+       >\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"\r
+               />\r
+       </Platforms>\r
+       <ToolFiles>\r
+       </ToolFiles>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="Debug"\r
+                       IntermediateDirectory="Debug"\r
+                       ConfigurationType="2"\r
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="1"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="4"\r
+                               WarnAsError="true"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="4"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_commands.dll"\r
+                               LinkIncremental="2"\r
+                               AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"\r
+                               GenerateDebugInformation="true"\r
+                               ProgramDatabaseFile="$(OutDir)/mod_commands.pdb"\r
+                               SubSystem="2"\r
+                               ImportLibrary="$(OutDir)/mod_commands.lib"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="Release"\r
+                       IntermediateDirectory="Release"\r
+                       ConfigurationType="2"\r
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"\r
+                               RuntimeLibrary="0"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="4"\r
+                               WarnAsError="true"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_commands.dll"\r
+                               LinkIncremental="1"\r
+                               AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="2"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               ImportLibrary="$(OutDir)/mod_commands.lib"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="Source Files"\r
+                       Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+                       >\r
+                       <File\r
+                               RelativePath=".\mod_commands.c"\r
+                               >\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Header Files"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+                       >\r
+               </Filter>\r
+               <Filter\r
+                       Name="Resource Files"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+                       >\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
index f90a5381434fadb64b0d005df8222a1718ddc2d3..72fa52c5548201fad046409ee7aba9a5edaa6d6f 100644 (file)
@@ -126,6 +126,7 @@ struct private_object {
        switch_queue_t *dtmf_queue;
        char out_digit;
        switch_time_t cng_next;
+       switch_time_t last_read;
        unsigned char out_digit_packet[4];
        unsigned int out_digit_sofar;
        unsigned int out_digit_dur;
@@ -551,7 +552,14 @@ static switch_status exosip_read_frame(switch_core_session *session, switch_fram
        } else {
                assert(0);
        }
-
+       
+       if (tech_pvt->last_read) {
+               elapsed = (unsigned int)((switch_time_now() - tech_pvt->last_read) / 1000);
+               if (elapsed > 60000) {
+                       return SWITCH_STATUS_TIMEOUT;
+               }
+       }
+       
        if (switch_test_flag(tech_pvt, TFLAG_IO)) {
 
                if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
@@ -561,6 +569,7 @@ static switch_status exosip_read_frame(switch_core_session *session, switch_fram
                assert(tech_pvt->rtp_session != NULL);
                tech_pvt->read_frame.datalen = 0;
 
+
                while (!switch_test_flag(tech_pvt, TFLAG_BYE) && switch_test_flag(tech_pvt, TFLAG_IO)
                           && tech_pvt->read_frame.datalen == 0) {
                        now = switch_time_now();
@@ -640,6 +649,7 @@ static switch_status exosip_read_frame(switch_core_session *session, switch_fram
                        }
                        
                        if (tech_pvt->read_frame.datalen > 0) {
+                               tech_pvt->last_read = switch_time_now();
                                bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
                                frames = (tech_pvt->read_frame.datalen / bytes);
                                samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;