I do exactly this.. I wrote a script that when a new phone enters the
system.. The static aastra.cfg file tells the phone to go grab a default
PHP script that basically makes the phone say "enter you extension"... You
type the extension and hit OK.. This calls my phone register script
sending the extension number as an argument.. By using the HTTP headers I
grab the phone type and the MAC address of the phone.. Generate a config
file and push back a reboot request to the phone...
The phone then reboots and grabs the config from the server.. The server
parameters are given to the phone by DHCP.. In my dhcpd.conf I have set
up where I send different options to different types of devices based on
their macs...
The trick is you place an aastra.cfg file on the server and make DHCP give
out the server location for the phone to go.. This way it is zero-config
out of the box for a new phone...
I wrote my own set of auto-config scripts mainly because I found the
provided ones to be convoluted and didn¹t work in the way I wanted...
I use lighttpd for the web server and all works great.
Here is an example of how I grab the phone's type and MAC address... By
grabbing the type I can generate the correct type of key buttons
dependant on the type of set they have.. Ie softkey vs prgkey
# get extension from URL if sent
if (array_key_exists('user',$_GET)) {
$extension =$_GET['user'];
} else {
$extension = NULL;
}
## get user agent info from web server
$user_agent_raw = $_SERVER["HTTP_USER_AGENT"];
#decode our HTTP header
$ffr = decode_header($user_agent_raw);
#####################################################################
# decode_header()
#
# Returns an array
# 0 Phone Type
# 1 Phone MAC Address
# 2 Phone firmware version
#####################################################################
function decode_header($user_agent)
{
testlog($user_agent);
# $user_agent="Aastra6731i MAC:00-08-5D-26-17-78 V:2.6.0.66-SIP";
if(stristr($user_agent,"Aastra")) {
$value=preg_split("/ MAC:/",$user_agent);
$fin=preg_split("/ /",$value[1]);
$value[1]=preg_replace("/\-/","",$fin[0]);
$value[2]=preg_replace("/V:/","",$fin[1]);
} else {
$value[0]="MSIE";
$value[1]="NA";
$value[2]="NA";
}
$value[3]=$_SERVER["REMOTE_ADDR"];
return $value;
}
******
Here is a snippet from my dhcpd.conf on how I tell DHCP to send options
based on MAC
# tftp for Aastra sets is special, otherwise use GUI value
if substring(hardware,1,3) = 00:08:5D {
option tftp-server-name "tftp://192.168.10.5/aastra/";
}
******
And finally my aastra.cfg file.. This file is checked by every phone on
bootup, however data in a MAC.cfg takes precedence over data in this
file.. So you can leave it on the server all the time and put a different
action uri startup in your MAC.cfg or blank it out.. So then the phones
will only go to your newphone script once when they are default or are
missing a config on the server
# Setup DHCP mode
dhcp: 1
lldp: 0
download protocol: TFTP
time server disabled: 1
time server1:
time server2:
time server3:
contact rcs: 0
action uri startup: http://10.11.12.13/aastra/newphone.php?user=none
-Christopher
On 2/24/12 11:49 AM, "Lonnie Abelbeck" <[email protected]> wrote:
>
>On Feb 24, 2012, at 8:18 AM, Neuer User wrote:
>>
>> I want to provision some aastra phones. The asterisk provisioning system
>> is not very well documented, but from what I understand it does not
>> allow for more diverse configuration files, e.g. different softkeys per
>> phone.
>>
>> So, I would like to use some simple php scripts to generate the
>> configuration files. But for this I need a rewrite rule, because the
>> aastra phones (like all others that I know) use static URLs like
>>
>> http://192.168.0.1/phoneprov/0011223344.cfg
>>
>> I would rewrite this to something like this
>>
>> http://192.168.0.1/phoneprov.php?mac=0011223344
>>
>> Which a php script can use to generate the configuration file.
>
>Question, why not run your PHP script that would generate .cfg files for
>*all* phones in static files where the phones expect ?
>
>Lonnie
>
>
>--------------------------------------------------------------------------
>----
>Virtualization & Cloud Management Using Capacity Planning
>Cloud computing makes use of virtualization - but cloud computing
>also focuses on allowing computing to be delivered as a service.
>http://www.accelacomm.com/jaw/sfnl/114/51521223/
>_______________________________________________
>Astlinux-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/astlinux-users
>
>Donations to support AstLinux are graciously accepted via PayPal to
>[email protected].
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Astlinux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/astlinux-users
Donations to support AstLinux are graciously accepted via PayPal to
[email protected].