aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Crane <mcrane@pfsense.org>2008-12-11 07:02:51 +0000
committerMark Crane <mcrane@pfsense.org>2008-12-11 07:02:51 +0000
commit1860a8c95f4de3333b8e5a6bb1f311b826b525a3 (patch)
tree39d11e04dd39a869c49b0c4fc45db7b9f3add8fd
parentcccfa4887d9ad3df4e72f09ee2de2a721d6dc213 (diff)
downloadpfsense-packages-1860a8c95f4de3333b8e5a6bb1f311b826b525a3.tar.gz
pfsense-packages-1860a8c95f4de3333b8e5a6bb1f311b826b525a3.tar.bz2
pfsense-packages-1860a8c95f4de3333b8e5a6bb1f311b826b525a3.zip
pfSense FreeSWITCH add recording timeout feature to IVR
-rw-r--r--packages/freeswitch/freeswitch.inc87
-rw-r--r--packages/freeswitch/freeswitch.xml2
-rw-r--r--packages/freeswitch/freeswitch_ivr_edit.tmp12
-rw-r--r--pkg_config.7.xml2
4 files changed, 91 insertions, 12 deletions
diff --git a/packages/freeswitch/freeswitch.inc b/packages/freeswitch/freeswitch.inc
index 8fde49fb..3d91c781 100644
--- a/packages/freeswitch/freeswitch.inc
+++ b/packages/freeswitch/freeswitch.inc
@@ -858,8 +858,8 @@ function sync_package_freeswitch_ivr()
$ent['tag'] = 'condition'; //condition, action, antiaction
$ent['fieldtype'] = 'destination_number';
$ent['fielddata'] = '^'.$rowhelper['ivrextension'].'$';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
+ $a_dialplan_include_details[] = $ent;
+ unset($ent);
$ivrid = str_replace(array("{", "}"), "", $rowhelper['ivrid']);
@@ -921,7 +921,6 @@ function sync_package_freeswitch_ivr()
$tmp .= "\n";
$tmp .= " var condition = true;\n";
$tmp .= "\n";
- $tmp .= " var dtmftimeout = 3;\n";
$tmp .= " var domain = \"".$domain."\"; //by default this is the ipv4 address of FreeSWITCH used for transfer to voicemail\n";
$tmp .= " var digitmaxlength = 0;\n";
$tmp .= " var objdate = new Date();\n";
@@ -989,7 +988,43 @@ function sync_package_freeswitch_ivr()
$tmp .= " while (session.ready() && ! exit ) {\n";
$tmp .= " //session.streamFile( \"C:/Program Files/FreeSWITCH/sounds/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n";
$tmp .= " session.streamFile( \"/usr/local/freeswitch/recordings/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n";
- $tmp .= " //session.collectInput( mycb, dtmf, dtmftimeout );\n";
+ $tmp .= " if (session.ready()) {\n";
+ $tmp .= " if (dtmf.digits == 0) {\n";
+ $tmp .= " dtmf.digits += session.getDigits(1, "#", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n";
+ $tmp .= " if (dtmf.digits == 0) {\n";
+ //$tmp .= " console_log( "info", "time out option: " + dtmf.digits + "\n" );\n";
+
+
+ //find the timeout IVR options with the correct action
+ if (count($a_ivr_options) > 0) {
+ foreach($a_ivr_options as $row) {
+
+ if ($row['ivrid'] == $rowhelper['ivrid']) {
+
+ if ($row['optionaction'] == "action") {
+
+ if ($row['optiontype'] == "extension") {
+ $tmp .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n";
+ }
+ if ($row['optiontype'] == "voicemail") {
+ //$tmp .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n";
+ $tmp .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n";
+ }
+
+ } //end anti-action
+
+ } //end ivrid
+
+ } //end for each
+ } //if count
+
+
+ $tmp .= " }\n";
+ $tmp .= " else {\n";
+ $tmp .= " break; //dtmf found end the while loop\n";
+ $tmp .= " }\n";
+ $tmp .= " }\n";
+ $tmp .= " }\n";
$tmp .= " }\n";
$tmp .= "\n";
$tmp .= " //pickup the remaining digits\n";
@@ -1101,7 +1136,45 @@ function sync_package_freeswitch_ivr()
$tmp .= " digitmaxlength = 1;\n";
$tmp .= " while (session.ready() && ! exit ) {\n";
$tmp .= " session.streamFile( \"/usr/local/freeswitch/recordings/".$recording_antiaction_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n";
- $tmp .= " //session.collectInput( mycb, dtmf, dtmftimeout );\n";
+ $tmp .= " if (session.ready()) {\n";
+ $tmp .= " if (dtmf.digits == 0) {\n";
+ $tmp .= " dtmf.digits += session.getDigits(1, "#", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n";
+ $tmp .= " if (dtmf.digits == 0) {\n";
+ //$tmp .= " console_log( "info", "time out option: " + dtmf.digits + "\n" );\n";
+
+
+ //find the timeout IVR options with the correct action
+ if (count($a_ivr_options) > 0) {
+ foreach($a_ivr_options as $row) {
+
+
+ if ($row['ivrid'] == $rowhelper['ivrid']) {
+
+ if ($row['optionaction'] == "anti-action") {
+
+ if ($row['optiontype'] == "extension") {
+ $tmp .= " session.execute(\"transfer\", \"".$row['optiondest']." XML default\"); //".$row['optiondescr']."\n";
+ }
+ if ($row['optiontype'] == "voicemail") {
+ //$tmp .= " session.execute(\"voicemail\", \"".$row['optiondest']." XML default\");\n";
+ $tmp .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['optiondest']."\");\n";
+ }
+
+ } //end anti-action
+
+ } //end ivrid
+
+
+ } //end for each
+ } //if count
+
+
+ $tmp .= " }\n";
+ $tmp .= " else {\n";
+ $tmp .= " break; //dtmf found end the while loop\n";
+ $tmp .= " }\n";
+ $tmp .= " }\n";
+ $tmp .= " }\n";
$tmp .= " }\n";
$tmp .= "\n";
$tmp .= " //pickup the remaining digits\n";
@@ -1147,7 +1220,7 @@ function sync_package_freeswitch_ivr()
if ($row['optionaction'] == "anti-action") {
- switch ($row['optionnumber']) {
+ switch ($row['optionnumber']) {
case "t":
if ($row['optiontype'] == "extension") {
@@ -1816,7 +1889,7 @@ function freeswitch_php_install_command()
}
$config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_version'] = "1.0.1 revision 10638.";
- $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = "0.3.8";
+ $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = "0.3.9";
conf_mount_ro();
diff --git a/packages/freeswitch/freeswitch.xml b/packages/freeswitch/freeswitch.xml
index 624a199a..e3675b73 100644
--- a/packages/freeswitch/freeswitch.xml
+++ b/packages/freeswitch/freeswitch.xml
@@ -44,7 +44,7 @@
<requirements>Describe your package requirements here</requirements>
<faq>Currently there are no FAQ items provided.</faq>
<name>FreeSWITCH Settings</name>
- <version>0.3.8</version>
+ <version>0.3.9</version>
<title>FreeSWITCH: Settings</title>
<include_file>/usr/local/pkg/freeswitch.inc</include_file>
<menu>
diff --git a/packages/freeswitch/freeswitch_ivr_edit.tmp b/packages/freeswitch/freeswitch_ivr_edit.tmp
index 6eaf8216..71efac2c 100644
--- a/packages/freeswitch/freeswitch_ivr_edit.tmp
+++ b/packages/freeswitch/freeswitch_ivr_edit.tmp
@@ -297,15 +297,21 @@ include("head.inc");
?>
</td>
</tr>
- <!-- reserved for future use -->
- <!--
+ <?php
+ if (strlen($pconfig['ivrtimeout']) == 0) {
+ $pconfig['ivrtimeout'] = 10; //set a default timeout
+ }
+ ?>
<tr>
<td width="22%" valign="top" class="vncellreq">Timeout</td>
<td width="78%" class="vtable">
<input name="ivrtimeout" type="text" class="formfld" id="ivrtimeout" size="40" value="<?=htmlspecialchars($pconfig['ivrtimeout']);?>">
+ <br><span class="vexpl">After the recording concludes the
+ timeout sets the time in seconds to continue to wait for DTMF.
+ If the DTMF is <br />not detected during that time the 't'
+ timeout option is executed.</span>
</td>
</tr>
- -->
<tr>
<td width="22%" valign="top" class="vncell">Context</td>
<td width="78%" class="vtable">
diff --git a/pkg_config.7.xml b/pkg_config.7.xml
index f5bbec89..f950d703 100644
--- a/pkg_config.7.xml
+++ b/pkg_config.7.xml
@@ -49,7 +49,7 @@
<category>Services</category>
<config_file>http://www.pfsense.com/packages/config/freeswitch/freeswitch.xml</config_file>
<depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url>
- <version>0.3.8</version>
+ <version>0.3.9</version>
<status>Beta</status>
<required_version>1.2.1</required_version>
<maintainer>markjcrane@gmail.com</maintainer>