Open Source Training Seminar FreePBX Paid Support

Devices

For a while I've wanted freepbx to have the ability to actually setup devices.

The idea is that all the asterisk settings are removed from the device page (nat, qualify, rfcmode..), and in their place, a very simple device setup page.

This would have something like:

  • device name
  • device type (sipura spa-941, polycom 501, cisco 7960, etc)
  • if locally/automatically provisioned, if so:
    • mac address
  • adhoc/fixed

basically, the minimum of stuff to get it going.

There would also have to be some other settings specific to each phone type, although freepbx wouldn't really need this part, it would only be for provisioning. Examples:

  • key assignment
  • internal phone dialplan
  • ringer types

The framework for this will be added in 2.3 (see also QuickFormBranch).

This probably will require having a TftpServer http://en.wikipedia.org/wiki/Tftp, but there may be other ways to provision as well, all device-specific. We'll need a plugin system to add device types, so there could be a directory for each device, with a file inside to provide the basic info about the device, define the additional fields, and then a file to configure it (an executable that scans the network, tftp configuration, something that generates an xml for a webserver, whatever).

In the end, it should be possible to configure devices completely without ever logging into them - just enter the MAC in freePBX and plug the phone in.

See also: ProvisioningModule

Related to this, UserPortal will also be integated, so for phones that can support it, you could have all the UserPortal functionality on the phone via their XML scripting, mini HTML browsers, etc. When provisioned, the appropriate URL would be loaded into the phone to enable this functionality.

Breaking down the process

Network Scanning

Scanning would just be an optional feature of provisioning, to assist finding new devices. Probably as a popup window available from the 'add device' screen that would allow you to select a MAC address to use.

It would seem the MAC address of the phone would reveal the manufacturer and possibly even the model. Ie: Polycom: 00:04:F2 :6A:XX:XX and a scan of the dhcp.leases file would quickly reveal both the mac and ip address of all polycom phones. This project seems to provide php code to do this job: http://sourceforge.net/project/showfiles.php?group_id=106985

*I have a block of code that reads the dhcpd.leases file and displays all known voip product dhcp leases written.

--

To avoid having to access the dhcp.leases file (ie, if the DHCP server is another machine, or on a locked device like a linksys/dlink router), another way to scan the network is to ping scan it:

nmap -sP 10.0.0.0/24

In theory you could also do a broadcast ping, but not all devices actually reply to broadcast pings. this nmap command pings every IP individually. Once you've communicated with everyone, arp will show the hosts:

arp -n

This prints out a list like:

10.0.0.183 ether 00:10:DC:C4:44:2F C eth0

And can actually be processed with:

        exec('arp -n', $output);
        foreach ($output as $str) {
                if (preg_match("/^\s*(\d+.\d+.\d+.\d+).*(([0-9A-Fa-f]{2}:?){6})\s/", $str, $matches)) {
                        $map[ strtoupper( str_replace(":","",$matches[2]) ) ] = $matches[1];
                }
        }

This outputs an associative array like $map0010DCC4442F? = '10.0.0.183';

--

I suggest using nmap with some more options to catch all needed information in an XML array.

nmap -sU -sS -p 5060,4569 -oX - 192.168.1.0/24

would produce this output:

<?xml version="1.0" ?>
<?xml-stylesheet href="/usr/share/nmap/nmap.xsl" type="text/xsl"?>
<!-- Nmap 4.20 scan initiated Tue Mar 18 17:35:46 2008 as: nmap -&#45;open -p 5060 -oX - 192.168.1.0/24 -->
<nmaprun scanner="nmap" args="nmap --open -p 5060 -oX - 192.168.1.0/24" start="1205858146" startstr="Tue Mar 18 17:35:46 2008" version="4.20" xmloutputversion="1.01">
<scaninfo type="syn" protocol="tcp" numservices="1" services="5060" />
<verbose level="0" />
<debugging level="0" />
...
<host><status state="up" />
<address addr="192.168.1.36" addrtype="ipv4" />
<address addr="00:0E:50:4E:F6:13" addrtype="mac" vendor="Thomson Telecom Belgium" />
<hostnames />
<ports><port protocol="tcp" portid="4569"><state state="closed" /></port>
<port protocol="tcp" portid="5060"><state state="open" /><service name="sip" method="table" conf="3" /></port>
<port protocol="udp" portid="4569"><state state="closed" /></port>
<port protocol="udp" portid="5060"><state state="open|filtered" /><service name="sip" method="table" conf="3" /></port>
</ports>
</host>
<host><status state="up" />
<address addr="192.168.1.193" addrtype="ipv4" />
<address addr="00:0B:82:0E:E2:15" addrtype="mac" vendor="Grandstream Networks" />
<hostnames />
<ports><port protocol="tcp" portid="4569"><state state="filtered" /></port>
<port protocol="tcp" portid="5060"><state state="filtered" /><service name="sip" method="table" conf="3" /></port>
<port protocol="udp" portid="4569"><state state="open|filtered" /></port>
<port protocol="udp" portid="5060"><state state="open|filtered" /><service name="sip" method="table" conf="3" /></port>
</ports>
</host>
...
<runstats><finished time="1205857799" timestr="Tue Mar 18 17:29:59 2008"/><hosts up="10" down="246" total="256" />
<!-- Nmap run completed at Tue Mar 18 17:29:59 2008; 256 IP addresses (10 hosts up) scanned in 5.965 seconds -->
</runstats></nmaprun>

MAC TABLE **PLEASE UPDATE WITH FIRST 3 OCTETS OF MANUFACTURERS MAC**

Aastra00085dxxxxxx
Atcom (and other PA168x devices)000945xxxxxx
Cisco0002b9xxxxxxCisco uses DHCP Option 150 when running skinny protocol instead of Option 66 for specifying the TFTP server (When upgrading from skinny to sip you need to reflect this change).
Grandstream000b82xxxxxx
Hitachi Cable00032axxxxxx
Pirelli Broadband00193exxxxxx
Polycom SoundPoint?0004f2xxxxxx
Polycom SoundStation?00e075xxxxxx I have a Polycom SoundStation? IP4000 which has a 0004f2 MAC address - is this for non VoIP models ?
Siemens 0018d1xxxxxx(Siemens Home & Office Division - ie Siemens Gigaset DECT VoIP Phones)
Siemens 0001e3xxxxxx(Siemens OptiPoint?)
Snom000413xxxxxx
Linksys Sipura (SPA models)000e08xxxxxx
Linksys - Cisco (Linksys WIP330)0016b6xxxxxx
Swissvoice000590xxxxxx
Thomson000e50xxxxxx
Thomson00147fxxxxxxRecent ST2030 and ST2022
UTStarcom0007baxxxxxx
ZyXEL00a0c5xxxxxx
Welltech0001A8xxxxxx

Looking for a OUI (MAC prefix assigned to a specific manufacturer) ? Follow this link: IEEE OUI and Company_id Assignments

Looking for a manufacturer for the provided MAC address or prefix: MAC Find


<?php
function devices_lookup_mfg_by_mac($macid){
  //The 2d MACTABLE array associates a MAC Address Pattern, addrpat with a device name, name.
  $MACTABLE['0004F2'] = "Polycom";
  $MACTABLE['000413'] = "Snom";
  $MACTABLE['000B82'] = "Grandstream";
  $MACTABLE['000E08'] = "LinkSys Sipura";
  $MACTABLE['000E50'] = "Thomson";

  $mfg_macid=substr($macid,1,5);
  foreach ($mactable as $addr => $name) {
    if ($addr == $mfg_macid) return $name;
  }
}

?>

Manufacturer Provisioning System

Please provide, if you know, ways to remotely populate the telephone phonebook (where available)

Snom

Snoms can be configured through a configuration file published on an HTTP or TFTP server (it users URI syntax, http:// or tftp://)

Snoms can get files on the web / tftp server including their own MAC address in the request, for example you can use the following URL: http://provisioning.snom.com/snomXXX/snomXXX.php?mac={mac} - {mac} is replaced with phone own mac address before getting the file

DHCP can be used to specify the location of this file (fields 66 and 67)

Setting files are ASCII-based files containing lines terminated with newline or carriage return/newline pairs. Comments start with a # or a < character. Names may consist of the characters a-z, A-Z, 0-9 and _.

SNOM wiki has a very good documentation on settings file, have a look at: http://www.snom.com/wiki/index.php/Mass_deployment

The Snom devices store a phonebook on the phone itself and I think it only holds up to 100 entries. From the phone's WWW admin interface you can manually import a CSV file into the phonebook but I don't this this is a realistic mechanism. However the Snom 360 I have here supports XML applications and I've just see that someone who had previously written a XML phonebook for Cisco phones has now modified it to also support the Snom360 - this would allow the Snom 360 to be configured so when the phonebook button is pressed it would load the XML content from a HTTP server (i.e. on the FreePBX box)

Grandstream

The beta firmware I've recently put onto my GXP-2000 supports an XML-based phonebook

I'm looking into getting FreePBX to dump out suitable content into files locally whenever an extension is added/deleted/edited to handle both these phones. Feel free to contact me - dermot.bradley at sla-networks.com

Polycom Phones

*July 11, 2006: Polycom support has a feature request to return the phone model by a dhcp field. Apparently not enough customers have demanded the feature so it is not currently a priority. I will follow up and advise of any news. A.W.

Has anyone explored using a push method by the phones http interface? Pull method is most easily executed by way of dhcp and a tftp server.

Provisioning server is auto-configured using dhcpd.conf setting:

option tftp-server-name         "tftp://192.168.99.10";

This alternatively be any url, such as

option tftp-server-name          "http://user:pass@192.168.99.10/pcomprov/";

All soundpoint models - Provision with tftp This method is not terribly secure since anyone could conceivably download the authentication settings for the extensions, but all models support this method.

Soundpoint 301,501,601 - Provision with http, https, ftp, tftp - Provisioning file is xml, master file 0004f2xxxxxx.cfg where xxxxxx represents the specific mac address of that node.

0004f2xxxxxx.cfg Example:

<?xml version="1.0" standalone="yes"?>
<!-- Default Master SIP Configuration File-->
<!-- Edit and rename this file to <Ethernet-address>.cfg for each phone.-->
<!-- $Revision: 1.14 $  $Date: 2005/07/27 18:43:30 $ -->
<APPLICATION APP_FILE_PATH="sip.ld" CONFIG_FILES="phonepc601.cfg, sip.cfg" MISC_FILES="" LOG_FILE_DIRECTORY="" OVERRIDES_DIRECTORY="" CONTACTS_DIRECTORY=""/>

Note this file tells the phone which files to download, this is the only config file loaded by default. In this example sip.ld, phonepc601.cfg and sip.cfg are identified as includes for the phone.

sip.cfg typically contains lan generic settings

phonepc601.cfg should hold the phone specific settings. This is where you should put your extension numbers and auth info.

Therefore, for Polycom phones we would need:
1 A template macfile.cfg that could be modified to the specific mac of the phone with a uniquely named phonepc601.cfg.
2 A sip.cfg file that had been modified to the lan site settings.
3 An official sip.ld that is compatible with the bootrom.ld
4 An official bootrom.ld. **A 3.x firmware flashed phone can never return to 2.x and so on**

Due to the closed nature of Polycom it may be difficult to do this properly since the config files typically relate closely to the firmware revision of the phone. Current firmware is not always avaiable to those who are not certified resellers. --

Swissvoice

These phones use a similar way of provinionning as Polycom.

I dont choose to implement it that way, but I make some scripts to create phones with their own settings in the dhcp server, tftp config are also created with own templates.

For example:

host phoneTEST {
  hardware ethernet 00:05:90:XX:XX:XX;
  fixed-address 10.0.0.115;
  option tftp-server-name "10.0.0.1";
  option host-name "215";
  option bootfile-name "swupdate_215.inf";
}

The .inf file contains the links to the other update files (firmware and settings).

<LOGO server=tftp>
logo.bmp
</LOGO>
<CONFIG server=tftp>
config_215.cfg
</CONFIG>

The server value can be tftp (the one provided with DHCP) or ftp. All these settings are well explained in the provisionning documents. If somebody work on the provisionning module, feel free to ping me on irc (nick: eldu).

We also oticed that the firmware version is very important to have a good sound quality and to avoid some weird behaviours during upgrade or provisionning.

Linksys/Sipura

Article: Bulk provisioning Linksys IP Phones

Discussion

**NOTE added**

I'm currently trying to get this sort of thing going myself. To provision a new device all that should be needed is MAC address, device make/model, IP address to use, extension number, and extension name. A script callout should occur once the data is written to MySQL and this script is passed the extension number so it can then read the data and generate appropriate bootstrap file for the handset. I'm working with Grandstream devices which use TFTP and Snom devices which use HTTP.

Anyone interested in discussing further can email me at dermot.bradley at sla-networks.com

--

I can provide some scripts for the Swissvoice IP10S.
Please start by including the mac address identifier in the MAC table

--

We should collaborate with Trixbox on this one -> http://www.trixbox.org/modules/newbb/viewtopic.php?topic_id=473&forum=7&viewmode=flat&order=ASC&start=0
Trixbox is a system integration project, the discussion should really take place here --

Relevant tickets:

  • #459 - MAC address field for devices
  • #103 - Templates for devices
    • The method described in this ticket may not be the best way to do this, but either way this ticket is either relevant to this discussion, or needs to be marked as 'wontfix'
  • #1032 - tftp module
    • Adding any files to tftp should be done by this module, if it exists.. if it doesn't exist, then tftp provisioning would not be available. See ticket for further details
  • #1691 - new GUI for devices/users/extensions
  • #1950 - Auto Provisioning For Polycom & Grandstream Phones might help

--

Has anyone looked at Voicepulse Global Provisioning System?

http://sourceforge.net/projects/vgps/

It seems to be very comprehensive and should only require integration with a frontend and some backend stuff to enable ftp and tftp. The docs are in the download and wikified here for readability --> http://www.trixboxtools.co.uk/wiki/id,reloaded:config:vgps:readme/

Any phone can be supported by creating a template which can be assigned to a phone by mac addr.

Page Macro

Method to determine within dial plan what the phone type is on the fly and set correct ALERT_INFO in page/intercom macro:

[intercom]


exten => _*81.,1,Set(dialnumber=${EXTEN:3})
exten => _*81.,n,Set(user-intercom=${DB(AMPUSER/${dialnumber}/intercom)})
exten => _*81.,n,GotoIf($["${user-intercom}" = "disabled" ]?nointercom)
exten => _*81.,n,Gosub(getalertinfo)
exten => _*81.,n,Set(__SIPADDHEADER=Call-Info: \;answer-after=0)
exten => _*81.,n,Set(__ALERT_INFO=${ALERTINFO})
exten => _*81.,n,Set(__SIP_URI_OPTIONS=intercom=true)
exten => _*81.,n,Dial(Local/${dialnumber}@from-internal/n,)
exten => _*81.,n,Busy(20)
exten => _*81.,n,Macro(hangupcall,)
exten => _*81.,n(nointercom),Noop(Intercom disallowed by ${dialnumber})
exten => _*81.,n,Playback(intercom&for&extension)
exten => _*81.,n,SayDigits(${dialnumber})
exten => _*81.,n,Playback(is&disabled)
exten => _*81.,n,Congestion(20)

;modify polycoms sip.cfg to the following
;<alertInfo voIpProt.SIP.alertInfo.1.value="Ring Answer" voIpProt.SIP.alertInfo.1.class="3" voIpProt.SIP.alertInfo.2.value="Intercom" voIpProt.SIP.alertInfo.2.class="4"/>


exten => _*81.,n(getalertinfo),Set(phone=${SIPPEER(${dialnumber}:useragent)})
exten => _*81.,n,Set(ALERTINFO=Ring Answer) ;if cant match returns "Ring Answer"
exten => _*81.,n,ExecIf($[${phone:0:4} = Poly]|Set|ALERTINFO=Intercom) ;match Polycom 
exten => _*81.,n,ExecIf($[${phone:0:4} = Link]|Set|ALERTINFO=Ring Answer) ;match Lynksys
exten => _*81.,n,NoOp(ToDo: Add more phones here, match to useragent return value)
exten => _*81.,n,Return

Auto Provision Polycom Phone

Extract included file autoconfig.tar.gz then modify the following dial plan with correct server IP and Path to files. I put files in the tftpboot directory:

Make your Polycom sip.cfg file default to a defined default extension in FREEBPX so when a new phone is plugged in it will be able to dial a feature code right away. When phone comes up dial *999 and dial extension to assign that phone, script will create mac.cfg with new extension and reboot phone, when phone is back up it will be provisioned with new extension. This makes deploying phones in a large install easy just plug in phones and go back through and set extension, usually the old phone is sitting right next to new Polycom and has the extension label so matching to old system is easy too.

in FREEPBX under Misc applications under custom set "custom-new-polycom-ext,script,1" I use feature code *999

in FREEPBX under Misc applications under custom set "reboot-polycom,script,1" I use feature code *REBOOT "*732668"

[custom-new-polycom-ext]
;make sure to modify sip.cfg 
;voIpProt.SIP.specialEvent.checkSync.alwaysReboot="1"
; if script wont over write existing mac.cfg files permissions need to be reset or delete old mac.cfg file
; could add SU to script but preventing overwriting customization to mac.cfg after provisioning is a good thing

exten => script,1,Answer
exten => script,n,Wait(1)
exten => script,n,Read(number,/tftpboot/polycom/autoconfig/waves/getnumber,4)
exten => script,n,PlayBack(/tftpboot/polycom/autoconfig/waves/youentered)
exten => script,n,SayDigits(${number});
exten => script,n,Read(confirm,/tftpboot/polycom/autoconfig/waves/confirm,1)
exten => script,n,Gotoif($[${confirm} = 1]?20:100)

exten => script,20,NoOp
exten => script,n,Set(ip=${SIPCHANINFO(peerip)})
exten => script,n,Set(path=/tftpboot/polycom/overides/)
exten => script,n,Set(ext=${CALLERID(num)})
exten => script,n,Set(serverip=192.168.0.222)
exten => script,n,Set(script=/tftpboot/polycom/autoconfig/agi-bin/initpolycom.pl
exten => script,n,AGI(${script}|${path}|${ip}|${ext}|${number}|${serverip})
exten => script,n,Hangup

exten => script,100,Hangup

[reboot-polycom]
exten => script,1,Answer
exten => script,n,Set(ip=${SIPCHANINFO(peerip)})
exten => script,n,Set(ext=${CALLERID(num)})
exten => script,n,Set(serverip=192.168.0.222)
exten => script,n,Set(script=/tftpboot/polycom/autoconfig/PolyReboot.pl
exten => script,n,AGI(${script}|${ip}|${ext}|${serverip})
exten => script,n,Hangup

Attachments

Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads