Add account code option to outbound routes.

This commit is contained in:
Mark Crane 2013-09-11 03:49:58 +00:00
parent 73799ec284
commit 8260650afd
2 changed files with 105 additions and 17 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
Portions created by the Initial Developer are Copyright (C) 2008-2013
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -26,66 +26,131 @@
*/
$text['title-dialplan-outbound-add']['en-us'] = 'Outbound Call Routing';
$text['message-provide']['en-us'] = 'Please Provide';
$text['label-gateway-name']['en-us'] = 'Gateway Name';
$text['label-dialplan-expression']['en-us'] = 'Dialplan Expression';
$text['label-2d']['en-us'] = '2 Digits';
$text['label-3d']['en-us'] = '3 Digits';
$text['label-4d']['en-us'] = '4 Digits';
$text['label-5d']['en-us'] = '5 Digits';
$text['label-6d']['en-us'] = '6 Digits';
$text['label-7d']['en-us'] = '7 Digits Local';
$text['label-8d']['en-us'] = '8 Digits';
$text['label-9d']['en-us'] = '9 Digits';
$text['label-10d']['en-us'] = '10 Digits Long Distance';
$text['label-11d']['en-us'] = '11 Digits Long Distance';
$text['label-12d']['en-us'] = '12 Digits';
$text['label-13d']['en-us'] = '13 Digits';
$text['label-14d']['en-us'] = '14 Digits';
$text['label-int']['en-us'] = '15 Digits International';
$text['label-311']['en-us'] = '311 Information';
$text['label-411']['en-us'] = '411 Information';
$text['label-911']['en-us'] = '911 Emergency';
$text['label-9d2']['en-us'] = 'Dial 9, then 2 Digits';
$text['label-9d3']['en-us'] = 'Dial 9, then 3 Digits';
$text['label-9d4']['en-us'] = 'Dial 9, then 4 Digits';
$text['label-9d5']['en-us'] = 'Dial 9, then 5 Digits';
$text['label-9d6']['en-us'] = 'Dial 9, then 6 Digits';
$text['label-9d7']['en-us'] = 'Dial 9, then 7 Digits';
$text['label-9d8']['en-us'] = 'Dial 9, then 8 Digits';
$text['label-9d9']['en-us'] = 'Dial 9, then 9 Digits';
$text['label-9d10']['en-us'] = 'Dial 9, then 10 Digits';
$text['label-9d11']['en-us'] = 'Dial 9, then 11 Digits';
$text['label-9d12']['en-us'] = 'Dial 9, then 12 Digits';
$text['label-9d13']['en-us'] = 'Dial 9, then 13 Digits';
$text['label-9d14']['en-us'] = 'Dial 9, then 14 Digits';
$text['label-9d15']['en-us'] = 'Dial 9, then International';
$text['label-800']['en-us'] = 'Toll-Free';
$text['message-update']['en-us'] = 'Update Complete';
$text['label-outbound-routes']['en-us'] = 'Outbound Routes';
$text['button-back']['en-us'] = 'Back';
$text['description-outbound-routes']['en-us'] = 'Outbound dialplans have one or more conditions that are matched to attributes of a call. When a call matches the conditions the call is then routed to the gateway.';
$text['label-gateway']['en-us'] = 'Gateway';
$text['label-sip-gateway']['en-us'] = 'SIP Gateways';
$text['label-add-options']['en-us'] = 'Additional Options';
$text['message-add-options']['en-us'] = 'Select the gateway to use with this outbound route.';
$text['label-alt1']['en-us'] = 'Alternate 1';
$text['message-add-options1']['en-us'] = 'Select another gateway as an alternative to use if the first one fails.';
$text['label-alt2']['en-us'] = 'Alternate 2';
$text['message-add-options2']['en-us'] = 'Select another gateway as an alternative to use if the second one fails.';
$text['description-shortcut']['en-us'] = 'Shortcut to create the outbound dialplan entries for this Gateway.';
$text['label-prefix']['en-us'] = 'Prefix';
$text['description-enter-prefix']['en-us'] = 'Enter a prefix number to add to the beginning of the destination number.';
$text['label-limit']['en-us'] = 'Limit';
$text['description-limit']['en-us'] = 'Enter limit to restrict the number of outbound calls.';
$text['label-accountcode']['en-us'] = 'Account Code';
$text['description-accountcode']['en-us'] = 'Enter the accountcode.';
$text['label-order']['en-us'] = 'Order';
$text['description-order']['en-us'] = 'Select the order number. The order number determines the order of the outbound routes when there is more than one.';
$text['label-enabled']['en-us'] = 'Enabled';
$text['label-true']['en-us'] = 'True';
$text['label-false']['en-us'] = 'False';
$text['description-enabled']['en-us'] = 'Choose to enable or disable the outbound route.';
$text['label-description']['en-us'] = 'Description';
$text['description-description']['en-us'] = 'Enter a description for the outbound route.';
$text['button-save']['en-us'] = 'Save';

View File

@ -49,16 +49,18 @@ else {
//get the http post values and set theme as php variables
if (count($_POST)>0) {
$dialplan_name = check_str($_POST["dialplan_name"]);
$dialplan_order = check_str($_POST["dialplan_order"]);
$dialplan_expression = check_str($_POST["dialplan_expression"]);
$prefix_number = check_str($_POST["prefix_number"]);
$condition_field_1 = check_str($_POST["condition_field_1"]);
$condition_expression_1 = check_str($_POST["condition_expression_1"]);
$condition_field_2 = check_str($_POST["condition_field_2"]);
$condition_expression_2 = check_str($_POST["condition_expression_2"]);
$gateway = check_str($_POST["gateway"]);
$limit = check_str($_POST["limit"]);
//set the variables
$dialplan_name = check_str($_POST["dialplan_name"]);
$dialplan_order = check_str($_POST["dialplan_order"]);
$dialplan_expression = check_str($_POST["dialplan_expression"]);
$prefix_number = check_str($_POST["prefix_number"]);
$condition_field_1 = check_str($_POST["condition_field_1"]);
$condition_expression_1 = check_str($_POST["condition_expression_1"]);
$condition_field_2 = check_str($_POST["condition_field_2"]);
$condition_expression_2 = check_str($_POST["condition_expression_2"]);
$gateway = check_str($_POST["gateway"]);
$limit = check_str($_POST["limit"]);
$accountcode = check_str($_POST["accountcode"]);
//set the default type
$gateway_type = 'gateway';
@ -441,12 +443,22 @@ else {
$dialplan_detail_group = '';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'set';
$dialplan_detail_data = 'sip_h_X-accountcode=${accountcode}';
$dialplan_detail_order = '010';
$dialplan_detail_group = '';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
if (strlen($accountcode) > 0) {
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'set';
$dialplan_detail_data = 'sip_h_X-accountcode='.$accountcode;
$dialplan_detail_order = '010';
$dialplan_detail_group = '';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
}
else {
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'set';
$dialplan_detail_data = 'sip_h_X-accountcode=${accountcode}';
$dialplan_detail_order = '010';
$dialplan_detail_group = '';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
}
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'set';
@ -921,6 +933,17 @@ function type_onchange(dialplan_detail_type) {
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-accountcode'].":\n";
echo "</td>\n";
echo "<td colspan='4' class='vtable' align='left'>\n";
echo " <input class='formfld' style='width: 60%;' type='text' name='accountcode' maxlength='255' value=\"$accountcode\">\n";
echo "<br />\n";
echo $text['description-accountcode']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-order'].":\n";