Skip to content

Phils Blog and Stuff

TELECOMS. VIRTUALIZATION. IT. CODING. and more…

Menu
  • Home
  • Resources
    • Subnet Mask Cheat Sheet
    • Easy Dmarc+Email
    • MX Tool Box
    • LOAD BALANCING & SRE
  • SHOP
  • SOLUTIONS
  • SERVICES
  • Contact Me
Menu

Auto Provisioning of Phones (Snom/Polycom/YeaLink/Linksys)

Posted on 21/06/201108/03/2023 by Phil

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.

POSTS

  • Home Assistant. Add water meter with PHP+MQTT+YML.
  • Automating your home with Home Assistant. Initial install and config (Hyper-V).
  • The importance of setting up email security correctly.
  • Automate Debian installations with Seed, DHCP and Nginx.
  • A simple link shortener.. Fun little project…

WORD CLOUD

3CX 3CX Phone System Apache Asterisk Cacti CentOS CRM DHCP DNS Email Fail over Failover File System Firewall FreeBSD FreeNAS FXO IAX install IP IP PBX Linux M0n0wall Nottingham Open Source PBX PFSense PHP Router Server SIP snom SSH TrixBox ubuntu VLAN Voice VoIP VPN vyatta WAN Website WiFi yealink ZFS

© 2025 Phils Blog and Stuff | Powered by Superbs Personal Blog theme