Change array extensins to contact_extensions and add a new extension array. Remove trailing spaces. And add a new cisco 79xx directory called Our Phones.

This commit is contained in:
markjcrane 2016-01-12 02:42:59 -07:00
parent 2a04a88b69
commit fe9c46c0d0
9 changed files with 134 additions and 48 deletions

View File

@ -495,7 +495,7 @@ include "root.php";
unset ($prep_statement); 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") { if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory_extensions']['boolean'] == "true") {
//get contacts from the database //get contacts from the database
$sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, e.extension "; $sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, e.extension ";
@ -511,9 +511,27 @@ include "root.php";
$sql .= "order by c.contact_organization desc, c.contact_name_given asc, c.contact_name_family asc "; $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 = $this->db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED); $contact_extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql); 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 //assign the contacts array
$view->assign("extensions", $extensions); $view->assign("extensions", $extensions);
} }

View File

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

View File

@ -3,7 +3,7 @@
<TEMPLATE MATCH="1..." Timeout="0" User="Phone"/> <!-- 4 digits intra-office --> <TEMPLATE MATCH="1..." Timeout="0" User="Phone"/> <!-- 4 digits intra-office -->
<TEMPLATE MATCH=".11" Timeout="0" User="Phone"/> <!-- Service numbers --> <TEMPLATE MATCH=".11" Timeout="0" User="Phone"/> <!-- Service numbers -->
<TEMPLATE MATCH="1.........." Timeout="0" User="Phone"/> <!-- Long Distance --> <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="972......." Timeout="0" User="Phone"/> <!-- 10 digits -->
<TEMPLATE MATCH="214......." Timeout="0" User="Phone"/> <!-- 10 digits --> <TEMPLATE MATCH="214......." Timeout="0" User="Phone"/> <!-- 10 digits -->
<TEMPLATE MATCH="469......." 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> <CiscoIPPhoneMenu>
<Title>Contacts</Title> <Title>Contacts</Title>
<Prompt>Please choose...</Prompt> <Prompt>Please choose...</Prompt>
<MenuItem>
<Name>Our Phones</Name>
<URL>http://{$domain_name}/app/provision/file/directory-extensions.xml</URL>
</MenuItem>
<!-- <!--
<MenuItem> <MenuItem>
<Name>Personal</Name> <Name>Personal</Name>
<URL>http://{$domain_name}/app/provision/file/directory-personal.xml</URL> <URL>http://{$domain_name}/app/provision/file/directory-personal.xml</URL>
</MenuItem> </MenuItem>
--> <MenuItem> <Name>Enterprise</Name> -->
<MenuItem>
<Name>Enterprise</Name>
<URL>http://{$domain_name}/app/provision/file/directory-enterprise.xml?mac={$mac}</URL> <URL>http://{$domain_name}/app/provision/file/directory-enterprise.xml?mac={$mac}</URL>
</MenuItem> </MenuItem>
<MenuItem> <MenuItem>

View File

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

View File

@ -3,7 +3,7 @@
<TEMPLATE MATCH="1..." Timeout="0" User="Phone"/> <!-- 4 digits intra-office --> <TEMPLATE MATCH="1..." Timeout="0" User="Phone"/> <!-- 4 digits intra-office -->
<TEMPLATE MATCH=".11" Timeout="0" User="Phone"/> <!-- Service numbers --> <TEMPLATE MATCH=".11" Timeout="0" User="Phone"/> <!-- Service numbers -->
<TEMPLATE MATCH="1.........." Timeout="0" User="Phone"/> <!-- Long Distance --> <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="972......." Timeout="0" User="Phone"/> <!-- 10 digits -->
<TEMPLATE MATCH="214......." Timeout="0" User="Phone"/> <!-- 10 digits --> <TEMPLATE MATCH="214......." Timeout="0" User="Phone"/> <!-- 10 digits -->
<TEMPLATE MATCH="469......." 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> <CiscoIPPhoneMenu>
<Title>Contacts</Title> <Title>Contacts</Title>
<Prompt>Please choose...</Prompt> <Prompt>Please choose...</Prompt>
<MenuItem>
<Name>Our Phones</Name>
<URL>http://{$domain_name}/app/provision/file/directory-extensions.xml</URL>
</MenuItem>
<!-- <!--
<MenuItem> <MenuItem>
<Name>Personal</Name> <Name>Personal</Name>
<URL>http://{$domain_name}/app/provision/file/directory-personal.xml</URL> <URL>http://{$domain_name}/app/provision/file/directory-personal.xml</URL>
</MenuItem> </MenuItem>
--> <MenuItem> <Name>Enterprise</Name> -->
<MenuItem>
<Name>Enterprise</Name>
<URL>http://{$domain_name}/app/provision/file/directory-enterprise.xml?mac={$mac}</URL> <URL>http://{$domain_name}/app/provision/file/directory-enterprise.xml?mac={$mac}</URL>
</MenuItem> </MenuItem>
<MenuItem> <MenuItem>