Merge branch 'master' of github.com:dkgroot/provision_sccp

This commit is contained in:
Diederik de Groot
2019-05-14 22:13:12 +02:00
56 changed files with 132 additions and 86 deletions

View File

@@ -0,0 +1,29 @@
Listen 6970
<VirtualHost *:6970>
DocumentRoot "/tftpboot"
ErrorLog /var/log/httpd/tftp.error.log
CustomLog /var/log/httpd/tftp.access.log combined
<Directory /tftpboot>
Options FollowSymlinks
AllowOverride none
Require all granted
RewriteEngine on
RewriteBase "/"
RewriteCond "/tftpboot/%{REQUEST_FILENAME}" !-f
RewriteCond "/tftpboot/%{REQUEST_FILENAME}" !-d
RewriteRule "(.*)" "index.php?id=$1" [PT,QSA]
</Directory>
<Directory />
Options FollowSymLinks
AllowOverride all
Require all granted
</Directory>
<Location />
Require all granted
</Location>
Alias / "/tftpboot/"
</VirtualHost>

View File

@@ -1,27 +0,0 @@
#
# ---------------- Apache 2 ( httpd ) Configuration to support the starting load of the cisco phones via HTTP.
Listen 6970
NameVirtualHost *:6970
<VirtualHost *:6970>
DocumentRoot "/tftpboot"
# DocumentRoot "/data/development/sccp/sources/tftp/tftpboot"
# server_name default
ErrorLog /var/log/httpd/tftp.error.log
CustomLog /var/log/httpd/tftp.access.log combined
# Other directives here
<Directory /tftpboot>
RewriteEngine on
RewriteBase "/"
RewriteCond "/tftpboot/%{REQUEST_FILENAME}" !-f
RewriteCond "/tftpboot/%{REQUEST_FILENAME}" !-d
RewriteRule "(.*)" "index.php?id=$1" [PT,QSA]
</Directory>
# <Directory /data/development/sccp/sources/tftp/tftpboot>
# RewriteEngine on
# RewriteBase "/"
# RewriteCond "/data/development/sccp/sources/tftp/tftpboot/%{REQUEST_FILENAME}" !-f
# RewriteCond "/data/development/sccp/sources/tftp/tftpboot/%{REQUEST_FILENAME}" !-d
# RewriteRule "(.*)" "index.php?id=$1" [PT,QSA]
# </Directory>
</VirtualHost>

View File

@@ -3,10 +3,11 @@ debug = on ; The output in the browser window for more information
tftproot = /tftpboot
;default_language = English_United_States
;firmware = firmware
;settings = settings
;wallpapers = wallpapers
;ringtones = ringtones
;locales = locales
;countries = locales/countries
;languages = locales/languages
firmware = firmware
settings = settings
wallpapers = wallpapers
ringtones = ringtones
locales = locales
countries = countries
languages = languages
;log = /tftpboot/provision.log

View File

@@ -40,11 +40,12 @@ $request = $_REQUEST;
$req_file = !empty($request['id']) ? $request['id'] : '';
# directory content extensions map
$fw_suffix = array('.bin', '.loads', '.sbn', '.sb2', '.sbin', '.zz', '.zup');
$fw_suffix = array('.bin', '.loads', '.sbn', '.sb2', '.sbin', '.zz', '.zup', '.loads');
//$settings_suffix = array('cnf.xml');
$ringtones_list = array('distinctive.xml', 'ringlist.xml');
$ringtones_list = array('distinctive.xml', 'ringlist.xml','distinctiveringlist.xml');
$ringtones_suffix = array('.raw', '.pcm', '.rwb');
$locale_list = array('-dictionary.', 'dictionary-ext.', '-dictionary.utf-8.', '-kate.xml', '-font.xml', '-font.dat','-tones.xml',
'be-sccp.jar', 'tc-sccp.jar', 'td-sccp.jar', 'ipc-sccp.jar', 'mk-sccp.jar', '_locale.loads', 'i-button-help.xml');
@@ -104,7 +105,13 @@ if (!empty($req_file)) {
$tmp_file = $config['wallpapers'].'/'. $req_data_ar[$req_data_len-1].'/'. $req_file_name;
}
else if (strpos_array($ringtones_list, $req_file_name, 'any') !== FALSE) { // Request RingTones
$tmp_file = $config['ringtones'].'/ringlist.xml';
$tmp_file = $config['ringtones'].'/'.$req_file_name;
if (!file_exists($tmp_file)) {
$tmp_file = $config['ringtones'].'/ringlist.xml';
}
}
else if(strpos_array($req_file_name, $ringtones_suffix,'any') !== FALSE) { // Firmware file was requested
$tmp_file = $config['ringtones'].'/'.$req_file_name;
}
else if (strpos_array($req_file, $locale_list, 'any') !== FALSE) { // Request Languages
if (!empty($req_data_ar[$req_data_len-1])) {
@@ -131,14 +138,16 @@ if (!empty($req_file)) {
$tmp_file = $config['languages'].'/'. $req_data_ar[$req_data_len-1].'/'. $req_data_ar[$req_data_len];
}
*/
if ($print_debug == 'on'){ print_r('<br>File : '. $req_file_name. ' not found.<br>');}
if ($print_debug == 'on'){ print_r('<br>File : '. $orig_req_file_name. ' not found.<br>');}
if (empty($tmp_file)) {
if (!empty($config['log'])) { to_log(array('GET :'.$orig_req_file_name, 'no match found'),'E',$config['log']); }
die('ERROR: no match found.');
}
$req_file_full_path = $tmp_file;
}
}
if (!empty($config['log'])) { to_log(array('GET :'.$orig_req_file_name, 'Remap :'.$req_file_full_path),'i',$config['log']); }
if (!empty($req_file_full_path)) {
if ($signed) {
$req_file_full_path .= '.sgn';
@@ -220,6 +229,39 @@ function strpos_array($haystack, $needles, $mode='any') {
return FALSE;
}
function to_log($text, $level='i', $file) {
switch (strtolower($level)) {
case 'e':
case 'error':
$level='ERROR';
break;
case 'i':
case 'info':
$level='INFO';
break;
case 'd':
case 'debug':
$level='DEBUG';
break;
default:
$level='INFO';
}
if (is_array($text)) {
$to_log = '';
foreach ($text as $value) {
$to_log .= $value."\t";
}
} else {
$to_log .= $text;
}
$_txt = date('d.m.Y h:i:s')."\t[".$level."]\t ".$to_log."\n";
if (empty($file)) {
error_log($_txt, 0);
} else {
error_log($_txt, 3, $file);
}
}
function find_all_files($dir, $file_mask=null, $mode='full'){
$result = NULL;

View File

@@ -6,7 +6,7 @@ if [ ! -z "`ls *.pcm 2>/dev/null`" ]; then
basename=`basename ${filename} .pcm`
echo -e "\t<Ring>" >>$outfile
echo -e "\t\t<DisplayName>${basename}</DisplayName>" >>$outfile
echo -e "\t\t<FileName>${filename}</FileName>" >>$outfile
echo -e "\t\t<FileName>ringtones\${filename}</FileName>" >>$outfile
echo -e "\t</Ring>" >>$outfile
done
fi
@@ -15,7 +15,7 @@ if [ ! -z "`ls *.raw 2>/dev/null`" ]; then
basename=`basename ${filename} .raw`
echo -e "\t<Ring>" >>$outfile
echo -e "\t\t<DisplayName>${basename}</DisplayName>" >>$outfile
echo -e "\t\t<FileName>${filename}</FileName>" >>$outfile
echo -e "\t\t<FileName>ringtones\${filename}</FileName>" >>$outfile
echo -e "\t</Ring>" >>$outfile
done
fi

View File

@@ -1,62 +1,62 @@
<CiscoIPPhoneRingList>
<Ring>
<DisplayName>drums1</DisplayName>
<FileName>drums1.pcm</FileName>
<FileName>ringtones\drums1.pcm</FileName>
</Ring>
<Ring>
<DisplayName>drums2</DisplayName>
<FileName>drums2.pcm</FileName>
<FileName>ringtones\drums2.pcm</FileName>
</Ring>
<Ring>
<DisplayName>loudc1</DisplayName>
<FileName>loudc1.pcm</FileName>
<FileName>ringtones\loudc1.pcm</FileName>
</Ring>
<Ring>
<DisplayName>loudc2</DisplayName>
<FileName>loudc2.pcm</FileName>
<FileName>ringtones\loudc2.pcm</FileName>
</Ring>
<Ring>
<DisplayName>loudlaser</DisplayName>
<FileName>loudlaser.pcm</FileName>
<FileName>ringtones\loudlaser.pcm</FileName>
</Ring>
<Ring>
<DisplayName>merlin2</DisplayName>
<FileName>merlin2.pcm</FileName>
<FileName>ringtones\merlin2.pcm</FileName>
</Ring>
<Ring>
<DisplayName>merlin3</DisplayName>
<FileName>merlin3.pcm</FileName>
<FileName>ringtones\merlin3.pcm</FileName>
</Ring>
<Ring>
<DisplayName>merlin4</DisplayName>
<FileName>merlin4.pcm</FileName>
<FileName>ringtones\merlin4.pcm</FileName>
</Ring>
<Ring>
<DisplayName>merlin5</DisplayName>
<FileName>merlin5.pcm</FileName>
<FileName>ringtones\merlin5.pcm</FileName>
</Ring>
<Ring>
<DisplayName>merlin6</DisplayName>
<FileName>merlin6.pcm</FileName>
<FileName>ringtones\merlin6.pcm</FileName>
</Ring>
<Ring>
<DisplayName>merlin7</DisplayName>
<FileName>merlin7.pcm</FileName>
<FileName>ringtones\merlin7.pcm</FileName>
</Ring>
<Ring>
<DisplayName>ringer1</DisplayName>
<FileName>ringer1.pcm</FileName>
<FileName>ringtones\ringer1.pcm</FileName>
</Ring>
<Ring>
<DisplayName>ringer2</DisplayName>
<FileName>ringer2.pcm</FileName>
<FileName>ringtones\ringer2.pcm</FileName>
</Ring>
<Ring>
<DisplayName>ringer3</DisplayName>
<FileName>ringer3.pcm</FileName>
<FileName>ringtones\ringer3.pcm</FileName>
</Ring>
<Ring>
<DisplayName>ringer4</DisplayName>
<FileName>ringer4.pcm</FileName>
<FileName>ringtones\ringer4.pcm</FileName>
</Ring>
</CiscoIPPhoneRingList>

View File

@@ -25,17 +25,17 @@
<member priority="0">
<callManager>
<name>asterisk1</name>
<ipv6Addr>2001:471:2f25:3ce::466</ipv6Addr>
<ipv6Addr>2001:aaa:bbb:ccc::111</ipv6Addr>
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
</ports>
<processNodeName>192.168.0.3</processNodeName>
<processNodeName>192.168.1.1</processNodeName>
</callManager>
</member>
<member priority="1">
<callManager>
<name>asterisk2</name>
<ipv6Addr>2a00:471:2f25:4cd::10</ipv6Addr>
<ipv6Addr>2001:aaa:bbb:ccc::112</ipv6Addr>
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
</ports>
@@ -46,7 +46,7 @@
</callManagerGroup>
<srstInfo>
<srstOption>Disable</srstOption>
<ipAddr1>192.168.0.2</ipAddr1>
<ipAddr1>192.168.1.2</ipAddr1>
<port1>2000</port1>
<ipAddr2></ipAddr2>
<port2></port2>
@@ -58,7 +58,7 @@
<commonProfile>
<phonePassword>1234</phonePassword>
<defaultBackground>http://192.168.0.2/Chan-SCCP-b.png</defaultBackground>
<defaultBackground>http://192.168.1.1/Chan-SCCP-b.png</defaultBackground>
<backgroundImageAccess>true</backgroundImageAccess>
<callLogBlfEnabled>3</callLogBlfEnabled>
</commonProfile>
@@ -77,15 +77,15 @@
<displayOnWhenIncomingCall>1</displayOnWhenIncomingCall>
<loggingDisplay>1</loggingDisplay>
<autoCallSelect>0</autoCallSelect>
<logServer>192.168.0.3:9001</logServer>
<logServer>192.168.1.1:9001</logServer>
<enableCdpSwPort>1</enableCdpSwPort>
<enableCdpPcPort>1</enableCdpPcPort>
<enableLldpSwPort>1</enableLldpSwPort>
<enableLldpPcPort>1</enableLldpPcPort>
<lldpAssetId>Cisco Phone</lldpAssetId>
<powerPriority>1</powerPriority>
<ipv6LoadServer>2001:471:2f25:3ce::466</ipv6LoadServer>
<ipv6LogServer>2001:471:2f25:3ce::466:9001</ipv6LogServer>
<ipv6LoadServer>2001:aaa:bbb:ccc::111</ipv6LoadServer>
<ipv6LogServer>2001:aaa:bbb:ccc::111:9001</ipv6LogServer>
<detectCMConnectionFailure>0</detectCMConnectionFailure>
<rtpcontrolprotocol>1</rtpcontrolprotocol>
<g722CodecSupport>2</g722CodecSupport>
@@ -112,10 +112,10 @@
<!-- End Locale Information -->
<deviceSecurityMode>1</deviceSecurityMode>
<informationURL>http://192.168.0.3/cisco_menu/help/help.php</informationURL>
<authenticationURL>http://192.168.0.3/authenticate.php</authenticationURL>
<servicesURL>http://192.168.0.3/tests.xml</servicesURL>
<directoryURL>http://192.168.0.3/CiscoDirectory/phonebook.php</directoryURL>
<informationURL>http://192.168.1.1/cisco_menu/help/help.php</informationURL>
<authenticationURL>http://192.168.1.1/authenticate.php</authenticationURL>
<servicesURL>http://192.168.1.1/tests.xml</servicesURL>
<directoryURL>http://192.168.1.1/CiscoDirectory/phonebook.php</directoryURL>
<messagesURL/>
<proxyServerURL/>
<dscpForSCCPPhoneConfig>96</dscpForSCCPPhoneConfig>
@@ -169,13 +169,13 @@
</phoneService>
<phoneService type="0" category="0">
<name>Tests</name>
<url>http://192.168.0.3/tests.xml</url>
<url>http://192.168.1.1/tests.xml</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="0" category="0">
<name>Corporate Directory</name>
<url>http://192.168.0.3/cisco-addressbook/</url>
<url>http://192.168.1.1/cisco-addressbook/</url>
<vendor/>
<version/>
</phoneService>

View File

@@ -22,20 +22,21 @@
<members>
<member priority="0">
<callManager>
<name>moviebox</name>
<ipv6Addr>2001:471:2f25:3ce::3</ipv6Addr>
<name>server1</name>
<ipv6Addr>2001:aaa:bbb:ccc::111</ipv6Addr>
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
</ports>
<processNodeName>192.168.187.3</processNodeName>
<processNodeName>192.168.1.1</processNodeName>
</callManager>
</member>
<member priority="1">
<callManager>
<name>server2</name>
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
</ports>
<processNodeName>192.168.187.3</processNodeName>
<processNodeName>192.168.1.2</processNodeName>
</callManager>
</member>
</members>
@@ -114,9 +115,9 @@
</commonProfile>
<vendorConfig>
<logServer>192.168.178.3</logServer>
<syslogServer>192.168.178.3</syslogServer>
<debugServer>192.168.178.3</debugServer>
<logServer>192.168.1.1</logServer>
<syslogServer>192.168.1.1</syslogServer>
<debugServer>192.168.1.1</debugServer>
<debugLevel>3</debugLevel>
<disableSpeaker>false</disableSpeaker>
<disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
@@ -151,8 +152,8 @@
<powerPriority>1</powerPriority>
<sshAccess>0</sshAccess>
<sshPort>22</sshPort>
<ipv6LoadServer>2a00:1258:3::185</ipv6LoadServer>
<ipv6LogServer>2a00:1258:3::185</ipv6LogServer>
<ipv6LoadServer>2001:aaa:bbb:ccc::111</ipv6LoadServer>
<ipv6LogServer>2001:aaa:bbb:ccc::111</ipv6LogServer>
<detectCMConnectionFailure>0</detectCMConnectionFailure>
<useEnblocDialing>1</useEnblocDialing>
</vendorConfig>
@@ -224,12 +225,12 @@
<userId>9999</userId>
<!-- Begin URL's -->
<idleURL>http://192.168.178.3/idle.php</idleURL>
<authenticationURL>http://192.168.178.3/authenticate.php</authenticationURL>
<informationURL>http://192.168.178.3/cisco_menu/help/help.php</informationURL>
<idleURL>http://192.168.1.1/idle.php</idleURL>
<authenticationURL>http://192.168.1.1/authenticate.php</authenticationURL>
<informationURL>http://192.168.1.1/cisco_menu/help/help.php</informationURL>
<messagesURL/>
<proxyServerURL/>
<servicesURL>http://192.168.178.3/tests.xml</servicesURL>
<directoryURL>http://192.168.178.3/cisco_menu/directory/menu.php</directoryURL>
<servicesURL>http://192.168.1.1/tests.xml</servicesURL>
<directoryURL>http://192.168.1.1/cisco_menu/directory/menu.php</directoryURL>
<!-- End URL's -->
</Default>