Using PHP and MySQL to integrate with Hello Telecoms existing systems I created scripts to enable phones to be auto provisioned from there Hosted VoIP Portal, to enable plug’n’play of most phones for both the private network and phones out on the Internet using Snom’s redirection server and some custom XML RPC coding.
This has enabled Hello Telecom to ship out phones direct from suppliers and only needing to know the MAC address of the phone, once entered on the system the config files are automatically built, and in the case of snom phones they automatically configure them self’s right out of the box to use Hello Telecom’s hosted voip communication system.
A Sample of my early testing code can be found below.
<?php // Get values sent to page from user form input $mac=$_POST['mac']; $realname=$_POST['realname']; $username=$_POST['username']; $userpass=$_POST['userpass']; $ippbxip=$_POST['ippbxip']; $pname=$_POST['pname']; $vm=$_POST['vm']; $ringtone=$_POST['ringtone']; $displayname=$_POST['displayname']; $recordcalls=$_POST['recordcalls']; Echo "Writing file..."; $myFile = "snom320-$mac.htm"; $fh = fopen($myFile, 'w') or die("Doh you have a problem. NOOOOO!!!"); $stringData = "# Snom 320 Configuration:Generated By Phils Snom Config script" . PHP_EOL.PHP_EOL . "user_realname1: $realname" . PHP_EOL ."user_name1: $username" . PHP_EOL ."user_pass1: $userpass" . PHP_EOL ."user_host1: $ippbxip" . PHP_EOL ."user_pname1: $pname" . PHP_EOL ."user_mailbox1: $vm" . PHP_EOL ."user_ringer1: $ringtone" . PHP_EOL ."user_idle_text1: $displayname" . PHP_EOL ."record_missed_calls1: $recordcalls" /*. PHP_EOL ."fkey11: dest 701"*/; fwrite($fh, $stringData); fclose($fh); Echo "Completed"; Echo "<br><br><a href='snom320-$mac.htm'>View Generated Config File</a>"; ?>
The above code is the code that will go and create the file based on a form the user submits to this page, if the phone and network is set up correctly the phone will boot up and have all the settings in this file, the code for polycom’s and other phones is about the same except that on the form input page the user can select what phone is to be provisioned and then the code takes them to the right page to write the file.
The above code is example code my real script now uses PHP + SQL to interrogate another database and automatically create the phones as part of a cron job on Linux.