Add ivr menu cid prefix.

This commit is contained in:
Mark Crane
2013-02-12 11:19:52 +00:00
parent 9872b991ee
commit 83d388b822
4 changed files with 34 additions and 2 deletions

View File

@@ -175,6 +175,10 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'ivr_menu_cid_prefix';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'ivr_menu_enabled';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';

View File

@@ -118,6 +118,7 @@ if (count($_POST)>0) {
$ivr_menu_digit_len = check_str($_POST["ivr_menu_digit_len"]);
$ivr_menu_direct_dial = check_str($_POST["ivr_menu_direct_dial"]);
$ivr_menu_ringback = check_str($_POST["ivr_menu_ringback"]);
$ivr_menu_cid_prefix = check_str($_POST["ivr_menu_cid_prefix"]);
$ivr_menu_enabled = check_str($_POST["ivr_menu_enabled"]);
$ivr_menu_description = check_str($_POST["ivr_menu_description"]);
@@ -204,6 +205,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$ivr->ivr_menu_digit_len = $ivr_menu_digit_len;
$ivr->ivr_menu_direct_dial = $ivr_menu_direct_dial;
$ivr->ivr_menu_ringback = $ivr_menu_ringback;
$ivr->ivr_menu_cid_prefix = $ivr_menu_cid_prefix;
$ivr->ivr_menu_enabled = $ivr_menu_enabled;
$ivr->ivr_menu_description = $ivr_menu_description;
@@ -264,6 +266,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$ivr_menu_digit_len = $row["ivr_menu_digit_len"];
$ivr_menu_direct_dial = $row["ivr_menu_direct_dial"];
$ivr_menu_ringback = $row["ivr_menu_ringback"];
$ivr_menu_cid_prefix = $row["ivr_menu_cid_prefix"];
$ivr_menu_enabled = $row["ivr_menu_enabled"];
$ivr_menu_description = $row["ivr_menu_description"];
@@ -646,6 +649,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " CID Prefix:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='ivr_menu_cid_prefix' maxlength='255' value=\"$ivr_menu_cid_prefix\">\n";
echo "<br />\n";
echo "Set a prefix on the caller ID name.\n";
echo "</td>\n";
echo "</tr>\n";
//--- begin: show_advanced -----------------------
echo "<tr>\n";
echo "<td style='padding: 0px;' colspan='2' class='' valign='top' align='left' nowrap>\n";

View File

@@ -53,6 +53,7 @@ require_once "includes/classes/switch_dialplan.php";
public $ivr_menu_digit_len;
public $ivr_menu_direct_dial;
public $ivr_menu_ringback;
public $ivr_menu_cid_prefix;
public $ivr_menu_enabled;
public $ivr_menu_description;
public $ivr_menu_option_uuid;
@@ -324,6 +325,7 @@ require_once "includes/classes/switch_dialplan.php";
$database->fields['ivr_menu_digit_len'] = $this->ivr_menu_digit_len;
$database->fields['ivr_menu_direct_dial'] = $this->ivr_menu_direct_dial;
$database->fields['ivr_menu_ringback'] = $this->ivr_menu_ringback;
$database->fields['ivr_menu_cid_prefix'] = $this->ivr_menu_cid_prefix;
$database->fields['ivr_menu_enabled'] = $this->ivr_menu_enabled;
$database->fields['ivr_menu_description'] = $this->ivr_menu_description;
$database->add();
@@ -435,6 +437,7 @@ require_once "includes/classes/switch_dialplan.php";
$database->fields['ivr_menu_digit_len'] = $this->ivr_menu_digit_len;
$database->fields['ivr_menu_direct_dial'] = $this->ivr_menu_direct_dial;
$database->fields['ivr_menu_ringback'] = $this->ivr_menu_ringback;
$database->fields['ivr_menu_cid_prefix'] = $this->ivr_menu_cid_prefix;
$database->fields['ivr_menu_enabled'] = $this->ivr_menu_enabled;
$database->fields['ivr_menu_description'] = $this->ivr_menu_description;
$database->where[0]['name'] = 'domain_uuid';

View File

@@ -96,8 +96,19 @@
ivr_menu_direct_dial = row["ivr_menu_direct_dial"];
--ivr_menu_description = row["ivr_menu_description"];
ivr_menu_ringback = row["ivr_menu_ringback"];
ivr_menu_cid_prefix = row["ivr_menu_cid_prefix"];
end);
--set the caller id name
caller_id_name = session:getVariable("caller_id_name");
effective_caller_id_name = session:getVariable("effective_caller_id_name");
if (string.len(ivr_menu_cid_prefix) > 0) then
caller_id_name = ivr_menu_cid_prefix .. "#" .. caller_id_name;
effective_caller_id_name = ivr_menu_cid_prefix .. "#" .. effective_caller_id_name;
session:setVariable("caller_id_name", caller_id_name);
session:setVariable("effective_caller_id_name", effective_caller_id_name);
end
--get the sounds dir, language, dialect and voice
sounds_dir = session:getVariable("sounds_dir");
default_language = session:getVariable("default_language");
@@ -151,7 +162,7 @@
end
if (string.len(dtmf_digits) > 0) then
freeswitch.consoleLog("notice", "[ivr_menu] dtmf_digits: " .. dtmf_digits .. "\n");
menu_options(dtmf_digits);
menu_options(session, dtmf_digits);
else
if (tries <= tonumber(ivr_menu_max_failures)) then
--log the dtmf digits
@@ -164,7 +175,7 @@
end
end
function menu_options(digits)
function menu_options(session, digits)
--remove the pound sign
digits = digits:gsub("#", "");