Merge pull request #10 from fusionpbx/master

7
This commit is contained in:
blackc2004 2016-01-12 12:18:57 -08:00
commit ce7f0f82d5
17 changed files with 347 additions and 234 deletions

View File

@ -553,7 +553,7 @@ require_once "resources/require.php";
else {
$domain_name = $_SESSION['domain_name'];
}
echo " window.location = 'https://".$domain_name."/app/provision?mac=$device_mac_address&file=' + d + '&content_type=application/octet-stream';\n";
echo " window.location = 'https://".$domain_name."/app/provision?mac=".$device_mac_address."&file=' + d + '&content_type=application/octet-stream';\n";
echo " }\n";
echo "\n";
@ -602,8 +602,11 @@ require_once "resources/require.php";
echo " <select class='formfld' style='display: none; width: auto;' name='target_file' id='target_file' onchange='download(this.value)'>\n";
echo " <option value=''>".$text['label-download']."</option>\n";
foreach ($files as $file) {
//format the mac address and
$format = new provision();
$mac = $format->format_mac($device_mac_address, $device_vendor);
//render the file name
$file_name = str_replace("{\$mac}",$device_mac_address,basename($file));
$file_name = str_replace("{\$mac}", $mac, basename($file));
//add the select option
echo " <option value='".basename($file)."'>".$file_name."</option>\n";
}

View File

@ -53,18 +53,6 @@ include "root.php";
case "00085d":
$device_vendor = "aastra";
break;
case "000e08":
$device_vendor = "linksys";
break;
case "0004f2":
$device_vendor = "polycom";
break;
case "00907a":
$device_vendor = "polycom";
break;
case "0080f0":
$device_vendor = "panasonic";
break;
case "001873":
$device_vendor = "cisco";
break;
@ -83,23 +71,38 @@ include "root.php";
case "68efbd":
$device_vendor = "cisco";
break;
case "000b82":
$device_vendor = "grandstream";
break;
case "00177d":
$device_vendor = "konftel";
break;
case "00045a":
$device_vendor = "linksys";
break;
case "000625":
$device_vendor = "linksys";
break;
case "001565":
$device_vendor = "yealink";
case "000e08":
$device_vendor = "linksys";
break;
case "08000f":
$device_vendor = "mitel";
break;
case "0080f0":
$device_vendor = "panasonic";
break;
case "0004f2":
$device_vendor = "polycom";
break;
case "00907a":
$device_vendor = "polycom";
break;
case "000413":
$device_vendor = "snom";
break;
case "000b82":
$device_vendor = "grandstream";
break;
case "00177d":
$device_vendor = "konftel";
case "001565":
$device_vendor = "yealink";
break;
default:
$device_vendor = "";

View File

@ -0,0 +1,8 @@
<context name="{v_context}">
<extension name="cidlookup" number="" continue="true" app_uuid="a0cb498c-6e09-441f-83ea-a7684565c44e" enabled="false">
<condition field="${user_exists}" expression="^true$"/>
<condition field="${call_direction}" expression="^(inbound)$" break="never">
<action application="set" data="effective_caller_id_name=${cidlookup(${caller_id_number})}"/>
</condition>
</extension>
</context>

View File

@ -298,15 +298,21 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
//deliver the customized config over HTTP/HTTPS
//need to make sure content-type is correct
if ($_REQUEST['content_type'] == 'application/octet-stream') {
$file_name = str_replace("{\$mac}",$mac,$file);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file_name).'"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file_contents));
//format the mac address and
$mac = $prov->format_mac($mac, $device_vendor);
//replace the variable name with the value
$file_name = str_replace("{\$mac}", $mac, $file);
//set the headers
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file_name).'"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file_contents));
}
else {
$cfg_ext = ".cfg";

View File

@ -126,7 +126,29 @@ include "root.php";
}
}
function render() {
//set the mac address in the correct format for the specific vendor
public function format_mac($mac, $vendor) {
switch (strtolower($vendor)) {
case "aastra":
$mac = strtoupper($mac);
break;
case "mitel":
$mac = strtoupper($mac);
break;
case "polycom":
$mac = strtolower($mac);
break;
case "snom":
$mac = strtolower($mac);
break;
default:
$mac = strtolower($mac);
$mac = substr($mac, 0,2).'-'.substr($mac, 2,2).'-'.substr($mac, 4,2).'-'.substr($mac, 6,2).'-'.substr($mac, 8,2).'-'.substr($mac, 10,2);
}
return $mac;
}
public function render() {
//debug
$debug = $_REQUEST['debug']; // array
@ -473,7 +495,7 @@ include "root.php";
unset ($prep_statement);
}
//get the extensions array and add to the template engine
//get the contact extensions array and add to the template engine
if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory_extensions']['boolean'] == "true") {
//get contacts from the database
$sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, e.extension ";
@ -489,9 +511,27 @@ include "root.php";
$sql .= "order by c.contact_organization desc, c.contact_name_given asc, c.contact_name_family asc ";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$contact_extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//assign the contacts array
$view->assign("contact_extensions", $contact_extensions);
}
//get the extensions array and add to the template engine
if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory_extensions']['boolean'] == "true") {
//get contacts from the database
$sql = "select directory_full_name, description ";
$sql .= "effective_caller_id_name, effective_caller_id_number ";
$sql .= "from v_extensions ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and enabled = 'true' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
}
//assign the contacts array
$view->assign("extensions", $extensions);
}
@ -703,20 +743,7 @@ include "root.php";
unset ($prep_statement);
//set the mac address in the correct format
switch (strtolower($device_vendor)) {
case "aastra":
$mac = strtoupper($mac);
break;
case "snom":
$mac = strtolower($mac);
break;
case "polycom":
$mac = strtolower($mac);
break;
default:
$mac = strtolower($mac);
$mac = substr($mac, 0,2).'-'.substr($mac, 2,2).'-'.substr($mac, 4,2).'-'.substr($mac, 6,2).'-'.substr($mac, 8,2).'-'.substr($mac, 10,2);
}
$mac = $this->format_mac($mac, $device_vendor);
//replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number
$view->assign("mac" , $mac);
@ -882,15 +909,11 @@ include "root.php";
$this->file = $file_name;
$file_contents = $this->render();
//format the mac address
$mac = $this->format_mac($device_mac_address, $device_vendor);
//replace {$mac} in the file name
if ($device_vendor == "aastra" || $device_vendor == "cisco") {
//upper case the mac address for aastra phones
$file_name = str_replace("{\$mac}", strtoupper($device_mac_address), $file_name);
}
else {
//all other phones
$file_name = str_replace("{\$mac}", $device_mac_address, $file_name);
}
$file_name = str_replace("{\$mac}", $mac, $file_name);
//write the file
//echo $directory.'/'.$file_name."\n";

View File

@ -290,7 +290,7 @@
case "inbound":
$callee_number = check_str(urldecode($row->caller_profile->destination_number));
$callee_number_serie = number_series($callee_number);
$sql_user_rate = "SELECT v_lcr.currency, v_lcr.rate, v_lcr.connect_increment, v_lcr.talk_increment FROM v_lcr JOIN v_billings ON v_billings.type_value='$accountcode' WHERE v_lcr.carrier_uuid IS NULL AND v_lcr.lcr_direction = '".check_str(urldecode($xml->variables->call_direction))."' AND v_lcr.lcr_profile=v_billings.lcr_profile AND NOW() >= v_lcr.date_start AND NOW() < v_lcr.date_end AND digits IN ($destination_number_serie) ORDER BY digits DESC, rate ASC, date_start DESC LIMIT 1";
$sql_user_rate = "SELECT v_lcr.currency, v_lcr.rate, v_lcr.connect_increment, v_lcr.talk_increment FROM v_lcr JOIN v_billings ON v_billings.type_value='$accountcode' WHERE v_lcr.carrier_uuid IS NULL AND v_lcr.lcr_direction = '".check_str(urldecode($xml->variables->call_direction))."' AND v_lcr.lcr_profile=v_billings.lcr_profile AND NOW() >= v_lcr.date_start AND NOW() < v_lcr.date_end AND digits IN ($callee_number_serie) ORDER BY digits DESC, rate ASC, date_start DESC LIMIT 1";
if ($debug) {
echo "sql_user_rate: $sql_user_rate\n";

View File

@ -44,6 +44,7 @@
--get the variables
dsn = trim(api:execute("global_getvar", "dsn"));
dsn_callcenter = trim(api:execute("global_getvar", "dsn_callcenter"));
--start the xml array
local xml = {}
@ -52,8 +53,12 @@
table.insert(xml, [[ <section name="configuration">]]);
table.insert(xml, [[ <configuration name="callcenter.conf" description="Call Center">]]);
table.insert(xml, [[ <settings>]]);
if (string.len(dsn) > 0) then
table.insert(xml, [[ <param name="odbc-dsn" value="]]..database["switch"]..[["/>]]);
if (dsn_callcenter) then
table.insert(xml, [[ <param name="odbc-dsn" value="]]..dsn_callcenter..[["/>]]);
else
if (string.len(dsn) > 0) then
table.insert(xml, [[ <param name="odbc-dsn" value="]]..database["switch"]..[["/>]]);
end
end
--table.insert(xml, [[ <param name="dbname" value="/usr/local/freeswitch/db/call_center.db"/>]]);
table.insert(xml, [[ </settings>]]);
@ -156,136 +161,136 @@
table.insert(xml, [[ </queues>]]);
--get the agents
table.insert(xml, [[ <agents>]]);
sql = "select * from v_call_center_agents as a, v_domains as d ";
sql = sql .. "where d.domain_uuid = a.domain_uuid; ";
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
end
x = 0;
dbh:query(sql, function(row)
--get the values from the database and set as variables
domain_uuid = row.domain_uuid;
domain_name = row.domain_name;
agent_name = row.agent_name;
agent_type = row.agent_type;
agent_call_timeout = row.agent_call_timeout;
agent_contact = row.agent_contact;
agent_status = row.agent_status;
agent_no_answer_delay_time = row.agent_no_answer_delay_time;
agent_max_no_answer = row.agent_max_no_answer;
agent_wrap_up_time = row.agent_wrap_up_time;
agent_reject_delay_time = row.agent_reject_delay_time;
agent_busy_delay_time = row.agent_busy_delay_time;
table.insert(xml, [[ <agents>]]);
sql = "select * from v_call_center_agents as a, v_domains as d ";
sql = sql .. "where d.domain_uuid = a.domain_uuid; ";
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
end
x = 0;
dbh:query(sql, function(row)
--get the values from the database and set as variables
domain_uuid = row.domain_uuid;
domain_name = row.domain_name;
agent_name = row.agent_name;
agent_type = row.agent_type;
agent_call_timeout = row.agent_call_timeout;
agent_contact = row.agent_contact;
agent_status = row.agent_status;
agent_no_answer_delay_time = row.agent_no_answer_delay_time;
agent_max_no_answer = row.agent_max_no_answer;
agent_wrap_up_time = row.agent_wrap_up_time;
agent_reject_delay_time = row.agent_reject_delay_time;
agent_busy_delay_time = row.agent_busy_delay_time;
--get and then set the complete agent_contact with the call_timeout and when necessary confirm
--confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1";
--if you change this variable also change app/call_center/call_center_agent_edit.php
confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1,group_confirm_read_timeout=2000,leg_timeout="..agent_call_timeout;
if (string.find(agent_contact, '}') == nil) then
--get and then set the complete agent_contact with the call_timeout and when necessary confirm
--confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1";
--if you change this variable also change app/call_center/call_center_agent_edit.php
confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1,group_confirm_read_timeout=2000,leg_timeout="..agent_call_timeout;
if (string.find(agent_contact, '}') == nil) then
--not found
if (string.find(agent_contact, 'sofia/gateway') == nil) then
--add the call_timeout
agent_contact = "{call_timeout="..agent_call_timeout.."}"..agent_contact;
else
--add the call_timeout and confirm
tmp_pos = string.find(agent_contact, "}");
tmp_first = string.sub(agent_contact, 0, tmp_pos);
tmp_last = string.sub(agent_contact, tmp_pos);
agent_contact = tmp_first..',call_timeout='..agent_call_timeout..tmp_last;
agent_contact = "{"..confirm..",call_timeout="..agent_call_timeout.."}"..agent_contact;
end
else
--found
if (string.find(agent_contact, 'sofia/gateway') == nil) then
--not found
if (string.find(agent_contact, 'sofia/gateway') == nil) then
--add the call_timeout
agent_contact = "{call_timeout="..agent_call_timeout.."}"..agent_contact;
if (string.find(agent_contact, 'call_timeout') == nil) then
--add the call_timeout
pos = string.find(agent_contact, "}");
first = string.sub(agent_contact, 0, pos);
last = string.sub(agent_contact, tmp_pos);
agent_contact = first..[[,call_timeout=]]..agent_call_timeout..last;
else
--add the call_timeout and confirm
tmp_pos = string.find(agent_contact, "}");
tmp_first = string.sub(agent_contact, 0, tmp_pos);
tmp_last = string.sub(agent_contact, tmp_pos);
agent_contact = tmp_first..',call_timeout='..agent_call_timeout..tmp_last;
agent_contact = "{"..confirm..",call_timeout="..agent_call_timeout.."}"..agent_contact;
--the string has the call timeout
agent_contact = agent_contact;
end
else
--found
if (string.find(agent_contact, 'sofia/gateway') == nil) then
--not found
if (string.find(agent_contact, 'call_timeout') == nil) then
--add the call_timeout
pos = string.find(agent_contact, "}");
first = string.sub(agent_contact, 0, pos);
last = string.sub(agent_contact, tmp_pos);
agent_contact = first..[[,call_timeout=]]..agent_call_timeout..last;
else
--the string has the call timeout
agent_contact = agent_contact;
end
pos = string.find(agent_contact, "}");
first = string.sub(agent_contact, 0, pos);
last = string.sub(agent_contact, pos);
if (stristr(agent_contact, 'call_timeout') == FALSE) then
--add the call_timeout and confirm
agent_contact = first..','..confirm..',call_timeout='..agent_call_timeout..last;
else
--found
pos = string.find(agent_contact, "}");
first = string.sub(agent_contact, 0, pos);
last = string.sub(agent_contact, pos);
if (stristr(agent_contact, 'call_timeout') == FALSE) then
--add the call_timeout and confirm
agent_contact = first..','..confirm..',call_timeout='..agent_call_timeout..last;
else
--add confirm
agent_contact = tmp_first..','..confirm..tmp_last;
end
--add confirm
agent_contact = tmp_first..','..confirm..tmp_last;
end
end
end
--build the xml string
table.insert(xml, [[ <agent ]]);
table.insert(xml, [[ name="]]..agent_name..[[@]]..domain_name..[[" ]]);
table.insert(xml, [[ type="]]..agent_type..[[" ]]);
table.insert(xml, [[ contact="]]..agent_contact..[[" ]]);
table.insert(xml, [[ status="]]..agent_status..[[" ]]);
if (agent_no_answer_delay_time ~= nil) then
table.insert(xml, [[ no-answer-delay-time="]]..agent_no_answer_delay_time..[[" ]]);
end
if (agent_max_no_answer ~= nil) then
table.insert(xml, [[ max-no-answer="]]..agent_max_no_answer..[[" ]]);
end
if (agent_wrap_up_time ~= nil) then
table.insert(xml, [[ wrap-up-time="]]..agent_wrap_up_time..[[" ]]);
end
if (agent_reject_delay_time ~= nil) then
table.insert(xml, [[ reject-delay-time="]]..agent_reject_delay_time..[[" ]]);
end
if (agent_busy_delay_time ~= nil) then
table.insert(xml, [[ busy-delay-time="]]..agent_busy_delay_time..[[" ]]);
end
table.insert(xml, [[ />]]);
end)
table.insert(xml, [[ </agents>]]);
--build the xml string
table.insert(xml, [[ <agent ]]);
table.insert(xml, [[ name="]]..agent_name..[[@]]..domain_name..[[" ]]);
table.insert(xml, [[ type="]]..agent_type..[[" ]]);
table.insert(xml, [[ contact="]]..agent_contact..[[" ]]);
table.insert(xml, [[ status="]]..agent_status..[[" ]]);
if (agent_no_answer_delay_time ~= nil) then
table.insert(xml, [[ no-answer-delay-time="]]..agent_no_answer_delay_time..[[" ]]);
end
if (agent_max_no_answer ~= nil) then
table.insert(xml, [[ max-no-answer="]]..agent_max_no_answer..[[" ]]);
end
if (agent_wrap_up_time ~= nil) then
table.insert(xml, [[ wrap-up-time="]]..agent_wrap_up_time..[[" ]]);
end
if (agent_reject_delay_time ~= nil) then
table.insert(xml, [[ reject-delay-time="]]..agent_reject_delay_time..[[" ]]);
end
if (agent_busy_delay_time ~= nil) then
table.insert(xml, [[ busy-delay-time="]]..agent_busy_delay_time..[[" ]]);
end
table.insert(xml, [[ />]]);
end)
table.insert(xml, [[ </agents>]]);
--get the tiers
sql = "select * from v_call_center_tiers as t, v_domains as d ";
sql = sql .. "where d.domain_uuid = t.domain_uuid; ";
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
end
table.insert(xml, [[ <tiers>]]);
dbh:query(sql, function(row)
--get the values from the database and set as variables
domain_uuid = row.domain_uuid;
domain_name = row.domain_name;
agent_name = row.agent_name;
queue_name = row.queue_name;
tier_level = row.tier_level;
tier_position = row.tier_position;
--build the xml
table.insert(xml, [[ <tier ]]);
table.insert(xml, [[ agent="]]..agent_name..[[@]]..domain_name..[[" ]]);
table.insert(xml, [[ queue="]]..queue_name..[[@]]..domain_name..[[" ]]);
table.insert(xml, [[ level="]]..tier_level..[[" ]]);
table.insert(xml, [[ position="]]..tier_position..[[" ]]);
table.insert(xml, [[ />]]);
end)
table.insert(xml, [[ </tiers>]]);
sql = "select * from v_call_center_tiers as t, v_domains as d ";
sql = sql .. "where d.domain_uuid = t.domain_uuid; ";
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
end
table.insert(xml, [[ <tiers>]]);
dbh:query(sql, function(row)
--get the values from the database and set as variables
domain_uuid = row.domain_uuid;
domain_name = row.domain_name;
agent_name = row.agent_name;
queue_name = row.queue_name;
tier_level = row.tier_level;
tier_position = row.tier_position;
--build the xml
table.insert(xml, [[ <tier ]]);
table.insert(xml, [[ agent="]]..agent_name..[[@]]..domain_name..[[" ]]);
table.insert(xml, [[ queue="]]..queue_name..[[@]]..domain_name..[[" ]]);
table.insert(xml, [[ level="]]..tier_level..[[" ]]);
table.insert(xml, [[ position="]]..tier_position..[[" ]]);
table.insert(xml, [[ />]]);
end)
table.insert(xml, [[ </tiers>]]);
--close the extension tag if it was left open
table.insert(xml, [[ </configuration>]]);
table.insert(xml, [[ </section>]]);
table.insert(xml, [[</document>]]);
XML_STRING = table.concat(xml, "\n");
if (debug["xml_string"]) then
freeswitch.consoleLog("notice", "[xml_handler] XML_STRING: " .. XML_STRING .. "\n");
end
table.insert(xml, [[ </configuration>]]);
table.insert(xml, [[ </section>]]);
table.insert(xml, [[</document>]]);
XML_STRING = table.concat(xml, "\n");
if (debug["xml_string"]) then
freeswitch.consoleLog("notice", "[xml_handler] XML_STRING: " .. XML_STRING .. "\n");
end
--close the database connection
dbh:release();
--freeswitch.consoleLog("notice", "[xml_handler]"..api:execute("eval ${dsn}"));
dbh:release();
--freeswitch.consoleLog("notice", "[xml_handler]"..api:execute("eval ${dsn}"));
--set the cache
result = trim(api:execute("memcache", "set configuration:callcenter.conf:" .. hostname .." '"..XML_STRING:gsub("'", "&#39;").."' ".."expire['callcenter.conf']"));

View File

@ -457,8 +457,8 @@
freeswitch.consoleLog("INFO", "[FAX] RETRY_STATS FAILURE BAD NUMBER: GATEWAY[".. fax_uri .."]");
email_message_fail = email_message_fail.."We tried sending, but the number entered was not a working phone number "
email_address = email_address:gsub("\\,", ",");
freeswitch.email("",
"",
freeswitch.email(email_address,
email_address,
"To: "..email_address.."\nFrom: "..from_address.."\nSubject: Fax to: "..number_dialed.." was INVALID",
email_message_fail ,
fax_file
@ -470,8 +470,8 @@
freeswitch.consoleLog("INFO", "[FAX] RETRY STATS FAILURE BUSY: GATEWAY[".. fax_uri .."], BUSY NUMBER");
email_message_fail = email_message_fail.." We tried sending, but the call was busy "..fax_busy_attempts.." of those times."
email_address = email_address:gsub("\\,", ",");
freeswitch.email("",
"",
freeswitch.email(email_address,
email_address,
"To: "..email_address.."\nFrom: "..from_address.."\nSubject: Fax to: "..number_dialed.." was BUSY",
email_message_fail ,
fax_file
@ -485,8 +485,8 @@
email_message_fail = email_message_fail.." We tried sending 5 times ways. You may also want to know that the call was busy "..fax_busy_attempts.." of those times."
email_address = email_address:gsub("\\,", ",");
freeswitch.email("",
"",
freeswitch.email(email_address,
email_address,
"To: "..email_address.."\nFrom: "..from_address.."\nSubject: Fax to: "..number_dialed.." FAILED",
email_message_fail ,
fax_file
@ -521,8 +521,8 @@
freeswitch.consoleLog("INFO", "[FAX] RETRY STATS SUCCESS: GATEWAY[".. fax_uri .."] VARS[" .. fax_trial .. "]");
email_address = email_address:gsub("\\,", ",");
freeswitch.email("",
"",
freeswitch.email(email_address,
email_address,
"To: "..email_address.."\nFrom: "..from_address.."\nSubject: Fax to: "..number_dialed.." SENT",
email_message_success ,
fax_file

View File

@ -1,15 +1,11 @@
<configuration name="cidlookup.conf" description="cidlookup Configuration">
<settings>
<!-- comment out url to not setup a url based lookup -->
<param name="url" value="http://query.voipcnam.com/query.php?api_key=MYAPIKEY&number=${caller_id_number}"/>
<!-- comment out url to not setup a url based lookup -->
<!-- contact support@to-call.me for more details -->
<!-- <param name="url" value="http://cnam.to-call.me/lookup/${caller_id_number}?api_key=MYAPIKEY"/> -->
<!--<param name="url" value="http://query.voipcnam.com/query.php?api_key=MYAPIKEY&number=${caller_id_number}"/>-->
<!-- comment out whitepages-apikey to not use whitepages.com, you must
get an API key from http://developer.whitepages.com/ -->
<!--<param name="whitepages-apikey" value="MYAPIKEY"/>-->
<param name="whitepages-apikey" value="MYAPIKEY"/>-->
<!-- set to false to not cache (in memcache) results from the url query -->
<param name="cache" value="true"/>
@ -21,11 +17,12 @@
<!-- comment out sql to not setup a database (directory) lookup -->
<param name="sql" value="
SELECT v_contacts.contact_name_given || ' ' || v_contacts.contact_name_family ||' ('||v_contact_phones.phone_type||')' AS name, v_contact_phones.phone_number AS number
SELECT trim(v_contacts.contact_name_given || ' ' || v_contacts.contact_name_family || ' (' || v_contacts.contact_organization || ')') AS name, v_contact_phones.phone_number AS number
FROM v_contacts, v_contact_phones
WHERE v_contact_phones.contact_uuid = v_contacts.contact_uuid AND v_contact_phones.phone_number = '${caller_id_number}'
WHERE v_contact_phones.contact_uuid = v_contacts.contact_uuid AND (v_contact_phones.phone_number = '${caller_id_number}' OR v_contact_phones.phone_number = '1${caller_id_number}')
LIMIT 1
"/>
<!-- comment out citystate-sql to not setup a database (city/state)
lookup -->
<!--

View File

@ -11,8 +11,9 @@ preferred_codec: g711ulaw
enable_vad: 0
dial_template: "dialplan"
{foreach $lines as $row}reg.{$row.line_number}.displayName="{$row.display_name}"
#registration information
# Registration information
{foreach $lines as $row}
reg.{$row.line_number}.displayName="{$row.display_name}"
proxy{$row.line_number}_address: "{$row.server_address}"
proxy{$row.line_number}_port:"{$row.sip_port}"
line{$row.line_number}_name: "{$row.user_id}"
@ -29,11 +30,11 @@ proxy_emergency_port: "{$proxy_emergency_port}"
# Backup Proxy info
proxy_backup: "{$proxy_backup}"
proxy_backup_port: "{$proxy_backup_port}"
# Outbound Proxy info
outbound_proxy: "{$outbound_proxy}"
outbound_proxy_port: "{$outbound_proxy_port}"
# NAT/Firewall Traversal
voip_control_port: "5060"
start_media_port: "16384"
@ -47,50 +48,50 @@ sync: 1 ; Default 1
# Proxy Registration (0-disable (default), 1-enable)
proxy_register: "1"
# Phone Registration Expiration [1-3932100 sec] (Default - 3600)
timer_register_expires: "80"
# Codec for media stream (g711ulaw (default), g711alaw, g729)
preferred_codec: "none"
# TOS bits in media stream [0-5] (Default - 5)
tos_media: "5"
# Enable VAD (0-disable (default), 1-enable)
enable_vad: "0"
# Allow for the bridge on a 3way call to join remaining parties upon hangup
cnf_join_enable: "1" ; 0-Disabled, 1-Enabled (default)
# Allow Transfer to be completed while target phone is still ringing
semi_attended_transfer: "0" ; 0-Disabled, 1-Enabled (default)
# Telnet Level (enable or disable the ability to telnet into this phone
telnet_level: "2" ; 0-Disabled (default), 1-Enabled, 2-Privileged
# Inband DTMF Settings (0-disable, 1-enable (default))
dtmf_inband: "1"
# Out of band DTMF Settings (none-disable, avt-avt enable (default), avt_always - always avt )
dtmf_outofband: "avt"
# DTMF dB Level Settings (1-6dB down, 2-3db down, 3-nominal (default), 4-3db up, 5-6dB up)
dtmf_db_level: "3"
# SIP Timers
timer_t1: "500" ; Default 500 msec
timer_t2: "4000" ; Default 4 sec
sip_retx: "10" ; Default 11
sip_invite_retx: "6" ; Default 7
timer_invite_expires: "180" ; Default 180 sec
# Setting for Message speeddial to UOne box
messages_uri: "*97"
# TFTP Phone Specific Configuration File Directory
tftp_cfg_dir: ""
# Time Server
sntp_mode: "unicast"
sntp_server: "{$ntp_server_primary}"
@ -109,22 +110,25 @@ dst_stop_day_of_week: "Sunday"
dst_stop_week_of_month: "1"
dst_stop_time: "2"
dst_auto_adjust: "1"
# Do Not Disturb Control (0-off, 1-on, 2-off with no user control, 3-on with no user control)
{if isset($cisco_dnd_control)}
dnd_control: "{$cisco_dnd_control}" ; Default 0 (Do Not Disturb feature is off)
{else}
dnd_control: "2" ; Default 0 (Do Not Disturb feature is off)
{/if}
# Caller ID Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
callerid_blocking: "0" ; Default 0 (Disable sending all calls as anonymous)
# Anonymous Call Blocking (0-disbaled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
anonymous_call_block: "0" ; Default 0 (Disable blocking of anonymous calls)
# Call Waiting (0-disabled, 1-enabled, 2-disabled with no user control, 3-enabled with no user control)
call_waiting: "1" ; Default 1 (Call Waiting enabled)
# DTMF AVT Payload (Dynamic payload range for AVT tones - 96-127)
dtmf_avt_payload: "101" ; Default 100
# XML file that specifies the dialplan desired
dial_template: "dialplan"

View File

@ -3,7 +3,7 @@
<TEMPLATE MATCH="1..." Timeout="0" User="Phone"/> <!-- 4 digits intra-office -->
<TEMPLATE MATCH=".11" Timeout="0" User="Phone"/> <!-- Service numbers -->
<TEMPLATE MATCH="1.........." Timeout="0" User="Phone"/> <!-- Long Distance -->
<TEMPLATE MATCH="*" Timeout="2"/> <!-- Anything else -->
<TEMPLATE MATCH="*" Timeout="2"/> <!-- Anything else -->
<TEMPLATE MATCH="972......." Timeout="0" User="Phone"/> <!-- 10 digits -->
<TEMPLATE MATCH="214......." Timeout="0" User="Phone"/> <!-- 10 digits -->
<TEMPLATE MATCH="469......." Timeout="0" User="Phone"/> <!-- 10 digits -->

View File

@ -0,0 +1,25 @@
<CiscoIPPhoneDirectory>
<Title>Our Phones</Title>
<Prompt>Please choose...</Prompt>
{assign var=x value=1}
{foreach $extensions as $row}{
<DirectoryEntry>
{if $row.directory_full_name != ""}
<Name>{$row.directory_full_name}</Name>
{else}
<Name>{$row.effective_caller_id_name}</Name>
{/if}
{if $row.number_alias != ""}
<Telephone>{$row.number_alias}</Telephone>
{else}
<Telephone>{$row.extension}</Telephone>
{/if}
</DirectoryEntry>
{/if}
{assign var=x value=$x+1}
{/foreach}
</CiscoIPPhoneDirectory>

View File

@ -1,13 +1,18 @@
<CiscoIPPhoneMenu>
<Title>Contacts</Title>
<Prompt>Please choose...</Prompt>
<MenuItem>
<Name>Our Phones</Name>
<URL>http://{$domain_name}/app/provision/file/directory-extensions.xml</URL>
</MenuItem>
<!--
<MenuItem>
<Name>Personal</Name>
<URL>http://{$domain_name}/app/provision/file/directory-personal.xml</URL>
</MenuItem>
--> <MenuItem> <Name>Enterprise</Name>
-->
<MenuItem>
<Name>Enterprise</Name>
<URL>http://{$domain_name}/app/provision/file/directory-enterprise.xml?mac={$mac}</URL>
</MenuItem>
<MenuItem>

View File

@ -11,8 +11,9 @@ preferred_codec: g711ulaw
enable_vad: 0
dial_template: "dialplan"
{foreach $lines as $row}reg.{$row.line_number}.displayName="{$row.display_name}"
#registration information
# Registration information
{foreach $lines as $row}
reg.{$row.line_number}.displayName="{$row.display_name}"
proxy{$row.line_number}_address: "{$row.server_address}"
proxy{$row.line_number}_port:"{$row.sip_port}"
line{$row.line_number}_name: "{$row.user_id}"
@ -29,11 +30,11 @@ proxy_emergency_port: "{$proxy_emergency_port}"
# Backup Proxy info
proxy_backup: "{$proxy_backup}"
proxy_backup_port: "{$proxy_backup_port}"
# Outbound Proxy info
outbound_proxy: "{$outbound_proxy}"
outbound_proxy_port: "{$outbound_proxy_port}"
# NAT/Firewall Traversal
voip_control_port: "5060"
start_media_port: "16384"
@ -47,50 +48,50 @@ sync: 1 ; Default 1
# Proxy Registration (0-disable (default), 1-enable)
proxy_register: "1"
# Phone Registration Expiration [1-3932100 sec] (Default - 3600)
timer_register_expires: "80"
# Codec for media stream (g711ulaw (default), g711alaw, g729)
preferred_codec: "none"
# TOS bits in media stream [0-5] (Default - 5)
tos_media: "5"
# Enable VAD (0-disable (default), 1-enable)
enable_vad: "0"
# Allow for the bridge on a 3way call to join remaining parties upon hangup
cnf_join_enable: "1" ; 0-Disabled, 1-Enabled (default)
# Allow Transfer to be completed while target phone is still ringing
semi_attended_transfer: "0" ; 0-Disabled, 1-Enabled (default)
# Telnet Level (enable or disable the ability to telnet into this phone
telnet_level: "2" ; 0-Disabled (default), 1-Enabled, 2-Privileged
# Inband DTMF Settings (0-disable, 1-enable (default))
dtmf_inband: "1"
# Out of band DTMF Settings (none-disable, avt-avt enable (default), avt_always - always avt )
dtmf_outofband: "avt"
# DTMF dB Level Settings (1-6dB down, 2-3db down, 3-nominal (default), 4-3db up, 5-6dB up)
dtmf_db_level: "3"
# SIP Timers
timer_t1: "500" ; Default 500 msec
timer_t2: "4000" ; Default 4 sec
sip_retx: "10" ; Default 11
sip_invite_retx: "6" ; Default 7
timer_invite_expires: "180" ; Default 180 sec
# Setting for Message speeddial to UOne box
messages_uri: "*97"
# TFTP Phone Specific Configuration File Directory
tftp_cfg_dir: ""
# Time Server
sntp_mode: "unicast"
sntp_server: "{$ntp_server_primary}"
@ -109,22 +110,25 @@ dst_stop_day_of_week: "Sunday"
dst_stop_week_of_month: "1"
dst_stop_time: "2"
dst_auto_adjust: "1"
# Do Not Disturb Control (0-off, 1-on, 2-off with no user control, 3-on with no user control)
{if isset($cisco_dnd_control)}
dnd_control: "{$cisco_dnd_control}" ; Default 0 (Do Not Disturb feature is off)
{else}
dnd_control: "2" ; Default 0 (Do Not Disturb feature is off)
{/if}
# Caller ID Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
callerid_blocking: "0" ; Default 0 (Disable sending all calls as anonymous)
# Anonymous Call Blocking (0-disbaled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
anonymous_call_block: "0" ; Default 0 (Disable blocking of anonymous calls)
# Call Waiting (0-disabled, 1-enabled, 2-disabled with no user control, 3-enabled with no user control)
call_waiting: "1" ; Default 1 (Call Waiting enabled)
# DTMF AVT Payload (Dynamic payload range for AVT tones - 96-127)
dtmf_avt_payload: "101" ; Default 100
# XML file that specifies the dialplan desired
dial_template: "dialplan"

View File

@ -3,7 +3,7 @@
<TEMPLATE MATCH="1..." Timeout="0" User="Phone"/> <!-- 4 digits intra-office -->
<TEMPLATE MATCH=".11" Timeout="0" User="Phone"/> <!-- Service numbers -->
<TEMPLATE MATCH="1.........." Timeout="0" User="Phone"/> <!-- Long Distance -->
<TEMPLATE MATCH="*" Timeout="2"/> <!-- Anything else -->
<TEMPLATE MATCH="*" Timeout="2"/> <!-- Anything else -->
<TEMPLATE MATCH="972......." Timeout="0" User="Phone"/> <!-- 10 digits -->
<TEMPLATE MATCH="214......." Timeout="0" User="Phone"/> <!-- 10 digits -->
<TEMPLATE MATCH="469......." Timeout="0" User="Phone"/> <!-- 10 digits -->

View File

@ -0,0 +1,25 @@
<CiscoIPPhoneDirectory>
<Title>Our Phones</Title>
<Prompt>Please choose...</Prompt>
{assign var=x value=1}
{foreach $extensions as $row}{
<DirectoryEntry>
{if $row.directory_full_name != ""}
<Name>{$row.directory_full_name}</Name>
{else}
<Name>{$row.effective_caller_id_name}</Name>
{/if}
{if $row.number_alias != ""}
<Telephone>{$row.number_alias}</Telephone>
{else}
<Telephone>{$row.extension}</Telephone>
{/if}
</DirectoryEntry>
{/if}
{assign var=x value=$x+1}
{/foreach}
</CiscoIPPhoneDirectory>

View File

@ -1,13 +1,18 @@
<CiscoIPPhoneMenu>
<Title>Contacts</Title>
<Prompt>Please choose...</Prompt>
<MenuItem>
<Name>Our Phones</Name>
<URL>http://{$domain_name}/app/provision/file/directory-extensions.xml</URL>
</MenuItem>
<!--
<MenuItem>
<Name>Personal</Name>
<URL>http://{$domain_name}/app/provision/file/directory-personal.xml</URL>
</MenuItem>
--> <MenuItem> <Name>Enterprise</Name>
-->
<MenuItem>
<Name>Enterprise</Name>
<URL>http://{$domain_name}/app/provision/file/directory-enterprise.xml?mac={$mac}</URL>
</MenuItem>
<MenuItem>