[Freeswitch-branches] [commit] r5519 - in freeswitch/branches/greenlizard: libs/win32/etpan libs/win32/sofia libs/xmlrpc-c/lib/abyss/src scripts/contrib/trixter scripts/contrib/trixter/xml-cdr scripts/contrib/trixter/xml-curl scripts/contrib/trixter/xml-curl/modules scripts/contrib/trixter/xml-curl/templates/switch1 scripts/contrib/trixter/xml-curl/templates/switch1/configuration scripts/contrib/trixter/xml-curl/templates/switch1/dialplan src src/include src/mod/applications/mod_commands src/mod/codecs/mod_l16 src/mod/endpoints/mod_iax src/mod/endpoints/mod_portaudio src/mod/endpoints/mod_sofia src/mod/languages/mod_spidermonkey
Freeswitch SVN
greenlizard at freeswitch.org
Sun Jul 8 22:28:41 EDT 2007
Author: greenlizard
Date: Sun Jul 8 22:28:40 2007
New Revision: 5519
Added:
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/modules/
- copied from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/modules/
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/modules/configuration.php
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/modules/configuration.php
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/modules/dialplan.php
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/modules/dialplan.php
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/
- copied from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/conference.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/conference.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/dialplan_directory.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/dialplan_directory.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/dingaling.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/dingaling.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/enum.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/enum.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/event_multicast.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/event_multicast.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/event_socket.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/event_socket.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/iax.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/iax.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/ivr.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/ivr.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/portaudio.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/portaudio.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/post_load_modules.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/post_load_modules.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/rss.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/rss.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/sofia.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/sofia.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/spidermonkey.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/spidermonkey.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/wanpipe.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/wanpipe.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/woomera.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/woomera.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/xml_rpc.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/xml_rpc.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/xmpp_event.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/xmpp_event.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/zeroconf.conf.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/configuration/zeroconf.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/dialplan/
- copied from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/dialplan/
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/dialplan/fail.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/dialplan/fail.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/dialplan/frompstn.tpl
- copied unchanged from r5513, /freeswitch/trunk/scripts/contrib/trixter/xml-curl/templates/switch1/dialplan/frompstn.tpl
Removed:
freeswitch/branches/greenlizard/scripts/contrib/trixter/Parse_XML_CDR.php
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/conference.conf.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/fail.tpl
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/templates/switch1/frompstn.tpl
Modified:
freeswitch/branches/greenlizard/libs/win32/etpan/libetpan.vcproj
freeswitch/branches/greenlizard/libs/win32/sofia/libsofia_sip_ua_static.vcproj
freeswitch/branches/greenlizard/libs/xmlrpc-c/lib/abyss/src/conn.c
freeswitch/branches/greenlizard/scripts/contrib/trixter/faxlib.jm
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-cdr/Parse_XML_CDR.php
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-cdr/README
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/README
freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/curlrouting.php
freeswitch/branches/greenlizard/src/include/switch_loadable_module.h
freeswitch/branches/greenlizard/src/include/switch_module_interfaces.h
freeswitch/branches/greenlizard/src/include/switch_types.h
freeswitch/branches/greenlizard/src/mod/applications/mod_commands/mod_commands.c
freeswitch/branches/greenlizard/src/mod/codecs/mod_l16/mod_l16.c
freeswitch/branches/greenlizard/src/mod/endpoints/mod_iax/mod_iax.c
freeswitch/branches/greenlizard/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/branches/greenlizard/src/switch_channel.c
freeswitch/branches/greenlizard/src/switch_core.c
freeswitch/branches/greenlizard/src/switch_core_file.c
freeswitch/branches/greenlizard/src/switch_core_io.c
freeswitch/branches/greenlizard/src/switch_core_session.c
freeswitch/branches/greenlizard/src/switch_core_state_machine.c
freeswitch/branches/greenlizard/src/switch_ivr_bridge.c
freeswitch/branches/greenlizard/src/switch_ivr_play_say.c
freeswitch/branches/greenlizard/src/switch_rtp.c
Log:
merge trunk version 5489 to 5513
Modified: freeswitch/branches/greenlizard/libs/win32/etpan/libetpan.vcproj
==============================================================================
--- freeswitch/branches/greenlizard/libs/win32/etpan/libetpan.vcproj (original)
+++ freeswitch/branches/greenlizard/libs/win32/etpan/libetpan.vcproj Sun Jul 8 22:28:40 2007
@@ -50,7 +50,7 @@
UsePrecompiledHeader="0"
WarningLevel="0"
Detect64BitPortabilityProblems="false"
- DebugInformationFormat="4"
+ DebugInformationFormat="3"
CompileAs="1"
ForcedIncludeFiles="$(ProjectDir)../../libetpan/build-windows/StdAfx.h"
/>
@@ -68,7 +68,7 @@
AdditionalOptions="/DLL"
AdditionalDependencies="oldnames.lib Ws2_32.lib mswsock.lib"
OutputFile="$(SolutionDir)$(IntDir)/libetpan.dll"
- LinkIncremental="2"
+ LinkIncremental="1"
SuppressStartupBanner="true"
IgnoreDefaultLibraryNames="C"
ModuleDefinitionFile=""
@@ -1081,6 +1081,7 @@
>
<Tool
Name="VCCLCompilerTool"
+ MinimalRebuild="false"
CompileAs="2"
/>
</FileConfiguration>
Modified: freeswitch/branches/greenlizard/libs/win32/sofia/libsofia_sip_ua_static.vcproj
==============================================================================
--- freeswitch/branches/greenlizard/libs/win32/sofia/libsofia_sip_ua_static.vcproj (original)
+++ freeswitch/branches/greenlizard/libs/win32/sofia/libsofia_sip_ua_static.vcproj Sun Jul 8 22:28:40 2007
@@ -26,7 +26,7 @@
>
<Tool
Name="VCPreBuildEventTool"
- CommandLine="if not exist "$(ProjectDir)..\..\sofia-sip\win32\gawk.exe" cscript /nologo "$(ProjectDir)..\util.vbs" Get http://svn.freeswitch.org/downloads/win32/gawk.exe "$(ProjectDir)..\..\sofia-sip\win32\"
cd /D "$(ProjectDir)..\..\sofia-sip\win32\"
"autogen.cmd"
"
+ CommandLine="if not exist "$(ProjectDir)..\..\sofia-sip\win32\gawk.exe" cscript /nologo "$(ProjectDir)..\util.vbs" Get http://svn.freeswitch.org/downloads/win32/gawk.exe "$(ProjectDir)..\..\sofia-sip\win32\"
cd /D "$(ProjectDir)..\..\sofia-sip\win32\"
set AWK="$(ProjectDir)..\..\sofia-sip\win32\gawk.exe"
"autogen.cmd"
"
/>
<Tool
Name="VCCustomBuildTool"
@@ -105,7 +105,7 @@
>
<Tool
Name="VCPreBuildEventTool"
- CommandLine="if not exist "$(ProjectDir)..\..\sofia-sip\win32\gawk.exe" cscript /nologo "$(ProjectDir)..\util.vbs" Get http://svn.freeswitch.org/downloads/win32/gawk.exe "$(ProjectDir)..\..\sofia-sip\win32\"
cd /D "$(ProjectDir)..\..\sofia-sip\win32\"
"autogen.cmd"
"
+ CommandLine="if not exist "$(ProjectDir)..\..\sofia-sip\win32\gawk.exe" cscript /nologo "$(ProjectDir)..\util.vbs" Get http://svn.freeswitch.org/downloads/win32/gawk.exe "$(ProjectDir)..\..\sofia-sip\win32\"
cd /D "$(ProjectDir)..\..\sofia-sip\win32\"
set AWK="$(ProjectDir)..\..\sofia-sip\win32\gawk.exe"
"autogen.cmd"
"
/>
<Tool
Name="VCCustomBuildTool"
Modified: freeswitch/branches/greenlizard/libs/xmlrpc-c/lib/abyss/src/conn.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/xmlrpc-c/lib/abyss/src/conn.c (original)
+++ freeswitch/branches/greenlizard/libs/xmlrpc-c/lib/abyss/src/conn.c Sun Jul 8 22:28:40 2007
@@ -277,7 +277,7 @@
{
char *p,*t;
abyss_bool first=TRUE;
- uint32_t to,start;
+ clock_t to,start;
p=*z=c->buffer+c->bufferpos;
start=clock();
Modified: freeswitch/branches/greenlizard/scripts/contrib/trixter/faxlib.jm
==============================================================================
--- freeswitch/branches/greenlizard/scripts/contrib/trixter/faxlib.jm (original)
+++ freeswitch/branches/greenlizard/scripts/contrib/trixter/faxlib.jm Sun Jul 8 22:28:40 2007
@@ -1,5 +1,13 @@
// -*- mode:c; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil; -*-
/*
+ *
+ * THIS IS DEPRECATED NOW - THERE IS A FUNCTION IN DPTOOLS THAT LETS YOU DO MOST
+ * OF THIS WITHOUT USING THIS SCRIPT. DIRECT TRANSFER ON FAX CNG DETECT
+ * THIS IS HERE FOR REFERENCE AND HOW YOU MIGHT EMAIL A PDF OF A FAX
+ *
+ */
+
+/*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
Modified: freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-cdr/Parse_XML_CDR.php
==============================================================================
--- freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-cdr/Parse_XML_CDR.php (original)
+++ freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-cdr/Parse_XML_CDR.php Sun Jul 8 22:28:40 2007
@@ -9,6 +9,7 @@
var $_level = 0;
function Parse_CDR_XML(&$data,$showattribs = false) {
+ $data = preg_replace("/<(.*?)><(.*?)><\/(.*?)>/","<\\1>\\2</\\3>",$data);
$this->_showAttribs = $showattribs;
$this->_parser = xml_parser_create();
@@ -74,6 +75,8 @@
if (!isset($start[$name])) $start[$name] = '';
$add = '';
}
+
+
$update = &$start[$name];
if ($isattribs && !$this->_showAttribs) return;
Modified: freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-cdr/README
==============================================================================
--- freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-cdr/README (original)
+++ freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-cdr/README Sun Jul 8 22:28:40 2007
@@ -1,11 +1,23 @@
To use this you need to have the mod_xml_cdr loaded and configured.
+If you use either errLogDir or logDir then make sure that the directories
+exist. In the case of logDir the original code appended "/xml_cdr" onto
+the value, so I do that as well. If logDir is set but empty (value="")
+it will use the FreeSWITCH default log dir and appent "/xml_cdr" onto
+that.
+
<configuration name="xml_cdr.conf" description="XML CDR CURL logger">
<settings>
+ <!-- the credentials we may optionally use when POSTing ->
<param name="cred" value="user:pass"/>
+ <!-- url to log to -->
<param name="url" value="http://myhost/cdr.php"/>
+ <!-- how many times we retry not counting the inital try -->
<param name="retries" value="2"/>
+ <!-- how many seconds before we try again -->
<param name="delay" value="120"/>
+ <!-- this is where we log failed POSTs to the webserver -->
+ <param name="errLogDir" value="/usr/local/freeswitch/log/xml_cdr_errors"/>
<!-- optional: if not present we do not log every record to disk -->
<!-- per original code base /xml_cdr is appended to the directory name -->
Modified: freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/README
==============================================================================
--- freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/README (original)
+++ freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/README Sun Jul 8 22:28:40 2007
@@ -1 +1,57 @@
+This is an example that will respond to mod_xml_curl requests for information.
+It uses modules, which are contained in the modules subdirectory. If a module
+(any file ending in .php) is in the dir it will be loaded. If it registers
+to handle a specific type of xml_curl request, that will be passed to the function named.
+If you dont have a module for a specific type of data, for example directory, then
+a 404 will be returned to FreeSWITCH.
+
+The module nature allows you to more easily turn on/off different components.
+
+Its a template based system, which relies on someone authenticating, such as with
+.htaccess. Their username is used in this default example for their configuration
+files. This allows for multiple switches to identify themselves uniquely, as well
+as giving you the ability to have different templates for different switches.
+
+
+
+
+
+If you do configuration via mod_xml_curl you only need to load and configure
+mod_xml_curl from freeswitch.xml, all other modules and their configs do not
+need to be present. I do suggest that you load loggers before xml_curl though.
+
+If you load modules *before* loading xml_curl they will be loaded from the static
+xml file, only *after* loading xml_curl will stuff start to be pulled from the
+webserver. Seems logical but some people dont think about it and wonder why
+it doesnt work.
+
+
+
+
+
+
+The default examples require a .htaccess user to be authed with. If you dont
+want to do this (I recommend that you do password protect it) you can optionally
+just add the following somewhere near the top of curlrouting.php
+
+$_SERVER['REMOTE_USER']='switch1';
+
+which will set the username to 'switch1' which is the default user in this example
+
+
+
+
+PREREQUISITES
You will need to get smarty from http://smarty.php.net to make this work
+
+If you install it globally, edit your php.ini to make the Smarty/libs dir as part
+of the search path, otherwise add the following to curlrouting.php near the other
+ini_set line. Adjust it to suit your particular setup.
+
+ini_set("include_path",".:/usr/local/lib/php:/usr/share/php:./Smarty-2.6.18/libs");
+
+
+
+You also must create a directory named templates_c where you install this, its a smarty
+requirement for caching templates. This directory *must* be writable by the webserver
+or Smarty will not properly operate.
Modified: freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/curlrouting.php
==============================================================================
--- freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/curlrouting.php (original)
+++ freeswitch/branches/greenlizard/scripts/contrib/trixter/xml-curl/curlrouting.php Sun Jul 8 22:28:40 2007
@@ -1,65 +1,28 @@
<?php // -*- mode:c; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil; -*-
Header("Content-type: text/plain");
-ini_set("include_path",".:/usr/local/lib/php:/usr/share/php:./Smarty-2.6.18/libs");
+$callBacks = Array();
+ini_set("magic_quotes_gpc","Off");
include_once('Smarty.class.php');
-
-if (isset($_POST['section']) && $_POST['section']=="dialplan") {
- // create a new smarty object
- $smarty = new Smarty();
- $template = 'fail.tpl';
-
-
- // see if they authenticated via .htaccess
- if(isset($_SERVER['REMOTE_USER']) && $_SERVER['REMOTE_USER']!="") {
- // we might check a database for the route, but in this example we hardcode it
- $template = 'frompstn.tpl'; // one can exist for each profile or channel type or ...
-
- $ACTION['javascript']="somethingcool.js";
- $ACTION['bridge']="sofia/external/".$_POST['destination_number']."@myprovider.tld";
- $smarty->assign('ACTION',$ACTION);
-
- } // end - they were logged in
- $smarty->display($_SERVER['DOCUMENT_ROOT']."/templates/".$_SERVER['REMOTE_USER']."/".$template);
-} else if (isset($_POST['section']) && $_POST['section']=="configuration") {
- $smarty = new Smarty();
- $template = $_POST['key_value'].".tpl";
- switch($_POST['key_value']) {
- case "conference.conf":
- // simulate data from a database, perhaps a table with 3 columns did,value,args
- $digits['pin'] = '1234';
- $digits['anounce-count'] = '2';
- $digits['max-mmebers'] = '15';
- $digits['energy-level'] = '300';
- $params['0'] = 'event';
- $params['1'] = 'event';
- $params['2'] = 'event';
- $params['3'] = 'event';
- $params['4'] = 'event';
- $params['5'] = 'event';
- $params['6'] = 'event';
- $params['7'] = 'event';
- $params['8'] = 'event';
- $params['9'] = 'event';
- $params['#'] = 'event';
- $params['*'] = 'event';
+// load the modules
+$dh = @opendir("./modules") or die("Unable to open modules dir");
+while ($file = readdir($dh)) {
+ if(preg_match("/.*\.php$/i",$file)) {
+ include_once("modules/$file");
+ }
+}
- $smarty->assign('CONFNAME',$_POST['conf_name']);
- $smarty->assign('digits',$digits);
- $smarty->assign('params',$params);
- }
- if($smarty->template_exists($_SERVER['DOCUMENT_ROOT']."/templates/".$_SERVER['REMOTE_USER']."/".$template)) {
- $smarty->display($_SERVER['DOCUMENT_ROOT']."/templates/".$_SERVER['REMOTE_USER']."/".$template);
- } else {
- // //logCallData();
- error_log("Unable to locate template $template");
- $smarty->assign('CONFNAME',$_POST['key_value']);
- $smarty->display($_SERVER['DOCUMENT_ROOT']."/templates/".$_SERVER['REMOTE_USER']."/default.conf.tpl");
- }
-} else if (isset($_POST['section']) && $_POST['section']=="directory") {
- // we dont do anything but you get the idea
+if(isset($_POST['section'])) {
+ if(isset($callBacks[$_POST['section']])) {
+ if(call_user_func($callBacks[$_POST['section']])==TRUE) {
+ exit;
+ }
+ }
}
+Header("HTTP/1.0 404 Not Found");
+echo "Not Found";
+exit;
?>
Modified: freeswitch/branches/greenlizard/src/include/switch_loadable_module.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch_loadable_module.h (original)
+++ freeswitch/branches/greenlizard/src/include/switch_loadable_module.h Sun Jul 8 22:28:40 2007
@@ -256,7 +256,7 @@
\param filename the path to the module's dll or so file
\return SWITCH_STATUS_SUCCESS on a successful load
*/
-SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename);
+SWITCH_MOD_DECLARE(switch_status_t) switch_module_load( switch_loadable_module_interface_t **module_interface, char *filename);
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void);
/*!
Modified: freeswitch/branches/greenlizard/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch_module_interfaces.h (original)
+++ freeswitch/branches/greenlizard/src/include/switch_module_interfaces.h Sun Jul 8 22:28:40 2007
@@ -53,7 +53,8 @@
SWITCH_SHN_ON_LOOPBACK,
SWITCH_SHN_ON_TRANSMIT,
SWITCH_SHN_ON_HOLD,
- SWITCH_SHN_ON_HIBERNATE
+ SWITCH_SHN_ON_HIBERNATE,
+ SWITCH_SHN_ON_RESET,
} switch_state_handler_name_t;
struct switch_state_handler_table {
@@ -73,6 +74,8 @@
switch_state_handler_t on_hold;
/*! executed when the state changes to hibernate */
switch_state_handler_t on_hibernate;
+ /*! executed when the state changes to reset */
+ switch_state_handler_t on_reset;
void *padding[10];
};
@@ -281,6 +284,9 @@
switch_buffer_t *audio_buffer;
uint32_t thresh;
uint32_t silence_hits;
+ uint32_t offset_pos;
+ uint32_t last_pos;
+ int32_t vol;
};
/*! \brief Abstract interface to an asr module */
Modified: freeswitch/branches/greenlizard/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch_types.h (original)
+++ freeswitch/branches/greenlizard/src/include/switch_types.h Sun Jul 8 22:28:40 2007
@@ -527,6 +527,7 @@
CS_LOOPBACK - Channel is in loopback
CS_HOLD - Channel is on hold
CS_HIBERNATE - Channel is in a sleep state
+CS_RESET - Channel is in a reset state
CS_HANGUP - Channel is flagged for hangup and ready to end
CS_DONE - Channel is ready to be destroyed and out of the state machine
</pre>
@@ -540,6 +541,7 @@
CS_LOOPBACK,
CS_HOLD,
CS_HIBERNATE,
+ CS_RESET,
CS_HANGUP,
CS_DONE
} switch_channel_state_t;
Modified: freeswitch/branches/greenlizard/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/branches/greenlizard/src/mod/applications/mod_commands/mod_commands.c Sun Jul 8 22:28:40 2007
@@ -311,6 +311,19 @@
return SWITCH_STATUS_SUCCESS;
}
+
+SWITCH_STANDARD_API(uuid_function)
+{
+ switch_uuid_t uuid;
+ char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
+
+ switch_uuid_get(&uuid);
+ switch_uuid_format(uuid_str, &uuid);
+ stream->write_function(stream, "%s", uuid_str);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
#define SCHED_TRANSFER_SYNTAX "[+]<time> <uuid> <extension> [<dialplan>] [<context>]"
SWITCH_STANDARD_API(sched_transfer_function)
{
@@ -1282,7 +1295,7 @@
SWITCH_ADD_API(commands_api_interface, "break", "Break", break_function, BREAK_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "show", "Show", show_function, SHOW_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "status", "status", status_function, "");
- SWITCH_ADD_API(commands_api_interface, "uuid_bridge", "uuid_bridge", uuid_bridge_function, UUID_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "uuid_bridge", "uuid_bridge", uuid_bridge_function, "");
SWITCH_ADD_API(commands_api_interface, "session_displace", "session displace", session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]");
SWITCH_ADD_API(commands_api_interface, "session_record", "session record", session_record_function, SESS_REC_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "broadcast", "broadcast", uuid_broadcast_function, BROADCAST_SYNTAX);
@@ -1294,6 +1307,7 @@
SWITCH_ADD_API(commands_api_interface, "sched_hangup", "Schedule a running call to hangup", sched_hangup_function, SCHED_HANGUP_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "sched_broadcast", "Schedule a broadcast event to a running call", sched_broadcast_function, SCHED_BROADCAST_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "sched_transfer", "Schedule a broadcast event to a running call", sched_transfer_function, SCHED_TRANSFER_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "create_uuid", "Create a uuid", uuid_function, UUID_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "sched_api", "Schedule an api command", sched_api_function, "[+]<time> <group_name> <command_string>");
SWITCH_ADD_API(commands_api_interface, "sched_del", "Delete a Scheduled task", sched_del_function, "<task_id>|<group_id>");
SWITCH_ADD_API(commands_api_interface, "xml_wrap", "Wrap another api command in xml", xml_wrap_api_function, "<command> <args>");
Modified: freeswitch/branches/greenlizard/src/mod/codecs/mod_l16/mod_l16.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/codecs/mod_l16/mod_l16.c (original)
+++ freeswitch/branches/greenlizard/src/mod/codecs/mod_l16/mod_l16.c Sun Jul 8 22:28:40 2007
@@ -55,7 +55,7 @@
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
unsigned int *flag)
{
- printf("WTF %d %d\n", codec->implementation->samples_per_second , other_codec->implementation->samples_per_second );
+
/* NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary. */
if (codec && other_codec && codec->implementation && other_codec->implementation && codec->implementation->samples_per_second != other_codec->implementation->samples_per_second) {
memcpy(encoded_data, decoded_data, decoded_data_len);
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_iax/mod_iax.c (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_iax/mod_iax.c Sun Jul 8 22:28:40 2007
@@ -345,7 +345,6 @@
unsigned short samples = iax_build_codec_rates();
unsigned short mixed = ((tech_pvt->samprate ? tech_pvt->samprate : *samprate) & samples);
- //printf("\n\n******WTF %u %u %u\n******\n", *samprate, samples, mixed);
srate = 8000;
if (mixed & IAX_RATE_16KHZ) {
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_portaudio/mod_portaudio.c Sun Jul 8 22:28:40 2007
@@ -242,6 +242,8 @@
switch_channel_mark_ring_ready(channel);
while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
+ switch_size_t olen = globals.timer.samples;
+
if (switch_time_now() - last >= waitsec) {
char buf[512];
switch_event_t *event;
@@ -254,25 +256,22 @@
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
}
-
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf);
last = switch_time_now();
- if (ring_file) {
+ }
+
+ if (ring_file) {
+ if (switch_core_timer_next(&globals.timer) != SWITCH_STATUS_SUCCESS) {
+ switch_core_file_close(&fh);
+ break;
+ }
+ switch_core_file_read(&fh, abuf, &olen);
+ if (olen == 0) {
unsigned int pos = 0;
switch_core_file_seek(&fh, &pos, 0, SEEK_SET);
- for (;;) {
- switch_size_t olen = 1024;
- switch_core_file_read(&fh, abuf, &olen);
- if (olen == 0) {
- break;
- }
- WriteAudioStream(globals.ring_stream, abuf, (long) olen, &globals.timer);
- }
}
+ WriteAudioStream(globals.ring_stream, abuf, (long) olen, &globals.timer);
}
-
- switch_yield(globals.read_codec.implementation->microseconds_per_frame);
-
}
switch_clear_flag_locked((&globals), GFLAG_RING);
}
@@ -619,7 +618,7 @@
if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
globals.read_codec.implementation->samples_per_frame,
&globals.timer)) == 0) {
-
+ switch_mutex_unlock(globals.device_lock);
goto cng;
} else {
globals.read_frame.datalen = samples * 2;
Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_glue.c Sun Jul 8 22:28:40 2007
@@ -865,7 +865,7 @@
}
if (!((tech_pvt->profile->pflags & PFLAG_REWRITE_TIMESTAMPS) ||
- ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_rewrite_timestamps")) && switch_true(val)))) {
+ ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_rewrite_timestamps")) && !switch_true(val)))) {
flags |= SWITCH_RTP_FLAG_RAW_WRITE;
}
Modified: freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Sun Jul 8 22:28:40 2007
@@ -930,6 +930,29 @@
}
return SWITCH_STATUS_FALSE;
+ } else if (!strncasecmp(ret, "volume", 6)) {
+ char *p;
+
+ if ((p = strchr(ret, ':'))) {
+ p++;
+ if (*p == '+' || *p == '-') {
+ int step;
+ if (!(step = atoi(p))) {
+ step = 1;
+ }
+ fh->vol += step;
+ } else {
+ int vol = atoi(p);
+ fh->vol = vol;
+ }
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if (fh->vol) {
+ switch_normalize_volume(fh->vol);
+ }
+
+ return SWITCH_STATUS_FALSE;
} else if (!strcasecmp(ret, "pause")) {
if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
switch_clear_flag(fh, SWITCH_FILE_PAUSE);
@@ -1361,8 +1384,8 @@
switch_file_handle_t fh = { 0 };
JSFunction *function;
switch_input_args_t args = { 0 };
- char *prebuf;
-
+ char *prebuf, posbuf[35] = "";
+
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
@@ -1420,6 +1443,9 @@
JS_ResumeRequest(cx, cb_state.saveDepth);
*rval = cb_state.ret;
+ snprintf(posbuf, sizeof(posbuf), "%u", fh.offset_pos);
+ switch_channel_set_variable(channel, "last_file_position", posbuf);
+
return JS_TRUE;
}
@@ -1768,15 +1794,19 @@
CHANNEL_SANITY_CHECK();
- if (argc > 1) {
+ if (argc > 0) {
const switch_application_interface_t *application_interface;
char *app_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- char *app_arg = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+ char *app_arg = NULL;
struct js_session *jss = JS_GetPrivate(cx, obj);
jsrefcount saveDepth;
METHOD_SANITY_CHECK();
+ if (argc > 1) {
+ app_arg = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+ }
+
if ((application_interface = switch_loadable_module_get_application_interface(app_name))) {
if (application_interface->application_function) {
saveDepth = JS_SuspendRequest(cx);
Modified: freeswitch/branches/greenlizard/src/switch_channel.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_channel.c (original)
+++ freeswitch/branches/greenlizard/src/switch_channel.c Sun Jul 8 22:28:40 2007
@@ -139,9 +139,13 @@
uint8_t x;
switch_call_cause_t cause = SWITCH_CAUSE_UNALLOCATED;
- for (x = 0; CAUSE_CHART[x].name; x++) {
- if (!strcasecmp(CAUSE_CHART[x].name, str)) {
- cause = CAUSE_CHART[x].cause;
+ if (*str > 47 && *str < 58) {
+ cause = atoi(str);
+ } else {
+ for (x = 0; CAUSE_CHART[x].name; x++) {
+ if (!strcasecmp(CAUSE_CHART[x].name, str)) {
+ cause = CAUSE_CHART[x].cause;
+ }
}
}
return cause;
@@ -509,7 +513,8 @@
assert(channel != NULL);
- if (!channel->hangup_cause && channel->state > CS_RING && channel->state < CS_HANGUP && !switch_test_flag(channel, CF_TRANSFER)) {
+ if (!channel->hangup_cause && channel->state > CS_RING && channel->state < CS_HANGUP && channel->state != CS_RESET &&
+ !switch_test_flag(channel, CF_TRANSFER)) {
ret++;
}
@@ -525,6 +530,7 @@
"CS_LOOPBACK",
"CS_HOLD",
"CS_HIBERNATE",
+ "CS_RESET",
"CS_HANGUP",
"CS_DONE",
NULL
@@ -589,6 +595,7 @@
switch (last_state) {
case CS_NEW:
+ case CS_RESET:
switch (state) {
default:
ok++;
@@ -604,6 +611,7 @@
case CS_EXECUTE:
case CS_HOLD:
case CS_HIBERNATE:
+ case CS_RESET:
ok++;
default:
break;
@@ -617,6 +625,7 @@
case CS_EXECUTE:
case CS_HOLD:
case CS_HIBERNATE:
+ case CS_RESET:
ok++;
default:
break;
@@ -630,6 +639,7 @@
case CS_EXECUTE:
case CS_HOLD:
case CS_HIBERNATE:
+ case CS_RESET:
ok++;
default:
break;
@@ -643,6 +653,7 @@
case CS_EXECUTE:
case CS_TRANSMIT:
case CS_HIBERNATE:
+ case CS_RESET:
ok++;
default:
break;
@@ -655,6 +666,7 @@
case CS_EXECUTE:
case CS_TRANSMIT:
case CS_HOLD:
+ case CS_RESET:
ok++;
default:
break;
@@ -669,6 +681,7 @@
case CS_TRANSMIT:
case CS_HOLD:
case CS_HIBERNATE:
+ case CS_RESET:
ok++;
default:
break;
@@ -682,6 +695,7 @@
case CS_RING:
case CS_HOLD:
case CS_HIBERNATE:
+ case CS_RESET:
ok++;
default:
break;
@@ -752,6 +766,7 @@
if (channel->state_flags) {
channel->flags |= channel->state_flags;
channel->state_flags = 0;
+
}
switch_mutex_unlock(channel->flag_mutex);
Modified: freeswitch/branches/greenlizard/src/switch_core.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_core.c (original)
+++ freeswitch/branches/greenlizard/src/switch_core.c Sun Jul 8 22:28:40 2007
@@ -398,6 +398,8 @@
switch_uuid_t uuid;
memset(&runtime, 0, sizeof(runtime));
+ runtime.no_new_sessions = 1;
+
/* INIT APR and Create the pool context */
if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
*err = "FATAL ERROR! Could not initilize APR\n";
@@ -577,6 +579,9 @@
"\nFreeSWITCH Version %s Started.\nCrash Protection [%s]\nMax Sessions[%u]\n\n", SWITCH_VERSION_FULL,
runtime.crash_prot ? "Enabled" : "Disabled",
switch_core_session_limit(0));
+
+ runtime.no_new_sessions = 0;
+
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/greenlizard/src/switch_core_file.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_core_file.c (original)
+++ freeswitch/branches/greenlizard/src/switch_core_file.c Sun Jul 8 22:28:40 2007
@@ -110,11 +110,17 @@
SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh, unsigned int *cur_pos, int64_t samples, int whence)
{
+ switch_status_t status;
+
assert(fh != NULL);
assert(fh->file_interface != NULL);
switch_set_flag(fh, SWITCH_FILE_SEEK);
- return fh->file_interface->file_seek(fh, cur_pos, samples, whence);
+ status = fh->file_interface->file_seek(fh, cur_pos, samples, whence);
+ if (samples) {
+ fh->offset_pos = *cur_pos;
+ }
+ return status;
}
SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(switch_file_handle_t *fh, switch_audio_col_t col, const char *string)
Modified: freeswitch/branches/greenlizard/src/switch_core_io.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_core_io.c (original)
+++ freeswitch/branches/greenlizard/src/switch_core_io.c Sun Jul 8 22:28:40 2007
@@ -659,8 +659,6 @@
rate = session->write_codec->implementation->samples_per_second;
}
- printf("WTF %d %d %d\n", rate, enc_frame->datalen, session->enc_write_frame.datalen);
-
status = switch_core_codec_encode(session->write_codec,
frame->codec,
enc_frame->data,
Modified: freeswitch/branches/greenlizard/src/switch_core_session.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_core_session.c (original)
+++ freeswitch/branches/greenlizard/src/switch_core_session.c Sun Jul 8 22:28:40 2007
@@ -767,7 +767,10 @@
switch_uuid_t uuid;
uint32_t count = 0;
- assert(endpoint_interface != NULL);
+ if (!switch_core_ready() || endpoint_interface == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "The system cannot create any sessions at this time.\n");
+ return NULL;
+ }
switch_mutex_lock(session_manager.session_table_mutex);
count = session_manager.session_count;
@@ -778,11 +781,6 @@
return NULL;
}
- if (!switch_core_ready()) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read my lips: no new sessions!\n");
- return NULL;
- }
-
if (pool && *pool) {
usepool = *pool;
*pool = NULL;
Modified: freeswitch/branches/greenlizard/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_core_state_machine.c (original)
+++ freeswitch/branches/greenlizard/src/switch_core_state_machine.c Sun Jul 8 22:28:40 2007
@@ -47,6 +47,14 @@
}
+static void switch_core_standard_on_reset(switch_core_session_t *session)
+{
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard RESET %s\n",
+ switch_channel_get_name(session->channel));
+
+}
+
static void switch_core_standard_on_ring(switch_core_session_t *session)
{
switch_dialplan_interface_t *dialplan_interface = NULL;
@@ -433,6 +441,41 @@
}
}
break;
+ case CS_RESET: /* Look for a dialplan and find something to do */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State RESET\n", switch_channel_get_name(session->channel));
+ if (!driver_state_handler->on_reset
+ || (driver_state_handler->on_reset && driver_state_handler->on_reset(session) == SWITCH_STATUS_SUCCESS
+ && midstate == switch_channel_get_state(session->channel))) {
+ while ((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) {
+ if (!application_state_handler || !application_state_handler->on_reset
+ || (application_state_handler->on_reset
+ && application_state_handler->on_reset(session) == SWITCH_STATUS_SUCCESS
+ && midstate == switch_channel_get_state(session->channel))) {
+ proceed++;
+ continue;
+ } else {
+ proceed = 0;
+ break;
+ }
+ }
+ index = 0;
+ while (proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) {
+ if (!application_state_handler || !application_state_handler->on_reset ||
+ (application_state_handler->on_reset &&
+ application_state_handler->on_reset(session) == SWITCH_STATUS_SUCCESS
+ && midstate == switch_channel_get_state(session->channel))) {
+ proceed++;
+ continue;
+ } else {
+ proceed = 0;
+ break;
+ }
+ }
+ if (proceed) {
+ switch_core_standard_on_reset(session);
+ }
+ }
+ break;
case CS_EXECUTE: /* Execute an Operation */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State EXECUTE\n", switch_channel_get_name(session->channel));
if (!driver_state_handler->on_execute
Modified: freeswitch/branches/greenlizard/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_ivr_bridge.c (original)
+++ freeswitch/branches/greenlizard/src/switch_ivr_bridge.c Sun Jul 8 22:28:40 2007
@@ -262,11 +262,27 @@
};
+static switch_status_t uuid_bridge_on_reset(switch_core_session_t *session)
+{
+ switch_channel_t *channel = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM RESET\n");
+
+ if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
+ switch_channel_set_state(channel, CS_TRANSMIT);
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
static switch_status_t uuid_bridge_on_transmit(switch_core_session_t *session)
{
switch_channel_t *channel = NULL;
switch_core_session_t *other_session;
+ char *other_uuid = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -274,13 +290,13 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM TRANSMIT\n");
switch_channel_clear_state_handler(channel, NULL);
- switch_channel_set_flag(channel, CF_BREAK);
-
if (!switch_channel_test_flag(channel, CF_ORIGINATOR)) {
+ switch_channel_set_flag(channel, CF_TAGGED);
return SWITCH_STATUS_FALSE;
}
-
- if ((other_session = switch_channel_get_private(channel, SWITCH_UUID_BRIDGE))) {
+
+ if ((other_uuid = switch_channel_get_variable(channel, SWITCH_UUID_BRIDGE)) &&
+ (other_session = switch_core_session_locate(other_uuid))) {
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
switch_channel_state_t state = switch_channel_get_state(other_channel);
switch_channel_state_t mystate = switch_channel_get_state(channel);
@@ -288,20 +304,19 @@
uint8_t ready_a, ready_b;
switch_caller_profile_t *profile, *new_profile;
-
- switch_channel_clear_flag(channel, CF_TRANSFER);
- switch_channel_set_private(channel, SWITCH_UUID_BRIDGE, NULL);
-
- while (mystate <= CS_HANGUP && state <= CS_HANGUP && !switch_channel_test_flag(other_channel, CF_TAGGED)) {
+ switch_channel_set_variable(channel, SWITCH_UUID_BRIDGE, NULL);
+ switch_channel_set_state(other_channel, CS_TRANSMIT);
+ for(;;) {
+ if (mystate >= CS_HANGUP || state >= CS_HANGUP || switch_channel_test_flag(other_channel, CF_TAGGED)) {
+ break;
+ }
switch_yield(1000);
state = switch_channel_get_state(other_channel);
mystate = switch_channel_get_state(channel);
}
-
+ switch_channel_clear_flag(channel, CF_TRANSFER);
switch_channel_clear_flag(other_channel, CF_TRANSFER);
switch_channel_clear_flag(other_channel, CF_TAGGED);
-
-
switch_core_session_reset(session);
switch_core_session_reset(other_session);
@@ -316,6 +331,7 @@
if (!ready_b) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
+ switch_core_session_rwunlock(other_session);
return SWITCH_STATUS_FALSE;
}
@@ -348,6 +364,7 @@
}
switch_ivr_multi_threaded_bridge(session, other_session, NULL, NULL, NULL);
+ switch_core_session_rwunlock(other_session);
} else {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
@@ -364,7 +381,9 @@
/*.on_hangup */ NULL,
/*.on_loopback */ NULL,
/*.on_transmit */ uuid_bridge_on_transmit,
- /*.on_hold */ NULL
+ /*.on_hold */ NULL,
+ /*.on_hibernate*/ NULL,
+ /*.on_reset*/ uuid_bridge_on_reset
};
static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session)
@@ -654,29 +673,21 @@
switch_channel_set_flag(originator_channel, CF_ORIGINATOR);
switch_channel_add_state_handler(originator_channel, &uuid_bridge_state_handlers);
switch_channel_add_state_handler(originatee_channel, &uuid_bridge_state_handlers);
- switch_channel_set_flag(originatee_channel, CF_TAGGED);
- switch_channel_set_private(originator_channel, SWITCH_UUID_BRIDGE, originatee_session);
-
+ switch_channel_set_variable(originator_channel, SWITCH_UUID_BRIDGE, switch_core_session_get_uuid(originatee_session));
+
switch_channel_set_flag(originator_channel, CF_BREAK);
switch_channel_set_flag(originatee_channel, CF_BREAK);
- /* switch_channel_set_state_flag sets flags you want to be set when the next state change happens */
- switch_channel_set_state_flag(originator_channel, CF_TRANSFER);
- switch_channel_set_state_flag(originatee_channel, CF_TRANSFER);
-
/* change the states and let the chips fall where they may */
- switch_channel_set_state(originator_channel, CS_TRANSMIT);
- switch_channel_set_state(originatee_channel, CS_TRANSMIT);
+ switch_channel_set_state(originator_channel, CS_RESET);
+ switch_channel_set_state(originatee_channel, CS_RESET);
+
+ status = SWITCH_STATUS_SUCCESS;
/* release the read locks we have on the channels */
switch_core_session_rwunlock(originator_session);
switch_core_session_rwunlock(originatee_session);
- status = SWITCH_STATUS_SUCCESS;
-
- while (switch_channel_get_state(originatee_channel) < CS_HANGUP && switch_channel_test_flag(originatee_channel, CF_TAGGED)) {
- switch_yield(20000);
- }
} else {
switch_core_session_rwunlock(originator_session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no channel for originatee uuid %s\n", originatee_uuid);
Modified: freeswitch/branches/greenlizard/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_ivr_play_say.c (original)
+++ freeswitch/branches/greenlizard/src/switch_ivr_play_say.c Sun Jul 8 22:28:40 2007
@@ -394,7 +394,7 @@
for(;;) {
switch_size_t len;
-
+
if (!switch_channel_ready(channel)) {
status = SWITCH_STATUS_FALSE;
break;
@@ -547,7 +547,7 @@
for(;;) {
switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0);
-
+
if (!switch_channel_ready(channel)) {
status = SWITCH_STATUS_FALSE;
break;
@@ -556,6 +556,7 @@
if (switch_channel_test_flag(channel, CF_BREAK)) {
switch_channel_clear_flag(channel, CF_BREAK);
+ status = SWITCH_STATUS_BREAK;
break;
}
@@ -691,6 +692,7 @@
if (sample_start > 0) {
uint32_t pos = 0;
+ switch_core_file_seek(fh, &pos, 0, SEEK_SET);
switch_core_file_seek(fh, &pos, sample_start, SEEK_CUR);
}
@@ -799,13 +801,19 @@
ilen = samples;
- while (switch_channel_ready(channel)) {
+ for(;;) {
int done = 0;
int do_speed = 1;
int last_speed = -1;
+ if (!switch_channel_ready(channel)) {
+ status = SWITCH_STATUS_FALSE;
+ break;
+ }
+
if (switch_channel_test_flag(channel, CF_BREAK)) {
switch_channel_clear_flag(channel, CF_BREAK);
+ status = SWITCH_STATUS_BREAK;
break;
}
@@ -872,6 +880,7 @@
if (done || olen <= 0) {
break;
}
+
if (!asis) {
if (fh->speed > 2) {
@@ -933,8 +942,15 @@
olen = llen;
}
- write_frame.datalen = (uint32_t) (olen * (asis ? 1 : 2));
- write_frame.samples = (uint32_t) olen;
+ write_frame.samples = olen;
+
+ if (asis) {
+ write_frame.datalen = olen;
+ } else {
+ write_frame.datalen = write_frame.samples * 2;
+ }
+
+
llen = olen;
@@ -950,8 +966,13 @@
#endif
stream_id = 0;
- status = switch_core_session_write_frame(session, &write_frame, -1, stream_id);
+ if (fh->vol) {
+ switch_change_sln_volume(write_frame.data, write_frame.datalen / 2, fh->vol);
+ }
+ fh->offset_pos += write_frame.samples / 2;
+ status = switch_core_session_write_frame(session, &write_frame, -1, stream_id);
+
if (status == SWITCH_STATUS_MORE_DATA) {
status = SWITCH_STATUS_SUCCESS;
continue;
@@ -984,6 +1005,8 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done playing file\n");
+ switch_core_file_seek(fh, &fh->last_pos, 0, SEEK_CUR);
+
switch_core_file_close(fh);
switch_buffer_destroy(&fh->audio_buffer);
if (!asis) {
@@ -1176,11 +1199,17 @@
}
ilen = len;
- while (switch_channel_ready(channel)) {
+ for(;;) {
switch_event_t *event;
+ if (!switch_channel_ready(channel)) {
+ status = SWITCH_STATUS_FALSE;
+ break;
+ }
+
if (switch_channel_test_flag(channel, CF_BREAK)) {
switch_channel_clear_flag(channel, CF_BREAK);
+ status = SWITCH_STATUS_BREAK;
break;
}
Modified: freeswitch/branches/greenlizard/src/switch_rtp.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_rtp.c (original)
+++ freeswitch/branches/greenlizard/src/switch_rtp.c Sun Jul 8 22:28:40 2007
@@ -110,7 +110,6 @@
unsigned int out_digit_sofar;
unsigned int out_digit_dur;
uint16_t in_digit_seq;
- uint16_t out_digit_seq;
uint32_t out_digit_ssrc;
int32_t timestamp_dtmf;
char last_digit;
@@ -135,6 +134,7 @@
uint16_t seq;
uint16_t rseq;
+ uint8_t sending_dtmf;
switch_payload_t payload;
switch_payload_t rpayload;
switch_rtp_invalid_handler_t invalid_handler;
@@ -431,7 +431,7 @@
}
-
+ rtp_session->dtmf_data.out_digit_ssrc = ssrc;
rtp_session->pool = pool;
rtp_session->te = 101;
@@ -758,27 +758,26 @@
for (x = 0; x < loops; x++) {
- rtp_session->dtmf_data.out_digit_seq++;
+ rtp_session->seq++;
switch_rtp_write_manual(rtp_session,
rtp_session->dtmf_data.out_digit_packet,
4,
0,
rtp_session->te,
- rtp_session->dtmf_data.timestamp_dtmf, rtp_session->dtmf_data.out_digit_seq, rtp_session->dtmf_data.out_digit_ssrc,
+ rtp_session->dtmf_data.timestamp_dtmf, rtp_session->seq, rtp_session->dtmf_data.out_digit_ssrc,
&flags);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%d sofar=%u dur=%d seq=%d\n",
loops == 1 ? "middle" : "end", rtp_session->dtmf_data.out_digit, rtp_session->dtmf_data.timestamp_dtmf,
- rtp_session->dtmf_data.out_digit_sofar, duration, rtp_session->dtmf_data.out_digit_seq);
+ rtp_session->dtmf_data.out_digit_sofar, duration, rtp_session->seq);
}
- if (loops == 1) {
- rtp_session->last_write_seq = 0;
- } else {
- rtp_session->dtmf_data.out_digit_seq = 0;
+ if (loops != 1) {
+ rtp_session->sending_dtmf = 0;
}
+
}
if (!rtp_session->dtmf_data.out_digit_dur && rtp_session->dtmf_data.dtmf_queue && switch_queue_size(rtp_session->dtmf_data.dtmf_queue)) {
@@ -800,25 +799,24 @@
} else {
rtp_session->dtmf_data.timestamp_dtmf = rtp_session->last_write_ts;
}
-
- rtp_session->dtmf_data.out_digit_seq = rtp_session->last_write_seq;
- rtp_session->dtmf_data.out_digit_ssrc = rtp_session->last_write_ssrc;
-
+
+ rtp_session->sending_dtmf = 1;
for (x = 0; x < 3; x++) {
- rtp_session->dtmf_data.out_digit_seq++;
+ rtp_session->seq++;
switch_rtp_write_manual(rtp_session,
rtp_session->dtmf_data.out_digit_packet,
4,
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BUGGY_2833) ? 0 : 1,
rtp_session->te,
rtp_session->dtmf_data.timestamp_dtmf,
- rtp_session->dtmf_data.out_digit_seq, rtp_session->dtmf_data.out_digit_ssrc, &flags);
+ rtp_session->seq,
+ rtp_session->dtmf_data.out_digit_ssrc, &flags);
switch_log_printf(SWITCH_CHANNEL_LOG,
SWITCH_LOG_DEBUG,
"Send start packet for [%c] ts=%d sofar=%u dur=%d seq=%d\n",
rtp_session->dtmf_data.out_digit,
- rtp_session->dtmf_data.timestamp_dtmf, rtp_session->dtmf_data.out_digit_sofar, 0, rtp_session->dtmf_data.out_digit_seq);
+ rtp_session->dtmf_data.timestamp_dtmf, rtp_session->dtmf_data.out_digit_sofar, 0, rtp_session->seq);
}
rtp_session->dtmf_data.timestamp_dtmf += samples;
free(rdigit);
@@ -1027,6 +1025,7 @@
if ((time(NULL) - rtp_session->dtmf_data.last_digit_time) > 2) {
rtp_session->dtmf_data.last_digit = 0;
rtp_session->dtmf_data.dc = 0;
+ rtp_session->dtmf_data.in_digit_seq = 0;
}
if (in_digit_seq > rtp_session->dtmf_data.in_digit_seq) {
rtp_session->dtmf_data.in_digit_seq = in_digit_seq;
@@ -1295,7 +1294,7 @@
rtp_session->cn = 0;
m++;
}
-
+
send_msg = &rtp_session->send_msg;
send_msg->header.pt = payload;
send_msg->header.m = m ? 1 : 0;
@@ -1424,8 +1423,7 @@
}
}
-
- if (rtp_session->last_write_seq > 0 && rtp_session->last_write_seq <= rtp_session->dtmf_data.out_digit_seq) {
+ if (rtp_session->sending_dtmf) {
send = 0;
}
More information about the Freeswitch-branches
mailing list