39 | * @return void
40 | */
41 | private function write_settings($profile_id) {
42 | $query = sprintf('%s %s %s;'
43 | , "SELECT * FROM voicemail_settings "
44 | , "WHERE voicemail_id=$profile_id "
45 | , "ORDER BY voicemail_id, param_name"
46 | );
47 | $settings_array = $this -> db -> queryAll($query);
48 | $settings_count = count($settings_array);
49 | if (FS_PDO::isError($settings_array)) {
50 | $this -> comment($query);
51 | $this -> comment($this -> db -> getMessage());
52 | return ;
53 | }
54 | if ($settings_count < 1) {
55 | return ;
56 | }
57 |
58 | for ($i=0; $i<$settings_count; $i++) {
59 | //$this -> comment_array($settings_array[$i]);
60 | $this -> xmlw -> startElement('param');
61 | $this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
62 | $this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
63 | $this -> xmlw -> endElement();//
64 | }
65 | $this -> write_email($profile_id);
66 | }
67 |
68 | /**
69 | * Write XML for voicemail email settings
70 | * @return void
71 | */
72 | private function write_email($profile_id) {
73 | $query = sprintf('%s %s %s;'
74 | , "SELECT * FROM voicemail_email "
75 | , "WHERE voicemail_id=$profile_id "
76 | , "ORDER BY voicemail_id, param_name"
77 | );
78 | $settings_array = $this -> db -> queryAll($query);
79 | $settings_count = count($settings_array);
80 | if (FS_PDO::isError($settings_array)) {
81 | $this -> comment($query);
82 | $this -> comment($this -> db -> getMessage());
83 | return ;
84 | }
85 | if ($settings_count < 1) {
86 | return ;
87 | }
88 | $this -> xmlw -> startElement('email');
89 |
90 | for ($i=0; $i<$settings_count; $i++) {
91 | //$this -> comment_array($settings_array[$i]);
92 | $this -> xmlw -> startElement('param');
93 | $this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
94 | $this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
95 | $this -> xmlw -> endElement();//
96 | }
97 | $this -> xmlw -> endElement();
98 | }
99 |
100 | /**
101 | * Write the XML for the current profile in write_profiles
102 | * @return void
103 | */
104 | private function write_single_profile($profile) {
105 | $this -> xmlw -> startElement('profile');
106 | $this -> xmlw -> writeAttribute('name', $profile['vm_profile']);
107 | $this -> write_settings($profile['id']);
108 | $this -> xmlw -> endElement();
109 | }
110 |
111 | /**
112 | * Write the entire XML config for the voicemail module
113 | * Write XML by calling other methods to do specific areas of config
114 | * @return void
115 | */
116 | private function write_config($profiles) {
117 | $profile_count = count($profiles);
118 | $this -> xmlw -> startElement('configuration');
119 | $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
120 | $this -> xmlw -> writeAttribute('description', 'voicemail Endpoint');
121 | $this -> xmlw -> startElement('profiles');
122 | for ($i=0; $i<$profile_count; $i++) {
123 | $this -> write_single_profile($profiles[$i]);
124 | }
125 | $this -> xmlw -> endElement();
126 | $this -> xmlw -> endElement();
127 | }
128 | }
129 |
130 | ?>
131 |
--------------------------------------------------------------------------------
/configuration/xml_cdr.conf.php:
--------------------------------------------------------------------------------
1 |
12 | * @version 0.1
13 | * Class for writing xml_cdr.conf XML
14 | */
15 | class xml_cdr_conf extends fs_configuration {
16 | function xml_cdr_conf() {
17 | $this->fs_configuration();
18 | }
19 |
20 | function main() {
21 | $params = $this->get_settings();
22 | $this->write_settings($params);
23 | }
24 |
25 | function get_settings() {
26 | return array(
27 | 'url'=>'http://' . $_SERVER['HTTP_HOST'] . '/' . $_SERVER['PHP_SELF']
28 | , 'encode'=>'true'
29 | );
30 | }
31 |
32 | function write_settings($params) {
33 | $this->xmlw->startElement('configuration');
34 | $this->xmlw->writeAttribute('name', basename(__FILE__, '.php'));
35 | $this->xmlw->writeAttribute('description', 'CDRs via XML Post');
36 | $this->xmlw->startElement('settings');
37 | while (list($name, $value) = each($params)) {
38 | $this->xmlw->startElement('param');
39 | $this->xmlw->writeAttribute('name', $name);
40 | $this->xmlw->writeAttribute('value', $value);
41 | $this->xmlw->endElement();
42 | }
43 | $this->xmlw->endElement();
44 | $this->xmlw->endElement();
45 | }
46 | }
47 |
48 | ?>
49 |
--------------------------------------------------------------------------------
/dialplan_importer.php:
--------------------------------------------------------------------------------
1 |
7 | * @version 0.1
8 | */
9 |
10 | /**
11 | * Switched to simple xml, pdo and new schemea. Added several new supporint functions
12 | * @author Michael Phillips
13 | */
14 |
15 | require_once('libs/fs_pdo.php');
16 |
17 | /**
18 | * require global definitions for FS_CURL
19 | */
20 | require_once('global_defines.php');
21 |
22 | /**
23 | * Output the upload form
24 | * echo out the HTML for the upload form.
25 | * @return null
26 | */
27 | function upload_form() {
28 | echo '';
29 | echo 'Select A File To Import
';
30 | echo '';
35 | echo '';
36 | }
37 |
38 | /**
39 | * Perform Insert Query
40 | * take MDB2 object and query as params and
41 | * perform query, setting error flag in the event
42 | * of a db error.
43 | * @return null
44 | */
45 | function run_query($db, $query) {
46 | syslog(LOG_INFO, $query);
47 | $affected = $db -> exec($query);
48 | if (FS_PDO::isError($affected)) {
49 | if (!defined('UNSUCCESSFUL_QUERY')) {
50 | define('UNSUCCESSFUL_QUERY', true);
51 | }
52 | echo "$query
\n";
53 | echo $affected -> getMessage() . "\n";
54 | }
55 | }
56 |
57 | /**
58 | * Check uploaded file for obvious problems
59 | * This function checks the uploaded file's
60 | * size, type, length, etc to make sure it's
61 | * worth continuing with processing
62 | * @return bool
63 | */
64 | function check_uploaded_file($file_array) {
65 | if (!is_uploaded_file($file_array['tmp_name'])) {
66 | echo "File NOT uploaded OK
";
67 | die(upload_form());
68 | } elseif ($file_array['size'] < 1) {
69 | echo "File was empty";
70 | die(upload_form());
71 | } elseif ($file_array['error'] > 0) {
72 | echo "Uploading file encountered error #" . $file_array['error'];
73 | die(upload_form());
74 | } elseif ($file_array['type'] != 'text/xml') {
75 | echo "Expected file of type 'text/xml', but got " . $file_array['type'];
76 | die(upload_form());
77 | } else {
78 | //echo "File seems uploaded OK
";
79 | return true;
80 | }
81 | }
82 |
83 |
84 | if (!array_key_exists('confirmed', $_REQUEST)) {
85 | die(upload_form());
86 | }
87 |
88 | /*
89 | foreach ($_REQUEST as $key => $val) {
90 | echo "$key => $val
\n";
91 | }
92 | if (is_array($_FILES) && count($_FILES)>0) {
93 | echo "FILES is an array
";
94 | print_r($_FILES);
95 | }
96 | */
97 |
98 |
99 | // no need to do anything till we check that the file's ok
100 | if (check_uploaded_file($_FILES['file'])) {
101 | $xml_file = $_FILES['file']['tmp_name'];
102 | //move_uploaded_file($tmp_file, $xml_file);
103 | //is_uploaded_file
104 | //echo filesize($xml_file);
105 | //echo $xml_file . "\n
";
106 | $xml_str = file_get_contents($xml_file);
107 | }
108 |
109 |
110 | try {
111 | $db = new FS_PDO(DEFAULT_DSN,DEFAULT_DSN_LOGIN, DEFAULT_DSN_PASSWORD);
112 | } catch(Exception $e) {
113 | die($e->getMessage());
114 | }
115 |
116 | if($_POST['clear_dialplan']) {
117 | truncate_dialplan();
118 | }
119 |
120 | echo "";
121 | $xml = simplexml_load_string($xml_str);
122 | $num_of_conext = sizeof($xml->context);
123 |
124 |
125 | $dialplan_id = insert_dialplan();
126 | foreach($xml->children() as $context => $context_children) {
127 | //echo $context . " => " . $context_children->attributes()->name . "\n";
128 | $context_id = insert_dialplan_context($dialplan_id, $context_children->attributes()->name);
129 |
130 | foreach($context_children as $extension => $extension_children) {
131 | //echo "\t" . $extension . " => name: " . $extension_children->attributes()->name . " continue: " . $extension_children->attributes()->continue . "\n" ;
132 | if($extension == 'extension') { //verify again bad input
133 | $extension_id = insert_dialplan_extension($context_id, $extension_children->attributes()->name, $extension_children->attributes()->continue);
134 | }
135 | foreach($extension_children as $condition => $condition_children) {
136 | //echo "\t\t" . $condition . " => " . $condition_children->attributes()->field . ", expression; " .$condition_children->attributes()->expression . "\n";
137 | $condition_id = insert_dialplan_condition($extension_id, $condition_children->attributes()->field, $condition_children->attributes()->expression);
138 | foreach($condition_children as $action => $action_childress) {
139 | //echo "\t\t\t" . $action . " => " . $action_childress->attributes()->application . ", expression; " .$action_childress->attributes()->data . "\n";
140 | if($action == ('action' || 'anti-action')) { //verify again bad input
141 | insert_dialplan_actions($condition_id, $action_childress->attributes()->application , $action_childress->attributes()->data, $action);
142 | } else {
143 | echo "bad xml $action";
144 | }// end if
145 | } //end foreach
146 | } //end foreach
147 | }// end foreach
148 | } // end foreach
149 |
150 | echo "
";
151 |
152 | function insert_dialplan($domain = 'freeswitch' , $ip_address = '127.0.0.1') {
153 | global $db;
154 | $sql = sprintf("INSERT INTO dialplan (`domain`, `ip_address`) VALUES ('%s', '%s')", $domain, $ip_address);
155 | $db->query($sql);
156 | return $db->lastInsertId() ;
157 | }
158 |
159 | function insert_dialplan_context($dialplan_id, $context) {
160 | global $db;
161 | $sql = sprintf("INSERT INTO dialplan_context (`dialplan_id`, `context`, `weight`) VALUES (%d, '%s', %d)", $dialplan_id, $context, get_next_weight('context'));
162 | $db->query($sql);
163 | return $db->lastInsertId() ;
164 | }
165 |
166 | function insert_dialplan_extension($context_id, $name, $continue) {
167 | global $db;
168 | $sql = sprintf("INSERT INTO dialplan_extension (`context_id`, `name`, `continue`, `weight`) VALUES (%d, '%s', '%s', %d)", $context_id, $name, $continue, get_next_weight('extension'));
169 | get_next_weight('extension');
170 | $db->query($sql);
171 | return $db->lastInsertId() ;
172 | }
173 |
174 | function insert_dialplan_condition($extension_id, $field, $expression) {
175 | global $db;
176 | $sql = sprintf("INSERT INTO dialplan_condition (`extension_id`, `field`, `expression`, `weight`) VALUES (%d, '%s', '%s', %d)", $extension_id, addslashes($field), addslashes($expression),get_next_weight('condition') );
177 | //echo $sql . "\n";
178 | $db->query($sql);
179 | return $db->lastInsertId() ;
180 | }
181 |
182 | function insert_dialplan_actions($condition_id, $application , $data, $type) {
183 | global $db;
184 | $sql = sprintf("INSERT INTO dialplan_actions(`condition_id`, `application`, `data`, `type`, `weight`) VALUES (%d, '%s', '%s', '%s', %d)", $condition_id, addslashes($application), addslashes($data), $type, get_next_weight('actions'));
185 | $db->query($sql);
186 | return $db->lastInsertId() ;
187 | }
188 |
189 | function get_next_weight($table) { //used for weighting system
190 | global $db;
191 | $sql = sprintf("SELECT MAX(weight) as max FROM dialplan_%s", $table);
192 | $res = $db->queryAll($sql);
193 | return ($res[0]['max'] + 10);
194 | }
195 |
196 | function truncate_dialplan() {
197 | global $db;
198 | $db->query('TRUNCATE dialplan_extension');
199 | $db->query('TRUNCATE dialplan');
200 | $db->query('TRUNCATE dialplan_context');
201 | $db->query('TRUNCATE dialplan_condition');
202 | $db->query('TRUNCATE dialplan_actions');
203 | }
204 |
205 | if (defined(UNSUCCESSFUL_QUERY) && UNSUCCESSFUL_QUERY == true) {
206 | echo "Some Queries Were Not Successful
";
207 | } else {
208 | echo "File Successfully Imported
";
209 | }
210 | upload_form();
211 |
212 | //printf("%s
", print_r($xml_obj, true);
213 | ?>
--------------------------------------------------------------------------------
/dialplans/lcr.php:
--------------------------------------------------------------------------------
1 | xmlw -> startElement('section');
7 | $obj -> xmlw -> writeAttribute('name', 'dialplan');
8 | $obj -> xmlw -> writeAttribute('description', 'FreeSWITCH Dialplan');
9 | $obj -> xmlw -> startElement('context');
10 | $obj -> xmlw -> writeAttribute('name', 'lcr');
11 | $obj -> xmlw -> startElement('extension');
12 | $obj -> xmlw -> startElement('condition');
13 | $applications = $this -> lcr_lookup($obj);
14 | $app_count = count($applications);
15 |
16 | $sets = array(
17 | 'hangup_after_bridge'=>'true',
18 | 'continue_on_failure'=>'true'
19 | );
20 | foreach ($sets as $var=>$val) {
21 | $this -> xmlw -> startElement('action');
22 | $this -> xmlw -> writeAttribute('application', 'set');
23 | $this -> xmlw -> writeAttribute('data', "$var=$val");
24 | $this -> xmlw -> endElement();
25 | }
26 | for ($i=0; $i<$app_count; $i++) {
27 | $obj -> xmlw -> startElement($applications[$i]['type']);
28 | $obj -> xmlw -> writeAttribute('application', 'bridge');
29 | $obj -> xmlw -> writeAttribute('data', $applications[$i]['data']);
30 | $obj -> xmlw -> endElement();
31 | }
32 | $obj -> xmlw -> endElement(); //
33 | $obj -> xmlw -> endElement(); //
34 | $obj -> xmlw -> endElement(); //
35 | $obj -> xmlw -> endElement(); //
36 |
37 | }
38 |
39 | function lcr_lookup(&$obj) {
40 | $obj -> comment_array($obj -> request);
41 | $digitstr = $obj -> request['destination_number'];
42 | $digitlen = strlen($digitstr);
43 | $where_clause = '';
44 | for ($i=0; $i<$digitlen; $i++) {
45 | $where_clause .= sprintf("%s digits='%s' "
46 | , ($i==0?"WHERE":"OR")
47 | , substr($digitstr, 0, $i+1)
48 | );
49 | }
50 | $query = sprintf("SELECT l.digits, c.Carrier_Name, l.rate, cg.id, cg.gateway, cg.id AS gwid, l.lead_strip, l.trail_strip, l.prefix, l.suffix FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id %s ORDER BY length(digits) DESC, rate;", $where_clause);
51 | $res = $obj -> db -> query($query);
52 | $obj -> comment($query);
53 | if (FS_PDO::isError($res)) {
54 | $obj -> comment($query);
55 | $obj -> comment($this -> db -> getMessage());
56 | $obj -> file_not_found();
57 | }
58 | $carriers = array();
59 | while ($row = $res -> fetchRow()) {
60 | $carrier_id = $row['gwid'];
61 | if (array_key_exists($carrier_id, $carriers)) {
62 | continue;
63 | }
64 | $carriers[$carrier_id] = true;
65 | $datastr = sprintf('sofia/gateway/%s/%s', $row['gateway'], $digitstr);
66 | $results[] = array('type'=>'action', 'data'=>$datastr);
67 | }
68 | return $results;
69 | }
70 | }
71 |
72 |
73 | ?>
74 |
--------------------------------------------------------------------------------
/fs_cdr.php:
--------------------------------------------------------------------------------
1 |
14 | * @version 0.1
15 | * Class for inserting xml CDR records
16 | * @return object
17 | */
18 | class fs_cdr extends fs_curl {
19 | /**
20 | * This variable will hold the XML CDR string
21 | * @var string
22 | */
23 | public $cdr;
24 | /**
25 | * This object is the objectified representation of the XML CDR
26 | * @var XMLSimple Object
27 | */
28 | public $xml_cdr;
29 |
30 | /**
31 | * This array will hold the db field and their corresponding value
32 | * @var array
33 | */
34 | public $values = array();
35 |
36 | /**
37 | * This array maps the database field names to XMLSimple paths
38 | * @var array
39 | */
40 | public $fields = array(
41 | 'caller_id_name' => '$this->xml_cdr->callflow[0]->caller_profile->caller_id_name',
42 | 'caller_id_number' => '$this->xml_cdr->callflow[0]->caller_profile->caller_id_number',
43 | 'destination_number' => '$this->xml_cdr->callflow[0]->caller_profile->destination_number',
44 | 'context' => '$this->xml_cdr->callflow[0]->caller_profile->context',
45 | 'start_stamp' => 'urldecode($this->xml_cdr->variables->start_stamp)',
46 | 'answer_stamp' => 'urldecode($this->xml_cdr->variables->answer_stamp)',
47 | 'end_stamp' => 'urldecode($this->xml_cdr->variables->end_stamp)',
48 | 'duration' => '$this->xml_cdr->variables->duration',
49 | 'billsec' => '$this->xml_cdr->variables->billsec',
50 | 'hangup_cause' => '$this->xml_cdr->variables->hangup_cause',
51 | 'uuid' => '$this->xml_cdr->callflow[0]->caller_profile->uuid',
52 | 'bleg_uuid' => '$this->xml_cdr->callflow[0]->caller_profile->bleg_uuid',
53 | 'accountcode' => '$this->xml_cdr->variables->accountcode',
54 | 'read_codec' => '$this->xml_cdr->variables->read_codec',
55 | 'write_codec' => '$this->xml_cdr->variables->write_codec'
56 | );
57 |
58 | /**
59 | * This is where we instantiate our parent and set up our CDR object
60 | */
61 |
62 | public function fs_cdr() {
63 | self::__construct();
64 | }
65 |
66 | public function __construct() {
67 | $this->fs_curl();
68 | $this->cdr = stripslashes($this->request['cdr']);
69 | $this->xml_cdr = new SimpleXMLElement($this->cdr);
70 | }
71 |
72 | /**
73 | * This is where we run the bulk of our logic through other methods
74 | */
75 | public function main() {
76 | $this->set_record_values();
77 | $this->insert_cdr();
78 | }
79 |
80 | /**
81 | * This method will take the db fields and paths defined above and
82 | * set the values array to be used for the insert
83 | */
84 | public function set_record_values() {
85 | foreach ($this->fields as $field => $run) {
86 | eval("\$str = $run;");
87 | $this->values["$field"] = "'$str'";
88 | $this->debug($str);
89 | }
90 | $this->debug(print_r($this->values, true));
91 | print_r($this->values);
92 | }
93 |
94 | /**
95 | * finally do the insert of the CDR
96 | */
97 | public function insert_cdr() {
98 | $query = sprintf(
99 | "INSERT INTO cdr (%s) VALUES (%s);",
100 | join(',', array_keys($this->values)), join(',', $this->values)
101 | );
102 | $this->debug($query);
103 | $this->db->exec($query);
104 | }
105 |
106 | }
107 |
108 |
109 |
--------------------------------------------------------------------------------
/fs_chatplan.php:
--------------------------------------------------------------------------------
1 |
14 | * @version 0.1
15 | * Class for XML chatplan
16 | */
17 | class fs_chatplan extends fs_curl {
18 | private $special_class_file;
19 |
20 | public function fs_chatplan() {
21 | self::__construct();
22 | }
23 |
24 | public function __construct() {
25 | $this -> fs_curl();
26 | }
27 |
28 | /**
29 | * This is the method that determines the XML output. Customized chatplans can
30 | * be easily created by adding a record to the chatplan_special table with the
31 | * appropriate values. The php class MUST contain a "main()" method. The method
32 | * should write directly to the xmlw obj that's pased or take care of writing
33 | * out the xml itself and exiting as to not return.
34 | *
35 | */
36 | public function main() {
37 | $this -> comment($this -> request);
38 | $context = $this -> request['context'];
39 | if ($this -> is_specialized_chatplan($context)) {
40 | $this->debug("$context should be handled in a specialized chatplan class file");
41 | if (!include_once($this -> special_class_file)) {
42 | $this -> file_not_found();
43 | }
44 | $class = sprintf('chatplan_%s', $context);
45 | if (!class_exists($class)) {
46 | $this -> comment("No Class of name $class");
47 | $this -> file_not_found();
48 | }
49 | $obj = new $class;
50 | /**
51 | * recieving method should take incoming parameter as &$something
52 | */
53 | $obj -> main($this);
54 | } else {
55 | $dp_array = $this -> get_chatplan($context);
56 | $this -> writeChatplan($dp_array);
57 | }
58 | $this -> output_xml();
59 | }
60 |
61 | public function is_specialized_chatplan($context) {
62 | $query = sprintf(
63 | "SELECT * FROM chatplan_special WHERE context='%s'", $context
64 | );
65 | $this -> debug($query);
66 | $res = $this -> db -> query($query);
67 | if (FS_PDO::isError($res)) {
68 | $this -> comment($query);
69 | $this -> comment($this -> db -> getMessage());
70 | $this -> file_not_found();
71 | }
72 |
73 | if ($res -> numRows() == 1) {
74 | $this -> debug("numRows() == 1");
75 | $row = $res -> fetchRow();
76 | $this->debug($row);
77 | $this -> special_class_file = sprintf('chatplans/%s', $row['class_file']);
78 | return true;
79 | } else {
80 | return false;
81 | }
82 | }
83 |
84 | /**
85 | * This method will pull chatplan from database
86 | *
87 | * @param string $context context name for XML chatplan
88 | * @return array
89 | */
90 | private function get_chatplan($context) {
91 | $dp_array = array();
92 | $dpQuery = sprintf('SELECT
93 | %1$scontext%1$s,
94 | %1$sname%1$s as extension,
95 | %1$sapplication%1$s as application_name,
96 | %1$sdata%1$s as application_data,
97 | %1$sfield%1$s as condition_field,
98 | %1$sexpression%1$s as condition_expression,
99 | %1$scontinue%1$s as ext_continue,
100 | %1$stype%1$s
101 | FROM chatplan
102 | INNER JOIN chatplan_context USING(chatplan_id)
103 | INNER JOIN chatplan_extension USING(context_id)
104 | INNER JOIN chatplan_condition USING(extension_id)
105 | INNER JOIN chatplan_actions USING(condition_id)
106 | WHERE context = \'%2$s\'
107 | ORDER BY chatplan_context.weight,
108 | chatplan_extension.weight,
109 | chatplan_condition.weight,
110 | chatplan_actions.weight'
111 | , DB_FIELD_QUOTE, $context
112 | );
113 | $this->debug($dpQuery);
114 | $res = $this -> db -> query($dpQuery);
115 | if (FS_PDO::isError($res)) {
116 | $this -> comment($this -> db -> getMessage());
117 | $this -> file_not_found();
118 | }
119 | if ($res -> numRows() < 1) {
120 | $this -> debug("nothing to do, let's just return not found");
121 | $this -> file_not_found();
122 | }
123 | $condition_number = 0;
124 | while ($row = $res -> fetchRow()) {
125 | $ct = $row['context'];
126 | $et = $row['extension'];
127 | $ec = $row['ext_continue'];
128 | $app = $row['application_name'];
129 | $data = $row['application_data'];
130 | //$app_cdata = $row['app_cdata'];
131 | $type = $row['type'];
132 | $cf = $row['condition_field'];
133 | $ce = $row['condition_expression'];
134 | //$rcd = $row['re_cdata'];
135 | $cc = empty($row['cond_break']) ? '0' : $row['cond_break'];
136 | $dp_array[$ct]["$et;$ec"]["$cf;$ce;$cc"][] = array(
137 | 'type'=>$type,
138 | 'application'=>$app,
139 | 'data'=>$data,
140 | 'is_cdata'=>(empty($app_cdata) ? '' : $app_cdata)
141 | );
142 | }
143 | return $dp_array;
144 | }
145 |
146 | /**
147 | * Write XML chatplan from the array returned by get_chatplan
148 | * @see fs_chatplan::get_chatplan
149 | * @param array $dpArray Multi-dimentional array from which we write the XML
150 | * @todo this method should REALLY be broken down into several smaller methods
151 | *
152 | */
153 | private function writeChatplan($dpArray) {
154 | //print_r($dpArray);
155 | if (is_array($dpArray)) {
156 | $this -> xmlw -> startElement('section');
157 | $this -> xmlw -> writeAttribute('name', 'chatplan');
158 | $this -> xmlw -> writeAttribute('description', 'FreeSWITCH Chatplan');
159 | //$this -> comment('dpArray is an array');
160 | foreach ($dpArray as $context => $extensions_array) {
161 | //$this -> comment($context);
162 | //start the context
163 | $this -> xmlw -> startElement('context');
164 | $this -> xmlw -> writeAttribute('name', $context);
165 | if (is_array($extensions_array)) {
166 | foreach ($extensions_array as $extension => $conditions) {
167 | //start an extension
168 | $ex_split = preg_split('/;/', $extension);
169 | $this -> xmlw -> startElement('extension');
170 | $this -> xmlw -> writeAttribute('name', $ex_split[0]);
171 | if (strlen($ex_split[1]) > 0) {
172 | $this -> xmlw -> writeAttribute('continue', $ex_split[1]);
173 | }
174 | $this -> debug($conditions);
175 | foreach ($conditions as $condition => $app_array) {
176 | $c_split = preg_split('/;/', $condition);
177 | $this -> xmlw -> startElement('condition');
178 | if (!empty($c_split[0])) {
179 | $this -> xmlw -> writeAttribute('field', $c_split[0]);
180 | }
181 | if (!empty($c_split[1])) {
182 | if (array_key_exists(3, $c_split)
183 | && $c_split[3] == true) {
184 | $this -> xmlw -> startElement('expression');
185 | $this -> xmlw -> writeCdata($c_split[1]);
186 | $this -> xmlw -> endElement();
187 | } else {
188 | $this -> xmlw -> writeAttribute(
189 | 'expression', $c_split[1]
190 | );
191 | }
192 | }
193 | //$this -> debug($c_split[2]);
194 | if ($c_split[2] != '0') {
195 | $this -> xmlw -> writeAttribute(
196 | 'break', $c_split[2]
197 | );
198 | }
199 | //$this -> debug($app_array);
200 | foreach ($app_array as $app) {
201 | if (empty($app['application'])) {
202 | continue;
203 | }
204 | $this -> xmlw -> startElement($app['type']);
205 | $this -> xmlw -> writeAttribute(
206 | 'application', $app['application']
207 | );
208 | if (!empty($app['data'])) {
209 | if (array_key_exists('is_cdata', $app)
210 | && $app['is_cdata'] == true) {
211 | $this -> xmlw -> writeCdata($app['data']);
212 | } else {
213 | $this -> xmlw -> writeAttribute(
214 | 'data', $app['data']
215 | );
216 | }
217 | }
218 | if ($app['application'] == 'set') {
219 | $this->xmlw->writeAttribute('inline', 'true');
220 | }
221 | $this -> xmlw -> endElement();
222 | }
223 | //
224 | $this -> xmlw -> endElement();
225 | }
226 | //
227 | $this -> xmlw -> endElement();
228 | }
229 | }
230 | //
231 | $this -> xmlw -> endElement();
232 | }
233 | //
234 | $this -> xmlw -> endElement();
235 | }
236 | }
237 | }
238 |
--------------------------------------------------------------------------------
/fs_configuration.php:
--------------------------------------------------------------------------------
1 |
14 | * @version 0.1
15 | * Class for all module configurations
16 | * @return object
17 | */
18 | class fs_configuration extends fs_curl {
19 | /**
20 | * Class Instantiation
21 | * This method will instantiate all other objects upon which it relies.
22 | * @return void
23 | */
24 |
25 | public function fs_dialplan()
26 | {
27 | self::__construct();
28 | }
29 |
30 | function __construct() {
31 | $this -> fs_curl();
32 | $conf_file = $this->request['key_value'];
33 | $this->debug("RECEIVED REQUEST FOR $conf_file");
34 | $mod_name = sprintf('mod_%s', str_replace('.conf', '', $conf_file));
35 | $this -> comment("module name is $mod_name");
36 | if (!($this -> is_mod_enabled($mod_name))
37 | && !($this -> is_modless_conf($this -> request['key_value']))) {
38 | $this -> comment('module not enabled and not modless config file');
39 | $this -> file_not_found();
40 | }
41 | $this -> xmlw -> startElement('section');
42 | $this -> xmlw -> writeAttribute('name', 'configuration');
43 | $this -> xmlw -> writeAttribute(
44 | 'description', 'FreeSWITCH Configuration'
45 | );
46 | }
47 |
48 | /**
49 | * Enabled module checker
50 | * This method will check if a module is enabled before
51 | * returning the XML for the module. If the module's not
52 | * enabled, the file_not_found method will be called.
53 | * @param string $mod_name name of module to check
54 | * @return bool
55 | */
56 | function is_mod_enabled($mod_name) {
57 | $query = sprintf('%s %s'
58 | , "SELECT * FROM post_load_modules_conf"
59 | , "WHERE module_name='$mod_name' AND load_module=1"
60 | );
61 | $res = $this -> db -> query($query);
62 | if ($this->db->errorCode() !== FS_SQL_SUCCESS) {
63 | $this -> comment($query);
64 | $this -> comment($this->db->errorCode());
65 | return true; //default allow policy
66 | return false; //comment previous line to default deny
67 | } elseif ($res -> rowCount() == 1) {
68 | return true;
69 | } else {
70 | return false;
71 | }
72 | }
73 |
74 | /**
75 | * Allow config files that aren't tied to any module
76 | *
77 | * @param string $conf
78 | * @return bool
79 | */
80 | private function is_modless_conf($conf) {
81 | $this -> comment("conf is $conf");
82 | $query = sprintf(
83 | "SELECT COUNT(*) cnt FROM modless_conf WHERE conf_name = '$conf';"
84 | );
85 | $res = $this -> db -> query($query);
86 | if (FS_PDO::isError($res)) {
87 | $this -> comment($query);
88 | $this -> comment($res -> getMessage());
89 | return true; //default allow policy
90 | return false; //comment previous line to default deny
91 | }
92 | $row = $res -> fetchRow();
93 | //$this -> comment($row['cnt']);
94 | return $row['cnt'];
95 | }
96 | }
97 |
98 |
--------------------------------------------------------------------------------
/fs_curl.php:
--------------------------------------------------------------------------------
1 |
15 | * @version 0.1
16 | * FreeSWITCH CURL base class
17 | * Base class for all curl XML output, contains methods for XML output and
18 | * connecting to a database
19 | * @return void
20 | */
21 | class fs_curl {
22 |
23 | /**
24 | * FS_PDO Object
25 | * @link http://www.php.net/pdo
26 | * @var $db FS_PDO
27 | */
28 | public $db;
29 | /**
30 | * Array of _REQUEST parameters passed
31 | *
32 | * @var array
33 | */
34 | public $request;
35 | /**
36 | * XMLWriter object
37 | * @link http://php.net/XMLWriter
38 | * @var object
39 | */
40 | public $xmlw;
41 | /**
42 | * Array of comments to be output in the XML
43 | * @see fs_curl::comment
44 | * @var array
45 | */
46 | private $comments;
47 |
48 | /**
49 | * Instantiation of XMLWriter and FS_PDO
50 | * This method will instantiate the FS_PDO and XMLWriter classes for use
51 | * in child classes
52 | * @return void
53 | */
54 |
55 | public function fs_curl()
56 | {
57 | self::__construct();
58 | }
59 |
60 | public function __construct() {
61 | //public function fs_curl() {
62 | openlog( 'fs_curl', LOG_NDELAY | LOG_PID, LOG_USER );
63 | header( 'Content-Type: text/xml' );
64 | $this->generate_request_array();
65 | $this->open_xml();
66 | $inc
67 | = array( 'required' => 'libs/fs_pdo.php' ); // include an external file. i.e. 'required'=>'important_file.php'
68 | $this->include_files( $inc );
69 | $this->connect_db( DEFAULT_DSN, DEFAULT_DSN_LOGIN, DEFAULT_DSN_PASSWORD );
70 | set_error_handler( array( $this, 'error_handler' ) );
71 | //trigger_error('blah', E_USER_ERROR);
72 | }
73 |
74 | /**
75 | * Connect to a database via FS_PDO
76 | *
77 | * @param mixed $dsn data source for database connection (array or string)
78 | *
79 | * @return void
80 | */
81 | public function connect_db( $dsn, $login, $password ) {
82 | try {
83 | $options = array(
84 | );
85 | $this->db = new FS_PDO( $dsn, $login, $password, $options );
86 | }
87 | catch ( Exception $e ) {
88 | $this->comment( $e->getMessage() );
89 | $this->file_not_found(); //program terminates in function file_not_found()
90 | }
91 | $driver = $this->db->getAttribute( constant( "PDO::ATTR_DRIVER_NAME" ) );
92 | $this->debug( "our driver is $driver" );
93 | switch ( $driver ) {
94 | case 'mysql':
95 | $quoter = '`';
96 | break;
97 | case 'pgsql':
98 | $quoter = '"';
99 | break;
100 | default:
101 | $quoter = '';
102 | break;
103 | }
104 | define( 'DB_FIELD_QUOTE', $quoter );
105 | }
106 |
107 | /**
108 | * Method to add comments to XML
109 | * Adds a comment to be displayed in the final XML
110 | *
111 | * @param string $comment comment string to be output in XML
112 | *
113 | * @return void
114 | */
115 | public function comment( $comment ) {
116 | $this->comments[] = $comment;
117 | }
118 |
119 | /**
120 | * Generate a globally accesible array of the _REQUEST parameters passed
121 | * Generates an array from the _REQUEST parameters that were passed, keeping
122 | * all key => value combinations intact
123 | * @return void
124 | */
125 | private function generate_request_array() {
126 | while ( list( $req_key, $req_val ) = each( $_REQUEST ) ) {
127 | if ( ! defined( 'FS_CURL_DEBUG' ) && $req_key == 'fs_curl_debug' ) {
128 | define( 'FS_CURL_DEBUG', $req_val );
129 | }
130 | //$this -> comment("$req_key => $req_val");
131 | $this->request[$req_key] = $req_val;
132 | }
133 | }
134 |
135 | /**
136 | * Actual Instantiation of XMLWriter Object
137 | * This method creates an XMLWriter Object and sets some needed options
138 | * @return void
139 | */
140 | private function open_xml() {
141 | $this->xmlw = new XMLWriter();
142 | $this->xmlw->openMemory();
143 | if ( array_key_exists( 'fs_curl_debug', $this->request )
144 | && $this->request['fs_curl_debug'] > 0
145 | ) {
146 | $this->xmlw->setIndent( TRUE );
147 | $this->xmlw->setIndentString( ' ' );
148 | } else {
149 | $this->xmlw->setIndent( FALSE );
150 | $this->xmlw->setIndentString( ' ' );
151 | }
152 | $this->xmlw->startDocument( '1.0', 'UTF-8', 'no' );
153 | //set the freeswitch document type
154 | $this->xmlw->startElement( 'document' );
155 | $this->xmlw->writeAttribute( 'type', 'freeswitch/xml' );
156 | }
157 |
158 | /**
159 | * Method to call on any error that can not be revovered from
160 | * This method was written to return a valid XML response to FreeSWITCH
161 | * in the event that we are unable to generate a valid configuration file
162 | * from the passed information
163 | * @return void
164 | */
165 | public function file_not_found() {
166 | $this->comment( 'Include Path = ' . ini_get( 'include_path' ) );
167 | $not_found = new XMLWriter();
168 | $not_found->openMemory();
169 | $not_found->setIndent( TRUE );
170 | $not_found->setIndentString( ' ' );
171 | $not_found->startDocument( '1.0', 'UTF-8', 'no' );
172 | //set the freeswitch document type
173 | $not_found->startElement( 'document' );
174 | $not_found->writeAttribute( 'type', 'freeswitch/xml' );
175 | $not_found->startElement( 'section' );
176 | $not_found->writeAttribute( 'name', 'result' );
177 | $not_found->startElement( 'result' );
178 | $not_found->writeAttribute( 'status', 'not found' );
179 | $not_found->endElement();
180 | $not_found->endElement();
181 | /* we put the comments inside the root element so we don't
182 | * get complaints about markup outside of it */
183 | $this->comments2xml( $not_found, $this->comments );
184 | $not_found->endElement();
185 | echo $not_found->outputMemory();
186 | exit();
187 | }
188 |
189 | /**
190 | * Generate XML comments from comments array
191 | * This [recursive] method will iterate over the passed array, writing XML
192 | * comments and calling itself in the event that the "comment" is an array
193 | *
194 | * @param object $xml_obj Already instantiated XMLWriter object
195 | * @param array $comments [Multi-dementional] Array of comments to be added
196 | * @param integer $space_pad Number of spaces to indent the comments
197 | *
198 | * @return void
199 | */
200 | private function comments2xml( $xml_obj, $comments, $space_pad = 0 ) {
201 | $comment_count = count( $comments );
202 | for ( $i = 0; $i < $comment_count; $i ++ ) {
203 | if ( array_key_exists( $i, $comments ) ) {
204 | if ( ! is_array( $comments[$i] ) ) {
205 | $xml_obj->writeComment( " " . $comments[$i] . " " );
206 | } else {
207 | $this->comments2xml( $xml_obj, $comments[$i], $space_pad + 2 );
208 | }
209 | }
210 | }
211 | }
212 |
213 | /**
214 | * End open XML elments in XMLWriter object
215 | * @return void
216 | */
217 | private function close_xml() {
218 | $this->xmlw->endElement();
219 | $this->xmlw->endElement();
220 | $this->xmlw->endElement();
221 | }
222 |
223 | /**
224 | * Close and Output XML and stop script execution
225 | * @return void
226 | */
227 | public function output_xml() {
228 | $this->comment(
229 | sprintf( 'Total # of Queries Run: %d', $this->db->counter )
230 | );
231 | $this->comment( sprintf( "Estimated Execution Time Is: %s"
232 | , ( preg_replace(
233 | '/^0\.(\d+) (\d+)$/', '\2.\1', microtime() ) - START_TIME )
234 | ) );
235 |
236 | $this->comments2xml( $this->xmlw, $this->comments );
237 | $this->close_xml();
238 | $xml_out = $this->xmlw->outputMemory();
239 | $this->debug( '---- Start XML Output ----' );
240 | $this->debug( explode( "\n", $xml_out ) );
241 | $this->debug( '---- End XML Output ----' );
242 | echo $xml_out;
243 | exit();
244 | }
245 |
246 | /**
247 | * Recursive method to add an array of comments
248 | * @return void
249 | */
250 | public function comment_array( $array, $spacepad = 0 ) {
251 | $spaces = str_repeat( ' ', $spacepad );
252 | foreach ( $array as $key => $val ) {
253 | if ( is_array( $val ) ) {
254 | $this->comment( "$spaces$key => Array" );
255 | $this->comment_array( $val, $spacepad + 2 );
256 | } else {
257 | $this->comment( "$spaces$key => $val" );
258 | }
259 | }
260 | }
261 |
262 | /**
263 | * Include files for child classes
264 | * This method will include the files needed by child classes.
265 | * Expects an associative array of type => path
266 | * where type = [required|any other string]
267 | *
268 | * @param array $file_array associative array of files to include
269 | *
270 | * @return void
271 | * @todo add other types for different levels of errors
272 | */
273 | public function include_files( $file_array ) {
274 | $return = FS_CURL_SUCCESS;
275 | while ( list( $type, $file ) = each( $file_array ) ) {
276 | $inc = @include_once( $file );
277 | if ( ! $inc ) {
278 | $comment = sprintf(
279 | 'Unable To Include %s File %s', $type, $file
280 | );
281 | $this->comment( $comment );
282 | if ( $type == 'required' ) {
283 | $return = FS_CURL_CRITICAL;
284 | } else {
285 | if ( $return != FS_CURL_CRITICAL ) {
286 | $return = FS_CURL_WARNING;
287 | }
288 | }
289 | }
290 | }
291 | if ( $return == FS_CURL_CRITICAL ) {
292 | $this->file_not_found();
293 | }
294 |
295 | return $return;
296 | }
297 |
298 | /**
299 | * Class-wide error handler
300 | * This method should be called whenever there is an error in any child
301 | * classes, script execution and returning is pariatlly determined by
302 | * defines
303 | * @see RETURN_ON_WARN
304 | * @return void
305 | * @todo add other defines that control what, if any, comments gets output
306 | */
307 | public function error_handler( $no, $str, $file, $line ) {
308 | if ( $no == E_STRICT ) {
309 | return TRUE;
310 | }
311 | $file = preg_replace( '/\.(inc|php)$/', '', $file );
312 | $this->comment( basename( $file ) . ":$line - $no:$str" );
313 |
314 | switch ( $no ) {
315 | case E_USER_NOTICE:
316 | case E_NOTICE:
317 | break;
318 | case E_USER_WARNING:
319 | case E_WARNING:
320 | if ( defined( 'RETURN_ON_WARN' ) && RETURN_ON_WARN == TRUE ) {
321 | break;
322 | }
323 | case E_ERROR:
324 | case E_USER_ERROR:
325 | default:
326 | $this->file_not_found();
327 | }
328 |
329 | return TRUE;
330 | }
331 |
332 | /**
333 | * Function to print out debugging info
334 | * This method will recieve arbitrary data and send it using your method of
335 | * choice.... enable/disable by defining FS_CURL_DEBUG to and arbitrary integer
336 | *
337 | * @param mixed $input what to debug, arrays and strings tested, objects MAY work
338 | * @param integer $debug_level debug if $debug_level <= FS_CURL_DEBUG
339 | * @param integer $spaces
340 | */
341 | public function debug( $input, $debug_level = -1, $spaces = 0 ) {
342 | if ( defined( 'FS_CURL_DEBUG' ) && $debug_level <= FS_CURL_DEBUG ) {
343 | if ( is_array( $input ) ) {
344 | $this->debug( 'Array (', $debug_level, $spaces );
345 | foreach ( $input as $key => $val ) {
346 | if ( is_array( $val ) || is_object( $val ) ) {
347 | $this->debug( "[$key] => $val", $debug_level, $spaces + 4 );
348 | $this->debug( '(', $debug_level, $spaces + 8 );
349 | $this->debug( $val, $debug_level, $spaces + 8 );
350 | } else {
351 | $this->debug( "[$key] => '$val'", $debug_level, $spaces + 4 );
352 | }
353 | }
354 | $this->debug( ")", $debug_level, $spaces );
355 | } else {
356 | $debug_str = sprintf( "%s%s"
357 | , str_repeat( ' ', $spaces ), $input
358 | );
359 | switch ( FS_DEBUG_TYPE ) {
360 | case 0:
361 | syslog( LOG_NOTICE, $debug_str );
362 | break;
363 | case 1:
364 | $debug_str = preg_replace( '/--/', '- - ', $debug_str );
365 | $this->comment( $debug_str );
366 | break;
367 | case 2:
368 | $ptr = fopen( FS_DEBUG_FILE, 'a' );
369 | fputs( $ptr, "$debug_str\r\n" );
370 | fclose( $ptr );
371 | break;
372 | default:
373 | return;
374 | }
375 | }
376 | }
377 | }
378 | }
379 |
380 |
--------------------------------------------------------------------------------
/fs_dialplan.php:
--------------------------------------------------------------------------------
1 |
15 | * @version 0.1
16 | * Class for XML dialplan
17 | */
18 | class fs_dialplan extends fs_curl {
19 | private $special_class_file;
20 |
21 |
22 | public function fs_dialplan()
23 | {
24 | self::__construct();
25 | }
26 | public function __construct() {
27 | $this -> fs_curl();
28 | }
29 |
30 | /**
31 | * This is the method that determines the XML output. Customized dialplans can
32 | * be easily created by adding a record to the dialplan_special table with the
33 | * appropriate values. The php class MUST contain a "main()" method. The method
34 | * should write directly to the xmlw obj that's pased or take care of writing
35 | * out the xml itself and exiting as to not return.
36 | *
37 | */
38 | public function main() {
39 | $this -> comment($this -> request);
40 | $context = $this -> request['Hunt-Context'];
41 | if ($this -> is_specialized_dialplan($context)) {
42 | $this->debug("$context should be handled in a specialized dialplan class file");
43 | if (!include_once($this -> special_class_file)) {
44 | $this -> file_not_found();
45 | }
46 | $class = sprintf('dialplan_%s', $context);
47 | if (!class_exists($class)) {
48 | $this -> comment("No Class of name $class");
49 | $this -> file_not_found();
50 | }
51 | $obj = new $class;
52 | /**
53 | * recieving method should take incoming parameter as &$something
54 | */
55 | $obj -> main($this);
56 | } else {
57 | $dp_array = $this -> get_dialplan($context);
58 | $this -> writeDialplan($dp_array);
59 | }
60 | $this -> output_xml();
61 | }
62 |
63 | public function is_specialized_dialplan($context) {
64 | $query = sprintf(
65 | "SELECT * FROM dialplan_special WHERE context='%s'", $context
66 | );
67 | $this -> debug($query);
68 | $res = $this -> db -> query($query);
69 | if (FS_PDO::isError($res)) {
70 | $this -> comment($query);
71 | $this -> comment($this -> db -> getMessage());
72 | $this -> file_not_found();
73 | }
74 |
75 | if ($res -> numRows() == 1) {
76 | $this -> debug("numRows() == 1");
77 | $row = $res -> fetchRow();
78 | $this->debug($row);
79 | $this -> special_class_file = sprintf('dialplans/%s', $row['class_file']);
80 | return true;
81 | } else {
82 | return false;
83 | }
84 | }
85 |
86 | /**
87 | * This method will pull dialplan from database
88 | *
89 | * @param string $context context name for XML dialplan
90 | * @return array
91 | */
92 | private function get_dialplan($context) {
93 | $dp_array = array();
94 | $dpQuery = sprintf('SELECT
95 | %1$scontext%1$s,
96 | %1$sname%1$s as extension,
97 | %1$sapplication%1$s as application_name,
98 | %1$sdata%1$s as application_data,
99 | %1$sfield%1$s as condition_field,
100 | %1$sexpression%1$s as condition_expression,
101 | %1$scontinue%1$s as ext_continue,
102 | %1$stype%1$s
103 | FROM dialplan
104 | INNER JOIN dialplan_context USING(dialplan_id)
105 | INNER JOIN dialplan_extension USING(context_id)
106 | INNER JOIN dialplan_condition USING(extension_id)
107 | INNER JOIN dialplan_actions USING(condition_id)
108 | WHERE context = \'%2$s\'
109 | ORDER BY dialplan_context.weight,
110 | dialplan_extension.weight,
111 | dialplan_condition.weight,
112 | dialplan_actions.weight'
113 | , DB_FIELD_QUOTE, $context
114 | );
115 | $this->debug($dpQuery);
116 | $res = $this -> db -> query($dpQuery);
117 | if (FS_PDO::isError($res)) {
118 | $this -> comment($this -> db -> getMessage());
119 | $this -> file_not_found();
120 | }
121 | if ($res -> numRows() < 1) {
122 | $this -> debug("nothing to do, let's just return not found");
123 | $this -> file_not_found();
124 | }
125 | $condition_number = 0;
126 | while ($row = $res -> fetchRow()) {
127 | $ct = $row['context'];
128 | $et = $row['extension'];
129 | $ec = $row['ext_continue'];
130 | $app = $row['application_name'];
131 | $data = $row['application_data'];
132 | //$app_cdata = $row['app_cdata'];
133 | $type = $row['type'];
134 | $cf = $row['condition_field'];
135 | $ce = $row['condition_expression'];
136 | //$rcd = $row['re_cdata'];
137 | $cc = empty($row['cond_break']) ? '0' : $row['cond_break'];
138 | $dp_array[$ct]["$et;$ec"]["$cf;$ce;$cc"][] = array(
139 | 'type'=>$type,
140 | 'application'=>$app,
141 | 'data'=>$data,
142 | 'is_cdata'=>(empty($app_cdata) ? '' : $app_cdata)
143 | );
144 | }
145 | return $dp_array;
146 | }
147 |
148 | /**
149 | * Write XML dialplan from the array returned by get_dialplan
150 | * @see fs_dialplan::get_dialplan
151 | * @param array $dpArray Multi-dimentional array from which we write the XML
152 | * @todo this method should REALLY be broken down into several smaller methods
153 | *
154 | */
155 | private function writeDialplan($dpArray) {
156 | //print_r($dpArray);
157 | if (is_array($dpArray)) {
158 | $this -> xmlw -> startElement('section');
159 | $this -> xmlw -> writeAttribute('name', 'dialplan');
160 | $this -> xmlw -> writeAttribute('description', 'FreeSWITCH Dialplan');
161 | //$this -> comment('dpArray is an array');
162 | foreach ($dpArray as $context => $extensions_array) {
163 | //$this -> comment($context);
164 | //start the context
165 | $this -> xmlw -> startElement('context');
166 | $this -> xmlw -> writeAttribute('name', $context);
167 | if (is_array($extensions_array)) {
168 | foreach ($extensions_array as $extension => $conditions) {
169 | //start an extension
170 | $ex_split = preg_split('/;/', $extension);
171 | $this -> xmlw -> startElement('extension');
172 | $this -> xmlw -> writeAttribute('name', $ex_split[0]);
173 | if (strlen($ex_split[1]) > 0) {
174 | $this -> xmlw -> writeAttribute('continue', $ex_split[1]);
175 | }
176 | $this -> debug($conditions);
177 | foreach ($conditions as $condition => $app_array) {
178 | $c_split = preg_split('/;/', $condition);
179 | $this -> xmlw -> startElement('condition');
180 | if (!empty($c_split[0])) {
181 | $this -> xmlw -> writeAttribute('field', $c_split[0]);
182 | }
183 | if (!empty($c_split[1])) {
184 | if (array_key_exists(3, $c_split)
185 | && $c_split[3] == true) {
186 | $this -> xmlw -> startElement('expression');
187 | $this -> xmlw -> writeCdata($c_split[1]);
188 | $this -> xmlw -> endElement();
189 | } else {
190 | $this -> xmlw -> writeAttribute(
191 | 'expression', $c_split[1]
192 | );
193 | }
194 | }
195 | //$this -> debug($c_split[2]);
196 | if ($c_split[2] != '0') {
197 | $this -> xmlw -> writeAttribute(
198 | 'break', $c_split[2]
199 | );
200 | }
201 | //$this -> debug($app_array);
202 | foreach ($app_array as $app) {
203 | if (empty($app['application'])) {
204 | continue;
205 | }
206 | $this -> xmlw -> startElement($app['type']);
207 | $this -> xmlw -> writeAttribute(
208 | 'application', $app['application']
209 | );
210 | if (!empty($app['data'])) {
211 | if (array_key_exists('is_cdata', $app)
212 | && $app['is_cdata'] == true) {
213 | $this -> xmlw -> writeCdata($app['data']);
214 | } else {
215 | $this -> xmlw -> writeAttribute(
216 | 'data', $app['data']
217 | );
218 | }
219 | }
220 | if ($app['application'] == 'set') {
221 | $this->xmlw->writeAttribute('inline', 'true');
222 | }
223 | $this -> xmlw -> endElement();
224 | }
225 | //
226 | $this -> xmlw -> endElement();
227 | }
228 | //
229 | $this -> xmlw -> endElement();
230 | }
231 | }
232 | //
233 | $this -> xmlw -> endElement();
234 | }
235 | //
236 | $this -> xmlw -> endElement();
237 | }
238 | }
239 | }
240 |
--------------------------------------------------------------------------------
/fs_directory.php:
--------------------------------------------------------------------------------
1 |
15 | * @license BSD
16 | * @version 0.1
17 | * Class for XML directory
18 | */
19 | class fs_directory extends fs_curl {
20 |
21 | private $user;
22 | private $userid;
23 | private $users_vars;
24 | private $users_params;
25 | private $users_gateways;
26 | private $users_gateway_params;
27 |
28 | public function fs_directory() {
29 | self::__construct();
30 | }
31 |
32 | public function __construct() {
33 | $this->fs_curl();
34 | if ( array_key_exists( 'user', $this->request ) ) {
35 | $this->user = $this->request['user'];
36 | }
37 | $this->comment( "User is " . $this->user );
38 | }
39 |
40 | public function main() {
41 | $this->comment( $this->request );
42 | if ( array_key_exists( 'VM-Action', $this->request ) && $this->request['VM-Action'] == 'change-password'
43 | ) {
44 | $this->update_pin( $this->request['VM-User'], $this->request['VM-User-Password'] );
45 | } else {
46 | if ( array_key_exists( 'domain', $this->request ) ) {
47 | $domains = $this->get_domains( $this->request['domain'] );
48 | } else {
49 | $domains = $this->get_domains();
50 | }
51 |
52 | $this->get_user_gateway_params();
53 |
54 | $this->xmlw->startElement( 'section' );
55 | $this->xmlw->writeAttribute( 'name', 'directory' );
56 | $this->xmlw->writeAttribute( 'description', 'FreeSWITCH Directory' );
57 |
58 | foreach ( $domains as $domain ) {
59 | $directory_array = $this->get_directory( $domain );
60 | $this->writedirectory( $directory_array, $domain );
61 | }
62 |
63 | $this->xmlw->endElement(); //
64 | $this->output_xml();
65 | }
66 | }
67 |
68 | private function update_pin( $username, $new_pin ) {
69 | $this->debug( "update pin for $username to $new_pin" );
70 | $and = '';
71 | if ( array_key_exists( 'domain', $this->request ) ) {
72 | $and = sprintf( 'AND %1$sdomain%1$s = \'%2$s\')', DB_FIELD_QUOTE, $this->request['domain'] );
73 | }
74 | $query = sprintf( 'UPDATE %1$sdirectory_params%1$s
75 | SET %1$sparam_value%1$s = \'%2$s\'
76 | WHERE %1$sparam_name%1$s = \'vm-password\'
77 | AND %1$sdirectory_id%1$s =
78 | (SELECT %1$sid%1$s
79 | FROM %1$sdirectory%1$s
80 | WHERE %1$susername%1$s = \'%3$s\' %4$s', DB_FIELD_QUOTE, $new_pin, $username,
81 | $and );
82 | $this->debug( $query );
83 | $this->db->exec( $query );
84 | $this->debug( $this->db->errorInfo() );
85 | }
86 |
87 | /**
88 | * This method will pull directory from database
89 | * @return array
90 | * @todo add GROUP BY to query to make sure we don't get duplicate users
91 | */
92 | private function get_directory( $domain ) {
93 | $directory_array = array();
94 | $join_clause = '';
95 | $where_array[] = sprintf( "domain_id='%s'", $domain['id'] );
96 | if ( array_key_exists( 'user', $this->request ) ) {
97 | $where_array[] = sprintf( "username='%s'", $this->user );
98 | }
99 | if ( array_key_exists( 'group', $this->request ) ) {
100 | $where_array[] = sprintf( "group_name='%s'", $this->request['group'] );
101 | $join_clause = "JOIN directory_group_user_map dgum ON d.id=dgum.user_id ";
102 | $join_clause .= "JOIN directory_groups dg ON dgum.group_id=dg.group_id ";
103 | }
104 | if ( ! empty ( $where_array ) ) {
105 | if ( count( $where_array ) > 1 ) {
106 | $where_clause = sprintf( 'WHERE %s', implode( ' AND ', $where_array ) );
107 | } else {
108 | $where_clause = sprintf( 'WHERE %s', $where_array[0] );
109 | }
110 | } else {
111 | $where_clause = '';
112 | }
113 | $query = sprintf( "SELECT * FROM directory d %s %s ORDER BY username", $join_clause, $where_clause );
114 | $this->debug( $query );
115 | $res = $this->db->queryAll( $query );
116 | if ( FS_PDO::isError( $res ) ) {
117 | $this->comment( $query );
118 | $this->comment( $this->db->getMessage() );
119 | $this->comment( $this->db->getMessage() );
120 | $this->file_not_found();
121 | }
122 | if ( ! empty ( $this->user ) ) {
123 | $this->userid = $res[0]['id'];
124 | $this->comment( sprintf( 'user id is: %d', $this->userid ) );
125 | }
126 |
127 | return $res;
128 | }
129 |
130 | /**
131 | * This method will pull the params for every user in a domain
132 | * @return array of users' params
133 | */
134 | private function get_users_params() {
135 | $where = '';
136 | if ( ! empty ( $this->userid ) ) {
137 | $where = sprintf( 'WHERE directory_id = %d', $this->userid );
138 | }
139 | $query = sprintf( "SELECT * FROM directory_params %s;", $where );
140 | $res = $this->db->queryAll( $query );
141 | if ( FS_PDO::isError( $res ) ) {
142 | $this->comment( $query );
143 | $this->comment( $this->db->getMessage() );
144 | $this->file_not_found();
145 | }
146 |
147 | $record_count = count( $res );
148 | for ( $i = 0; $i < $record_count; $i ++ ) {
149 | $di = $res[$i]['directory_id'];
150 | $pn = $res[$i]['param_name'];
151 | $this->users_params[$di][$pn] = $res[$i]['param_value'];
152 | }
153 | }
154 |
155 | /**
156 | * Writes XML for directory user's
157 | * This method will pull all of the user params based on the passed user_id
158 | *
159 | * @param integer $user_id
160 | *
161 | * @return void
162 | */
163 | private function write_params( $user_id ) {
164 | if ( ! is_array( $this->users_params ) ) {
165 | return;
166 | }
167 | if ( array_key_exists( $user_id, $this->users_params ) && is_array( $this->users_params[$user_id] )
168 | && count( $this->users_params[$user_id] ) > 0
169 | ) {
170 | $this->xmlw->startElement( 'params' );
171 | foreach ( $this->users_params[$user_id] as $pname => $pvalue ) {
172 | $this->xmlw->startElement( 'param' );
173 | $this->xmlw->writeAttribute( 'name', $pname );
174 | $this->xmlw->writeAttribute( 'value', $pvalue );
175 | $this->xmlw->endElement();
176 | }
177 | $this->xmlw->endElement();
178 | }
179 | }
180 |
181 | /**
182 | * Get all the users' variables
183 | */
184 | private function get_users_vars() {
185 | $where = '';
186 | if ( ! empty ( $this->userid ) ) {
187 | $where = sprintf( 'WHERE directory_id = %d', $this->userid );
188 | }
189 | $query = sprintf( "SELECT * FROM directory_vars %s;", $where );
190 | $this->debug( $query );
191 | $res = $this->db->queryAll( $query );
192 | if ( FS_PDO::isError( $res ) ) {
193 | $this->comment( $this->db->getMessage() );
194 | $this->file_not_found();
195 | }
196 |
197 | $record_count = count( $res );
198 | for ( $i = 0; $i < $record_count; $i ++ ) {
199 | $di = $res[$i]['directory_id'];
200 | $vn = $res[$i]['var_name'];
201 | $this->users_vars[$di][$vn] = $res[$i]['var_value'];
202 | }
203 | }
204 |
205 | /**
206 | * Write all the for a given user
207 | *
208 | * @param integer $user_id
209 | *
210 | * @return void
211 | */
212 | private function write_variables( $user_id ) {
213 | if ( ! is_array( $this->users_vars ) ) {
214 | return;
215 | }
216 | if ( array_key_exists( $user_id, $this->users_vars ) && is_array( $this->users_vars[$user_id] ) ) {
217 | $this->xmlw->startElement( 'variables' );
218 | foreach ( $this->users_vars[$user_id] as $vname => $vvalue ) {
219 | $this->xmlw->startElement( 'variable' );
220 | $this->xmlw->writeAttribute( 'name', $vname );
221 | $this->xmlw->writeAttribute( 'value', $vvalue );
222 | $this->xmlw->endElement();
223 | }
224 | $this->xmlw->endElement();
225 | }
226 | }
227 |
228 | /**
229 | * get the users' gateways
230 | */
231 | private function get_users_gateways() {
232 | $where = '';
233 | if ( ! empty ( $this->userid ) ) {
234 | $where = sprintf( 'WHERE directory_id = %d', $this->userid );
235 | }
236 | $query = sprintf( "SELECT * FROM directory_gateways %s;", $where );
237 | $this->debug( $query );
238 | $res = $this->db->queryAll( $query );
239 | if ( FS_PDO::isError( $res ) ) {
240 | $this->comment( $this->db->getMessage() );
241 | $this->file_not_found();
242 | }
243 | $record_count = count( $res );
244 | for ( $i = 0; $i < $record_count; $i ++ ) {
245 | $di = $res[$i]['directory_id'];
246 | $this->users_gateways[$di][] = $res[$i];
247 | }
248 | }
249 |
250 | /**
251 | * Write all of the XML for the user's
252 | * This method takes the id of the user from the directory table and pulls
253 | * all of the user's gateways. It then calls write_single_gateway for
254 | * each of them to write out all of the params
255 | *
256 | * @param integer $user_id
257 | *
258 | * @return void
259 | */
260 | private function write_gateways( $user_id ) {
261 | if ( is_array( $this->users_gateways ) && array_key_exists( $user_id, $this->users_gateways )
262 | && is_array( $this->users_gateways[$user_id] )
263 | ) {
264 | $this->xmlw->startElement( 'gateways' );
265 | $gateway_count = count( $this->users_gateways[$user_id] );
266 | for ( $i = 0; $i < $gateway_count; $i ++ ) {
267 | $this->xmlw->startElement( 'gateway' );
268 | $this->xmlw->writeAttribute( 'name', $this->users_gateways[$user_id][$i]['gateway_name'] );
269 |
270 | $this->write_user_gateway_params( $this->users_gateways[$user_id][$i]['id'] );
271 | $this->xmlw->endElement();
272 | }
273 | $this->xmlw->endElement();
274 | }
275 | }
276 |
277 | /**
278 | * get users' gateway params
279 | */
280 | private function get_user_gateway_params() {
281 | $query = sprintf( "SELECT * FROM directory_gateway_params;" );
282 | $res = $this->db->queryAll( $query );
283 | if ( FS_PDO::isError( $res ) ) {
284 | $this->comment( $this->db->getMessage() );
285 | $this->file_not_found();
286 | }
287 | $param_count = count( $res );
288 | for ( $i = 0; $i < $param_count; $i ++ ) {
289 | $dgwid = $res[$i]['id'];
290 | $pname = $res[$i]['param_name'];
291 | $pvalue = $res[$i]['param_value'];
292 | $this->users_gateway_params[$dgwid][$pname] = $pvalue;
293 | }
294 | }
295 |
296 | /**
297 | * Write out the XML for each user-specific gateway
298 | *
299 | * @param integer $d_gw_id id from directory_gateways
300 | *
301 | * @return void
302 | */
303 | private function write_user_gateway_params( $d_gw_id ) {
304 | if ( is_array( $this->users_gateway_params[$d_gw_id] )
305 | && count( $this->users_gateway_params[$d_gw_id] ) > 0
306 | ) {
307 | foreach ( $this->users_gateway_params[$d_gw_id] as $pname => $pvalue ) {
308 | $this->xmlw->startElement( 'param' );
309 | $this->xmlw->writeAttribute( 'name', $pname );
310 | $this->xmlw->writeAttribute( 'value', $pvalue );
311 | $this->xmlw->endElement();
312 | }
313 | }
314 | }
315 |
316 | /**
317 | * This method will write out XML for global directory params
318 | *
319 | */
320 | function write_global_params( $domain ) {
321 | $query = sprintf( 'SELECT * FROM directory_global_params WHERE domain_id = %d', $domain['id'] );
322 | $res = $this->db->queryAll( $query );
323 | if ( FS_PDO::isError( $res ) ) {
324 | $this->comment( $query );
325 | $error_msg = sprintf( "Error while selecting global params - %s", $this->db->getMessage() );
326 | trigger_error( $error_msg );
327 | }
328 | $param_count = count( $res );
329 | $this->xmlw->startElement( 'params' );
330 | for ( $i = 0; $i < $param_count; $i ++ ) {
331 | if ( empty ( $res[$i]['param_name'] ) ) {
332 | continue;
333 | }
334 | $this->xmlw->startElement( 'param' );
335 | $this->xmlw->writeAttribute( 'name', $res[$i]['param_name'] );
336 | $this->xmlw->writeAttribute( 'value', $res[$i]['param_value'] );
337 | $this->xmlw->endElement();
338 | }
339 | $this->xmlw->endElement();
340 | }
341 |
342 | /**
343 | * This method will write out XML for global directory variables
344 | *
345 | */
346 | function write_global_vars( $domain ) {
347 | $query = sprintf( 'SELECT * FROM directory_global_vars WHERE domain_id = %d', $domain['id'] );
348 | $res = $this->db->queryAll( $query );
349 | if ( FS_PDO::isError( $res ) ) {
350 | $this->comment( $query );
351 | $error_msg = sprintf( "Error while selecting global vars - %s", $this->db->getMessage() );
352 | trigger_error( $error_msg );
353 | }
354 | $param_count = count( $res );
355 | $this->xmlw->startElement( 'variables' );
356 | for ( $i = 0; $i < $param_count; $i ++ ) {
357 | if ( empty ( $res[$i]['var_name'] ) ) {
358 | continue;
359 | }
360 | $this->xmlw->startElement( 'variable' );
361 | $this->xmlw->writeAttribute( 'name', $res[$i]['var_name'] );
362 | $this->xmlw->writeAttribute( 'value', $res[$i]['var_value'] );
363 | $this->xmlw->endElement();
364 | }
365 | $this->xmlw->endElement();
366 | }
367 |
368 | function get_domains( $domain = NULL ) {
369 | $where = '';
370 | if ( $domain ) {
371 | $where = sprintf( "WHERE domain_name='%s'", $domain );
372 | }
373 |
374 | $query = "SELECT * FROM directory_domains $where;";
375 | $this->debug( $query );
376 | $res = $this->db->queryAll( $query );
377 | if ( FS_PDO::isError( $res ) ) {
378 | $this->comment( $query );
379 | $this->comment( $this->db->getMessage() );
380 | $this->comment( $this->db->getMessage() );
381 | $this->file_not_found();
382 | }
383 |
384 | return $res;
385 | }
386 |
387 | /**
388 | * Write XML directory from the array returned by get_directory
389 | * @see fs_directory::get_directory
390 | *
391 | * @param array $directory Multi-dimentional array from which we write the XML
392 | *
393 | * @return void
394 | */
395 | private function writedirectory( $directory, $domain ) {
396 | $directory_count = count( $directory );
397 |
398 | $this->get_users_params();
399 | $this->get_users_vars();
400 | $this->get_users_gateways();
401 |
402 | $this->xmlw->startElement( 'domain' );
403 | $this->xmlw->writeAttribute( 'name', $domain['domain_name'] );
404 | $this->write_global_params( $domain );
405 | $this->write_global_vars( $domain );
406 |
407 | $this->xmlw->startElement( 'groups' );
408 | $this->xmlw->startElement( 'group' );
409 | if ( array_key_exists( 'group', $this->request ) ) {
410 | $this->xmlw->writeAttribute( 'name', $this->request['group'] );
411 | } else {
412 | $this->xmlw->writeAttribute( 'name', 'default' );
413 | }
414 | $this->xmlw->startElement( 'users' );
415 | for ( $i = 0; $i < $directory_count; $i ++ ) {
416 | $cacheable = 0;
417 | $username = $directory[$i]['username'];
418 | $mailbox = empty ( $directory[$i]['mailbox'] ) ? $username : $directory[$i]['mailbox'];
419 | $this->xmlw->startElement( 'user' );
420 | $this->xmlw->writeAttribute( 'id', $username );
421 | if ( array_key_exists( 'cache', $directory[$i] ) ) {
422 | $cacheable = $directory[$i]['cache'];
423 | }
424 | $this->xmlw->writeAttribute( 'cacheable', $cacheable );
425 | $this->xmlw->writeAttribute( 'mailbox', $mailbox );
426 |
427 | $this->write_params( $directory[$i]['id'] );
428 | $this->write_variables( $directory[$i]['id'] );
429 | $this->write_gateways( $directory[$i]['id'] );
430 | $this->xmlw->endElement();
431 | }
432 | $this->xmlw->endElement(); //
433 | $this->xmlw->endElement(); //
434 | $this->xmlw->endElement(); //
435 | $this->xmlw->endElement(); //
436 | }
437 | }
438 |
439 |
--------------------------------------------------------------------------------
/global_defines.php:
--------------------------------------------------------------------------------
1 |
6 | * @version 0.1
7 | */
8 |
9 | if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
10 | header('Location: index.php');
11 | }
12 |
13 | /**
14 | * Defines the default dsn for the FS_PDO class
15 | */
16 | define('DEFAULT_DSN', 'pgsql:dbname=freeswitch;host=127.0.0.1');
17 | /**
18 | * Defines the default dsn login for the PDO class
19 | */
20 | define('DEFAULT_DSN_LOGIN', 'freeswitch');
21 | /**
22 | * Defines the default dsn password for the PDOclass
23 | */
24 | define('DEFAULT_DSN_PASSWORD', 'Fr33Sw1tch');
25 | /**
26 | * Generic return success
27 | */
28 | define('FS_CURL_SUCCESS', 0);
29 | /**
30 | * Generic return success
31 | */
32 | define('FS_SQL_SUCCESS', '00000');
33 | /**
34 | * Generic return warning
35 | */
36 | define('FS_CURL_WARNING', 1);
37 | /**
38 | * Generic return critical
39 | */
40 | define('FS_CURL_CRITICAL', 2);
41 |
42 | /**
43 | * determines how the error handler handles warnings
44 | */
45 | define('RETURN_ON_WARN', true);
46 |
47 | /**
48 | * Determines whether or not users should be domain specific
49 | * If GLOBAL_USERS is true, user info will be returned for whatever
50 | * domain is passed.....
51 | * NOTE: using a1 hashes will NOT work with this setting
52 | */
53 | define('GLOBAL_USERS', false);
54 |
55 | /**
56 | * Define debug level... should not be used in production for performance reasons
57 | */
58 | //define('FS_CURL_DEBUG', 9);
59 | /**
60 | * define how debugging should be done (depends on FS_CURL_DEBUG)
61 | * 0 syslog
62 | * 1 xml comment
63 | * 2 file (named in FS_DEBUG_FILE), take care when using this option as there's currently nothing to watch the file's size
64 | */
65 | define('FS_DEBUG_TYPE', 0);
66 |
67 | /**
68 | * File to use for debugging to file
69 | */
70 | define('FS_DEBUG_FILE', '/tmp/fs_curl.debug');
71 |
72 |
73 |
74 |
75 | //define('', '');
76 | ?>
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
6 | * @version 0.1
7 | * initial page hit in all curl requests
8 | */
9 |
10 | /**
11 | * define for the time that execution of the script started
12 | */
13 | define('START_TIME', preg_replace('/^0\.(\d+) (\d+)$/', '\2.\1', microtime()));
14 | /**
15 | * Pre-Class initialization die function
16 | * This function should be called on any
17 | * critical error condition before the fs_curl
18 | * class is successfully instantiated.
19 | * @return void
20 | */
21 |
22 | function file_not_found($no=false, $str=false, $file=false, $line=false) {
23 | if ($no == E_STRICT) {
24 | return;
25 | }
26 | header('Content-Type: text/xml');
27 | printf("\n");
28 | printf("\n");
29 | printf(" \n");
30 | printf(" \n");
31 | printf(" \n");
32 | if (!empty($no) && !empty($str) && !empty($file) &&!empty($line)) {
33 | printf(" \n");
34 | }
35 | printf("\n");
36 | exit();
37 | }
38 | error_reporting(E_ALL);
39 | set_error_handler('file_not_found');
40 |
41 | if (!class_exists('XMLWriter')) {
42 | trigger_error(
43 | "XMLWriter Class NOT Found... You Must install it before using this package"
44 | , E_USER_ERROR
45 | );
46 | }
47 | if (!(@include_once('fs_curl.php'))
48 | || !(@include_once('global_defines.php'))) {
49 | trigger_error(
50 | 'could not include fs_curl.php or global_defines.php', E_USER_ERROR
51 | );
52 | }
53 | if (!is_array($_REQUEST)) {
54 | trigger_error('$_REQUEST is not an array');
55 | }
56 |
57 | if (array_key_exists('cdr', $_REQUEST)) {
58 | $section = 'cdr';
59 | } else {
60 | $section = $_REQUEST['section'];
61 | }
62 | $section_file = sprintf('fs_%s.php', $section);
63 | /**
64 | * this include will differ based on the section that's passed
65 | */
66 | if (!(@include_once($section_file))) {
67 | trigger_error("unable to include $section_file");
68 | }
69 | switch ($section) {
70 | case 'configuration':
71 | if (!array_key_exists('key_value', $_REQUEST)) {
72 | trigger_error('key_value does not exist in $_REQUEST');
73 | }
74 | $config = $_REQUEST['key_value'];
75 | $processor = sprintf('configuration/%s.php', $config);
76 | $class = str_replace('.', '_', $config);
77 | if (!(@include_once($processor))) {
78 | trigger_error("unable to include $processor");
79 | }
80 | $conf = new $class;
81 | $conf -> comment("class name is $class");
82 | break;
83 | case 'dialplan':
84 | $conf = new fs_dialplan();
85 | break;
86 | case 'directory':
87 | $conf = new fs_directory();
88 | break;
89 | case 'cdr':
90 | $conf = new fs_cdr();
91 | break;
92 | case 'chatplan':
93 | $conf = new fs_chatplan();
94 | break;
95 | case 'phrases':
96 | $conf = new fs_phrases();
97 | break;
98 | }
99 |
100 | $conf -> debug('---- Start _REQUEST ----');
101 | $conf -> debug($_REQUEST);
102 | $conf -> debug('---- End _REQUEST ----');
103 | $conf -> main();
104 | $conf -> output_xml();
105 |
106 | ?>
107 |
--------------------------------------------------------------------------------
/libs/fs_pdo.php:
--------------------------------------------------------------------------------
1 |
8 | * @license bsd http://www.opensource.org/licenses/bsd-license.php
9 | */
10 | if (class_exists('PDO')) {
11 | class FS_PDO extends PDO {
12 | /**
13 | * Default fetch mode. Associative arrays seem to be used most often
14 | */
15 | private $fetch_mode = PDO::FETCH_ASSOC;
16 |
17 | /**
18 | * Basic counter for profiling the number of queries executed.
19 | */
20 | public $counter = 0;
21 |
22 | public function __construct($dsn, $login = NULL, $password = NULL, $options = NULL) {
23 | parent::__construct($dsn, $login, $password, $options);
24 | $this->setAttribute( PDO::ATTR_STATEMENT_CLASS, array( 'FS_PDOStatement', array() ) );
25 | }
26 |
27 | /**
28 | * Set the fetch mode i.e. PDO::FETCH_ASSOC
29 | * @param string $fetch_mode
30 | */
31 | public function setFetchMode($fetch_mode) {
32 | $this->fetch_mode = $fetch_mode;
33 | }
34 |
35 | /**
36 | * Return an associative array instead of a PDO statement object
37 | * @param string $query Query to be executed
38 | * @return mixed Associative array result set
39 | */
40 | public function queryAll($query) {
41 | $this->counter++;
42 | $res = $this->query($query);
43 | if(!$res) {
44 | return false;
45 | } else {
46 | return $res->fetchAll($this->fetch_mode);
47 | }
48 | }
49 |
50 | /**
51 | * Backwards compatibility for error checking with MDB2
52 | * @static
53 | * @param string $result The return status of a previous query operation
54 | * @return bool
55 | */
56 | public static function isError($result) {
57 | if($result === false) {
58 | return true;
59 | } else {
60 | return false;
61 | }
62 | }
63 |
64 | /**
65 | *
66 | * @param string $query Query to be executed
67 | * @return PDOStatement
68 | */
69 | public function query($query) {
70 | $this->counter++;
71 | return PDO::query($query);
72 | }
73 |
74 | /**
75 | * Takes and array and converts to a string
76 | * @return string $full_error A formated message
77 | */
78 | public function getMessage() {
79 | $full_error = "";
80 | foreach($this->errorInfo() as $error) {
81 | $full_error .= $error . "\n";
82 | }
83 | return $full_error;
84 | }
85 | }
86 |
87 | /**
88 | * PDOStatment was extended to provide backwards compatible functions such as
89 | * fetchRow and rowCount. At some point all references to numRow() should be
90 | * replaced with rowCount()
91 | */
92 |
93 | class FS_PDOStatement extends PDOStatement {
94 |
95 | protected function __construct() {
96 |
97 | }
98 |
99 | public function fetchRow() {
100 |
101 | return $this->fetch(PDO::FETCH_ASSOC);
102 | }
103 |
104 | public function numRows() {
105 | if (preg_match('/^select/i', $this->queryString)) {
106 | $results = $this->fetchAll();
107 | $this->execute();
108 | return count($results);
109 | } else {
110 | return $this->rowCount();
111 | }
112 | }
113 | }
114 | } else {
115 | trigger_error("PDO doesn't seem to be installed, make sure it's installed and loaded", E_USER_ERROR);
116 | }
117 |
--------------------------------------------------------------------------------
/sql/mssql.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intralanman/fs_curl/2c8c15dd42e4aa4fefe4a39a6275e55d9e24758d/sql/mssql.sql
--------------------------------------------------------------------------------
/sql/oracle-with-examples.sql:
--------------------------------------------------------------------------------
1 | -- phpMyAdmin SQL Dump
2 | -- version 3.1.2deb1
3 | -- http://www.phpmyadmin.net
4 | --
5 | -- Host: localhost
6 | -- Generation Time: Feb 15, 2009 at 09:35 PM
7 | -- Server version: 5.0.75
8 | -- PHP Version: 5.2.6-3ubuntu2
9 |
10 |
11 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
12 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
13 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
14 | /*!40101 SET NAMES utf8 */;
15 |
16 | --
17 | -- Database: `freeswitch`
18 | --
19 |
20 | -- --------------------------------------------------------
21 |
22 | --
23 | -- Table structure for table `acl_lists`
24 | --
25 |
26 | CREATE TABLE IF NOT EXISTS "acl_lists" (
27 | "id" int(10) unsigned NOT NULL,
28 | "acl_name" varchar(128) NOT NULL,
29 | "default_policy" varchar(45) NOT NULL,
30 | PRIMARY KEY ("id")
31 | ) AUTO_INCREMENT=4 ;
32 |
33 | --
34 | -- Dumping data for table `acl_lists`
35 | --
36 |
37 | INSERT INTO `acl_lists` (`id`, `acl_name`, `default_policy`) VALUES
38 | (1, 'rfc1918', 'deny'),
39 | (2, 'lan', 'allow'),
40 | (3, 'default', 'allow');
41 |
42 | -- --------------------------------------------------------
43 |
44 | --
45 | -- Table structure for table `acl_nodes`
46 | --
47 |
48 | CREATE TABLE IF NOT EXISTS "acl_nodes" (
49 | "id" int(10) unsigned NOT NULL,
50 | "cidr" varchar(45) NOT NULL,
51 | "type" varchar(16) NOT NULL,
52 | "list_id" int(10) unsigned NOT NULL,
53 | PRIMARY KEY ("id")
54 | ) AUTO_INCREMENT=4 ;
55 |
56 | --
57 | -- Dumping data for table `acl_nodes`
58 | --
59 |
60 | INSERT INTO `acl_nodes` (`id`, `cidr`, `type`, `list_id`) VALUES
61 | (1, '192.168.0.0/16', 'allow', 1),
62 | (2, '10.0.0.0/8', 'allow', 1),
63 | (3, '172.16.0.0/12', 'allow', 1);
64 |
65 | -- --------------------------------------------------------
66 |
67 | --
68 | -- Table structure for table `conference_advertise`
69 | --
70 |
71 | CREATE TABLE IF NOT EXISTS "conference_advertise" (
72 | "id" int(10) unsigned NOT NULL,
73 | "room" varchar(64) NOT NULL,
74 | "status" varchar(128) NOT NULL,
75 | PRIMARY KEY ("id"),
76 | UNIQUE KEY "unique_room" ("room")
77 | ) AUTO_INCREMENT=4 ;
78 |
79 | --
80 | -- Dumping data for table `conference_advertise`
81 | --
82 |
83 | INSERT INTO `conference_advertise` (`id`, `room`, `status`) VALUES
84 | (1, '3000@$${domain}', 'Freeswitch Conference'),
85 | (2, '3001@$${domain}', 'FreeSWITCH Conference 2'),
86 | (3, '3002@$${domain}', 'FreeSWITCH Conference 3');
87 |
88 | -- --------------------------------------------------------
89 |
90 | --
91 | -- Table structure for table `conference_controls`
92 | --
93 |
94 | CREATE TABLE IF NOT EXISTS "conference_controls" (
95 | "id" int(10) unsigned NOT NULL,
96 | "conf_group" varchar(64) NOT NULL,
97 | "action" varchar(64) NOT NULL,
98 | "digits" varchar(16) NOT NULL,
99 | PRIMARY KEY ("id"),
100 | UNIQUE KEY "unique_group_action" ("conf_group","action")
101 | ) AUTO_INCREMENT=13 ;
102 |
103 | --
104 | -- Dumping data for table `conference_controls`
105 | --
106 |
107 | INSERT INTO `conference_controls` (`id`, `conf_group`, `action`, `digits`) VALUES
108 | (1, 'default', 'mute', '0'),
109 | (2, 'default', 'deaf_mute', '*'),
110 | (3, 'default', 'energy up', '9'),
111 | (4, 'default', 'energy equ', '8'),
112 | (5, 'default', 'energy dn', '7'),
113 | (6, 'default', 'vol talk up', '3'),
114 | (7, 'default', 'vol talk dn', '1'),
115 | (8, 'default', 'vol talk zero', '2'),
116 | (9, 'default', 'vol listen up', '6'),
117 | (10, 'default', 'vol listen dn', '4'),
118 | (11, 'default', 'vol listen zero', '5'),
119 | (12, 'default', 'hangup', '#');
120 |
121 | -- --------------------------------------------------------
122 |
123 | --
124 | -- Table structure for table `conference_profiles`
125 | --
126 |
127 | CREATE TABLE IF NOT EXISTS "conference_profiles" (
128 | "id" int(10) unsigned NOT NULL,
129 | "profile_name" varchar(64) NOT NULL,
130 | "param_name" varchar(64) NOT NULL,
131 | "param_value" varchar(64) NOT NULL,
132 | PRIMARY KEY ("id"),
133 | KEY "unique_profile_param" ("profile_name","param_name")
134 | ) AUTO_INCREMENT=8 ;
135 |
136 | --
137 | -- Dumping data for table `conference_profiles`
138 | --
139 |
140 | INSERT INTO `conference_profiles` (`id`, `profile_name`, `param_name`, `param_value`) VALUES
141 | (1, 'default', 'domain', '$${domain}'),
142 | (2, 'default', 'rate', '8000'),
143 | (3, 'default', 'interval', '20'),
144 | (4, 'default', 'energy-level', '300'),
145 | (5, 'default', 'moh-sound', '$${moh_uri}'),
146 | (6, 'default', 'caller-id-name', '$${outbound_caller_name}'),
147 | (7, 'default', 'caller-id-number', '$${outbound_caller_number}');
148 |
149 | -- --------------------------------------------------------
150 |
151 | --
152 | -- Table structure for table `dialplan`
153 | --
154 |
155 | CREATE TABLE IF NOT EXISTS "dialplan" (
156 | "dialplan_id" int(11) NOT NULL,
157 | "domain" varchar(128) NOT NULL,
158 | "ip_address" varchar(15) NOT NULL,
159 | PRIMARY KEY ("dialplan_id")
160 | ) AUTO_INCREMENT=2 ;
161 |
162 | --
163 | -- Dumping data for table `dialplan`
164 | --
165 |
166 | INSERT INTO `dialplan` (`dialplan_id`, `domain`, `ip_address`) VALUES
167 | (1, 'freeswitch', '127.0.0.1');
168 |
169 | -- --------------------------------------------------------
170 |
171 | --
172 | -- Table structure for table `dialplan_actions`
173 | --
174 |
175 | CREATE TABLE IF NOT EXISTS "dialplan_actions" (
176 | "action_id" int(11) NOT NULL,
177 | "condition_id" int(11) NOT NULL,
178 | "application" varchar(256) NOT NULL,
179 | "data" varchar(256) NOT NULL,
180 | "type" varchar(32) NOT NULL,
181 | "weight" int(11) NOT NULL,
182 | PRIMARY KEY ("action_id")
183 | ) AUTO_INCREMENT=170 ;
184 |
185 | --
186 | -- Dumping data for table `dialplan_actions`
187 | --
188 |
189 | INSERT INTO `dialplan_actions` (`action_id`, `condition_id`, `application`, `data`, `type`, `weight`) VALUES
190 | (1, 2, 'deflect', '${destination_number}', 'action', 10),
191 | (2, 5, 'set', 'domain_name=$${domain}', 'action', 20),
192 | (3, 5, 'set', 'domain_name=${sip_auth_realm}', 'anti-action', 30),
193 | (4, 7, 'set', 'domain_name=$${domain}', 'action', 40),
194 | (5, 9, 'set', 'open=true', 'action', 50),
195 | (6, 10, 'answer', '', 'action', 60),
196 | (7, 10, 'intercept', '${db(select/${domain_name}-last_dial/global)}', 'action', 70),
197 | (8, 10, 'sleep', '2000', 'action', 80),
198 | (9, 11, 'answer', '', 'action', 90),
199 | (10, 11, 'intercept', '${db(select/${domain_name}-last_dial/${callgroup})}', 'action', 100),
200 | (11, 11, 'sleep', '2000', 'action', 110),
201 | (12, 12, 'answer', '', 'action', 120),
202 | (13, 12, 'intercept', '${db(select/${domain_name}-last_dial_ext/$1)}', 'action', 130),
203 | (14, 12, 'sleep', '2000', 'action', 140),
204 | (15, 13, 'transfer', '${db(select/${domain_name}-last_dial/${caller_id_number})}', 'action', 150),
205 | (16, 14, 'set', 'use_profile=${cond(${acl($${local_ip_v4} rfc1918)} == true ? nat : default)}', 'action', 160),
206 | (17, 14, 'set', 'use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}', 'anti-action', 170),
207 | (18, 15, 'set_user', 'default@${domain_name}', 'action', 180),
208 | (19, 16, 'info', '', 'action', 190),
209 | (20, 17, 'set', 'sip_secure_media=true', 'action', 200),
210 | (21, 18, 'db', 'insert/${domain_name}-spymap/${caller_id_number}/${uuid}', 'action', 210),
211 | (22, 18, 'db', 'insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}', 'action', 220),
212 | (23, 18, 'db', 'insert/${domain_name}-last_dial/global/${uuid}', 'action', 230),
213 | (24, 19, 'eval', '${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}', 'action', 240),
214 | (25, 19, 'transfer', '3000', 'action', 250),
215 | (26, 20, 'eval', '${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}', 'action', 260),
216 | (27, 20, 'playback', '$${hold_music}', 'action', 270),
217 | (28, 21, 'answer', '', 'action', 280),
218 | (29, 21, 'eavesdrop', '${db(select/${domain_name}-spymap/$1)}', 'action', 290),
219 | (30, 22, 'answer', '', 'action', 300),
220 | (31, 22, 'set', 'eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)', 'action', 310),
221 | (32, 22, 'set', 'eavesdrop_indicate_new=tone_stream://%(500, 0, 620)', 'action', 320),
222 | (33, 22, 'set', 'eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)', 'action', 330),
223 | (34, 22, 'eavesdrop', 'all', 'action', 340),
224 | (35, 23, 'transfer', '${db(select/${domain_name}-call_return/${caller_id_number})}', 'action', 350),
225 | (36, 24, 'answer', '', 'action', 360),
226 | (37, 24, 'group', 'delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 370),
227 | (38, 24, 'gentones', '%(1000, 0, 320)', 'action', 380),
228 | (39, 25, 'answer', '', 'action', 390),
229 | (40, 25, 'group', 'insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}', 'action', 400),
230 | (41, 25, 'gentones', '%(1000, 0, 640)', 'action', 410),
231 | (42, 26, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name})}', 'action', 420),
232 | (43, 27, 'set', 'call_timeout=10', 'action', 430),
233 | (44, 27, 'bridge', '{ignore_early_media=true}${group(call:$1@${domain_name}:order)}', 'action', 440),
234 | (45, 28, 'set', 'dialed_extension=$1', 'action', 450),
235 | (46, 28, 'export', 'sip_auto_answer=true', 'action', 460),
236 | (47, 28, 'bridge', 'user/${dialed_extension}@${domain_name}', 'action', 470),
237 | (48, 29, 'set', 'dialed_extension=$1', 'action', 480),
238 | (49, 29, 'export', 'dialed_extension=$1', 'action', 490),
239 | (50, 30, 'set', 'voicemail_authorized=${sip_authorized}', 'action', 500),
240 | (51, 30, 'answer', '', 'action', 510),
241 | (52, 30, 'sleep', '1000', 'action', 520),
242 | (53, 30, 'voicemail', 'check default ${domain_name} ${dialed_extension}', 'action', 530),
243 | (54, 30, 'bind_meta_app', '1 b s execute_extension::dx XML features', 'anti-action', 540),
244 | (55, 30, 'bind_meta_app', '2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
245 | (56, 30, 'bind_meta_app', '3 b s execute_extension::cf XML features', 'anti-action', 560),
246 | (57, 30, 'set', 'ringback=${us-ring}', 'anti-action', 570),
247 | (58, 30, 'set', 'transfer_ringback=$${hold_music}', 'anti-action', 580),
248 | (59, 30, 'set', 'call_timeout=30', 'anti-action', 590),
249 | (60, 30, 'set', 'hangup_after_bridge=true', 'anti-action', 600),
250 | (61, 30, 'set', 'continue_on_fail=true', 'anti-action', 610),
251 | (62, 30, 'db', 'insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}', 'anti-action', 620),
252 | (63, 30, 'db', 'insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}', 'anti-action', 630),
253 | (64, 30, 'set', 'called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}', 'anti-action', 640),
254 | (65, 30, 'db', 'insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}', 'anti-action', 650),
255 | (66, 30, 'bridge', 'user/${dialed_extension}@${domain_name}', 'anti-action', 660),
256 | (67, 30, 'answer', '', 'anti-action', 670),
257 | (68, 30, 'sleep', '1000', 'anti-action', 680),
258 | (69, 30, 'voicemail', 'default ${domain_name} ${dialed_extension}', 'anti-action', 690),
259 | (70, 31, 'bridge', '${group_call(sales@${domain_name})}', 'action', 700),
260 | (71, 32, 'bridge', 'group/support@${domain_name}', 'action', 710),
261 | (72, 33, 'bridge', 'group/billing@${domain_name}', 'action', 720),
262 | (73, 34, 'set', 'transfer_ringback=$${hold_music}', 'action', 730),
263 | (74, 34, 'transfer', '1000 XML features', 'action', 740),
264 | (75, 35, 'answer', '', 'action', 750),
265 | (76, 35, 'sleep', '1000', 'action', 760),
266 | (77, 35, 'voicemail', 'check default ${domain_name}', 'action', 770),
267 | (78, 36, 'bridge', 'sofia/${use_profile}/$1', 'action', 780),
268 | (79, 37, 'answer', '', 'action', 790),
269 | (80, 37, 'conference', '$1-${domain_name}@default', 'action', 800),
270 | (81, 38, 'answer', '', 'action', 810),
271 | (82, 38, 'conference', '$1-${domain_name}@wideband', 'action', 820),
272 | (83, 39, 'answer', '', 'action', 830),
273 | (84, 39, 'conference', '$1-${domain_name}@ultrawideband', 'action', 840),
274 | (85, 40, 'answer', '', 'action', 850),
275 | (86, 40, 'conference', '$1-${domain_name}@cdquality', 'action', 860),
276 | (87, 41, 'bridge', 'sofia/${use_profile}/$1@conference.freeswitch.org', 'action', 870),
277 | (88, 42, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss1', 'action', 880),
278 | (89, 42, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 890),
279 | (90, 42, 'set', 'conference_auto_outcall_timeout=60', 'action', 900),
280 | (91, 42, 'set', 'conference_auto_outcall_flags=mute', 'action', 910),
281 | (92, 42, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 920),
282 | (93, 42, 'set', 'sip_exclude_contact=${network_addr}', 'action', 930),
283 | (94, 42, 'conference_set_auto_outcall', '${group_call(sales)}', 'action', 940),
284 | (95, 42, 'conference', 'madboss_intercom1@default+flags{endconf|deaf}', 'action', 950),
285 | (96, 43, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss2', 'action', 960),
286 | (97, 43, 'set', 'conference_auto_outcall_caller_id_number=0912', 'action', 970),
287 | (98, 43, 'set', 'conference_auto_outcall_timeout=60', 'action', 980),
288 | (99, 43, 'set', 'conference_auto_outcall_flags=mute', 'action', 990),
289 | (100, 43, 'set', 'conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer=''bind_meta_app 2 a s1 intercept::${uuid}''}', 'action', 1000),
290 | (101, 43, 'set', 'sip_exclude_contact=${network_addr}', 'action', 1010),
291 | (102, 43, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1020),
292 | (103, 43, 'conference', 'madboss_intercom2@default+flags{endconf|deaf}', 'action', 1030),
293 | (104, 44, 'set', 'conference_auto_outcall_caller_id_name=Mad Boss', 'action', 1040),
294 | (105, 44, 'set', 'conference_auto_outcall_caller_id_number=0911', 'action', 1050),
295 | (106, 44, 'set', 'conference_auto_outcall_timeout=60', 'action', 1060),
296 | (107, 44, 'set', 'conference_auto_outcall_flags=none', 'action', 1070),
297 | (108, 44, 'conference_set_auto_outcall', 'loopback/9999', 'action', 1080),
298 | (109, 44, 'conference', 'madboss3@default', 'action', 1090),
299 | (110, 45, 'answer', '', 'action', 1100),
300 | (111, 45, 'sleep', '2000', 'action', 1110),
301 | (112, 45, 'ivr', 'demo_ivr', 'action', 1120),
302 | (113, 46, 'conference', 'bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org', 'action', 1130),
303 | (114, 47, 'answer', '', 'action', 1140),
304 | (115, 47, 'esf_page_group', '', 'action', 1150),
305 | (116, 48, 'set', 'fifo_music=$${hold_music}', 'action', 1160),
306 | (117, 48, 'fifo', '5900@${domain_name} in', 'action', 1170),
307 | (118, 49, 'answer', '', 'action', 1180),
308 | (119, 49, 'fifo', '5900@${domain_name} out nowait', 'action', 1190),
309 | (120, 51, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1200),
310 | (121, 54, 'answer', '', 'action', 1210),
311 | (122, 54, 'fifo', '$1@${domain_name} out nowait', 'action', 1220),
312 | (123, 57, '', '', 'expression', 1230),
313 | (124, 57, 'fifo', '$1@${domain_name} in undef $${hold_music}', 'action', 1240),
314 | (125, 60, 'answer', '', 'action', 1250),
315 | (126, 60, 'fifo', '$1@${domain_name} out nowait', 'action', 1260),
316 | (127, 61, 'pre_answer', '', 'action', 1270),
317 | (128, 61, 'sleep', '20000', 'action', 1280),
318 | (129, 61, 'answer', '', 'action', 1290),
319 | (130, 61, 'sleep', '1000', 'action', 1300),
320 | (131, 61, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1310),
321 | (132, 61, 'hangup', '', 'action', 1320),
322 | (133, 62, 'ring_ready', '', 'action', 1330),
323 | (134, 62, 'sleep', '20000', 'action', 1340),
324 | (135, 62, 'answer', '', 'action', 1350),
325 | (136, 62, 'sleep', '1000', 'action', 1360),
326 | (137, 62, 'playback', 'voicemail/vm-goodbye.wav', 'action', 1370),
327 | (138, 62, 'hangup', '', 'action', 1380),
328 | (139, 63, 'set', 'ringback=$${uk-ring}', 'action', 1390),
329 | (140, 63, 'bridge', 'loopback/wait', 'action', 1400),
330 | (141, 64, 'set', 'ringback=$${hold_music}', 'action', 1410),
331 | (142, 64, 'bridge', 'loopback/wait', 'action', 1420),
332 | (143, 65, 'set', 'transfer_ringback=$${uk-ring}', 'action', 1430),
333 | (144, 65, 'answer', '', 'action', 1440),
334 | (145, 65, 'bridge', 'loopback/wait', 'action', 1450),
335 | (146, 66, 'set', 'transfer_ringback=$${hold_music}', 'action', 1460),
336 | (147, 66, 'answer', '', 'action', 1470),
337 | (148, 66, 'bridge', 'loopback/wait', 'action', 1480),
338 | (149, 67, 'answer', '', 'action', 1490),
339 | (150, 67, 'info', '', 'action', 1500),
340 | (151, 67, 'sleep', '250', 'action', 1510),
341 | (152, 67, 'hangup', '', 'action', 1520),
342 | (153, 68, 'answer', '', 'action', 1530),
343 | (154, 68, 'record_fsv', '/tmp/testrecord.fsv', 'action', 1540),
344 | (155, 69, 'answer', '', 'action', 1550),
345 | (156, 69, 'play_fsv', '/tmp/testrecord.fsv', 'action', 1560),
346 | (157, 70, 'answer', '', 'action', 1570),
347 | (158, 70, 'delay_echo', '5000', 'action', 1580),
348 | (159, 71, 'answer', '', 'action', 1590),
349 | (160, 71, 'echo', '', 'action', 1600),
350 | (161, 72, 'answer', '', 'action', 1610),
351 | (162, 72, 'playback', 'tone_stream://%(10000,0,1004);loops=-1', 'action', 1620),
352 | (163, 73, 'answer', '', 'action', 1630),
353 | (164, 73, 'playback', 'tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10', 'action', 1640),
354 | (165, 75, 'answer', '', 'action', 1650),
355 | (166, 75, 'execute_extension', 'is_secure XML features', 'action', 1660),
356 | (167, 75, 'playback', '$${hold_music}', 'action', 1670),
357 | (168, 75, 'answer', '', 'anti-action', 1680),
358 | (169, 75, 'playback', '$${hold_music}', 'anti-action', 1690);
359 |
360 | -- --------------------------------------------------------
361 |
362 | --
363 | -- Table structure for table `dialplan_condition`
364 | --
365 |
366 | CREATE TABLE IF NOT EXISTS "dialplan_condition" (
367 | "condition_id" int(11) NOT NULL,
368 | "extension_id" int(11) NOT NULL,
369 | "field" varchar(1238) NOT NULL,
370 | "expression" varchar(128) NOT NULL,
371 | "weight" int(11) NOT NULL,
372 | PRIMARY KEY ("condition_id")
373 | ) AUTO_INCREMENT=76 ;
374 |
375 | --
376 | -- Dumping data for table `dialplan_condition`
377 | --
378 |
379 | INSERT INTO `dialplan_condition` (`condition_id`, `extension_id`, `field`, `expression`, `weight`) VALUES
380 | (1, 1, '$${unroll_loops}', '^true$', 10),
381 | (2, 1, '${sip_looped_call}', '^true$', 20),
382 | (3, 2, '${domain_name}', '^$', 30),
383 | (4, 2, 'source', 'mod_sofia', 40),
384 | (5, 2, '${sip_auth_realm}', '^$', 50),
385 | (6, 3, '${domain_name}', '^$', 60),
386 | (7, 3, 'source', 'mod_openzap', 70),
387 | (8, 4, '${strftime(%w)}', '^([1-5])$', 80),
388 | (9, 4, '${strftime(%H%M)}', '^((09|1[0-7])[0-5][0-9]|1800)$', 90),
389 | (10, 5, 'destination_number', '^886$', 100),
390 | (11, 6, 'destination_number', '^\\*8$', 110),
391 | (12, 7, 'destination_number', '^\\*\\*(\\d+)$', 120),
392 | (13, 8, 'destination_number', '^870$', 130),
393 | (14, 9, '${network_addr}', '^$', 140),
394 | (15, 9, '${numbering_plan}', '^$', 150),
395 | (16, 9, '${call_debug}', '^true$', 160),
396 | (17, 9, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 170),
397 | (18, 9, '', '', 180),
398 | (19, 10, 'destination_number', '^9001$', 190),
399 | (20, 11, 'destination_number', '^9000$', 200),
400 | (21, 12, 'destination_number', '^88(.*)$|^\\*0(.*)$', 210),
401 | (22, 13, 'destination_number', '^779$', 220),
402 | (23, 14, 'destination_number', '^\\*69$|^869$|^lcr$', 230),
403 | (24, 15, 'destination_number', '^80(\\d{2})$', 240),
404 | (25, 16, 'destination_number', '^81(\\d{2})$', 250),
405 | (26, 17, 'destination_number', '^82(\\d{2})$', 260),
406 | (27, 18, 'destination_number', '^83(\\d{2})$', 270),
407 | (28, 19, 'destination_number', '^8(10[01][0-9])$', 280),
408 | (29, 20, 'destination_number', '^(20[01][0-9])$', 290),
409 | (30, 20, 'destination_number', '^${caller_id_number}$', 300),
410 | (31, 21, 'destination_number', '^3000$', 310),
411 | (32, 22, 'destination_number', '^3001$', 320),
412 | (33, 23, 'destination_number', '^3002$', 330),
413 | (34, 24, 'destination_number', '^operator$|^0$', 340),
414 | (35, 25, 'destination_number', '^vmain|4000$', 350),
415 | (36, 26, 'destination_number', '^sip:(.*)$', 360),
416 | (37, 27, 'destination_number', '^(30\\d{2})$', 370),
417 | (38, 28, 'destination_number', '^(31\\d{2})$', 380),
418 | (39, 29, 'destination_number', '^(32\\d{2})$', 390),
419 | (40, 30, 'destination_number', '^(33\\d{2})$', 400),
420 | (41, 31, 'destination_number', '^9(888|1616|3232)$', 410),
421 | (42, 32, 'destination_number', '^0911$', 420),
422 | (43, 33, 'destination_number', '^0912$', 430),
423 | (44, 34, 'destination_number', '^0913$', 440),
424 | (45, 35, 'destination_number', '^5000$', 450),
425 | (46, 36, 'destination_number', '^5001$', 460),
426 | (47, 37, 'destination_number', '^pagegroup$|^7243', 470),
427 | (48, 38, 'destination_number', '^5900$', 480),
428 | (49, 39, 'destination_number', '^5901$', 490),
429 | (50, 40, 'source', 'mod_sofia', 500),
430 | (51, 40, 'destination_number', 'park\\+(\\d+)', 510),
431 | (52, 41, 'source', 'mod_sofia', 520),
432 | (53, 41, 'destination_number', '^parking$', 530),
433 | (54, 41, '${sip_to_params}', 'fifo\\=(\\d+)', 540),
434 | (55, 42, 'source', 'mod_sofia', 550),
435 | (56, 42, 'destination_number', 'callpark', 560),
436 | (57, 42, '${sip_refer_to}', '', 570),
437 | (58, 43, 'source', 'mod_sofia', 580),
438 | (59, 43, 'destination_number', 'pickup', 590),
439 | (60, 43, '${sip_to_params}', 'orbit\\=(\\d+)', 600),
440 | (61, 44, 'destination_number', '^wait$', 610),
441 | (62, 45, 'destination_number', '^9980$', 620),
442 | (63, 46, 'destination_number', '^9981$', 630),
443 | (64, 47, 'destination_number', '^9982$', 640),
444 | (65, 48, 'destination_number', '^9983$', 650),
445 | (66, 49, 'destination_number', '^9984$', 660),
446 | (67, 50, 'destination_number', '^9992$', 670),
447 | (68, 51, 'destination_number', '^9993$', 680),
448 | (69, 52, 'destination_number', '^9994$', 690),
449 | (70, 53, 'destination_number', '^9995$', 700),
450 | (71, 54, 'destination_number', '^9996$', 710),
451 | (72, 55, 'destination_number', '^9997$', 720),
452 | (73, 56, 'destination_number', '^9998$', 730),
453 | (74, 57, 'destination_number', '^9999$', 740),
454 | (75, 57, '${sip_has_crypto}', '^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$', 750);
455 |
456 | -- --------------------------------------------------------
457 |
458 | --
459 | -- Table structure for table `dialplan_context`
460 | --
461 |
462 | CREATE TABLE IF NOT EXISTS "dialplan_context" (
463 | "context_id" int(11) NOT NULL,
464 | "dialplan_id" int(11) NOT NULL,
465 | "context" varchar(64) NOT NULL,
466 | "weight" int(11) NOT NULL,
467 | PRIMARY KEY ("context_id")
468 | ) AUTO_INCREMENT=3 ;
469 |
470 | --
471 | -- Dumping data for table `dialplan_context`
472 | --
473 |
474 | INSERT INTO `dialplan_context` (`context_id`, `dialplan_id`, `context`, `weight`) VALUES
475 | (1, 1, 'default', 10),
476 | (2, 1, 'public', 20);
477 |
478 | -- --------------------------------------------------------
479 |
480 | --
481 | -- Table structure for table `dialplan_extension`
482 | --
483 |
484 | CREATE TABLE IF NOT EXISTS "dialplan_extension" (
485 | "extension_id" int(11) NOT NULL,
486 | "context_id" int(11) NOT NULL,
487 | "name" varchar(128) NOT NULL,
488 | "continue" varchar(32) NOT NULL,
489 | "weight" int(11) NOT NULL,
490 | PRIMARY KEY ("extension_id")
491 | ) AUTO_INCREMENT=58 ;
492 |
493 | --
494 | -- Dumping data for table `dialplan_extension`
495 | --
496 |
497 | INSERT INTO `dialplan_extension` (`extension_id`, `context_id`, `name`, `continue`, `weight`) VALUES
498 | (1, 1, 'unloop', '', 10),
499 | (2, 1, 'set_domain', 'true', 20),
500 | (3, 1, 'set_domain_openzap', 'true', 30),
501 | (4, 1, 'tod_example', 'true', 40),
502 | (5, 1, 'global-intercept', '', 50),
503 | (6, 1, 'group-intercept', '', 60),
504 | (7, 1, 'intercept-ext', '', 70),
505 | (8, 1, 'redial', '', 80),
506 | (9, 1, 'global', 'true', 90),
507 | (10, 1, 'snom-demo-2', '', 100),
508 | (11, 1, 'snom-demo-1', '', 110),
509 | (12, 1, 'eavesdrop', '', 120),
510 | (13, 1, 'eavesdrop', '', 130),
511 | (14, 1, 'call_return', '', 140),
512 | (15, 1, 'del-group', '', 150),
513 | (16, 1, 'add-group', '', 160),
514 | (17, 1, 'call-group-simo', '', 170),
515 | (18, 1, 'call-group-order', '', 180),
516 | (19, 1, 'extension-intercom', '', 190),
517 | (20, 1, 'Local_Extension', '', 200),
518 | (21, 1, 'group_dial_sales', '', 210),
519 | (22, 1, 'group_dial_support', '', 220),
520 | (23, 1, 'group_dial_billing', '', 230),
521 | (24, 1, 'operator', '', 240),
522 | (25, 1, 'vmain', '', 250),
523 | (26, 1, 'sip_uri', '', 260),
524 | (27, 1, 'nb_conferences', '', 270),
525 | (28, 1, 'wb_conferences', '', 280),
526 | (29, 1, 'uwb_conferences', '', 290),
527 | (30, 1, 'cdquality_conferences', '', 300),
528 | (31, 1, 'freeswitch_public_conf_via_sip', '', 310),
529 | (32, 1, 'mad_boss_intercom', '', 320),
530 | (33, 1, 'mad_boss_intercom', '', 330),
531 | (34, 1, 'mad_boss', '', 340),
532 | (35, 1, 'ivr_demo', '', 350),
533 | (36, 1, 'dyanmic conference', '', 360),
534 | (37, 1, 'rtp_multicast_page', '', 370),
535 | (38, 1, 'park', '', 380),
536 | (39, 1, 'unpark', '', 390),
537 | (40, 1, 'park', '', 400),
538 | (41, 1, 'unpark', '', 410),
539 | (42, 1, 'park', '', 420),
540 | (43, 1, 'unpark', '', 430),
541 | (44, 1, 'wait', '', 440),
542 | (45, 1, 'ringback_180', '', 450),
543 | (46, 1, 'ringback_183_uk_ring', '', 460),
544 | (47, 1, 'ringback_183_music_ring', '', 470),
545 | (48, 1, 'ringback_post_answer_uk_ring', '', 480),
546 | (49, 1, 'ringback_post_answer_music', '', 490),
547 | (50, 1, 'show_info', '', 500),
548 | (51, 1, 'video_record', '', 510),
549 | (52, 1, 'video_playback', '', 520),
550 | (53, 1, 'delay_echo', '', 530),
551 | (54, 1, 'echo', '', 540),
552 | (55, 1, 'milliwatt', '', 550),
553 | (56, 2, 'tone_stream', '', 560),
554 | (57, 2, 'hold_music', '', 570);
555 |
556 | -- --------------------------------------------------------
557 |
558 | --
559 | -- Table structure for table `dialplan_special`
560 | --
561 |
562 | CREATE TABLE IF NOT EXISTS "dialplan_special" (
563 | "id" int(11) NOT NULL,
564 | "context" varchar(255) NOT NULL,
565 | "class_file" varchar(255) NOT NULL,
566 | PRIMARY KEY ("id"),
567 | UNIQUE KEY "unique_context" ("context")
568 | ) AUTO_INCREMENT=1 ;
569 |
570 | --
571 | -- Dumping data for table `dialplan_special`
572 | --
573 |
574 |
575 | -- --------------------------------------------------------
576 |
577 | --
578 | -- Table structure for table `dingaling_profiles`
579 | --
580 |
581 | CREATE TABLE IF NOT EXISTS "dingaling_profiles" (
582 | "id" int(10) unsigned NOT NULL,
583 | "profile_name" varchar(64) NOT NULL,
584 | "type" varchar(64) NOT NULL,
585 | PRIMARY KEY ("id"),
586 | UNIQUE KEY "unique_name" ("profile_name")
587 | ) AUTO_INCREMENT=2 ;
588 |
589 | --
590 | -- Dumping data for table `dingaling_profiles`
591 | --
592 |
593 | INSERT INTO `dingaling_profiles` (`id`, `profile_name`, `type`) VALUES
594 | (1, 'fs.intralanman.servehttp.com', 'component');
595 |
596 | -- --------------------------------------------------------
597 |
598 | --
599 | -- Table structure for table `dingaling_profile_params`
600 | --
601 |
602 | CREATE TABLE IF NOT EXISTS "dingaling_profile_params" (
603 | "id" int(10) unsigned NOT NULL,
604 | "dingaling_id" int(10) unsigned NOT NULL,
605 | "param_name" varchar(64) NOT NULL,
606 | "param_value" varchar(64) NOT NULL,
607 | PRIMARY KEY ("id"),
608 | UNIQUE KEY "unique_type_name" ("dingaling_id","param_name")
609 | ) AUTO_INCREMENT=5 ;
610 |
611 | --
612 | -- Dumping data for table `dingaling_profile_params`
613 | --
614 |
615 | INSERT INTO `dingaling_profile_params` (`id`, `dingaling_id`, `param_name`, `param_value`) VALUES
616 | (1, 1, 'password', 'secret'),
617 | (2, 1, 'dialplan', 'XML,enum'),
618 | (3, 1, 'server', 'example.org'),
619 | (4, 1, 'name', 'fs.example.org');
620 |
621 | -- --------------------------------------------------------
622 |
623 | --
624 | -- Table structure for table `dingaling_settings`
625 | --
626 |
627 | CREATE TABLE IF NOT EXISTS "dingaling_settings" (
628 | "id" int(10) unsigned NOT NULL,
629 | "param_name" varchar(64) NOT NULL,
630 | "param_value" varchar(64) NOT NULL,
631 | PRIMARY KEY ("id"),
632 | UNIQUE KEY "unique_param" ("param_name")
633 | ) AUTO_INCREMENT=3 ;
634 |
635 | --
636 | -- Dumping data for table `dingaling_settings`
637 | --
638 |
639 | INSERT INTO `dingaling_settings` (`id`, `param_name`, `param_value`) VALUES
640 | (1, 'debug', '0'),
641 | (2, 'codec-prefs', '$${global_codec_prefs}');
642 |
643 | -- --------------------------------------------------------
644 |
645 | --
646 | -- Table structure for table `directory`
647 | --
648 |
649 | CREATE TABLE IF NOT EXISTS "directory" (
650 | "id" int(11) NOT NULL,
651 | "username" varchar(255) NOT NULL,
652 | "domain" varchar(255) NOT NULL,
653 | PRIMARY KEY ("id")
654 | ) AUTO_INCREMENT=12 ;
655 |
656 | --
657 | -- Dumping data for table `directory`
658 | --
659 |
660 | INSERT INTO `directory` (`id`, `username`, `domain`) VALUES
661 | (1, '1000', 'example.com'),
662 | (2, '1001', 'example.org'),
663 | (3, '1002', 'example.net'),
664 | (5, '1003', 'example.info'),
665 | (6, '1004', 'example.com'),
666 | (7, '1005', 'example.org'),
667 | (8, '1006', 'example.net'),
668 | (9, '1007', 'example.info'),
669 | (10, '2000', 'default'),
670 | (11, '1009', '$${local_ip_v4}');
671 |
672 | -- --------------------------------------------------------
673 |
674 | --
675 | -- Table structure for table `directory_domains`
676 | --
677 |
678 | CREATE TABLE IF NOT EXISTS "directory_domains" (
679 | "id" int(10) unsigned NOT NULL,
680 | "domain_name" varchar(128) NOT NULL,
681 | PRIMARY KEY ("id")
682 | ) AUTO_INCREMENT=3 ;
683 |
684 | --
685 | -- Dumping data for table `directory_domains`
686 | --
687 |
688 | INSERT INTO `directory_domains` (`id`, `domain_name`) VALUES
689 | (1, 'freeswitch.org'),
690 | (2, 'sofaswitch.org');
691 |
692 | -- --------------------------------------------------------
693 |
694 | --
695 | -- Table structure for table `directory_gateways`
696 | --
697 |
698 | CREATE TABLE IF NOT EXISTS "directory_gateways" (
699 | "id" int(10) unsigned NOT NULL,
700 | "directory_id" int(10) unsigned NOT NULL,
701 | "gateway_name" varchar(128) NOT NULL,
702 | PRIMARY KEY ("id")
703 | ) AUTO_INCREMENT=1 ;
704 |
705 | --
706 | -- Dumping data for table `directory_gateways`
707 | --
708 |
709 |
710 | -- --------------------------------------------------------
711 |
712 | --
713 | -- Table structure for table `directory_gateway_params`
714 | --
715 |
716 | CREATE TABLE IF NOT EXISTS "directory_gateway_params" (
717 | "id" int(10) unsigned NOT NULL,
718 | "d_gw_id" int(10) unsigned NOT NULL,
719 | "param_name" varchar(64) NOT NULL,
720 | "param_value" varchar(64) NOT NULL,
721 | PRIMARY KEY ("id"),
722 | UNIQUE KEY "unique_gw_param" ("d_gw_id","param_name")
723 | ) AUTO_INCREMENT=1 ;
724 |
725 | --
726 | -- Dumping data for table `directory_gateway_params`
727 | --
728 |
729 |
730 | -- --------------------------------------------------------
731 |
732 | --
733 | -- Table structure for table `directory_global_params`
734 | --
735 |
736 | CREATE TABLE IF NOT EXISTS "directory_global_params" (
737 | "id" int(10) unsigned NOT NULL,
738 | "param_name" varchar(64) NOT NULL,
739 | "param_value" varchar(128) NOT NULL,
740 | "domain_id" int(10) unsigned NOT NULL,
741 | PRIMARY KEY ("id")
742 | ) AUTO_INCREMENT=2 ;
743 |
744 | --
745 | -- Dumping data for table `directory_global_params`
746 | --
747 |
748 | INSERT INTO `directory_global_params` (`id`, `param_name`, `param_value`, `domain_id`) VALUES
749 | (1, 'default_gateway', 'errors', 1);
750 |
751 | -- --------------------------------------------------------
752 |
753 | --
754 | -- Table structure for table `directory_global_vars`
755 | --
756 |
757 | CREATE TABLE IF NOT EXISTS "directory_global_vars" (
758 | "id" int(10) unsigned NOT NULL,
759 | "var_name" varchar(64) NOT NULL,
760 | "var_value" varchar(128) NOT NULL,
761 | "domain_id" int(10) unsigned NOT NULL,
762 | PRIMARY KEY ("id")
763 | ) AUTO_INCREMENT=1 ;
764 |
765 | --
766 | -- Dumping data for table `directory_global_vars`
767 | --
768 |
769 |
770 | -- --------------------------------------------------------
771 |
772 | --
773 | -- Table structure for table `directory_params`
774 | --
775 |
776 | CREATE TABLE IF NOT EXISTS "directory_params" (
777 | "id" int(11) NOT NULL,
778 | "directory_id" int(11) default NULL,
779 | "param_name" varchar(255) default NULL,
780 | "param_value" varchar(255) default NULL,
781 | PRIMARY KEY ("id")
782 | ) AUTO_INCREMENT=23 ;
783 |
784 | --
785 | -- Dumping data for table `directory_params`
786 | --
787 |
788 | INSERT INTO `directory_params` (`id`, `directory_id`, `param_name`, `param_value`) VALUES
789 | (1, 1, 'password', '1234'),
790 | (2, 1, 'vm-password', '861000'),
791 | (3, 2, 'password', '1234'),
792 | (4, 2, 'vm-password', '861001'),
793 | (7, 5, 'password', '1234'),
794 | (8, 6, 'password', '1234'),
795 | (9, 7, 'password', '1234'),
796 | (10, 8, 'password', '123456'),
797 | (11, 9, 'password', '1234'),
798 | (12, 10, 'password', '123456'),
799 | (13, 11, 'password', '1234'),
800 | (14, 3, 'vm-password', '861002'),
801 | (15, 3, 'password', '1234'),
802 | (16, 11, 'vm-password', '861009'),
803 | (17, 10, 'vm-password', '1234'),
804 | (18, 9, 'vm-password', '861007'),
805 | (19, 8, 'vm-password', '861006'),
806 | (20, 7, 'vm-password', '861005'),
807 | (21, 6, 'vm-password', '861004'),
808 | (22, 5, 'vm-password', '861003');
809 |
810 | -- --------------------------------------------------------
811 |
812 | --
813 | -- Table structure for table `directory_vars`
814 | --
815 |
816 | CREATE TABLE IF NOT EXISTS "directory_vars" (
817 | "id" int(11) NOT NULL,
818 | "directory_id" int(11) default NULL,
819 | "var_name" varchar(255) default NULL,
820 | "var_value" varchar(255) default NULL,
821 | PRIMARY KEY ("id")
822 | ) AUTO_INCREMENT=6 ;
823 |
824 | --
825 | -- Dumping data for table `directory_vars`
826 | --
827 |
828 | INSERT INTO `directory_vars` (`id`, `directory_id`, `var_name`, `var_value`) VALUES
829 | (1, 1, 'numbering_plan', 'US'),
830 | (2, 2, 'numbering_plan', 'US'),
831 | (3, 3, 'numbering_plan', 'AU'),
832 | (4, 5, 'numbering_plan', 'US'),
833 | (5, 5, 'area_code', '434');
834 |
835 | -- --------------------------------------------------------
836 |
837 | --
838 | -- Table structure for table `iax_conf`
839 | --
840 |
841 | CREATE TABLE IF NOT EXISTS "iax_conf" (
842 | "id" int(11) NOT NULL,
843 | "profile_name" varchar(255) default NULL,
844 | PRIMARY KEY ("id")
845 | ) AUTO_INCREMENT=4 ;
846 |
847 | --
848 | -- Dumping data for table `iax_conf`
849 | --
850 |
851 | INSERT INTO `iax_conf` (`id`, `profile_name`) VALUES
852 | (3, 'test_profile');
853 |
854 | -- --------------------------------------------------------
855 |
856 | --
857 | -- Table structure for table `iax_settings`
858 | --
859 |
860 | CREATE TABLE IF NOT EXISTS "iax_settings" (
861 | "id" int(11) NOT NULL,
862 | "iax_id" int(11) default NULL,
863 | "param_name" varchar(255) default NULL,
864 | "param_value" varchar(255) default NULL,
865 | PRIMARY KEY ("id")
866 | ) AUTO_INCREMENT=43 ;
867 |
868 | --
869 | -- Dumping data for table `iax_settings`
870 | --
871 |
872 | INSERT INTO `iax_settings` (`id`, `iax_id`, `param_name`, `param_value`) VALUES
873 | (35, 3, 'debug', '1'),
874 | (36, 3, 'ip', '$${local_ip_v4}'),
875 | (37, 3, 'port', '4569'),
876 | (38, 3, 'context', 'public'),
877 | (39, 3, 'dialplan', 'enum,XML'),
878 | (40, 3, 'codec-prefs', '$${global_codec_prefs}'),
879 | (41, 3, 'codec-master', 'us'),
880 | (42, 3, 'codec-rate', '8');
881 |
882 | -- --------------------------------------------------------
883 |
884 | --
885 | -- Table structure for table `ivr_conf`
886 | --
887 |
888 | CREATE TABLE IF NOT EXISTS "ivr_conf" (
889 | "id" int(10) unsigned NOT NULL,
890 | "name" varchar(64) NOT NULL,
891 | "greet_long" varchar(255) NOT NULL,
892 | "greet_short" varchar(255) NOT NULL,
893 | "invalid_sound" varchar(255) NOT NULL,
894 | "exit_sound" varchar(255) NOT NULL,
895 | "max_failures" int(10) unsigned NOT NULL default '3',
896 | "timeout" int(11) NOT NULL default '5',
897 | "tts_engine" varchar(64) default NULL,
898 | "tts_voice" varchar(64) default NULL,
899 | PRIMARY KEY ("id"),
900 | UNIQUE KEY "unique_name" ("name")
901 | ) AUTO_INCREMENT=4 ;
902 |
903 | --
904 | -- Dumping data for table `ivr_conf`
905 | --
906 |
907 | INSERT INTO `ivr_conf` (`id`, `name`, `greet_long`, `greet_short`, `invalid_sound`, `exit_sound`, `max_failures`, `timeout`, `tts_engine`, `tts_voice`) VALUES
908 | (1, 'demo', 'soundfiles/ivr/demo/greet-long.wav', 'soundfiles/ivr/demo/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, 'cepstral', 'allison'),
909 | (2, 'demo2', 'soundfiles/ivr/demo2/greet-long.wav', 'soundfiles/ivr/demo2/greet-short.wav', 'soundfiles/ivr/invalid.wav', 'soundfiles/ivr/exit.wav', 3, 5, NULL, NULL),
910 | (3, 'menu8', 'soundfiles/ivr/menu8/greet-long.wav', 'soundfiles/ivr/menu8/greet-short.wav', 'soundfiles/ivr/menu8/invalid.wav', 'soundfiles/ivr/menu8/exit.wav', 3, 5, NULL, NULL);
911 |
912 | -- --------------------------------------------------------
913 |
914 | --
915 | -- Table structure for table `ivr_entries`
916 | --
917 |
918 | CREATE TABLE IF NOT EXISTS "ivr_entries" (
919 | "id" int(10) unsigned NOT NULL,
920 | "ivr_id" int(10) unsigned NOT NULL,
921 | "action" varchar(64) NOT NULL,
922 | "digits" varchar(16) NOT NULL,
923 | "params" varchar(255) default NULL,
924 | PRIMARY KEY ("id"),
925 | UNIQUE KEY "unique_ivr_digits" ("ivr_id","digits")
926 | ) AUTO_INCREMENT=11 ;
927 |
928 | --
929 | -- Dumping data for table `ivr_entries`
930 | --
931 |
932 | INSERT INTO `ivr_entries` (`id`, `ivr_id`, `action`, `digits`, `params`) VALUES
933 | (1, 1, 'menu-play-sound', '1', 'soundfiles/features.wav'),
934 | (2, 1, 'menu-exit', '*', NULL),
935 | (3, 1, 'menu-sub', '2', 'demo2'),
936 | (4, 1, 'menu-exec-api', '3', 'bridge sofia/$${domain}/888@conference.freeswtich.org'),
937 | (5, 1, 'menu-call-transfer', '4', '888'),
938 | (6, 2, 'menu-back', '#', NULL),
939 | (7, 2, 'menu-top', '*', NULL),
940 | (8, 3, 'menu-back', '#', NULL),
941 | (9, 3, 'menu-top', '*', NULL),
942 | (10, 3, 'menu-playsound', '4', 'soundfiles/4.wav');
943 |
944 | -- --------------------------------------------------------
945 |
946 | --
947 | -- Table structure for table `limit_conf`
948 | --
949 |
950 | CREATE TABLE IF NOT EXISTS "limit_conf" (
951 | "id" int(11) NOT NULL,
952 | "name" varchar(255) default NULL,
953 | "value" varchar(255) default NULL,
954 | PRIMARY KEY ("id")
955 | ) AUTO_INCREMENT=2 ;
956 |
957 | --
958 | -- Dumping data for table `limit_conf`
959 | --
960 |
961 |
962 | -- --------------------------------------------------------
963 |
964 | --
965 | -- Table structure for table `limit_data`
966 | --
967 |
968 | CREATE TABLE IF NOT EXISTS "limit_data" (
969 | "hostname" varchar(255) default NULL,
970 | "realm" varchar(255) default NULL,
971 | "id" varchar(255) default NULL,
972 | "uuid" varchar(255) default NULL
973 | );
974 |
975 | --
976 | -- Dumping data for table `limit_data`
977 | --
978 |
979 |
980 | -- --------------------------------------------------------
981 |
982 | --
983 | -- Table structure for table `local_stream_conf`
984 | --
985 |
986 | CREATE TABLE IF NOT EXISTS "local_stream_conf" (
987 | "id" int(11) NOT NULL,
988 | "directory_name" varchar(255) default NULL,
989 | "directory_path" text,
990 | "param_name" varchar(255) default NULL,
991 | "param_value" varchar(255) default NULL,
992 | PRIMARY KEY ("id")
993 | ) AUTO_INCREMENT=1 ;
994 |
995 | --
996 | -- Dumping data for table `local_stream_conf`
997 | --
998 |
999 |
1000 | -- --------------------------------------------------------
1001 |
1002 | --
1003 | -- Table structure for table `modless_conf`
1004 | --
1005 |
1006 | CREATE TABLE IF NOT EXISTS "modless_conf" (
1007 | "id" int(10) unsigned NOT NULL,
1008 | "conf_name" varchar(64) NOT NULL,
1009 | PRIMARY KEY ("id")
1010 | ) AUTO_INCREMENT=4 ;
1011 |
1012 | --
1013 | -- Dumping data for table `modless_conf`
1014 | --
1015 |
1016 | INSERT INTO `modless_conf` (`id`, `conf_name`) VALUES
1017 | (1, 'acl.conf'),
1018 | (2, 'postl_load_switch.conf'),
1019 | (3, 'post_load_modules.conf');
1020 |
1021 | -- --------------------------------------------------------
1022 |
1023 | --
1024 | -- Table structure for table `post_load_modules_conf`
1025 | --
1026 |
1027 | CREATE TABLE IF NOT EXISTS "post_load_modules_conf" (
1028 | "id" int(10) unsigned NOT NULL,
1029 | "module_name" varchar(64) NOT NULL,
1030 | "load_module" tinyint(1) NOT NULL default '1',
1031 | "priority" int(10) unsigned NOT NULL default '1000',
1032 | PRIMARY KEY ("id"),
1033 | UNIQUE KEY "unique_mod" ("module_name")
1034 | ) AUTO_INCREMENT=54 ;
1035 |
1036 | --
1037 | -- Dumping data for table `post_load_modules_conf`
1038 | --
1039 |
1040 | INSERT INTO `post_load_modules_conf` (`id`, `module_name`, `load_module`, `priority`) VALUES
1041 | (1, 'mod_sofia', 1, 2000),
1042 | (2, 'mod_iax', 1, 2000),
1043 | (3, 'mod_xml_rpc', 1, 100),
1044 | (4, 'mod_portaudio', 1, 1000),
1045 | (5, 'mod_enum', 1, 2000),
1046 | (6, 'mod_xml_cdr', 1, 1000),
1047 | (7, 'mod_spidermonkey', 1, 1000),
1048 | (8, 'mod_alsa', 0, 1000),
1049 | (9, 'mod_log_file', 1, 0),
1050 | (10, 'mod_commands', 1, 1000),
1051 | (11, 'mod_voicemail', 1, 1000),
1052 | (12, 'mod_dialplan_xml', 1, 150),
1053 | (13, 'mod_dialplan_asterisk', 1, 150),
1054 | (14, 'mod_openzap', 0, 1000),
1055 | (15, 'mod_woomera', 0, 1000),
1056 | (17, 'mod_speex', 1, 500),
1057 | (18, 'mod_ilbc', 0, 1000),
1058 | (20, 'mod_g723_1', 1, 500),
1059 | (21, 'mod_g729', 1, 500),
1060 | (22, 'mod_g722', 1, 500),
1061 | (23, 'mod_g726', 1, 500),
1062 | (25, 'mod_amr', 1, 500),
1063 | (26, 'mod_fifo', 1, 1000),
1064 | (27, 'mod_limit', 1, 1000),
1065 | (28, 'mod_syslog', 1, 0),
1066 | (29, 'mod_dingaling', 1, 2000),
1067 | (30, 'mod_cdr_csv', 1, 1000),
1068 | (31, 'mod_event_socket', 1, 100),
1069 | (32, 'mod_multicast', 0, 1000),
1070 | (33, 'mod_zeroconf', 0, 1000),
1071 | (34, 'mod_xmpp_event', 0, 1000),
1072 | (35, 'mod_sndfile', 1, 1000),
1073 | (36, 'mod_native_file', 1, 1000),
1074 | (37, 'mod_shout', 1, 1000),
1075 | (38, 'mod_local_stream', 1, 1000),
1076 | (39, 'mod_perl', 0, 1000),
1077 | (40, 'mod_python', 0, 1000),
1078 | (41, 'mod_java', 0, 1000),
1079 | (42, 'mod_cepstral', 0, 1000),
1080 | (43, 'mod_openmrcp', 0, 1000),
1081 | (44, 'mod_lumenvox', 0, 1000),
1082 | (45, 'mod_rss', 0, 1000),
1083 | (46, 'mod_say_de', 1, 1000),
1084 | (47, 'mod_say_fr', 0, 1000),
1085 | (48, 'mod_say_en', 1, 1000),
1086 | (49, 'mod_conference', 1, 1000),
1087 | (50, 'mod_ivr', 0, 1000),
1088 | (51, 'mod_console', 1, 0),
1089 | (52, 'mod_dptools', 1, 1500),
1090 | (53, 'mod_voipcodecs', 1, 500);
1091 |
1092 | -- --------------------------------------------------------
1093 |
1094 | --
1095 | -- Table structure for table `rss_conf`
1096 | --
1097 |
1098 | CREATE TABLE IF NOT EXISTS "rss_conf" (
1099 | "id" int(11) NOT NULL,
1100 | "directory_id" int(11) NOT NULL,
1101 | "feed" text NOT NULL,
1102 | "local_file" text NOT NULL,
1103 | "description" text,
1104 | "priority" int(11) NOT NULL default '1000',
1105 | PRIMARY KEY ("id")
1106 | ) AUTO_INCREMENT=15 ;
1107 |
1108 | --
1109 | -- Dumping data for table `rss_conf`
1110 | --
1111 |
1112 |
1113 | -- --------------------------------------------------------
1114 |
1115 | --
1116 | -- Table structure for table `sip_authentication`
1117 | --
1118 |
1119 | CREATE TABLE IF NOT EXISTS "sip_authentication" (
1120 | "nonce" varchar(255) default NULL,
1121 | "expires" int(11) default NULL
1122 | );
1123 |
1124 | --
1125 | -- Dumping data for table `sip_authentication`
1126 | --
1127 |
1128 |
1129 | -- --------------------------------------------------------
1130 |
1131 | --
1132 | -- Table structure for table `sip_dialogs`
1133 | --
1134 |
1135 | CREATE TABLE IF NOT EXISTS "sip_dialogs" (
1136 | "call_id" varchar(255) default NULL,
1137 | "uuid" varchar(255) default NULL,
1138 | "sip_to_user" varchar(255) default NULL,
1139 | "sip_to_host" varchar(255) default NULL,
1140 | "sip_from_user" varchar(255) default NULL,
1141 | "sip_from_host" varchar(255) default NULL,
1142 | "contact_user" varchar(255) default NULL,
1143 | "contact_host" varchar(255) default NULL,
1144 | "state" varchar(255) default NULL,
1145 | "direction" varchar(255) default NULL,
1146 | "user_agent" varchar(255) default NULL
1147 | );
1148 |
1149 | --
1150 | -- Dumping data for table `sip_dialogs`
1151 | --
1152 |
1153 |
1154 | -- --------------------------------------------------------
1155 |
1156 | --
1157 | -- Table structure for table `sip_registrations`
1158 | --
1159 |
1160 | CREATE TABLE IF NOT EXISTS "sip_registrations" (
1161 | "call_id" varchar(255) default NULL,
1162 | "sip_user" varchar(255) default NULL,
1163 | "sip_host" varchar(255) default NULL,
1164 | "contact" varchar(1024) default NULL,
1165 | "status" varchar(255) default NULL,
1166 | "rpid" varchar(255) default NULL,
1167 | "expires" int(11) default NULL,
1168 | "user_agent" varchar(255) default NULL
1169 | );
1170 |
1171 | --
1172 | -- Dumping data for table `sip_registrations`
1173 | --
1174 |
1175 |
1176 | -- --------------------------------------------------------
1177 |
1178 | --
1179 | -- Table structure for table `sip_subscriptions`
1180 | --
1181 |
1182 | CREATE TABLE IF NOT EXISTS "sip_subscriptions" (
1183 | "proto" varchar(255) default NULL,
1184 | "sip_user" varchar(255) default NULL,
1185 | "sip_host" varchar(255) default NULL,
1186 | "sub_to_user" varchar(255) default NULL,
1187 | "sub_to_host" varchar(255) default NULL,
1188 | "event" varchar(255) default NULL,
1189 | "contact" varchar(1024) default NULL,
1190 | "call_id" varchar(255) default NULL,
1191 | "full_from" varchar(255) default NULL,
1192 | "full_via" varchar(255) default NULL,
1193 | "expires" int(11) default NULL,
1194 | "user_agent" varchar(255) default NULL,
1195 | "accept" varchar(255) default NULL
1196 | );
1197 |
1198 | --
1199 | -- Dumping data for table `sip_subscriptions`
1200 | --
1201 |
1202 |
1203 | -- --------------------------------------------------------
1204 |
1205 | --
1206 | -- Table structure for table `sofia_aliases`
1207 | --
1208 |
1209 | CREATE TABLE IF NOT EXISTS "sofia_aliases" (
1210 | "id" int(10) unsigned NOT NULL,
1211 | "sofia_id" int(10) unsigned NOT NULL,
1212 | "alias_name" varchar(255) NOT NULL,
1213 | PRIMARY KEY ("id")
1214 | ) AUTO_INCREMENT=4 ;
1215 |
1216 | --
1217 | -- Dumping data for table `sofia_aliases`
1218 | --
1219 |
1220 | INSERT INTO `sofia_aliases` (`id`, `sofia_id`, `alias_name`) VALUES
1221 | (1, 1, 'default'),
1222 | (3, 1, 'sip.example.com');
1223 |
1224 | -- --------------------------------------------------------
1225 |
1226 | --
1227 | -- Table structure for table `sofia_conf`
1228 | --
1229 |
1230 | CREATE TABLE IF NOT EXISTS "sofia_conf" (
1231 | "id" int(11) NOT NULL,
1232 | "profile_name" varchar(255) default NULL,
1233 | PRIMARY KEY ("id")
1234 | ) AUTO_INCREMENT=2 ;
1235 |
1236 | --
1237 | -- Dumping data for table `sofia_conf`
1238 | --
1239 |
1240 | INSERT INTO `sofia_conf` (`id`, `profile_name`) VALUES
1241 | (1, '$${domain}');
1242 |
1243 | -- --------------------------------------------------------
1244 |
1245 | --
1246 | -- Table structure for table `sofia_domains`
1247 | --
1248 |
1249 | CREATE TABLE IF NOT EXISTS "sofia_domains" (
1250 | "id" int(11) NOT NULL,
1251 | "sofia_id" int(11) default NULL,
1252 | "domain_name" varchar(255) default NULL,
1253 | "parse" tinyint(1) default NULL,
1254 | PRIMARY KEY ("id")
1255 | ) AUTO_INCREMENT=1 ;
1256 |
1257 | --
1258 | -- Dumping data for table `sofia_domains`
1259 | --
1260 |
1261 |
1262 | -- --------------------------------------------------------
1263 |
1264 | --
1265 | -- Table structure for table `sofia_gateways`
1266 | --
1267 |
1268 | CREATE TABLE IF NOT EXISTS "sofia_gateways" (
1269 | "id" int(11) NOT NULL,
1270 | "sofia_id" int(11) default NULL,
1271 | "gateway_name" varchar(255) default NULL,
1272 | "gateway_param" varchar(255) default NULL,
1273 | "gateway_value" varchar(255) default NULL,
1274 | PRIMARY KEY ("id")
1275 | ) AUTO_INCREMENT=15 ;
1276 |
1277 | --
1278 | -- Dumping data for table `sofia_gateways`
1279 | --
1280 |
1281 | INSERT INTO `sofia_gateways` (`id`, `sofia_id`, `gateway_name`, `gateway_param`, `gateway_value`) VALUES
1282 | (8, 1, 'default', 'proxy', 'asterlink.com'),
1283 | (9, 1, 'default', 'realm', 'asterlink.com'),
1284 | (10, 1, 'default', 'username', 'USERNAME_HERE'),
1285 | (11, 1, 'default', 'register', 'false'),
1286 | (12, 1, 'default', 'expire-seconds', '60'),
1287 | (13, 1, 'default', 'retry_seconds', '2'),
1288 | (14, 1, 'default', 'password', 'PASSWORD_HERE');
1289 |
1290 | -- --------------------------------------------------------
1291 |
1292 | --
1293 | -- Table structure for table `sofia_settings`
1294 | --
1295 |
1296 | CREATE TABLE IF NOT EXISTS "sofia_settings" (
1297 | "id" int(11) NOT NULL,
1298 | "sofia_id" int(11) default NULL,
1299 | "param_name" varchar(255) default NULL,
1300 | "param_value" varchar(255) default NULL,
1301 | PRIMARY KEY ("id")
1302 | ) AUTO_INCREMENT=37 ;
1303 |
1304 | --
1305 | -- Dumping data for table `sofia_settings`
1306 | --
1307 |
1308 | INSERT INTO `sofia_settings` (`id`, `sofia_id`, `param_name`, `param_value`) VALUES
1309 | (1, 1, 'user-agent-string', 'RayUA 2.0pre4'),
1310 | (2, 1, 'auth-calls', 'true'),
1311 | (5, 1, 'debug', '1'),
1312 | (6, 1, 'rfc2833-pt', '101'),
1313 | (7, 1, 'sip-port', '5060'),
1314 | (8, 1, 'dialplan', 'XML'),
1315 | (9, 1, 'dtmf-duration', '100'),
1316 | (10, 1, 'codec-prefs', '$${global_codec_prefs}'),
1317 | (11, 1, 'rtp-timeout-sec', '300'),
1318 | (12, 1, 'rtp-ip', '$${local_ip_v4}'),
1319 | (13, 1, 'sip-ip', '$${local_ip_v4}'),
1320 | (14, 1, 'context', 'default'),
1321 | (15, 1, 'manage-presence', 'true'),
1322 | (16, 1, 'force-register-domain', 'intralanman.servehttp.com'),
1323 | (17, 1, 'inbound-codec-negotiation', 'generous'),
1324 | (18, 1, 'rtp-rewrite-timestampes', 'true'),
1325 | (19, 1, 'nonce-ttl', '60'),
1326 | (20, 1, 'vad', 'out'),
1327 | (36, 1, 'odbc-dsn', 'freeswitch-mysql:freeswitch:Fr33Sw1tch');
1328 |
1329 | -- --------------------------------------------------------
1330 |
1331 | --
1332 | -- Table structure for table `voicemail_conf`
1333 | --
1334 |
1335 | CREATE TABLE IF NOT EXISTS "voicemail_conf" (
1336 | "id" int(10) unsigned NOT NULL,
1337 | "vm_profile" varchar(64) NOT NULL,
1338 | PRIMARY KEY ("id"),
1339 | UNIQUE KEY "unique_profile" ("vm_profile")
1340 | ) AUTO_INCREMENT=2 ;
1341 |
1342 | --
1343 | -- Dumping data for table `voicemail_conf`
1344 | --
1345 |
1346 | INSERT INTO `voicemail_conf` (`id`, `vm_profile`) VALUES
1347 | (1, 'default');
1348 |
1349 | -- --------------------------------------------------------
1350 |
1351 | --
1352 | -- Table structure for table `voicemail_email`
1353 | --
1354 |
1355 | CREATE TABLE IF NOT EXISTS "voicemail_email" (
1356 | "id" int(10) unsigned NOT NULL,
1357 | "voicemail_id" int(10) unsigned NOT NULL,
1358 | "param_name" varchar(64) NOT NULL,
1359 | "param_value" varchar(64) NOT NULL,
1360 | PRIMARY KEY ("id"),
1361 | UNIQUE KEY "unique_profile_param" ("param_name","voicemail_id")
1362 | ) AUTO_INCREMENT=4 ;
1363 |
1364 | --
1365 | -- Dumping data for table `voicemail_email`
1366 | --
1367 |
1368 | INSERT INTO `voicemail_email` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
1369 | (1, 1, 'template-file', 'voicemail.tpl'),
1370 | (2, 1, 'date-fmt', '%A, %B %d %Y, %I %M %p'),
1371 | (3, 1, 'email-from', '${voicemail_account}@${voicemail_domain}');
1372 |
1373 | -- --------------------------------------------------------
1374 |
1375 | --
1376 | -- Table structure for table `voicemail_settings`
1377 | --
1378 |
1379 | CREATE TABLE IF NOT EXISTS "voicemail_settings" (
1380 | "id" int(11) NOT NULL,
1381 | "voicemail_id" int(11) default NULL,
1382 | "param_name" varchar(255) default NULL,
1383 | "param_value" varchar(255) default NULL,
1384 | PRIMARY KEY ("id")
1385 | ) AUTO_INCREMENT=31 ;
1386 |
1387 | --
1388 | -- Dumping data for table `voicemail_settings`
1389 | --
1390 |
1391 | INSERT INTO `voicemail_settings` (`id`, `voicemail_id`, `param_name`, `param_value`) VALUES
1392 | (1, 1, 'file-extension', 'wav'),
1393 | (2, 1, 'terminator-key', '#'),
1394 | (3, 1, 'max-login-attempts', '3'),
1395 | (4, 1, 'digit-timeout', '10000'),
1396 | (5, 1, 'max-record-length', '300'),
1397 | (6, 1, 'tone-spec', '%(1000, 0, 640)'),
1398 | (7, 1, 'callback-dialplan', 'XML'),
1399 | (8, 1, 'callback-context', 'default'),
1400 | (9, 1, 'play-new-messages-key', '1'),
1401 | (10, 1, 'play-saved-messages-key', '2'),
1402 | (11, 1, 'main-menu-key', '*'),
1403 | (12, 1, 'config-menu-key', '5'),
1404 | (13, 1, 'record-greeting-key', '1'),
1405 | (14, 1, 'choose-greeting-key', '2'),
1406 | (15, 1, 'record-file-key', '3'),
1407 | (16, 1, 'listen-file-key', '1'),
1408 | (17, 1, 'record-name-key', '3'),
1409 | (18, 1, 'save-file-key', '9'),
1410 | (19, 1, 'delete-file-key', '7'),
1411 | (20, 1, 'undelete-file-key', '8'),
1412 | (21, 1, 'email-key', '4'),
1413 | (22, 1, 'pause-key', '0'),
1414 | (23, 1, 'restart-key', '1'),
1415 | (24, 1, 'ff-key', '6'),
1416 | (25, 1, 'rew-key', '4'),
1417 | (26, 1, 'record-silence-threshold', '200'),
1418 | (27, 1, 'record-silence-hits', '2'),
1419 | (28, 1, 'web-template-file', 'web-vm.tpl'),
1420 | (29, 1, 'operator-extension', 'operator XML default'),
1421 | (30, 1, 'operator-key', '9');
1422 |
1423 | --
1424 | -- Constraints for dumped tables
1425 | --
1426 |
1427 | --
1428 | -- Constraints for table `dingaling_profile_params`
1429 | --
1430 | ALTER TABLE `dingaling_profile_params`
1431 | ADD CONSTRAINT "dingaling_profile" FOREIGN KEY ("dingaling_id") REFERENCES "dingaling_profiles" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
1432 |
--------------------------------------------------------------------------------
/sql/oracle.sql:
--------------------------------------------------------------------------------
1 | -- phpMyAdmin SQL Dump
2 | -- version 3.1.2deb1
3 | -- http://www.phpmyadmin.net
4 | --
5 | -- Host: localhost
6 | -- Generation Time: Feb 15, 2009 at 09:37 PM
7 | -- Server version: 5.0.75
8 | -- PHP Version: 5.2.6-3ubuntu2
9 |
10 |
11 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
12 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
13 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
14 | /*!40101 SET NAMES utf8 */;
15 |
16 | --
17 | -- Database: `freeswitch`
18 | --
19 |
20 | -- --------------------------------------------------------
21 |
22 | --
23 | -- Table structure for table `acl_lists`
24 | --
25 |
26 | CREATE TABLE IF NOT EXISTS "acl_lists" (
27 | "id" int(10) unsigned NOT NULL,
28 | "acl_name" varchar(128) NOT NULL,
29 | "default_policy" varchar(45) NOT NULL,
30 | PRIMARY KEY ("id")
31 | ) AUTO_INCREMENT=1 ;
32 |
33 | --
34 | -- Dumping data for table `acl_lists`
35 | --
36 |
37 |
38 | -- --------------------------------------------------------
39 |
40 | --
41 | -- Table structure for table `acl_nodes`
42 | --
43 |
44 | CREATE TABLE IF NOT EXISTS "acl_nodes" (
45 | "id" int(10) unsigned NOT NULL,
46 | "cidr" varchar(45) NOT NULL,
47 | "type" varchar(16) NOT NULL,
48 | "list_id" int(10) unsigned NOT NULL,
49 | PRIMARY KEY ("id")
50 | ) AUTO_INCREMENT=1 ;
51 |
52 | --
53 | -- Dumping data for table `acl_nodes`
54 | --
55 |
56 |
57 | -- --------------------------------------------------------
58 |
59 | --
60 | -- Table structure for table `conference_advertise`
61 | --
62 |
63 | CREATE TABLE IF NOT EXISTS "conference_advertise" (
64 | "id" int(10) unsigned NOT NULL,
65 | "room" varchar(64) NOT NULL,
66 | "status" varchar(128) NOT NULL,
67 | PRIMARY KEY ("id"),
68 | UNIQUE KEY "unique_room" ("room")
69 | ) AUTO_INCREMENT=1 ;
70 |
71 | --
72 | -- Dumping data for table `conference_advertise`
73 | --
74 |
75 |
76 | -- --------------------------------------------------------
77 |
78 | --
79 | -- Table structure for table `conference_controls`
80 | --
81 |
82 | CREATE TABLE IF NOT EXISTS "conference_controls" (
83 | "id" int(10) unsigned NOT NULL,
84 | "conf_group" varchar(64) NOT NULL,
85 | "action" varchar(64) NOT NULL,
86 | "digits" varchar(16) NOT NULL,
87 | PRIMARY KEY ("id"),
88 | UNIQUE KEY "unique_group_action" ("conf_group","action")
89 | ) AUTO_INCREMENT=1 ;
90 |
91 | --
92 | -- Dumping data for table `conference_controls`
93 | --
94 |
95 |
96 | -- --------------------------------------------------------
97 |
98 | --
99 | -- Table structure for table `conference_profiles`
100 | --
101 |
102 | CREATE TABLE IF NOT EXISTS "conference_profiles" (
103 | "id" int(10) unsigned NOT NULL,
104 | "profile_name" varchar(64) NOT NULL,
105 | "param_name" varchar(64) NOT NULL,
106 | "param_value" varchar(64) NOT NULL,
107 | PRIMARY KEY ("id"),
108 | KEY "unique_profile_param" ("profile_name","param_name")
109 | ) AUTO_INCREMENT=1 ;
110 |
111 | --
112 | -- Dumping data for table `conference_profiles`
113 | --
114 |
115 |
116 | -- --------------------------------------------------------
117 |
118 | --
119 | -- Table structure for table `dialplan`
120 | --
121 |
122 | CREATE TABLE IF NOT EXISTS "dialplan" (
123 | "dialplan_id" int(11) NOT NULL,
124 | "domain" varchar(128) NOT NULL,
125 | "ip_address" varchar(15) NOT NULL,
126 | PRIMARY KEY ("dialplan_id")
127 | ) AUTO_INCREMENT=1 ;
128 |
129 | --
130 | -- Dumping data for table `dialplan`
131 | --
132 |
133 |
134 | -- --------------------------------------------------------
135 |
136 | --
137 | -- Table structure for table `dialplan_actions`
138 | --
139 |
140 | CREATE TABLE IF NOT EXISTS "dialplan_actions" (
141 | "action_id" int(11) NOT NULL,
142 | "condition_id" int(11) NOT NULL,
143 | "application" varchar(256) NOT NULL,
144 | "data" varchar(256) NOT NULL,
145 | "type" varchar(32) NOT NULL,
146 | "weight" int(11) NOT NULL,
147 | PRIMARY KEY ("action_id")
148 | ) AUTO_INCREMENT=1 ;
149 |
150 | --
151 | -- Dumping data for table `dialplan_actions`
152 | --
153 |
154 |
155 | -- --------------------------------------------------------
156 |
157 | --
158 | -- Table structure for table `dialplan_condition`
159 | --
160 |
161 | CREATE TABLE IF NOT EXISTS "dialplan_condition" (
162 | "condition_id" int(11) NOT NULL,
163 | "extension_id" int(11) NOT NULL,
164 | "field" varchar(1238) NOT NULL,
165 | "expression" varchar(128) NOT NULL,
166 | "weight" int(11) NOT NULL,
167 | PRIMARY KEY ("condition_id")
168 | ) AUTO_INCREMENT=1 ;
169 |
170 | --
171 | -- Dumping data for table `dialplan_condition`
172 | --
173 |
174 |
175 | -- --------------------------------------------------------
176 |
177 | --
178 | -- Table structure for table `dialplan_context`
179 | --
180 |
181 | CREATE TABLE IF NOT EXISTS "dialplan_context" (
182 | "context_id" int(11) NOT NULL,
183 | "dialplan_id" int(11) NOT NULL,
184 | "context" varchar(64) NOT NULL,
185 | "weight" int(11) NOT NULL,
186 | PRIMARY KEY ("context_id")
187 | ) AUTO_INCREMENT=1 ;
188 |
189 | --
190 | -- Dumping data for table `dialplan_context`
191 | --
192 |
193 |
194 | -- --------------------------------------------------------
195 |
196 | --
197 | -- Table structure for table `dialplan_extension`
198 | --
199 |
200 | CREATE TABLE IF NOT EXISTS "dialplan_extension" (
201 | "extension_id" int(11) NOT NULL,
202 | "context_id" int(11) NOT NULL,
203 | "name" varchar(128) NOT NULL,
204 | "continue" varchar(32) NOT NULL,
205 | "weight" int(11) NOT NULL,
206 | PRIMARY KEY ("extension_id")
207 | ) AUTO_INCREMENT=1 ;
208 |
209 | --
210 | -- Dumping data for table `dialplan_extension`
211 | --
212 |
213 |
214 | -- --------------------------------------------------------
215 |
216 | --
217 | -- Table structure for table `dialplan_special`
218 | --
219 |
220 | CREATE TABLE IF NOT EXISTS "dialplan_special" (
221 | "id" int(11) NOT NULL,
222 | "context" varchar(255) NOT NULL,
223 | "class_file" varchar(255) NOT NULL,
224 | PRIMARY KEY ("id"),
225 | UNIQUE KEY "unique_context" ("context")
226 | ) AUTO_INCREMENT=1 ;
227 |
228 | --
229 | -- Dumping data for table `dialplan_special`
230 | --
231 |
232 |
233 | -- --------------------------------------------------------
234 |
235 | --
236 | -- Table structure for table `dingaling_profiles`
237 | --
238 |
239 | CREATE TABLE IF NOT EXISTS "dingaling_profiles" (
240 | "id" int(10) unsigned NOT NULL,
241 | "profile_name" varchar(64) NOT NULL,
242 | "type" varchar(64) NOT NULL,
243 | PRIMARY KEY ("id"),
244 | UNIQUE KEY "unique_name" ("profile_name")
245 | ) AUTO_INCREMENT=1 ;
246 |
247 | --
248 | -- Dumping data for table `dingaling_profiles`
249 | --
250 |
251 |
252 | -- --------------------------------------------------------
253 |
254 | --
255 | -- Table structure for table `dingaling_profile_params`
256 | --
257 |
258 | CREATE TABLE IF NOT EXISTS "dingaling_profile_params" (
259 | "id" int(10) unsigned NOT NULL,
260 | "dingaling_id" int(10) unsigned NOT NULL,
261 | "param_name" varchar(64) NOT NULL,
262 | "param_value" varchar(64) NOT NULL,
263 | PRIMARY KEY ("id"),
264 | UNIQUE KEY "unique_type_name" ("dingaling_id","param_name")
265 | ) AUTO_INCREMENT=1 ;
266 |
267 | --
268 | -- Dumping data for table `dingaling_profile_params`
269 | --
270 |
271 |
272 | -- --------------------------------------------------------
273 |
274 | --
275 | -- Table structure for table `dingaling_settings`
276 | --
277 |
278 | CREATE TABLE IF NOT EXISTS "dingaling_settings" (
279 | "id" int(10) unsigned NOT NULL,
280 | "param_name" varchar(64) NOT NULL,
281 | "param_value" varchar(64) NOT NULL,
282 | PRIMARY KEY ("id"),
283 | UNIQUE KEY "unique_param" ("param_name")
284 | ) AUTO_INCREMENT=1 ;
285 |
286 | --
287 | -- Dumping data for table `dingaling_settings`
288 | --
289 |
290 |
291 | -- --------------------------------------------------------
292 |
293 | --
294 | -- Table structure for table `directory`
295 | --
296 |
297 | CREATE TABLE IF NOT EXISTS "directory" (
298 | "id" int(11) NOT NULL,
299 | "username" varchar(255) NOT NULL,
300 | "domain" varchar(255) NOT NULL,
301 | PRIMARY KEY ("id")
302 | ) AUTO_INCREMENT=1 ;
303 |
304 | --
305 | -- Dumping data for table `directory`
306 | --
307 |
308 |
309 | -- --------------------------------------------------------
310 |
311 | --
312 | -- Table structure for table `directory_domains`
313 | --
314 |
315 | CREATE TABLE IF NOT EXISTS "directory_domains" (
316 | "id" int(10) unsigned NOT NULL,
317 | "domain_name" varchar(128) NOT NULL,
318 | PRIMARY KEY ("id")
319 | ) AUTO_INCREMENT=1 ;
320 |
321 | --
322 | -- Dumping data for table `directory_domains`
323 | --
324 |
325 |
326 | -- --------------------------------------------------------
327 |
328 | --
329 | -- Table structure for table `directory_gateways`
330 | --
331 |
332 | CREATE TABLE IF NOT EXISTS "directory_gateways" (
333 | "id" int(10) unsigned NOT NULL,
334 | "directory_id" int(10) unsigned NOT NULL,
335 | "gateway_name" varchar(128) NOT NULL,
336 | PRIMARY KEY ("id")
337 | ) AUTO_INCREMENT=1 ;
338 |
339 | --
340 | -- Dumping data for table `directory_gateways`
341 | --
342 |
343 |
344 | -- --------------------------------------------------------
345 |
346 | --
347 | -- Table structure for table `directory_gateway_params`
348 | --
349 |
350 | CREATE TABLE IF NOT EXISTS "directory_gateway_params" (
351 | "id" int(10) unsigned NOT NULL,
352 | "d_gw_id" int(10) unsigned NOT NULL,
353 | "param_name" varchar(64) NOT NULL,
354 | "param_value" varchar(64) NOT NULL,
355 | PRIMARY KEY ("id"),
356 | UNIQUE KEY "unique_gw_param" ("d_gw_id","param_name")
357 | ) AUTO_INCREMENT=1 ;
358 |
359 | --
360 | -- Dumping data for table `directory_gateway_params`
361 | --
362 |
363 |
364 | -- --------------------------------------------------------
365 |
366 | --
367 | -- Table structure for table `directory_global_params`
368 | --
369 |
370 | CREATE TABLE IF NOT EXISTS "directory_global_params" (
371 | "id" int(10) unsigned NOT NULL,
372 | "param_name" varchar(64) NOT NULL,
373 | "param_value" varchar(128) NOT NULL,
374 | "domain_id" int(10) unsigned NOT NULL,
375 | PRIMARY KEY ("id")
376 | ) AUTO_INCREMENT=1 ;
377 |
378 | --
379 | -- Dumping data for table `directory_global_params`
380 | --
381 |
382 |
383 | -- --------------------------------------------------------
384 |
385 | --
386 | -- Table structure for table `directory_global_vars`
387 | --
388 |
389 | CREATE TABLE IF NOT EXISTS "directory_global_vars" (
390 | "id" int(10) unsigned NOT NULL,
391 | "var_name" varchar(64) NOT NULL,
392 | "var_value" varchar(128) NOT NULL,
393 | "domain_id" int(10) unsigned NOT NULL,
394 | PRIMARY KEY ("id")
395 | ) AUTO_INCREMENT=1 ;
396 |
397 | --
398 | -- Dumping data for table `directory_global_vars`
399 | --
400 |
401 |
402 | -- --------------------------------------------------------
403 |
404 | --
405 | -- Table structure for table `directory_params`
406 | --
407 |
408 | CREATE TABLE IF NOT EXISTS "directory_params" (
409 | "id" int(11) NOT NULL,
410 | "directory_id" int(11) default NULL,
411 | "param_name" varchar(255) default NULL,
412 | "param_value" varchar(255) default NULL,
413 | PRIMARY KEY ("id")
414 | ) AUTO_INCREMENT=1 ;
415 |
416 | --
417 | -- Dumping data for table `directory_params`
418 | --
419 |
420 |
421 | -- --------------------------------------------------------
422 |
423 | --
424 | -- Table structure for table `directory_vars`
425 | --
426 |
427 | CREATE TABLE IF NOT EXISTS "directory_vars" (
428 | "id" int(11) NOT NULL,
429 | "directory_id" int(11) default NULL,
430 | "var_name" varchar(255) default NULL,
431 | "var_value" varchar(255) default NULL,
432 | PRIMARY KEY ("id")
433 | ) AUTO_INCREMENT=1 ;
434 |
435 | --
436 | -- Dumping data for table `directory_vars`
437 | --
438 |
439 |
440 | -- --------------------------------------------------------
441 |
442 | --
443 | -- Table structure for table `iax_conf`
444 | --
445 |
446 | CREATE TABLE IF NOT EXISTS "iax_conf" (
447 | "id" int(11) NOT NULL,
448 | "profile_name" varchar(255) default NULL,
449 | PRIMARY KEY ("id")
450 | ) AUTO_INCREMENT=1 ;
451 |
452 | --
453 | -- Dumping data for table `iax_conf`
454 | --
455 |
456 |
457 | -- --------------------------------------------------------
458 |
459 | --
460 | -- Table structure for table `iax_settings`
461 | --
462 |
463 | CREATE TABLE IF NOT EXISTS "iax_settings" (
464 | "id" int(11) NOT NULL,
465 | "iax_id" int(11) default NULL,
466 | "param_name" varchar(255) default NULL,
467 | "param_value" varchar(255) default NULL,
468 | PRIMARY KEY ("id")
469 | ) AUTO_INCREMENT=1 ;
470 |
471 | --
472 | -- Dumping data for table `iax_settings`
473 | --
474 |
475 |
476 | -- --------------------------------------------------------
477 |
478 | --
479 | -- Table structure for table `ivr_conf`
480 | --
481 |
482 | CREATE TABLE IF NOT EXISTS "ivr_conf" (
483 | "id" int(10) unsigned NOT NULL,
484 | "name" varchar(64) NOT NULL,
485 | "greet_long" varchar(255) NOT NULL,
486 | "greet_short" varchar(255) NOT NULL,
487 | "invalid_sound" varchar(255) NOT NULL,
488 | "exit_sound" varchar(255) NOT NULL,
489 | "max_failures" int(10) unsigned NOT NULL default '3',
490 | "timeout" int(11) NOT NULL default '5',
491 | "tts_engine" varchar(64) default NULL,
492 | "tts_voice" varchar(64) default NULL,
493 | PRIMARY KEY ("id"),
494 | UNIQUE KEY "unique_name" ("name")
495 | ) AUTO_INCREMENT=1 ;
496 |
497 | --
498 | -- Dumping data for table `ivr_conf`
499 | --
500 |
501 |
502 | -- --------------------------------------------------------
503 |
504 | --
505 | -- Table structure for table `ivr_entries`
506 | --
507 |
508 | CREATE TABLE IF NOT EXISTS "ivr_entries" (
509 | "id" int(10) unsigned NOT NULL,
510 | "ivr_id" int(10) unsigned NOT NULL,
511 | "action" varchar(64) NOT NULL,
512 | "digits" varchar(16) NOT NULL,
513 | "params" varchar(255) default NULL,
514 | PRIMARY KEY ("id"),
515 | UNIQUE KEY "unique_ivr_digits" ("ivr_id","digits")
516 | ) AUTO_INCREMENT=1 ;
517 |
518 | --
519 | -- Dumping data for table `ivr_entries`
520 | --
521 |
522 |
523 | -- --------------------------------------------------------
524 |
525 | --
526 | -- Table structure for table `limit_conf`
527 | --
528 |
529 | CREATE TABLE IF NOT EXISTS "limit_conf" (
530 | "id" int(11) NOT NULL,
531 | "name" varchar(255) default NULL,
532 | "value" varchar(255) default NULL,
533 | PRIMARY KEY ("id")
534 | ) AUTO_INCREMENT=1 ;
535 |
536 | --
537 | -- Dumping data for table `limit_conf`
538 | --
539 |
540 |
541 | -- --------------------------------------------------------
542 |
543 | --
544 | -- Table structure for table `limit_data`
545 | --
546 |
547 | CREATE TABLE IF NOT EXISTS "limit_data" (
548 | "hostname" varchar(255) default NULL,
549 | "realm" varchar(255) default NULL,
550 | "id" varchar(255) default NULL,
551 | "uuid" varchar(255) default NULL
552 | );
553 |
554 | --
555 | -- Dumping data for table `limit_data`
556 | --
557 |
558 |
559 | -- --------------------------------------------------------
560 |
561 | --
562 | -- Table structure for table `local_stream_conf`
563 | --
564 |
565 | CREATE TABLE IF NOT EXISTS "local_stream_conf" (
566 | "id" int(11) NOT NULL,
567 | "directory_name" varchar(255) default NULL,
568 | "directory_path" text,
569 | "param_name" varchar(255) default NULL,
570 | "param_value" varchar(255) default NULL,
571 | PRIMARY KEY ("id")
572 | ) AUTO_INCREMENT=1 ;
573 |
574 | --
575 | -- Dumping data for table `local_stream_conf`
576 | --
577 |
578 |
579 | -- --------------------------------------------------------
580 |
581 | --
582 | -- Table structure for table `modless_conf`
583 | --
584 |
585 | CREATE TABLE IF NOT EXISTS "modless_conf" (
586 | "id" int(10) unsigned NOT NULL,
587 | "conf_name" varchar(64) NOT NULL,
588 | PRIMARY KEY ("id")
589 | ) AUTO_INCREMENT=1 ;
590 |
591 | --
592 | -- Dumping data for table `modless_conf`
593 | --
594 |
595 |
596 | -- --------------------------------------------------------
597 |
598 | --
599 | -- Table structure for table `post_load_modules_conf`
600 | --
601 |
602 | CREATE TABLE IF NOT EXISTS "post_load_modules_conf" (
603 | "id" int(10) unsigned NOT NULL,
604 | "module_name" varchar(64) NOT NULL,
605 | "load_module" tinyint(1) NOT NULL default '1',
606 | "priority" int(10) unsigned NOT NULL default '1000',
607 | PRIMARY KEY ("id"),
608 | UNIQUE KEY "unique_mod" ("module_name")
609 | ) AUTO_INCREMENT=1 ;
610 |
611 | --
612 | -- Dumping data for table `post_load_modules_conf`
613 | --
614 |
615 |
616 | -- --------------------------------------------------------
617 |
618 | --
619 | -- Table structure for table `rss_conf`
620 | --
621 |
622 | CREATE TABLE IF NOT EXISTS "rss_conf" (
623 | "id" int(11) NOT NULL,
624 | "directory_id" int(11) NOT NULL,
625 | "feed" text NOT NULL,
626 | "local_file" text NOT NULL,
627 | "description" text,
628 | "priority" int(11) NOT NULL default '1000',
629 | PRIMARY KEY ("id")
630 | ) AUTO_INCREMENT=1 ;
631 |
632 | --
633 | -- Dumping data for table `rss_conf`
634 | --
635 |
636 |
637 | -- --------------------------------------------------------
638 |
639 | --
640 | -- Table structure for table `sip_authentication`
641 | --
642 |
643 | CREATE TABLE IF NOT EXISTS "sip_authentication" (
644 | "nonce" varchar(255) default NULL,
645 | "expires" int(11) default NULL
646 | );
647 |
648 | --
649 | -- Dumping data for table `sip_authentication`
650 | --
651 |
652 |
653 | -- --------------------------------------------------------
654 |
655 | --
656 | -- Table structure for table `sip_dialogs`
657 | --
658 |
659 | CREATE TABLE IF NOT EXISTS "sip_dialogs" (
660 | "call_id" varchar(255) default NULL,
661 | "uuid" varchar(255) default NULL,
662 | "sip_to_user" varchar(255) default NULL,
663 | "sip_to_host" varchar(255) default NULL,
664 | "sip_from_user" varchar(255) default NULL,
665 | "sip_from_host" varchar(255) default NULL,
666 | "contact_user" varchar(255) default NULL,
667 | "contact_host" varchar(255) default NULL,
668 | "state" varchar(255) default NULL,
669 | "direction" varchar(255) default NULL,
670 | "user_agent" varchar(255) default NULL
671 | );
672 |
673 | --
674 | -- Dumping data for table `sip_dialogs`
675 | --
676 |
677 |
678 | -- --------------------------------------------------------
679 |
680 | --
681 | -- Table structure for table `sip_registrations`
682 | --
683 |
684 | CREATE TABLE IF NOT EXISTS "sip_registrations" (
685 | "call_id" varchar(255) default NULL,
686 | "sip_user" varchar(255) default NULL,
687 | "sip_host" varchar(255) default NULL,
688 | "contact" varchar(1024) default NULL,
689 | "status" varchar(255) default NULL,
690 | "rpid" varchar(255) default NULL,
691 | "expires" int(11) default NULL,
692 | "user_agent" varchar(255) default NULL
693 | );
694 |
695 | --
696 | -- Dumping data for table `sip_registrations`
697 | --
698 |
699 |
700 | -- --------------------------------------------------------
701 |
702 | --
703 | -- Table structure for table `sip_subscriptions`
704 | --
705 |
706 | CREATE TABLE IF NOT EXISTS "sip_subscriptions" (
707 | "proto" varchar(255) default NULL,
708 | "sip_user" varchar(255) default NULL,
709 | "sip_host" varchar(255) default NULL,
710 | "sub_to_user" varchar(255) default NULL,
711 | "sub_to_host" varchar(255) default NULL,
712 | "event" varchar(255) default NULL,
713 | "contact" varchar(1024) default NULL,
714 | "call_id" varchar(255) default NULL,
715 | "full_from" varchar(255) default NULL,
716 | "full_via" varchar(255) default NULL,
717 | "expires" int(11) default NULL,
718 | "user_agent" varchar(255) default NULL,
719 | "accept" varchar(255) default NULL
720 | );
721 |
722 | --
723 | -- Dumping data for table `sip_subscriptions`
724 | --
725 |
726 |
727 | -- --------------------------------------------------------
728 |
729 | --
730 | -- Table structure for table `sofia_aliases`
731 | --
732 |
733 | CREATE TABLE IF NOT EXISTS "sofia_aliases" (
734 | "id" int(10) unsigned NOT NULL,
735 | "sofia_id" int(10) unsigned NOT NULL,
736 | "alias_name" varchar(255) NOT NULL,
737 | PRIMARY KEY ("id")
738 | ) AUTO_INCREMENT=1 ;
739 |
740 | --
741 | -- Dumping data for table `sofia_aliases`
742 | --
743 |
744 |
745 | -- --------------------------------------------------------
746 |
747 | --
748 | -- Table structure for table `sofia_conf`
749 | --
750 |
751 | CREATE TABLE IF NOT EXISTS "sofia_conf" (
752 | "id" int(11) NOT NULL,
753 | "profile_name" varchar(255) default NULL,
754 | PRIMARY KEY ("id")
755 | ) AUTO_INCREMENT=1 ;
756 |
757 | --
758 | -- Dumping data for table `sofia_conf`
759 | --
760 |
761 |
762 | -- --------------------------------------------------------
763 |
764 | --
765 | -- Table structure for table `sofia_domains`
766 | --
767 |
768 | CREATE TABLE IF NOT EXISTS "sofia_domains" (
769 | "id" int(11) NOT NULL,
770 | "sofia_id" int(11) default NULL,
771 | "domain_name" varchar(255) default NULL,
772 | "parse" tinyint(1) default NULL,
773 | PRIMARY KEY ("id")
774 | ) AUTO_INCREMENT=1 ;
775 |
776 | --
777 | -- Dumping data for table `sofia_domains`
778 | --
779 |
780 |
781 | -- --------------------------------------------------------
782 |
783 | --
784 | -- Table structure for table `sofia_gateways`
785 | --
786 |
787 | CREATE TABLE IF NOT EXISTS "sofia_gateways" (
788 | "id" int(11) NOT NULL,
789 | "sofia_id" int(11) default NULL,
790 | "gateway_name" varchar(255) default NULL,
791 | "gateway_param" varchar(255) default NULL,
792 | "gateway_value" varchar(255) default NULL,
793 | PRIMARY KEY ("id")
794 | ) AUTO_INCREMENT=1 ;
795 |
796 | --
797 | -- Dumping data for table `sofia_gateways`
798 | --
799 |
800 |
801 | -- --------------------------------------------------------
802 |
803 | --
804 | -- Table structure for table `sofia_settings`
805 | --
806 |
807 | CREATE TABLE IF NOT EXISTS "sofia_settings" (
808 | "id" int(11) NOT NULL,
809 | "sofia_id" int(11) default NULL,
810 | "param_name" varchar(255) default NULL,
811 | "param_value" varchar(255) default NULL,
812 | PRIMARY KEY ("id")
813 | ) AUTO_INCREMENT=1 ;
814 |
815 | --
816 | -- Dumping data for table `sofia_settings`
817 | --
818 |
819 |
820 | -- --------------------------------------------------------
821 |
822 | --
823 | -- Table structure for table `voicemail_conf`
824 | --
825 |
826 | CREATE TABLE IF NOT EXISTS "voicemail_conf" (
827 | "id" int(10) unsigned NOT NULL,
828 | "vm_profile" varchar(64) NOT NULL,
829 | PRIMARY KEY ("id"),
830 | UNIQUE KEY "unique_profile" ("vm_profile")
831 | ) AUTO_INCREMENT=1 ;
832 |
833 | --
834 | -- Dumping data for table `voicemail_conf`
835 | --
836 |
837 |
838 | -- --------------------------------------------------------
839 |
840 | --
841 | -- Table structure for table `voicemail_email`
842 | --
843 |
844 | CREATE TABLE IF NOT EXISTS "voicemail_email" (
845 | "id" int(10) unsigned NOT NULL,
846 | "voicemail_id" int(10) unsigned NOT NULL,
847 | "param_name" varchar(64) NOT NULL,
848 | "param_value" varchar(64) NOT NULL,
849 | PRIMARY KEY ("id"),
850 | UNIQUE KEY "unique_profile_param" ("param_name","voicemail_id")
851 | ) AUTO_INCREMENT=1 ;
852 |
853 | --
854 | -- Dumping data for table `voicemail_email`
855 | --
856 |
857 |
858 | -- --------------------------------------------------------
859 |
860 | --
861 | -- Table structure for table `voicemail_settings`
862 | --
863 |
864 | CREATE TABLE IF NOT EXISTS "voicemail_settings" (
865 | "id" int(11) NOT NULL,
866 | "voicemail_id" int(11) default NULL,
867 | "param_name" varchar(255) default NULL,
868 | "param_value" varchar(255) default NULL,
869 | PRIMARY KEY ("id")
870 | ) AUTO_INCREMENT=1 ;
871 |
872 | --
873 | -- Dumping data for table `voicemail_settings`
874 | --
875 |
876 |
877 | --
878 | -- Constraints for dumped tables
879 | --
880 |
881 | --
882 | -- Constraints for table `dingaling_profile_params`
883 | --
884 | ALTER TABLE `dingaling_profile_params`
885 | ADD CONSTRAINT "dingaling_profile" FOREIGN KEY ("dingaling_id") REFERENCES "dingaling_profiles" ("id") ON DELETE CASCADE ON UPDATE CASCADE;
886 |
--------------------------------------------------------------------------------