mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Rename the directory app/dialplan to app/dialplans to make it more consistent.
This commit is contained in:
932
app/dialplans/resources/classes/dialplan.php
Normal file
932
app/dialplans/resources/classes/dialplan.php
Normal file
@@ -0,0 +1,932 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
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 FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2010-2016
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
|
||||
//define the dialplan class
|
||||
if (!class_exists('dialplan')) {
|
||||
class dialplan {
|
||||
//variables
|
||||
public $db;
|
||||
public $result;
|
||||
public $domain_uuid;
|
||||
public $dialplan_uuid;
|
||||
public $xml;
|
||||
public $json;
|
||||
public $display_type;
|
||||
public $default_context;
|
||||
public $bridges;
|
||||
public $variables;
|
||||
|
||||
//dialplans
|
||||
public $dialplan_name;
|
||||
public $dialplan_continue;
|
||||
public $dialplan_order;
|
||||
public $dialplan_context;
|
||||
public $dialplan_global;
|
||||
public $dialplan_enabled;
|
||||
public $dialplan_description;
|
||||
|
||||
//dialplan_details
|
||||
public $dialplan_detail_tag;
|
||||
public $dialplan_detail_order;
|
||||
public $dialplan_detail_type;
|
||||
public $dialplan_detail_data;
|
||||
public $dialplan_detail_break;
|
||||
public $dialplan_detail_inline;
|
||||
public $dialplan_detail_group;
|
||||
|
||||
//xml
|
||||
public $uuid;
|
||||
public $context;
|
||||
public $source;
|
||||
public $destination;
|
||||
public $is_empty;
|
||||
public $array;
|
||||
|
||||
//class constructor
|
||||
public function __construct() {
|
||||
//connect to the database if not connected
|
||||
if (!$this->db) {
|
||||
require_once "resources/classes/database.php";
|
||||
$database = new database;
|
||||
$database->connect();
|
||||
$this->db = $database->db;
|
||||
}
|
||||
|
||||
//set the default value
|
||||
$this->dialplan_global = false;
|
||||
}
|
||||
|
||||
public function dialplan_add() {
|
||||
|
||||
$sql = "insert into v_dialplans ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "app_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "dialplan_name, ";
|
||||
$sql .= "dialplan_number, ";
|
||||
$sql .= "dialplan_continue, ";
|
||||
$sql .= "dialplan_order, ";
|
||||
$sql .= "dialplan_context, ";
|
||||
$sql .= "dialplan_enabled, ";
|
||||
$sql .= "dialplan_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
if ($this->dialplan_global) {
|
||||
$sql .= "null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "'".check_str($this->domain_uuid)."', ";
|
||||
}
|
||||
$sql .= "'".check_str($this->app_uuid)."', ";
|
||||
$sql .= "'".check_str($this->dialplan_uuid)."', ";
|
||||
$sql .= "'".check_str($this->dialplan_name)."', ";
|
||||
$sql .= "'".check_str($this->dialplan_number)."', ";
|
||||
$sql .= "'".check_str($this->dialplan_continue)."', ";
|
||||
$sql .= "'".check_str($this->dialplan_order)."', ";
|
||||
$sql .= "'".check_str($this->dialplan_context)."', ";
|
||||
$sql .= "'".check_str($this->dialplan_enabled)."', ";
|
||||
$sql .= "'".check_str($this->dialplan_description)."' ";
|
||||
$sql .= ")";
|
||||
$this->db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
} //end function
|
||||
|
||||
public function dialplan_update() {
|
||||
|
||||
$sql = "update v_dialplans set ";
|
||||
$sql .= "dialplan_name = '".check_str($this->dialplan_name)."', ";
|
||||
if (strlen($this->dialplan_continue) > 0) {
|
||||
$sql .= "dialplan_continue = '".check_str($this->dialplan_continue)."', ";
|
||||
}
|
||||
$sql .= "dialplan_order = '".check_str($this->dialplan_order)."', ";
|
||||
$sql .= "dialplan_context = '".check_str($this->dialplan_context)."', ";
|
||||
$sql .= "dialplan_enabled = '".check_str($this->dialplan_enabled)."', ";
|
||||
$sql .= "dialplan_description = '".check_str($this->dialplan_description)."' ";
|
||||
$sql .= "where (domain_uuid = '".check_str($this->domain_uuid)."' or domain_uuid is null) ";
|
||||
$sql .= "and dialplan_uuid = '".check_str($this->dialplan_uuid)."' ";
|
||||
//echo "sql: ".$sql."<br />";
|
||||
$this->db->query($sql);
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
public function dialplan_detail_add() {
|
||||
|
||||
$dialplan_detail_uuid = uuid();
|
||||
$sql = "insert into v_dialplan_details ";
|
||||
$sql .= "(";
|
||||
$sql .= "dialplan_detail_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "dialplan_uuid, ";
|
||||
$sql .= "dialplan_detail_tag, ";
|
||||
$sql .= "dialplan_detail_order, ";
|
||||
$sql .= "dialplan_detail_type, ";
|
||||
$sql .= "dialplan_detail_data, ";
|
||||
$sql .= "dialplan_detail_break, ";
|
||||
$sql .= "dialplan_detail_inline, ";
|
||||
$sql .= "dialplan_detail_group ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".$dialplan_detail_uuid."', ";
|
||||
if ($this->dialplan_global) {
|
||||
$sql .= "null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "'".check_str($this->domain_uuid)."', ";
|
||||
}
|
||||
$sql .= "'".check_str($this->dialplan_uuid)."', ";
|
||||
$sql .= "'".check_str($this->dialplan_detail_tag)."', ";
|
||||
$sql .= "'".check_str($this->dialplan_detail_order)."', ";
|
||||
$sql .= "'".check_str($this->dialplan_detail_type)."', ";
|
||||
$sql .= "'".check_str($this->dialplan_detail_data)."', ";
|
||||
if (strlen($this->dialplan_detail_break) == 0) {
|
||||
$sql .= "null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "'".check_str($this->dialplan_detail_break)."', ";
|
||||
}
|
||||
if (strlen($this->dialplan_detail_inline) == 0) {
|
||||
$sql .= "null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "'".check_str($this->dialplan_detail_inline)."', ";
|
||||
}
|
||||
if (strlen($this->dialplan_detail_group) == 0) {
|
||||
$sql .= "null ";
|
||||
}
|
||||
else {
|
||||
$sql .= "'".check_str($this->dialplan_detail_group)."' ";
|
||||
}
|
||||
$sql .= ")";
|
||||
//echo $sql."\n\n";
|
||||
$this->db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
} //end function
|
||||
|
||||
public function dialplan_detail_update() {
|
||||
|
||||
$sql = "update v_dialplans set ";
|
||||
$sql .= "dialplan_detail_order = '".check_str($this->dialplan_detail_order)."', ";
|
||||
$sql .= "dialplan_detail_type = '".check_str($this->dialplan_detail_type)."', ";
|
||||
$sql .= "dialplan_detail_data = '".check_str($this->dialplan_detail_data)."', ";
|
||||
if (strlen($this->dialplan_detail_break) > 0) {
|
||||
$sql .= "dialplan_detail_break = '".check_str($this->dialplan_detail_break)."', ";
|
||||
}
|
||||
if (strlen($this->dialplan_detail_inline) > 0) {
|
||||
$sql .= "dialplan_detail_inline = '".check_str($this->dialplan_detail_inline)."', ";
|
||||
}
|
||||
if (strlen($this->dialplan_detail_group) > 0) {
|
||||
$sql .= "dialplan_detail_group = '".check_str($this->dialplan_detail_group)."', ";
|
||||
}
|
||||
$sql .= "dialplan_detail_tag = '".check_str($this->dialplan_detail_tag)."' ";
|
||||
$sql .= "where (domain_uuid = '".check_str($this->domain_uuid)."' or domain_uuid is null) ";
|
||||
$sql .= "and dialplan_uuid = '".check_str($this->dialplan_uuid)."' ";
|
||||
//echo "sql: ".$sql."<br />";
|
||||
$this->db->query($sql);
|
||||
unset($sql);
|
||||
} //end function
|
||||
|
||||
public function restore_advanced_xml() {
|
||||
$switch_dialplan_dir = $this->switch_dialplan_dir;
|
||||
if (is_dir($switch_dialplan_dir)) {
|
||||
//copy resources/templates/conf to the freeswitch conf dir
|
||||
if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf')){
|
||||
$src_dir = "/usr/share/examples/fusionpbx/resources/templates/conf";
|
||||
}
|
||||
else {
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf";
|
||||
}
|
||||
//get the contents of the dialplan/default.xml
|
||||
$file_default_path = $src_dir.'/dialplan/default.xml';
|
||||
$file_default_contents = file_get_contents($file_default_path);
|
||||
//prepare the file contents and the path
|
||||
//replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number
|
||||
$file_default_contents = str_replace("{v_domain}", $_SESSION['domain_name'], $file_default_contents);
|
||||
//set the file path
|
||||
$file_path = $switch_dialplan_dir.'/'.$_SESSION['domain_name'].'.xml';
|
||||
//write the default dialplan
|
||||
$fh = fopen($file_path,'w') or die('Unable to write to '.$file_path.'. Make sure the path exists and permissons are set correctly.');
|
||||
fwrite($fh, $file_default_contents);
|
||||
fclose($fh);
|
||||
//set the message
|
||||
$this->result['dialplan']['restore']['msg'] = "Default Restored";
|
||||
}
|
||||
}
|
||||
|
||||
private function app_uuid_exists() {
|
||||
$sql = "select domain_uuid from v_dialplans ";
|
||||
$sql .= "where (domain_uuid = '".$this->domain_uuid."' or domain_uuid is null) ";
|
||||
$sql .= "and app_uuid = '".$this->app_uuid."' ";
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (count($result)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
unset($sql, $prep_statement, $result);
|
||||
}
|
||||
|
||||
public function dialplan_exists() {
|
||||
$sql = "select domain_uuid from v_dialplans ";
|
||||
$sql .= "where (domain_uuid = '".$this->domain_uuid."' or domain_uuid is null)";
|
||||
$sql .= "and dialplan_uuid = '".$this->dialplan_uuid."' ";
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (count($result)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
unset($sql, $prep_statement, $result);
|
||||
}
|
||||
|
||||
public function import() {
|
||||
if (strlen($this->xml) > 0) {
|
||||
//replace the variables
|
||||
$length = (is_numeric($_SESSION["security"]["pin_length"]["var"])) ? $_SESSION["security"]["pin_length"]["var"] : 8;
|
||||
//$this->xml = str_replace("{v_context}", $this->default_context, $this->xml);
|
||||
$this->xml = str_replace("{v_pin_number}", generate_password($length, 1), $this->xml);
|
||||
$this->xml = str_replace("{v_switch_recordings_dir}", $_SESSION['switch']['recordings']['dir'], $this->xml);
|
||||
//convert the xml string to an xml object
|
||||
$xml = simplexml_load_string($this->xml);
|
||||
//convert to json
|
||||
$json = json_encode($xml);
|
||||
//convert to an array
|
||||
$dialplan = json_decode($json, true);
|
||||
}
|
||||
if (strlen($this->json) > 0) {
|
||||
//convert to an array
|
||||
$dialplan = json_decode($json, true);
|
||||
}
|
||||
|
||||
//ensure the condition array is uniform
|
||||
if (is_array($dialplan)) {
|
||||
if (!is_array($dialplan['extension']['condition'][0])) {
|
||||
$tmp = $dialplan['extension']['condition'];
|
||||
unset($dialplan['extension']['condition']);
|
||||
$dialplan['extension']['condition'][0] = $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
//get the app_uuid
|
||||
$this->app_uuid = $dialplan['extension']['@attributes']['app_uuid'];
|
||||
|
||||
//get the list of domains
|
||||
if (!isset($_SESSION['domains'])) {
|
||||
$sql = "select * from v_domains; ";
|
||||
$prep_statement = $this->db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$_SESSION['domains'] = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
unset($sql, $prep_statement);
|
||||
}
|
||||
|
||||
//check if the dialplan app uuid exists
|
||||
foreach ($_SESSION['domains'] as $domain) {
|
||||
//get the domain_uuid
|
||||
$this->domain_uuid = $domain['domain_uuid'];
|
||||
//set the dialplan_context
|
||||
$this->dialplan_context = $dialplan['@attributes']['name'];
|
||||
if ($this->dialplan_context == "{v_context}") {
|
||||
$this->dialplan_context = $domain['domain_name'];
|
||||
}
|
||||
//check if the dialplan exists
|
||||
if (!$this->app_uuid_exists()) {
|
||||
//start the transaction
|
||||
$this->db->beginTransaction();
|
||||
//get the attributes
|
||||
$this->dialplan_uuid = uuid();
|
||||
$this->dialplan_name = $dialplan['extension']['@attributes']['name'];
|
||||
$this->dialplan_number = $dialplan['extension']['@attributes']['number'];
|
||||
$this->dialplan_global = false;
|
||||
if (strlen($dialplan['extension']['@attributes']['global']) > 0) {
|
||||
if ($dialplan['extension']['@attributes']['global'] == "true") {
|
||||
$this->dialplan_global = true;
|
||||
}
|
||||
}
|
||||
if ($this->display_type == "text") {
|
||||
echo " ".$this->dialplan_name.": added\n";
|
||||
}
|
||||
if (strlen($dialplan['extension']['@attributes']['continue']) > 0) {
|
||||
$this->dialplan_continue = $dialplan['extension']['@attributes']['continue'];
|
||||
}
|
||||
if (strlen($dialplan['extension']['@attributes']['enabled']) > 0) {
|
||||
$this->dialplan_enabled = $dialplan['extension']['@attributes']['enabled'];
|
||||
}
|
||||
else {
|
||||
$this->dialplan_enabled = "true";
|
||||
}
|
||||
$this->dialplan_description = '';
|
||||
$this->dialplan_add();
|
||||
//loop through the condition array
|
||||
$x = 0;
|
||||
$group = 0;
|
||||
$order = 5;
|
||||
if (isset($dialplan['extension']['condition'])) {
|
||||
foreach ($dialplan['extension']['condition'] as &$row) {
|
||||
unset($this->dialplan_detail_break);
|
||||
unset($this->dialplan_detail_inline);
|
||||
$this->dialplan_detail_tag = 'condition';
|
||||
$this->dialplan_detail_type = $row['@attributes']['field'];
|
||||
$this->dialplan_detail_data = $row['@attributes']['expression'];
|
||||
$this->dialplan_detail_group = $group;
|
||||
$this->dialplan_detail_order = $order;
|
||||
if (strlen($row['@attributes']['break']) > 0) {
|
||||
$this->dialplan_detail_break = $row['@attributes']['break'];
|
||||
}
|
||||
$this->dialplan_detail_add();
|
||||
if (is_array($row['action']) || is_array($row['anti-action'])) {
|
||||
$condition_self_closing_tag = false;
|
||||
if (!is_array($row['action'][0])) {
|
||||
if ($row['action']['@attributes']['application']) {
|
||||
$tmp = $row['action'];
|
||||
unset($row['action']);
|
||||
$row['action'][0] = $tmp;
|
||||
}
|
||||
}
|
||||
if (!is_array($row['anti-action'][0])) {
|
||||
if ($row['anti-action']['@attributes']['application']) {
|
||||
$tmp = $row['anti-action'];
|
||||
unset($row['anti-action']);
|
||||
$row['anti-action'][0] = $tmp;
|
||||
}
|
||||
}
|
||||
$order = $order + 5;
|
||||
unset($this->dialplan_detail_break);
|
||||
unset($this->dialplan_detail_inline);
|
||||
if (isset($row['action'])) {
|
||||
foreach ($row['action'] as &$row2) {
|
||||
$this->dialplan_detail_tag = 'action';
|
||||
$this->dialplan_detail_type = $row2['@attributes']['application'];
|
||||
$this->dialplan_detail_data = $row2['@attributes']['data'];
|
||||
if (strlen($row2['@attributes']['inline']) > 0) {
|
||||
$this->dialplan_detail_inline = $row2['@attributes']['inline'];
|
||||
}
|
||||
$this->dialplan_detail_group = $group;
|
||||
$this->dialplan_detail_order = $order;
|
||||
$this->dialplan_detail_add();
|
||||
$order = $order + 5;
|
||||
}
|
||||
}
|
||||
if (isset($row['anti-action'])) {
|
||||
foreach ($row['anti-action'] as &$row2) {
|
||||
$this->dialplan_detail_tag = 'anti-action';
|
||||
$this->dialplan_detail_type = $row2['@attributes']['application'];
|
||||
$this->dialplan_detail_data = $row2['@attributes']['data'];
|
||||
$this->dialplan_detail_group = $group;
|
||||
$this->dialplan_detail_order = $order;
|
||||
$this->dialplan_detail_add();
|
||||
$order = $order + 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$condition_self_closing_tag = true;
|
||||
}
|
||||
//if not a self closing tag then increment the group
|
||||
if (!$condition_self_closing_tag) {
|
||||
$group++;
|
||||
}
|
||||
$row['group'] = $group;
|
||||
$order = $order + 5;
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
//end the transaction
|
||||
$this->db->commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function outbound_routes($destination_number) {
|
||||
|
||||
//normalize the destination number
|
||||
$destination_number = trim($destination_number);
|
||||
|
||||
//check the session array if it doesn't exist then build the array
|
||||
if (!is_array($_SESSION[$_SESSION['domain_uuid']]['outbound_routes'])) {
|
||||
//get the outbound routes from the database
|
||||
$sql = "select * from v_dialplans as d, v_dialplan_details as s ";
|
||||
$sql .= "where ";
|
||||
$sql .= "( ";
|
||||
$sql .= "d.domain_uuid = '".$this->domain_uuid."' ";
|
||||
$sql .= "or d.domain_uuid is null ";
|
||||
$sql .= ") ";
|
||||
$sql .= "and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' ";
|
||||
$sql .= "and d.dialplan_enabled = 'true' ";
|
||||
$sql .= "and d.dialplan_uuid = s.dialplan_uuid ";
|
||||
$sql .= "order by ";
|
||||
$sql .= "d.dialplan_order asc, ";
|
||||
$sql .= "d.dialplan_name asc, ";
|
||||
$sql .= "d.dialplan_uuid asc, ";
|
||||
$sql .= "s.dialplan_detail_group asc, ";
|
||||
$sql .= "CASE s.dialplan_detail_tag ";
|
||||
$sql .= "WHEN 'condition' THEN 1 ";
|
||||
$sql .= "WHEN 'action' THEN 2 ";
|
||||
$sql .= "WHEN 'anti-action' THEN 3 ";
|
||||
$sql .= "ELSE 100 END, ";
|
||||
$sql .= "s.dialplan_detail_order asc ";
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$dialplans = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
unset($prep_statement, $sql);
|
||||
$x = 0; $y = 0;
|
||||
if (isset($dialplans)) foreach ($dialplans as &$row) {
|
||||
//if the previous dialplan uuid has not been set then set it
|
||||
if (!isset($previous_dialplan_uuid)) { $previous_dialplan_uuid = $row['dialplan_uuid']; }
|
||||
|
||||
//increment dialplan ordinal number
|
||||
if ($previous_dialplan_uuid != $row['dialplan_uuid']) {
|
||||
$x++; $y = 0;
|
||||
}
|
||||
|
||||
//build the array
|
||||
$array[$x]['dialplan_uuid'] = $row['dialplan_uuid'];
|
||||
$array[$x]['dialplan_context'] = $row['dialplan_context'];
|
||||
$array[$x]['dialplan_name'] = $row['dialplan_name'];
|
||||
$array[$x]['dialplan_continue'] = $row['dialplan_continue'];
|
||||
$array[$x]['dialplan_order'] = $row['dialplan_order'];
|
||||
$array[$x]['dialplan_enabled'] = $row['dialplan_enabled'];
|
||||
$array[$x]['dialplan_description'] = $row['dialplan_description'];
|
||||
if (strlen($row['dialplan_detail_uuid']) > 0) {
|
||||
$array[$x]['dialplan_details'][$y]['dialplan_uuid'] = $row['dialplan_uuid'];
|
||||
$array[$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = $row['dialplan_detail_uuid'];
|
||||
$array[$x]['dialplan_details'][$y]['dialplan_detail_tag'] = $row['dialplan_detail_tag'];
|
||||
$array[$x]['dialplan_details'][$y]['dialplan_detail_type'] = $row['dialplan_detail_type'];
|
||||
$array[$x]['dialplan_details'][$y]['dialplan_detail_data'] = $row['dialplan_detail_data'];
|
||||
$y++;
|
||||
}
|
||||
|
||||
//set the previous dialplan_uuid
|
||||
$previous_dialplan_uuid = $row['dialplan_uuid'];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
//set the session array
|
||||
$_SESSION[$_SESSION['domain_uuid']]['outbound_routes'] = $array;
|
||||
} //end if !is_array
|
||||
//find the matching outbound routes
|
||||
if (isset($_SESSION[$_SESSION['domain_uuid']]['outbound_routes'])) foreach ($_SESSION[$_SESSION['domain_uuid']]['outbound_routes'] as $row) {
|
||||
if (isset($row['dialplan_details'])) foreach ($row['dialplan_details'] as $field) {
|
||||
if ($field['dialplan_detail_tag'] == "condition") {
|
||||
if ($field['dialplan_detail_type'] == "destination_number") {
|
||||
$dialplan_detail_data = $field['dialplan_detail_data'];
|
||||
$pattern = '/'.$dialplan_detail_data.'/';
|
||||
preg_match($pattern, $destination_number, $matches, PREG_OFFSET_CAPTURE);
|
||||
if (count($matches) == 0) {
|
||||
$regex_match = false;
|
||||
}
|
||||
else {
|
||||
$regex_match = true;
|
||||
$regex_match_1 = $matches[1][0];
|
||||
$regex_match_2 = $matches[2][0];
|
||||
$regex_match_3 = $matches[3][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($regex_match) {
|
||||
//get the variables
|
||||
if ($field[dialplan_detail_type] == "set" && $field[dialplan_detail_tag] == "action") {
|
||||
//only set variables with values not variables
|
||||
if (strpos($field[dialplan_detail_data], '$') === false) {
|
||||
$this->variables .= $field[dialplan_detail_data].",";
|
||||
}
|
||||
}
|
||||
//process the $x detail data variables
|
||||
if ($field['dialplan_detail_tag'] == "action" && $field['dialplan_detail_type'] == "bridge" && $dialplan_detail_data != "\${enum_auto_route}") {
|
||||
$dialplan_detail_data = $field['dialplan_detail_data'];
|
||||
$dialplan_detail_data = str_replace("\$1", $regex_match_1, $dialplan_detail_data);
|
||||
$dialplan_detail_data = str_replace("\$2", $regex_match_2, $dialplan_detail_data);
|
||||
$dialplan_detail_data = str_replace("\$3", $regex_match_3, $dialplan_detail_data);
|
||||
$this->bridges = $dialplan_detail_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end if isset
|
||||
} // outbound_routes
|
||||
|
||||
//reads dialplan details from the database to build the xml
|
||||
public function xml () {
|
||||
|
||||
//set the xml array and then concatenate the array to a string
|
||||
/* $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; */
|
||||
//$xml .= "<document type=\"freeswitch/xml\">\n";
|
||||
//$xml .= " <section name=\"dialplan\" description=\"\">\n";
|
||||
//$xml .= " <context name=\"" . $this->context . "\">\n";
|
||||
|
||||
//set defaults
|
||||
$previous_dialplan_uuid = "";
|
||||
$previous_dialplan_detail_group = "";
|
||||
$dialplan_tag_status = "closed";
|
||||
$condition_tag_status = "closed";
|
||||
|
||||
//get the dialplans from the dialplan_xml field in the dialplans table
|
||||
if ($this->source == "dialplans") {
|
||||
//get the data using a join between the dialplans and dialplan details tables
|
||||
$sql = "select dialplan_uuid, dialplan_xml ";
|
||||
$sql .= "from v_dialplans \n";
|
||||
if (isset($this->uuid)) {
|
||||
$sql .= "where dialplan_uuid = '".$this->uuid."' \n";
|
||||
}
|
||||
else {
|
||||
if (isset($this->context)) {
|
||||
if ($this->context == "public" || substr($this->context, 0, 7) == "public@" || substr($this->context, -7) == ".public") {
|
||||
$sql .= "where dialplan_context = '" . $this->context . "' \n";
|
||||
}
|
||||
else {
|
||||
$sql .= "where (dialplan_context = '" . $this->context . "' or dialplan_context = '\${domain_name}') \n";
|
||||
}
|
||||
$sql .= "and dialplan_enabled = 'true' \n";
|
||||
}
|
||||
}
|
||||
if ($this->is_empty == "dialplan_xml") {
|
||||
$sql .= "and p.dialplan_xml is null \n";
|
||||
}
|
||||
$sql .= "order by \n";
|
||||
$sql .= "dialplan_context asc, \n";
|
||||
$sql .= "dialplan_order asc \n";
|
||||
//echo $sql;
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$results = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
//echo $sql;
|
||||
foreach ($results as $row) {
|
||||
$dialplans[$row["dialplan_uuid"]] = $row["dialplan_xml"];
|
||||
}
|
||||
}
|
||||
|
||||
//get the dialplans from the dialplan details
|
||||
if ($this->source == "details") {
|
||||
|
||||
//get the data using a join between the dialplans and dialplan details tables
|
||||
$sql = "select ";
|
||||
$sql .= "p.domain_uuid, p.dialplan_uuid, p.app_uuid, p.dialplan_context, p.dialplan_name, p.dialplan_number, \n";
|
||||
$sql .= "p.dialplan_continue, p.dialplan_order, p.dialplan_enabled, p.dialplan_description, \n";
|
||||
$sql .= "s.dialplan_detail_uuid, s.dialplan_detail_tag, s.dialplan_detail_type, s.dialplan_detail_data, \n";
|
||||
$sql .= "s.dialplan_detail_break, s.dialplan_detail_inline, s.dialplan_detail_group, s.dialplan_detail_order \n";
|
||||
$sql .= "from v_dialplans as p, v_dialplan_details as s \n";
|
||||
$sql .= "where p.dialplan_uuid = s.dialplan_uuid \n";
|
||||
if ($this->is_empty == "dialplan_xml") {
|
||||
$sql .= "and p.dialplan_xml is null \n";
|
||||
}
|
||||
if (isset($this->context)) {
|
||||
if ($this->context == "public" || substr($this->context, 0, 7) == "public@" || substr($this->context, -7) == ".public") {
|
||||
$sql .= "and p.dialplan_context = '" . $this->context . "' \n";
|
||||
}
|
||||
else {
|
||||
$sql .= "and (p.dialplan_context = '" . $this->context . "' or p.dialplan_context = '\${domain_name}') \n";
|
||||
}
|
||||
$sql .= "and p.dialplan_enabled = 'true' \n";
|
||||
}
|
||||
if (isset($this->uuid)) {
|
||||
$sql .= "and p.dialplan_uuid = '".$this->uuid."' \n";
|
||||
$sql .= "and s.dialplan_uuid = '".$this->uuid."' \n";
|
||||
}
|
||||
$sql .= "order by \n";
|
||||
$sql .= "p.dialplan_order asc, \n";
|
||||
$sql .= "p.dialplan_name asc, \n";
|
||||
$sql .= "p.dialplan_uuid asc, \n";
|
||||
$sql .= "s.dialplan_detail_group asc, \n";
|
||||
$sql .= "CASE s.dialplan_detail_tag \n";
|
||||
$sql .= "WHEN 'condition' THEN 1 \n";
|
||||
$sql .= "WHEN 'action' THEN 2 \n";
|
||||
$sql .= "WHEN 'anti-action' THEN 3 \n";
|
||||
$sql .= "ELSE 100 END, \n";
|
||||
$sql .= "s.dialplan_detail_order asc \n";
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$results = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
|
||||
//debug info
|
||||
//echo "sql: $sql\n";
|
||||
//echo "<pre>\n";
|
||||
//print_r($results);
|
||||
//echo "</pre>\n";
|
||||
//exit;
|
||||
|
||||
//loop through the results to get the xml from the dialplan_xml field or from dialplan details table
|
||||
$x = 0;
|
||||
foreach ($results as $row) {
|
||||
//clear flag pass
|
||||
$pass = false;
|
||||
|
||||
//get the dialplan
|
||||
$domain_uuid = $row["domain_uuid"];
|
||||
$dialplan_uuid = $row["dialplan_uuid"];
|
||||
//$app_uuid = $row["app_uuid"];
|
||||
$this->context = $row["dialplan_context"];
|
||||
$dialplan_name = $row["dialplan_name"];
|
||||
//$dialplan_number = $row["dialplan_number"];
|
||||
$dialplan_continue = $row["dialplan_continue"];
|
||||
//$dialplan_order = $row["dialplan_order"];
|
||||
//$dialplan_enabled = $row["dialplan_enabled"];
|
||||
//$dialplan_description = $row["dialplan_description"];
|
||||
|
||||
//$get the dialplan details
|
||||
//$dialplan_detail_uuid = $row["dialplan_detail_uuid"];
|
||||
$dialplan_detail_tag = $row["dialplan_detail_tag"];
|
||||
$dialplan_detail_type = $row["dialplan_detail_type"];
|
||||
$dialplan_detail_data = $row["dialplan_detail_data"];
|
||||
$dialplan_detail_break = $row["dialplan_detail_break"];
|
||||
$dialplan_detail_inline = $row["dialplan_detail_inline"];
|
||||
$dialplan_detail_group = $row["dialplan_detail_group"];
|
||||
//$dialplan_detail_order = $row["dialplan_detail_order;
|
||||
|
||||
//remove $$ and replace with $
|
||||
$dialplan_detail_data = str_replace("$$", "$", $dialplan_detail_data);
|
||||
|
||||
//get the dialplan detail inline
|
||||
$detail_inline = "";
|
||||
if ($dialplan_detail_inline) {
|
||||
if (strlen($dialplan_detail_inline) > 0) {
|
||||
$detail_inline = " inline=\"" . $dialplan_detail_inline . "\"";
|
||||
}
|
||||
}
|
||||
|
||||
//close the tags
|
||||
if ($dialplan_tag_status != "closed") {
|
||||
if (($previous_dialplan_uuid != $dialplan_uuid) || ($previous_dialplan_detail_group != $dialplan_detail_group)) {
|
||||
if ($condition_tag_status != "closed") {
|
||||
if ($condition_attribute && (strlen($condition_attribute) > 0)) {
|
||||
$xml .= " <condition " . $condition_attribute . $condition_break . "/>\n";
|
||||
$condition_attribute = "";
|
||||
$condition_tag_status = "closed";
|
||||
}
|
||||
elseif ($condition && (strlen($condition) > 0)) {
|
||||
$xml .= " ".$condition . "/>";
|
||||
$condition = "";
|
||||
$condition_tag_status = "closed";
|
||||
}
|
||||
elseif ($condition_tag_status != "closed") {
|
||||
$xml .= " </condition>\n";
|
||||
$condition_tag_status = "closed";
|
||||
}
|
||||
$condition_tag_status = "closed";
|
||||
}
|
||||
}
|
||||
if ($previous_dialplan_uuid != $dialplan_uuid) {
|
||||
$xml .= "</extension>\n";
|
||||
|
||||
//add to the dialplanss
|
||||
$dialplans[$previous_dialplan_uuid] = $xml;
|
||||
$xml = '';
|
||||
|
||||
$dialplan_tag_status = "closed";
|
||||
}
|
||||
}
|
||||
|
||||
//open the tags
|
||||
if ($dialplan_tag_status == "closed") {
|
||||
$xml = '';
|
||||
$xml .= "<extension name=\"" . $dialplan_name . "\" continue=\"" . $dialplan_continue . "\" uuid=\"" . $dialplan_uuid . "\">\n";
|
||||
$dialplan_tag_status = "open";
|
||||
$first_action = true;
|
||||
$condition = "";
|
||||
$condition_attribute = "";
|
||||
}
|
||||
if ($dialplan_detail_tag == "condition") {
|
||||
//determine the type of condition
|
||||
if ($dialplan_detail_type == "hour") {
|
||||
$condition_type = 'time';
|
||||
}
|
||||
elseif ($dialplan_detail_type == "minute") {
|
||||
$condition_type = 'time';
|
||||
}
|
||||
elseif ($dialplan_detail_type == "minute-of-day") {
|
||||
$condition_type = 'time';
|
||||
}
|
||||
elseif ($dialplan_detail_type == "mday") {
|
||||
$condition_type = 'time';
|
||||
}
|
||||
elseif ($dialplan_detail_type == "mweek") {
|
||||
$condition_type = 'time';
|
||||
}
|
||||
elseif ($dialplan_detail_type == "mon") {
|
||||
$condition_type = 'time';
|
||||
}
|
||||
elseif ($dialplan_detail_type == "time-of-day") {
|
||||
$condition_type = 'time';
|
||||
}
|
||||
elseif ($dialplan_detail_type == "yday") {
|
||||
$condition_type = 'time';
|
||||
}
|
||||
elseif ($dialplan_detail_type == "year") {
|
||||
$condition_type = 'time';
|
||||
}
|
||||
elseif ($dialplan_detail_type == "wday") {
|
||||
$condition_type = 'time';
|
||||
}
|
||||
elseif ($dialplan_detail_type == "week") {
|
||||
$condition_type = 'time';
|
||||
}
|
||||
elseif ($ialplan_detail_type == "date-time") {
|
||||
$condition_type = 'time';
|
||||
}
|
||||
else {
|
||||
$condition_type = 'default';
|
||||
}
|
||||
|
||||
// finalize any previous pending condition statements
|
||||
if ($condition_tag_status == "open") {
|
||||
if (strlen($condition) > 0) {
|
||||
$xml .= $condition . "/>\n";
|
||||
$condition = '';
|
||||
$condition_tag_status = "closed";
|
||||
}
|
||||
elseif (strlen($condition_attribute) > 0 && $condition_tag_status == "open") {
|
||||
// previous condition(s) must have been of type time
|
||||
// do not finalize if new condition is also of type time
|
||||
if ($condition_type != 'time') {
|
||||
// note: condition_break here is value from the previous loop
|
||||
$xml .= " <condition " . $condition_attribute . $condition_break . "/>\n";
|
||||
$condition_attribute = '';
|
||||
$condition_tag_status = "closed";
|
||||
}
|
||||
//else {
|
||||
// $xml .= " </condition>\n";
|
||||
// $condition_tag_status = "closed";
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
//get the condition break attribute
|
||||
$condition_break = "";
|
||||
if ($dialplan_detail_break) {
|
||||
if (strlen($dialplan_detail_break) > 0) {
|
||||
$condition_break = " break=\"" . $dialplan_detail_break . "\"";
|
||||
}
|
||||
}
|
||||
|
||||
//condition tag but leave off the ending
|
||||
if ($condition_type == "default") {
|
||||
$condition = " <condition field=\"" . $dialplan_detail_type . "\" expression=\"" . $dialplan_detail_data . "\"" . $condition_break;
|
||||
}
|
||||
elseif ($condition_type == "time") {
|
||||
if ($condition_attribute) {
|
||||
$condition_attribute = $condition_attribute . $dialplan_detail_type . "=\"" . $dialplan_detail_data . "\" ";
|
||||
} else {
|
||||
$condition_attribute = $dialplan_detail_type . "=\"" . $dialplan_detail_data . "\" ";
|
||||
}
|
||||
$condition = ""; //prevents a duplicate time condition
|
||||
}
|
||||
else {
|
||||
$condition = " <condition field=\"" . $dialplan_detail_type . "\" expression=\"" . $dialplan_detail_data . "\"" . $condition_break;
|
||||
}
|
||||
$condition_tag_status = "open";
|
||||
}
|
||||
|
||||
if ($dialplan_detail_tag == "action" || $dialplan_detail_tag == "anti-action") {
|
||||
if ($condition_tag_status == "open") {
|
||||
if ($condition_attribute && (strlen($condition_attribute) > 0)) {
|
||||
$xml .= " <condition " . $condition_attribute . $condition_break . ">\n";
|
||||
$condition_attribute = "";
|
||||
}
|
||||
elseif ($condition && (strlen($condition) > 0)) {
|
||||
$xml .= $condition . ">\n";
|
||||
$condition = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->context == "public" || substr($this->context, 0, 7) == "public@" || substr($this->context, -7) == ".public") {
|
||||
if ($dialplan_detail_tag == "action") {
|
||||
if ($first_action) {
|
||||
//get the domains
|
||||
if (!isset($domains)) {
|
||||
$sql = "select * from v_domains; \n";
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
$domains[$row['domain_uuid']] = $row['domain_name'];
|
||||
}
|
||||
}
|
||||
//add the call direction and domain name and uuid
|
||||
$xml .= " <action application=\"set\" data=\"call_direction=inbound\" inline=\"true\"/>\n";
|
||||
if ($domain_uuid != null and $domain_uuid != '') {
|
||||
$domain_name = $domains[$domain_uuid];
|
||||
$xml .= " <action application=\"set\" data=\"domain_uuid=" . $domain_uuid . "\" inline=\"true\"/>\n";
|
||||
}
|
||||
if ($domain_name != null and $domain_name != '') {
|
||||
$xml .= " <action application=\"set\" data=\"domain_name=" . $domain_name . "\" inline=\"true\"/>\n";
|
||||
}
|
||||
$first_action = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($dialplan_detail_tag == "action") {
|
||||
$xml .= " <action application=\"" . $dialplan_detail_type . "\" data=\"" . $dialplan_detail_data . "\"" . $detail_inline . "/>\n";
|
||||
}
|
||||
if ($dialplan_detail_tag == "anti-action") {
|
||||
$xml .= " <anti-action application=\"" . $dialplan_detail_type . "\" data=\"" . $dialplan_detail_data . "\"" . $detail_inline . "/>\n";
|
||||
}
|
||||
|
||||
//save the previous values
|
||||
$previous_dialplan_uuid = $dialplan_uuid;
|
||||
$previous_dialplan_detail_group = $dialplan_detail_group;
|
||||
|
||||
//increment the x
|
||||
$x++;
|
||||
|
||||
//set flag pass
|
||||
$pass = true;
|
||||
}
|
||||
|
||||
// prevent partial dialplan (pass=nil may be error in sql or empty resultset)
|
||||
if ($pass == false) {
|
||||
if (count($results)) {
|
||||
echo 'error while build context: ' . $this->context;
|
||||
}
|
||||
}
|
||||
|
||||
//close the extension tag if it was left open
|
||||
if ($dialplan_tag_status == "open") {
|
||||
if ($condition_tag_status == "open") {
|
||||
if ($condition_attribute and (strlen($condition_attribute) > 0)) {
|
||||
$xml .= " <condition " . $condition_attribute . $condition_break . "/>\n";
|
||||
}
|
||||
elseif ($condition && (strlen($condition) > 0)) {
|
||||
$xml .= $condition . "/>\n";
|
||||
} else {
|
||||
$xml .= " </condition>\n";
|
||||
}
|
||||
}
|
||||
$xml .= "</extension>\n";
|
||||
|
||||
//add to the dialplans array
|
||||
$dialplans[$dialplan_uuid] = $xml;
|
||||
}
|
||||
|
||||
//set the xml array and then concatenate the array to a string
|
||||
//$xml .= " </context>\n";
|
||||
///$xml .= " </section>\n";
|
||||
//$xml .= "</document>\n";
|
||||
|
||||
} //end if source = details
|
||||
|
||||
//return the array
|
||||
if ($this->destination == "array") {
|
||||
return $dialplans;
|
||||
}
|
||||
|
||||
//save the dialplan xml
|
||||
if ($this->destination == "database") {
|
||||
if (is_array($dialplans)) {
|
||||
foreach ($dialplans as $key => $value) {
|
||||
$sql = "update v_dialplans ";
|
||||
//$sql .= "set dialplan_xml = ':xml' ";
|
||||
$sql .= "set dialplan_xml = '".check_str($value)."' ";
|
||||
//$sql .= "where dialplan_uuid=:dialplan_uuid ";
|
||||
$sql .= "where dialplan_uuid = '$key';";
|
||||
//$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
//$prep_statement->bindParam(':xml', $value );
|
||||
//$prep_statement->bindParam(':dialplan_uuid', $key);
|
||||
//$prep_statement->execute();
|
||||
//$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
//print_r($result);
|
||||
unset($prep_statement);
|
||||
$this->db->query($sql);
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
//return true;
|
||||
}
|
||||
|
||||
}
|
||||
} // end class
|
||||
} // class_exists
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,9 @@
|
||||
<context name="public">
|
||||
<extension name="caller-details" continue="true" app_uuid="b1cd7509-5576-469a-892d-d0cfb66a4197" global="true">
|
||||
<condition field="" expression="" break="never">
|
||||
<action application="set" data="caller_destination=${destination_number}" inline="true"/>
|
||||
<action application="set" data="caller_id_name=${caller_id_name}" inline="true"/>
|
||||
<action application="set" data="caller_id_number=${caller_id_number}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,25 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="user_exists" number="" continue="true" app_uuid="897845b0-1f13-444c-84fe-432fd47338ca">
|
||||
<condition field="" expression="" break="">
|
||||
<action application="set" data="user_exists=${user_exists id ${destination_number} ${domain_name}}" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${user_exists}" expression="^true$" break="">
|
||||
<action application="set" data="extension_uuid=${user_data ${destination_number}@${domain_name} var extension_uuid}" inline="true"/>
|
||||
<action application="set" data="hold_music=${user_data ${destination_number}@${domain_name} var hold_music}" inline="true"/>
|
||||
<action application="set" data="forward_all_enabled=${user_data ${destination_number}@${domain_name} var forward_all_enabled}" inline="true"/>
|
||||
<action application="set" data="forward_all_destination=${user_data ${destination_number}@${domain_name} var forward_all_destination}" inline="true"/>
|
||||
<action application="set" data="forward_busy_enabled=${user_data ${destination_number}@${domain_name} var forward_busy_enabled}" inline="true"/>
|
||||
<action application="set" data="forward_busy_destination=${user_data ${destination_number}@${domain_name} var forward_busy_destination}" inline="true"/>
|
||||
<action application="set" data="forward_no_answer_enabled=${user_data ${destination_number}@${domain_name} var forward_no_answer_enabled}" inline="true"/>
|
||||
<action application="set" data="forward_no_answer_destination=${user_data ${destination_number}@${domain_name} var forward_no_answer_destination}" inline="true"/>
|
||||
<action application="set" data="forward_user_not_registered_enabled=${user_data ${destination_number}@${domain_name} var forward_user_not_registered_enabled}" inline="true"/>
|
||||
<action application="set" data="forward_user_not_registered_destination=${user_data ${destination_number}@${domain_name} var forward_user_not_registered_destination}" inline="true"/>
|
||||
<action application="set" data="do_not_disturb=${user_data ${destination_number}@${domain_name} var do_not_disturb}" inline="true"/>
|
||||
<action application="set" data="call_timeout=${user_data ${destination_number}@${domain_name} var call_timeout}" inline="true"/>
|
||||
<action application="set" data="missed_call_app=${user_data ${destination_number}@${domain_name} var missed_call_app}" inline="true"/>
|
||||
<action application="set" data="missed_call_data=${user_data ${destination_number}@${domain_name} var missed_call_data}" inline="true"/>
|
||||
<action application="set" data="toll_allow=${user_data ${destination_number}@${domain_name} var toll_allow}" inline="true"/>
|
||||
<action application="set" data="call_screen_enabled=${user_data ${destination_number}@${domain_name} var call_screen_enabled}" inline="true"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,9 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="caller-details" continue="true" app_uuid="5c491a3e-f587-44df-970a-cd4352aa6f64">
|
||||
<condition field="${caller_destination}" expression="^$" break="never">
|
||||
<action application="set" data="caller_destination=${destination_number}" inline="true"/>
|
||||
<action application="set" data="caller_id_name=${caller_id_name}" inline="true"/>
|
||||
<action application="set" data="caller_id_number=${caller_id_number}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,7 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="call-direction" number="" continue="true" app_uuid="3780f814-5543-4350-b65d-563512d1fe71" enabled="true">
|
||||
<condition field="${call_direction}" expression="^(inbound|outbound|local)$" break="never">
|
||||
<anti-action application="set" data="call_direction=local" inline="true"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="variables" number="" continue="true" app_uuid="9f356fe7-8cf8-4c14-8fe2-6daf89304458">
|
||||
<condition>
|
||||
<action application="export" data="origination_callee_id_name=${destination_number}"/>
|
||||
<action application="set" data="RFC2822_DATE=${strftime(%a, %d %b %Y %T %z)}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,7 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="call-limit" number="" continue="true" app_uuid="4670c44c-45dd-4bae-97ba-b0dfe0aca639" enabled="false">
|
||||
<condition field="${call_direction}" expression="^(inbound|outbound)$">
|
||||
<action application="limit" data="hash inbound ${domain_uuid} ${max_calls} !USER_BUSY"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
7
app/dialplans/resources/switch/conf/dialplan/030_is_local.xml
Executable file
7
app/dialplans/resources/switch/conf/dialplan/030_is_local.xml
Executable file
@@ -0,0 +1,7 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="is_local" number="" continue="true" app_uuid="a1685b18-21aa-4d77-9f95-c0013b7286a3" enabled="false">
|
||||
<condition field="${user_exists}" expression="false">
|
||||
<action application="lua" data="app.lua is_local"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,7 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="call_block" number="" continue="true" app_uuid="b1b31930-d0ee-4395-a891-04df94599f1f" enabled="false">
|
||||
<condition field="${call_direction}" expression="^inbound$" >
|
||||
<action application="lua" data="app.lua call_block"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,57 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="user_record" number="" continue="true" app_uuid="43539dd3-d555-4498-835a-3245a0b184ca" enabled="true">
|
||||
<condition field="" expression="">
|
||||
<action application="set" data="user_record=${user_data ${destination_number}@${domain_name} var user_record}" inline="true"/>
|
||||
<action application="set" data="from_user_exists=${user_exists id ${sip_from_user} ${sip_from_host}}" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${user_exists}" expression="^true$" break="never"/>
|
||||
<condition field="${user_record}" expression="^all$" break="never">
|
||||
<action application="set" data="record_session=true" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${user_exists}" expression="^true$" break="never"/>
|
||||
<condition field="${call_direction}" expression="^inbound$" break="never"/>
|
||||
<condition field="${user_record}" expression="^inbound$" break="never">
|
||||
<action application="set" data="record_session=true" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${user_exists}" expression="^true$" break="never"/>
|
||||
<condition field="${call_direction}" expression="^outbound$" break="never"/>
|
||||
<condition field="${user_record}" expression="^outbound$" break="never">
|
||||
<action application="set" data="record_session=true" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${user_exists}" expression="^true$" break="never"/>
|
||||
<condition field="${call_direction}" expression="^local$" break="never"/>
|
||||
<condition field="${user_record}" expression="^local$" break="never">
|
||||
<action application="set" data="record_session=true" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${from_user_exists}" expression="^true$" break="never">
|
||||
<action application="set" data="from_user_record=${user_data ${sip_from_user}@${sip_from_host} var user_record}" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${from_user_exists}" expression="^true$" break="never"/>
|
||||
<condition field="${from_user_record}" expression="^all$" break="never">
|
||||
<action application="set" data="record_session=true" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${from_user_exists}" expression="^true$" break="never"/>
|
||||
<condition field="${call_direction}" expression="^inbound$" break="never"/>
|
||||
<condition field="${from_user_record}" expression="^inbound$" break="never">
|
||||
<action application="set" data="record_session=true" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${from_user_exists}" expression="^true$" break="never"/>
|
||||
<condition field="${call_direction}" expression="^outbound$" break="never"/>
|
||||
<condition field="${from_user_record}" expression="^outbound$" break="never">
|
||||
<action application="set" data="record_session=true" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${from_user_exists}" expression="^true$" break="never"/>
|
||||
<condition field="${call_direction}" expression="^local$" break="never"/>
|
||||
<condition field="${from_user_record}" expression="^local$" break="never">
|
||||
<action application="set" data="record_session=true" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${record_session}" expression="^true$">
|
||||
<action application="set" data="record_path=${recordings_dir}/${domain_name}/archive/${strftime(%Y)}/${strftime(%b)}/${strftime(%d)}" inline="true"/>
|
||||
<action application="set" data="record_name=${uuid}.${record_ext}" inline="true"/>
|
||||
<!--<action application="set" data="record_name=${destination_number}-${caller_id_number}_${strftime(%Y-%m-%d %H:%M)}.${record_ext}" inline="true"/>-->
|
||||
<action application="set" data="record_append=true" inline="true"/>
|
||||
<action application="set" data="record_in_progress=true" inline="true"/>
|
||||
<action application="record_session" data="${record_path}/${record_name}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
10
app/dialplans/resources/switch/conf/dialplan/060_redial.xml
Normal file
10
app/dialplans/resources/switch/conf/dialplan/060_redial.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="redial" number="*870" continue="true" app_uuid="459da8c1-073a-458e-ae7e-8194342f9583">
|
||||
<condition field="destination_number" expression="^(redial|\*870)$" break="on-true">
|
||||
<action application="transfer" data="${hash(select/${domain_name}-last_dial/${caller_id_number})}"/>
|
||||
</condition>
|
||||
<condition field="" expression="" break="never">
|
||||
<action application="hash" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,7 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="speed_dial" number="*0[ext]" continue="false" app_uuid="1a4a2611-01e3-4582-982b-4ada4d314ea3" enabled="true">
|
||||
<condition field="destination_number" expression="^\*0(.*)$">
|
||||
<action application="lua" data="app.lua speed_dial $1"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,12 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="default_caller_id" number="" continue="true" app_uuid="9660e536-976d-47cb-872e-85957c51bd3d">
|
||||
<condition field="${emergency_caller_id_number}" expression="^$" break="never">
|
||||
<action application="set" data="emergency_caller_id_name=${default_emergency_caller_id_name}" inline="true"/>
|
||||
<action application="set" data="emergency_caller_id_number=${default_emergency_caller_id_number}" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${outbound_caller_id_number}" expression="^$" break="never">
|
||||
<action application="set" data="outbound_caller_id_name=${default_outbound_caller_id_name}" inline="true"/>
|
||||
<action application="set" data="outbound_caller_id_number=${default_outbound_caller_id_number}" inline="true"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="agent_status" number="*22" continue="false" app_uuid="2eb032c5-c79d-4096-ac90-8a47fe40f411">
|
||||
<condition field="destination_number" expression="^\*22$">
|
||||
<action application="set" data="agent_id=${sip_from_user}"/>
|
||||
<action application="lua" data="app.lua agent_status"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="agent_status_id" number="*23" continue="false" app_uuid="feb0ee6e-0ea5-41fc-a9c1-189daf2d4161">
|
||||
<condition field="destination_number" expression="^\*23$">
|
||||
<action application="set" data="agent_id="/>
|
||||
<action application="lua" data="app.lua agent_status"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,12 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="provision" number="*11,*12" continue="false" app_uuid="d31d267d-7235-4887-a01b-d59f3a1dfcca" enabled="false">
|
||||
<condition field="destination_number" expression="^\*11$" break="on-true">
|
||||
<action application="set" data="action=login"/>
|
||||
<action application="lua" data="app.lua provision"/>
|
||||
</condition>
|
||||
<condition field="destination_number" expression="^\*12$">
|
||||
<action application="set" data="action=logout"/>
|
||||
<action application="lua" data="app.lua provision"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="group-intercept" number="*8" continue="false" app_uuid="15332e83-12f5-44d3-8472-633736eb4b9b">
|
||||
<condition field="destination_number" expression="^\*8$">
|
||||
<action application="answer"/>
|
||||
<action application="lua" data="intercept_group.lua"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
15
app/dialplans/resources/switch/conf/dialplan/240_page.xml
Normal file
15
app/dialplans/resources/switch/conf/dialplan/240_page.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="page" number="*724" continue="false" app_uuid="2011c518-696d-4878-a9b2-b217b6311311" enabled="false">
|
||||
<condition field="destination_number" expression="^\*724$" >
|
||||
<action application="set" data="caller_id_name=Page" />
|
||||
<action application="set" data="caller_id_number=" />
|
||||
<action application="set" data="pin_number={v_pin_number}" />
|
||||
<action application="set" data="destinations=101-103,105" />
|
||||
<action application="set" data="moderator=false" />
|
||||
<action application="set" data="mute=true" />
|
||||
<action application="set" data="set api_hangup_hook=conference page-${destination_number} kick all" />
|
||||
<action application="lua" data="page.lua" />
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<!--
|
||||
@usage
|
||||
set `conf_xfer_number` and do transfer to `conf_xfer_from_dialplan`
|
||||
|
||||
<action application="export" data="conf_xfer_number=xfer-${create_uuid foo}-${domain_name}">
|
||||
<action application="bind_digit_action" data="local,*0,exec:execute_extension,conf_xfer_from_dialplan XML conf-xfer@${domain_name},${bind_target}"/>
|
||||
|
||||
Control DTMF sequence
|
||||
`*0` transfer `self` to enter number and `peer` leg to conference room
|
||||
`##` transfer `self` to enter number and hangup `peer` leg
|
||||
`*#` transfer `self` to conference room and hangup `peer` leg
|
||||
-->
|
||||
<context name="conf-xfer@{v_context}">
|
||||
<extension name="conf-xfer" number="" continue="false" app_uuid="04e6a380-a27e-4032-bedf-f5b2249ea54d" enabled="false">
|
||||
|
||||
<condition field="destination_number" expression="^conf_add_begin$" break="on-true">
|
||||
<action application="set" data="api_result=${conference(${conf_xfer_number} unmute ${conference_member_id} quiet)}"/>
|
||||
<action application="bind_digit_action" data="conf-xfer,*0,api:lua,transfer2.lua ${uuid} conf_enter_number::XML::conf-xfer@${domain_name} conf_enter_to::XML::conf-xfer@${domain_name}"/>
|
||||
<action application="bind_digit_action" data="conf-xfer,##,api:lua,transfer2.lua ${uuid} conf_enter_number::XML::conf-xfer@${domain_name} ::KILL::"/>
|
||||
<action application="bind_digit_action" data="conf-xfer,*#,api:lua,transfer2.lua ${uuid} conf_add_end::XML::conf-xfer@${domain_name} ::KILL::"/>
|
||||
<action application="bind_digit_action" data="conf,*#,exec:execute_extension,conf_add_begin XML conf-xfer@${domain_name}"/>
|
||||
<action application="bind_digit_action" data="none,NONE,api:sleep,1"/>
|
||||
<action application="set" data="continue_on_fail=true"/>
|
||||
<action application="transfer" data="conf_enter_number XML conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_add_end$" break="on-true">
|
||||
<action application="digit_action_set_realm" data="conf"/>
|
||||
<action application="set" data="api_result=${conference(${conf_xfer_number} mute ${conference_member_id})}"/>
|
||||
<action application="conference" data="${conf_xfer_number}@page"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_enter_number$" break="on-true">
|
||||
<action application="digit_action_set_realm" data="none"/>
|
||||
<action application="read" data="2 11 'tone_stream://%(10000,0,350,440)' target_num 30000 #"/>
|
||||
<action application="execute_extension" data="conf_bridge_${target_num} XML conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_bridge_$" break="on-true">
|
||||
<action application="execute_extension" data="conf_add_end XML conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_bridge_\*$" break="on-true">
|
||||
<action application="execute_extension" data="conf_add_end XML conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_bridge_(\d{2,7})$" break="on-true">
|
||||
<action application="digit_action_set_realm" data="conf-xfer"/>
|
||||
<action application="bridge" data="{conf_xfer_number=${conf_xfer_number},transfer_after_bridge=conf_enter_to:XML:conf-xfer@${domain_name}}user/$1@${domain_name}"/>
|
||||
<action application="execute_extension" data="conf_enter_number XML conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_bridge_" break="on-true">
|
||||
<action application="playback" data="voicemail/vm-that_was_an_invalid_ext.wav"/>
|
||||
<action application="execute_extension" data="conf_enter_number XML conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_enter_to$" break="on-true">
|
||||
<action application="unbind_meta_app" data=""/>
|
||||
<action application="bind_digit_action" data="conf,*#,exec:execute_extension,conf_add_begin XML conf-xfer@${domain_name}"/>
|
||||
<action application="digit_action_set_realm" data="conf"/>
|
||||
<action application="answer" data=""/>
|
||||
<action application="playback" data="tone_stream://L=1;%(500, 0, 640)"/>
|
||||
<action application="conference" data="${conf_xfer_number}@page"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_xfer_from_dialplan$">
|
||||
<action application="lua" data="transfer2.lua ${uuid} conf_add_begin::XML::conf-xfer@${domain_name} conf_enter_to::XML::conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,11 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="page-extension" number="*8[ext]" continue="false" app_uuid="1b224444-de8b-448d-b2d1-19feaac3effa">
|
||||
<condition field="destination_number" expression="^\*8(\d{2,7})$">
|
||||
<action application="set" data="destinations=$1"/>
|
||||
<action application="set" data="pin_number={v_pin_number}"/>
|
||||
<action application="set" data="mute=true"/>
|
||||
<action application="set" data="moderator=false" />
|
||||
<action application="lua" data="page.lua"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,9 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="eavesdrop" number="*33[ext]" continue="false" app_uuid="e944af7e-8fcc-429b-a32f-0dcdce1585d8">
|
||||
<condition field="destination_number" expression="^\*33(\d{2,7})$">
|
||||
<action application="answer"/>
|
||||
<action application="set" data="pin_number={v_pin_number}"/>
|
||||
<action application="lua" data="eavesdrop.lua $1"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,10 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="call_privacy" number="*67[d+]" continue="false" app_uuid="eb478e66-f637-4ae7-b1eb-9a7b87a1bd9e">
|
||||
<condition field="destination_number" expression="^\*67(\d+)$">
|
||||
<action application="privacy" data="full"/>
|
||||
<action application="set" data="sip_h_Privacy=id"/>
|
||||
<action application="set" data="privacy=yes"/>
|
||||
<action application="transfer" data="$1 XML ${context}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,7 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="call_return" number="*69" continue="false" app_uuid="fa516204-920f-4802-8bb1-04c6a010bfe1">
|
||||
<condition field="destination_number" expression="^\*69$">
|
||||
<action application="transfer" data="${hash(select/${domain_name}-call_return/${caller_id_number})}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,14 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="extension_queue" number="*800[ext]" app_uuid="eb837d10-890d-11e3-baa8-0800200c9a66">
|
||||
<condition field="destination_number" expression="^\*800(.*)$" >
|
||||
<action application="set" data="fifo_music=$${hold_music}" />
|
||||
<action application="set" data="extension_queue=queue_$1@\${domain_name}" />
|
||||
<action application="set" data="fifo_simo=1" />
|
||||
<action application="set" data="fifo_timeout=30" />
|
||||
<action application="set" data="fifo_lag=10" />
|
||||
<action application="set" data="fifo_destroy_after_use=true" />
|
||||
<action application="set" data="fifo_extension_member=$1@\${domain_name}" />
|
||||
<action application="lua" data="extension_queue.lua" />
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="${domain_name}">
|
||||
<extension name="intercept-ext-polycom" number="*97[ext]" continue="false" app_uuid="07493266-2b99-400a-8fde-3e1a9d11f575" global="true">
|
||||
<condition field="destination_number" expression="^\*97(\d+)$">
|
||||
<action application="answer"/>
|
||||
<action application="lua" data="intercept.lua $1"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="intercept-ext" number="**[ext]" continue="false" app_uuid="2b7b2f82-edfe-4339-8cc5-7d0cf36e1e68">
|
||||
<condition field="destination_number" expression="^\*\*(\d+)$">
|
||||
<action application="answer"/>
|
||||
<action application="lua" data="intercept.lua $1"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
10
app/dialplans/resources/switch/conf/dialplan/300_dx.xml
Normal file
10
app/dialplans/resources/switch/conf/dialplan/300_dx.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<!-- In call Transfer for phones without a transfer button -->
|
||||
<context name="{v_context}">
|
||||
<extension name="dx" number="dx" continue="false" app_uuid="ddcf7740-78ca-4035-8c19-e2df10cebf67">
|
||||
<condition field="destination_number" expression="^dx$">
|
||||
<action application="answer"/>
|
||||
<action application="read" data="11 11 'tone_stream://%(10000,0,350,440)' digits 5000 #"/>
|
||||
<action application="transfer" data="-bleg ${digits}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,12 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="att_xfer" number="att_xfer" continue="false" app_uuid="7bd7a113-0afc-406a-b4a7-33077c22ac39">
|
||||
<condition field="destination_number" expression="^att_xfer$">
|
||||
<action application="read" data="2 6 'tone_stream://%(10000,0,350,440)' digits 30000 #"/>
|
||||
<action application="set" data="origination_cancel_key=#"/>
|
||||
<!-- sends it to the correct domain but public context-->
|
||||
<!--<action application="set" data="domain_name=${transfer_context}"/>-->
|
||||
<!--<action application="att_xfer" data="sofia/internal/${digits}@${transfer_context}"/>-->
|
||||
<action application="att_xfer" data="user/${digits}@${domain_name}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,15 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="extension-to-voicemail" number="[ext]" continue="false" app_uuid="8a2e7b81-996c-4d6b-87df-b879b972a572">
|
||||
<condition field="${user_exists}" expression="^true$" />
|
||||
<condition field="username" expression="^${caller_id_number}$" />
|
||||
<condition field="destination_number" expression="^${caller_id_number}$">
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="set" data="voicemail_action=check"/>
|
||||
<action application="set" data="voicemail_id=${caller_id_number}"/>
|
||||
<action application="set" data="voicemail_profile=default"/>
|
||||
<action application="lua" data="app.lua voicemail"/>
|
||||
<!--<action application="voicemail" data="default ${domain_name} ${caller_id_number}"/>-->
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,14 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="send_to_voicemail" number="*99[ext]" continue="false" app_uuid="001d5dab-e0c6-4352-8f06-e9986ee7b0d8">
|
||||
<condition field="destination_number" expression="^\*99(\d{2,10})$">
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="set" data="voicemail_action=save"/>
|
||||
<action application="set" data="voicemail_id=$1"/>
|
||||
<action application="set" data="voicemail_profile=default"/>
|
||||
<action application="set" data="send_to_voicemail=true" />
|
||||
<action application="lua" data="app.lua voicemail"/>
|
||||
<!--<action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>-->
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
22
app/dialplans/resources/switch/conf/dialplan/320_vmain.xml
Normal file
22
app/dialplans/resources/switch/conf/dialplan/320_vmain.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<!-- voicemail main extension, used when * is pressed from an external number -->
|
||||
<context name="{v_context}">
|
||||
<extension name="vmain" number="*98" continue="false" app_uuid="d085a1e3-c53a-4480-9ca6-6a362899a681">
|
||||
<condition field="destination_number" expression="^vmain$|^\*4000$|^\*98$" break="never">
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="set" data="voicemail_action=check"/>
|
||||
<action application="set" data="voicemail_profile=default"/>
|
||||
<action application="lua" data="app.lua voicemail"/>
|
||||
<!--<action application="voicemail" data="check default ${domain_name}"/>-->
|
||||
</condition>
|
||||
<condition field="destination_number" expression="^(vmain$|^\*4000$|^\*98)(\d{2,12})$">
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="set" data="voicemail_action=check"/>
|
||||
<action application="set" data="voicemail_id=$2"/>
|
||||
<action application="set" data="voicemail_profile=default"/>
|
||||
<action application="set" data="voicemail_authorized=false"/>
|
||||
<action application="lua" data="app.lua voicemail"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
11
app/dialplans/resources/switch/conf/dialplan/320_xfer_vm.xml
Normal file
11
app/dialplans/resources/switch/conf/dialplan/320_xfer_vm.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="xfer_vm" number="xfer_vm" continue="false" app_uuid="44a4b26d-9e13-41dc-8405-7ff2e4a215e0">
|
||||
<condition field="destination_number" expression="^xfer_vm$">
|
||||
<action application="read" data="2 6 'tone_stream://%(10000,0,350,440)' digits 30000 #"/>
|
||||
<action application="set" data="origination_cancel_key=#"/>
|
||||
<action application="set" data="domain_name=${transfer_context}"/>
|
||||
<action application="export" data="domain_name=${transfer_context}"/>
|
||||
<action application="transfer" data="-bleg *99${digits} XML ${transfer_context}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,9 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="is_transfer" number="is_transfer" continue="false" app_uuid="da8e22c7-9e07-4ff5-a28b-faf35ba8d411">
|
||||
<condition field="destination_number" expression="^is_transfer$"/>
|
||||
<condition field="${digits}" expression="^(\d+)$">
|
||||
<action application="transfer" data="-aleg ${digits} XML ${context}"/>
|
||||
<anti-action application="eval" data="cancel transfer"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,14 @@
|
||||
<!-- voicemail provide user extension -->
|
||||
<context name="{v_context}">
|
||||
<extension name="vmain_user" number="*97" continue="false" app_uuid="5d47ab13-f25d-4f62-a68e-2a7d945d05b7">
|
||||
<condition field="destination_number" expression="^\*97$">
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="set" data="voicemail_action=check"/>
|
||||
<action application="set" data="voicemail_id=${caller_id_number}"/>
|
||||
<action application="set" data="voicemail_profile=default"/>
|
||||
<action application="lua" data="app.lua voicemail"/>
|
||||
<!--<action application="voicemail" data="check default ${domain_name} ${caller_id_number}"/>-->
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
9
app/dialplans/resources/switch/conf/dialplan/340_cf.xml
Normal file
9
app/dialplans/resources/switch/conf/dialplan/340_cf.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<!-- Used to transfer both legs into a conference -->
|
||||
<context name="{v_context}">
|
||||
<extension name="cf" number="cf" continue="false" app_uuid="f13df3df-bfb4-4c11-bee1-6548cd983729">
|
||||
<condition field="destination_number" expression="^cf$">
|
||||
<action application="answer"/>
|
||||
<action application="transfer" data="-both 30${dialed_extension:2} XML ${context}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="delay_echo" number="*9195" continue="false" app_uuid="fe638409-b347-46d7-9aca-489561df8b35">
|
||||
<condition field="destination_number" expression="^\*9195$">
|
||||
<action application="answer"/>
|
||||
<action application="delay_echo" data="5000"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="echo" number="*9196" continue="false" app_uuid="1f894dfb-0567-4e20-9026-d538bbaa5261">
|
||||
<condition field="destination_number" expression="^\*9196$">
|
||||
<action application="answer"/>
|
||||
<action application="echo"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,10 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="please_hold" number="" continue="true" app_uuid="c3ea29d1-db41-421e-91b7-b0984e50bcae" enabled="false">
|
||||
<condition field="${user_exists}" expression="^true$">
|
||||
<action application="set" data="transfer_ringback=$${hold_music}"/>
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1500"/>
|
||||
<action application="playback" data="ivr/ivr-hold_connect_call.wav"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,9 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="is_zrtp_secure" number="" continue="true" app_uuid="951808c2-b778-404d-bd17-50b5df4b88f4">
|
||||
<condition field="${zrtp_secure_media_confirmed}" expression="^true$">
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="playback" data="misc/call_secured.wav"/>
|
||||
<anti-action application="eval" data="not_secure"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="milliwatt" number="*9197" continue="false" app_uuid="296acca3-d30f-42a0-ba90-5af2208ad7f8">
|
||||
<condition field="destination_number" expression="^\*9197$">
|
||||
<action application="answer"/>
|
||||
<action application="playback" data="{loops=-1}tone_stream://%(251,0,1004)"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!-- Only Truly consider it secure if its TLS and SRTP -->
|
||||
<context name="{v_context}">
|
||||
<extension name="is_secure" number="is_secure" continue="true" app_uuid="b57306e0-36df-4048-b182-7ad0f69d8c03">
|
||||
<condition field="${sip_via_protocol}" expression="tls"/>
|
||||
<condition field="${sip_secure_media_confirmed}" expression="^true$">
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="playback" data="misc/call_secured.wav"/>
|
||||
<anti-action application="eval" data="not_secure"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="tone_stream" number="*9198" continue="false" app_uuid="98ccdb0b-c074-4f74-b28a-9528372faa7d">
|
||||
<condition field="destination_number" expression="^\*9198$">
|
||||
<action application="answer"/>
|
||||
<action application="playback" data="{loops=10}tone_stream://path=${base_dir}/conf/tetris.ttml"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,15 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="hold_music" number="*9664" continue="false" app_uuid="b824b88a-e6da-486e-9f17-7b93cbaa318e">
|
||||
<condition field="destination_number" expression="^\*9664$"/>
|
||||
<condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$">
|
||||
<action application="answer"/>
|
||||
<action application="execute_extension" data="is_secure XML ${context}"/>
|
||||
<action application="playback" data="$${hold_music}"/>
|
||||
<anti-action application="set" data="zrtp_secure_media=true"/>
|
||||
<anti-action application="answer"/>
|
||||
<anti-action application="playback" data="silence_stream://2000"/>
|
||||
<anti-action application="execute_extension" data="is_zrtp_secure XML ${context}"/>
|
||||
<anti-action application="playback" data="$${hold_music}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,11 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="recordings" number="*732" continue="false" app_uuid="430737df-5385-42d1-b933-22600d3fb79e">
|
||||
<condition field="destination_number" expression="^\*(732)$">
|
||||
<action application="answer"/>
|
||||
<action application="set" data="pin_number={v_pin_number}"/>
|
||||
<action application="set" data="recording_slots=true"/>
|
||||
<action application="set" data="recording_prefix=recording"/>
|
||||
<action application="lua" data="recordings.lua"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,16 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="freeswitch_conference" number="*9888" continue="false" app_uuid="8e3ad78e-4b48-4d36-af7e-4920a9757043" enabled="false">
|
||||
<condition field="destination_number" expression="^\*9(888|8888|1616|3232)$">
|
||||
<action application="export" data="hold_music=silence"/>
|
||||
<!--
|
||||
This will take the SAS from the b-leg and send it to the display on the a-leg phone.
|
||||
Known working with Polycom and Snom maybe others.
|
||||
-->
|
||||
<!--
|
||||
<action application="set" data="exec_after_bridge_app=${sched_api(+4 zrtp expand uuid_display ${uuid} \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas1_string )} \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas2_string )} )}"/>
|
||||
<action application="export" data="nolocal:zrtp_secure_media=true"/>
|
||||
-->
|
||||
<action application="bridge" data="sofia/${use_profile}/$1@conference.freeswitch.org"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
10
app/dialplans/resources/switch/conf/dialplan/420_disa.xml
Normal file
10
app/dialplans/resources/switch/conf/dialplan/420_disa.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="disa" number="*3472" continue="false" app_uuid="3ade2d9a-f55d-4240-bb60-b4a3ab36951c" enabled="false">
|
||||
<condition field="destination_number" expression="^\*(3472)$">
|
||||
<action application="answer"/>
|
||||
<action application="set" data="pin_number={v_pin_number}"/>
|
||||
<action application="set" data="dialplan_context=${context}"/>
|
||||
<action application="lua" data="disa.lua"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,7 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="directory" number="*411" continue="false" app_uuid="a223dc70-28a1-4979-834e-8af813cd8ea6">
|
||||
<condition field="destination_number" expression="^\*411$">
|
||||
<action application="lua" data="directory.lua"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
10
app/dialplans/resources/switch/conf/dialplan/440_wake-up.xml
Normal file
10
app/dialplans/resources/switch/conf/dialplan/440_wake-up.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="wake-up" number="*925" continue="false" app_uuid="e27abe68-41c0-4188-bb0f-67d93de0c610">
|
||||
<condition field="destination_number" expression="^\*(925)$">
|
||||
<action application="answer"/>
|
||||
<action application="set" data="pin_number={v_pin_number}"/>
|
||||
<action application="set" data="time_zone_offset=-7"/>
|
||||
<action application="lua" data="wakeup.lua"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,23 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="valet_park" number="park+*5901-*5999" continue="false" app_uuid="3cc8363d-5ce3-48aa-8ac1-143cf297c4f7" enabled="true">
|
||||
<condition field="destination_number" expression="^(park\+)?(\*59[0-9][0-9])$" break="never"/>
|
||||
<condition field="${sip_h_Referred-By}" expression="sip:(.*)@.*" break="never">
|
||||
<action application="set" data="referred_by_user=$1"/>
|
||||
</condition>
|
||||
<condition field="destination_number" expression="^(park\+)?(\*59[0-9][0-9])$" break="never">
|
||||
<action application="set" data="park_in_use=false" inline="true"/>
|
||||
<action application="set" data="park_lot=$2" inline="true"/>
|
||||
</condition>
|
||||
<condition field="destination_number" expression="^(park\+)?(\*59[0-9][0-9])$"/>
|
||||
<condition field="${cond ${sip_h_Referred-By} == '' ? false : true}" expression="true" break="never">
|
||||
<action application="set" data="park_in_use=${regex ${valet_info park@${domain_name}}|${park_lot}}" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${park_in_use}" expression="true" break="never">
|
||||
<action application="transfer" data="${referred_by_user} XML ${context}"/>
|
||||
<anti-action application="set" data="valet_parking_timeout=90"/>
|
||||
<anti-action application="set" data="valet_hold_music=${hold_music}"/>
|
||||
<anti-action application="set" data="valet_parking_orbit_exten=${referred_by_user}"/>
|
||||
<anti-action application="valet_park" data="park@${domain_name} ${park_lot}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,7 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="valet_park_in" number="park+*5900" continue="false" app_uuid="c192ee50-084d-40d8-8d9a-6959369382c8" enabled="false">
|
||||
<condition field="destination_number" expression="^(park\+)?(\*5900)$">
|
||||
<action application="valet_park" data="park@${domain_name} auto in 5901 5999"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="valet_park_out" number="park+*5901-*5999" continue="false" app_uuid="242130d4-61d6-4daf-9dd1-b139a2b3b166" enabled="false">
|
||||
<condition field="destination_number" expression="^(park\+)?\*(59[0-9][0-9])$">
|
||||
<action application="answer"/>
|
||||
<action application="valet_park" data="park@${domain_name} $2"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,11 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="operator" number="0" continue="false" app_uuid="0e1cd2d7-9d84-4959-8b6c-0cb23de4de59">
|
||||
<condition field="destination_number" expression="^0$|^operator$">
|
||||
<action application="export" data="transfer_context={v_context}" />
|
||||
<action application="bind_meta_app" data="4 ab s execute_extension::att_xfer XML ${context}" />
|
||||
<action application="bind_meta_app" data="5 ab s execute_extension::xfer_vm XML ${context}" />
|
||||
<action application="set" data="domain_name={v_context}" />
|
||||
<action application="transfer" data="1001 XML {v_context}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,10 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="operator-forward" number="*000" continue="false" app_uuid="a90d3639-3b82-4905-a65d-85f58b6c4a19" enabled="true">
|
||||
<condition field="destination_number" expression="^\*000$" >
|
||||
<action application="set" data="dial_string=loopback/operator/{v_context}/XML" />
|
||||
<action application="set" data="direction=both" />
|
||||
<action application="set" data="extension=true" />
|
||||
<action application="lua" data="dial_string.lua" />
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,20 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="do-not-disturb" number="*77,*78,*79" continue="false" app_uuid="df32d982-e39e-4ae5-a46d-aed1893873f2" enabled="true">
|
||||
<condition field="destination_number" expression="^\*77$" break="on-true">
|
||||
<action application="set" data="enabled=toggle"/>
|
||||
<action application="lua" data="do_not_disturb.lua"/>
|
||||
</condition>
|
||||
<condition field="destination_number" expression="^\*78$|\*363$" break="on-true">
|
||||
<action application="set" data="enabled=true"/>
|
||||
<action application="lua" data="do_not_disturb.lua"/>
|
||||
</condition>
|
||||
<condition field="destination_number" expression="^\*79$" break="on-true">
|
||||
<action application="set" data="enabled=false"/>
|
||||
<action application="lua" data="do_not_disturb.lua"/>
|
||||
</condition>
|
||||
<condition field="destination_number" expression="^dnd\+${caller_id_number}$" break="on-true">
|
||||
<action application="set" data="enabled=toggle"/>
|
||||
<action application="lua" data="do_not_disturb.lua"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,22 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="call-forward" number="*72,*73,*74" continue="false" app_uuid="b4b32fb4-0181-4876-9bec-b9dff1299d60" enabled="true">
|
||||
<condition field="destination_number" expression="^\*72$" break="on-true">
|
||||
<action application="set" data="enabled=true"/>
|
||||
<action application="lua" data="call_forward.lua"/>
|
||||
</condition>
|
||||
<condition field="destination_number" expression="^\*73$" break="on-true">
|
||||
<action application="set" data="enabled=false"/>
|
||||
<action application="lua" data="call_forward.lua"/>
|
||||
</condition>
|
||||
<condition field="destination_number" expression="^\*74$" break="on-true">
|
||||
<action application="set" data="request_id=true"/>
|
||||
<action application="set" data="enabled=toggle"/>
|
||||
<action application="lua" data="call_forward.lua"/>
|
||||
</condition>
|
||||
<condition field="destination_number" expression="^forward\+(\Q${caller_id_number}\E)(?:\/(\d+))?$" break="on-true">
|
||||
<action application="set" data="enabled=toggle"/>
|
||||
<action application="set" data="forward_all_destination=$2"/>
|
||||
<action application="lua" data="call_forward.lua"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="${domain_name}">
|
||||
<extension name="call forward all" number="" app_uuid="57cf8f1f-9a2e-4996-bd80-d9300249b1ca" global="true">
|
||||
<condition field="${user_exists}" expression="^true"/>
|
||||
<condition field="${forward_all_enabled}" expression="^true">
|
||||
<action application="transfer" data="${forward_all_destination} XML ${domain_name}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="follow-me" number="*21" continue="false" app_uuid="b8c28c75-1a03-4dad-9a53-980ca5f487f0" enabled="true">
|
||||
<condition field="destination_number" expression="^\*21$">
|
||||
<action application="answer"/>
|
||||
<action application="lua" data="follow_me.lua"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,9 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="clear_sip_auto_answer" app_uuid="90c51470-dc31-11e3-9c1a-0800200c9a66" continue="true" >
|
||||
<condition field="${click_to_call}" expression="true" />
|
||||
<condition field="${sip_h_Call-Info}" expression="answer-after=0" >
|
||||
<action application="unset" data="sip_h_Call-Info" />
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<context name="${domain_name}">
|
||||
<extension name="talking clock date and time" number="*9172" app_uuid="3ce3d9a1-c7bd-45f6-a81f-37f526b4fe73" global="true">
|
||||
<condition field="destination_number" expression="^\*9172$">
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="say" data="${default_language} CURRENT_DATE_TIME pronounced ${strepoch()}"/>
|
||||
<action application="hangup"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,10 @@
|
||||
<context name="${domain_name}">
|
||||
<extension name="talking clock time" number="*9170" app_uuid="ce1786ff-1965-4c18-998a-27a381623534" global="true">
|
||||
<condition field="destination_number" expression="^\*9170$">
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="say" data="${default_language} CURRENT_TIME pronounced ${strepoch()}"/>
|
||||
<action application="hangup"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,10 @@
|
||||
<context name="${domain_name}">
|
||||
<extension name="talking clock date" number="*9171" app_uuid="780e174b-a645-478e-b53c-0eb08b9a043c" global="true">
|
||||
<condition field="destination_number" expression="^\*9171$">
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="say" data="${default_language} CURRENT_DATE pronounced ${strepoch()}"/>
|
||||
<action application="hangup"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,14 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="extension_queue" continue="false" app_uuid="854df474-bf40-419e-9ba7-3bd27a52d98a" enabled="false">
|
||||
<condition field="${user_exists}" expression="^true$">
|
||||
<action application="answer" data=""/>
|
||||
<action application="set" data="fifo_simo=1"/>
|
||||
<action application="set" data="fifo_timeout=1"/>
|
||||
<action application="set" data="fifo_lag=1"/>
|
||||
<action application="set" data="fifo_destroy_after_use=true"/>
|
||||
<action application="set" data="fifo_music=local_stream://default"/>
|
||||
<action application="set" data="result=${fifo_member(add ${destination_number}@${domain_name} {fifo_member_wait=nowait}user/${destination_number}@${domain_name}"/>
|
||||
<action application="fifo" data="${destination_number}@${domain_name} in"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,7 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="nway_conference" number="nway" continue="false" app_uuid="20617852-b069-4ace-9137-3d6a16588f6f" enabled="false">
|
||||
<condition field="destination_number" expression="^nway">
|
||||
<action application="conference" data="${destination_number}@${domain_name}+flags{mintwo}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
<context name="{v_context}">
|
||||
<extension name="bind_digit_action" number="" continue="true" app_uuid="7e007a4d-886b-4cdf-81f4-da9eb4689f1c" enabled="false">
|
||||
<condition field="${sip_authorized}" expression="true" break="never">
|
||||
<action application="set" data="bind_target=both" inline="true"/>
|
||||
<!-- set to peer to prevent manipulate of call by caller -->
|
||||
<anti-action application="set" data="bind_target=peer" inline="true"/>
|
||||
</condition>
|
||||
<condition>
|
||||
<!-- <action application="export" data="conf_xfer_number=xfer-${create_uuid foo}-${domain_name}"/>-->
|
||||
<action application="bind_digit_action" data="local,*1,exec:execute_extension,dx XML ${context},${bind_target}"/>
|
||||
<action application="bind_digit_action" data="local,*2,exec:record_session,$${recordings_dir}/${domain_name}/archive/${strftime(%Y)}/${strftime(%b)}/${strftime(%d)}/${uuid}.${record_ext},${bind_target}"/>
|
||||
<action application="bind_digit_action" data="local,*3,exec:execute_extension,cf XML ${context},${bind_target}"/>
|
||||
<action application="bind_digit_action" data="local,*4,exec:execute_extension,att_xfer XML ${context},${bind_target}"/>
|
||||
<!-- <action application="bind_digit_action" data="local,*0,exec:execute_extension,conf_xfer_from_dialplan XML conf-xfer@${domain_name},${bind_target}"/> -->
|
||||
<action application="digit_action_set_realm" data="local"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,9 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="cidlookup" number="" continue="true" app_uuid="a0cb498c-6e09-441f-83ea-a7684565c44e" enabled="false">
|
||||
<condition field="${user_exists}" expression="^true$"/>
|
||||
<condition field="${call_direction}" expression="^inbound$">
|
||||
<condition field="${module_exists(mod_cidlookup)}" expression="^true$"/>
|
||||
<action application="set" data="effective_caller_id_name=${cidlookup(${caller_id_number})}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,17 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="call_screen" number="[ext]" continue="true" app_uuid="b26a08a5-a062-42ca-b90f-d47f905dd876">
|
||||
<condition field="${call_screen_enabled}" expression="^true$"/>
|
||||
<condition field="${call_direction}" expression="^inbound$">
|
||||
<action application="set" data="call_screen_file=/tmp/${domain_name}-${caller_id_number}.${record_ext}"/>
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<action application="phrase" data="voicemail_record_name"/>
|
||||
<action application="playback" data="tone_stream://%(500, 0, 640)"/>
|
||||
<action application="set" data="playback_terminators=#*0123456789"/>
|
||||
<action application="record" data="${call_screen_file} 7 200 2"/>
|
||||
<action application="set" data="group_confirm_key=1"/>
|
||||
<action application="set" data="fail_on_single_reject=true"/>
|
||||
<action application="set" data="group_confirm_file=phrase:screen_confirm:${call_screen_file}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,30 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="local_extension" number="[ext]" continue="true" app_uuid="71cf1310-b6e3-415b-8745-3cbdc8e15212">
|
||||
<condition field="${user_exists}" expression="true">
|
||||
<!--<action application="pre_answer"/>-->
|
||||
<action application="export" data="dialed_extension=${destination_number}" inline="true"/>
|
||||
<action application="limit" data="hash ${domain_name} ${destination_number} ${limit_max} ${limit_destination}" inline="false" />
|
||||
</condition>
|
||||
<condition>
|
||||
<!--<action application="set" data="ringback=${ringback}"/>-->
|
||||
<action application="set" data="hangup_after_bridge=true"/>
|
||||
<!--<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
|
||||
<action application="set" data="continue_on_fail=true"/>
|
||||
<action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
|
||||
<action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
|
||||
<action application="set" data="called_party_call_group=${user_data(${dialed_extension}@${domain_name} var call_group)}"/>
|
||||
<!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>-->
|
||||
<action application="hash" data="insert/${domain_name}-last_dial/${called_party_call_group}/${uuid}"/>
|
||||
<action application="set" data="api_hangup_hook=lua app.lua hangup"/>
|
||||
<action application="export" data="domain_name=${domain_name}"/>
|
||||
<!-- standard method -->
|
||||
<action application="bridge" data="user/${destination_number}@${domain_name}"/>
|
||||
<!-- sofia contact -->
|
||||
<!--<action application="bridge" data="${sofia_contact(${dialed_extension}@${domain_name})}"/>-->
|
||||
<!-- number-alias / https://confluence.freeswitch.org/display/FREESWITCH/XML+User+Directory -->
|
||||
<!--<action application="bridge" data="user/${user_data(${destination_number}@${domain_name} attr id)}@${domain_name}"/> -->
|
||||
<!-- handles bridge failures before answer -->
|
||||
<action application="lua" data="app.lua failure_handler"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,13 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="voicemail" number="[ext]" continue="false" app_uuid="e3c14f2f-7697-4b5d-9c62-2443c0e22bf2">
|
||||
<condition field="${user_exists}" expression="true">
|
||||
<action application="answer"/>
|
||||
<action application="sleep" data="1000"/>
|
||||
<!--<action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>-->
|
||||
<action application="set" data="voicemail_action=save"/>
|
||||
<action application="set" data="voicemail_id=${destination_number}"/>
|
||||
<action application="set" data="voicemail_profile=default"/>
|
||||
<action application="lua" data="app.lua voicemail"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
@@ -0,0 +1,8 @@
|
||||
<context name="public">
|
||||
<extension name="not-found" continue="false" app_uuid="23d198e5-7a8e-4af7-b573-2d166c1c24ff" global="true">
|
||||
<condition field="" expression="">
|
||||
<action application="set" data="call_direction=inbound" inline="true"/>
|
||||
<action application="log" data="[inbound routes] 404 not found ${sip_network_ip}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
</context>
|
||||
Reference in New Issue
Block a user