Top

Provision your Cisco 79xx SIP Phone from Active Directory with these Auto Provisioning Scripts

November 6, 2008

Our friend over at Dave.vc has released a new set of scripts for provisioning your Cisco phones from Active Directory.

Visit Dave's site for more awesome tools like this.

You can download the Cisco Provisioning scripts.

Here's his tutorial, and provisioning scripts.

Here are the scripts I use to automatically provision cisco phones via AD information. The phone number (extension) is taken from AD’s ‘phone number’ field and the mac address comes from AD’s ‘IP Phone’ field.

As with the reboot script below, these scripts require PHP to be installed and compiled with LDAP and CLI on the asterisk server. It is possible (obviously) to perform these tasks remotely (not on the asterisk server) but that’s outside the scope of this post.

The PHP script reads the template files and does simple string replacement as needed. If the user is brand new, it adds their voicemail account, picks a psuedo-random extension password and tells asterisk what their email address is for the voicemail-to-email setup. The email information will only be in AD if you put it there or are running an exchange server in the same forest (as in the example).

It’s useful to note that all of the extensions I use in this example setup are in the format of 3xx. We then have another extension of the format 4xx set up to auto-answer so that we can do paging and intercom. You may need to modify if you have more than 100 extensions.

In order to add the extension, we read the config template in the directory listed and perform string replacement:

function add_extension($name,$extension,$secret,$email){

$template = file_get_contents(”/etc/asterisk/phones/conf.template”);

$template = str_replace(”<<<mainextension>>>”,$extension,$template);

$template = str_replace(”<<<email>>>”,$email,$template);

$template = str_replace(”<<<fullname>>>”,$name,$template);

$template = str_replace(”<<<secret>>>”,$secret,$template);

$template = str_replace(”<<<pageextension>>>”,”4?.substr($extension,1),$template);

file_put_contents(”/etc/asterisk/phones/”.$extension.”.conf”,$template);

}

The XML config file creation/modification follows the same format:

function provision_phone($name,$extension,$secret,$mac){

$template = file_get_contents(”/tftpboot/SEPCONF.template”);

$template = str_replace(”<<<mainextension>>>”,$extension,$template);

$template = str_replace(”<<<email>>>”,$email,$template);

$template = str_replace(”<<<fullname>>>”,$name,$template);

$template = str_replace(”<<<secret>>>”,$secret,$template);

$template = str_replace(”<<<pageextension>>>”,”4?.substr($extension,1),$template);

file_put_contents(”/tftpboot/SEP”.$mac.”.cnf.xml”,$template);

}

And finally we add the voicemail account:

function add_voicemail($name,$extension,$email){

$template = file_get_contents(”/etc/asterisk/voicemail.conf”);

$template .= “\n”.$extension.” => 1234,”.$name.”,”.$email;

file_put_contents(”/etc/asterisk/voicemail.conf”,$template);

}

These functions are really rather trivial but save a world of time when it comes to installing 75 new phones in one fell swoop — or even when you’re attempting to maintain continuity between installations separated lots of time.

I attached the the script to this post as well as some screen shots and config templates (SEPCONF and EXTENCONF) to facilitate setting up your AD objects to allow for automatic phone provisioning.

Enable SNMP on your Cisco Routers to watch SIP and other traffic

October 28, 2008

It’s pretty easy, just ssh (or telnet if you’re crazy) to your router and do this:

# en

# conf t

# snmp-server community YOUR.SNMP.COMMUNITY ro

# access-list 60 permit IP.OF.SNMP.DAEMON

# snmp-server host IP.OF.SNMP.DAEMON YOUR.SNMP.COMMUNITY

# snmp-server enable traps

Now your favourite graphing software should be able to collect all the data you need.

 

Remotely Reboot your Cisco 79xx Phone even with Asterisk PBX

September 5, 2008

Up until a few days ago, I don't think it was possible to reboot a Cisco 7960 or Cisco 7970 remotely, unless you are using Cisco Call manager software. Great, where does that leave us Asterisk users?

The other day I was fortunate enough to be contacted by Dave Gibbons who was also tired of dealing with Cisco to try and find a method to do this. He's gone ahead and made a script that remotely "pushes the buttons" on the phone so it will automatically reboot with a simple command line utility.

His posting on it is located here:
Remotely Reboot a Cisco 79xx Phone (without SIP NOTIFY)

The gist of it is:

1. Read the information on the Voip-Info wiki, about pushing XML services to your Cisco 79xx phone. This information can be found here.

2. Download David's script, which I've mirrored Locally on our servers to help spread the abilities.

File is located here: Remote Reboot Cisco 79xx PHP Script

3. Unzip the contents of said file to your local webserver that has access to your phones. We put it in /var/www/cisco/reboot.php

4. Now, you will need to modify the script to include your phone information, by changing the following lines:

$username = "jf903jsmfld93";
$password = "94jisdnhjdyw2euha";

5. To run the script is quite simple, just give it the extension, and the action.

# php reboot.php <extension> reboot

like this

# php reboot.php 8080 reboot

6. That's it. You should see the services window popup on the phone, and then a few seconds later it'll reset itself.

Thanks for the great script David, we hope to see many ideas stem from this since Cisco is no help to us Asterisk users.

Registering to Asterisk Behind Cisco Routers

March 31, 2008

Tonight a buddy and myself were playing with Asterisk. In order for him to be able to register to my server from outside my network we had to make some changes to my router. I am behind a Cisco 2650 Router, and we had to disable this in IOS:

no ip nat service sip udp port 5060

Note, that once this is disabled, you will no longer be able to register out to other Asterisk Servers until you re-enable it with.

ip nat service sip udp port 5060

Cisco 79xx (7940/7960/7970) and Asterisk in Harmony?

March 3, 2008

A little sensationalist? Yeah, probably. But, I must admit that I have a Cisco 7970 sitting here in the office and it works great with my setup. I've also setup these phones for clients and they love them as well. As long as you're willing to spend some time tinkering with Asterisk and the SIP Editions of the Cisco Phones you can get some great performance.

Recently on the Asterisk-Users mailing list there has been some back and forth about setting these phones up, and (C) Matthew Rubenstein was kind enough to post a big list of some links on Voip-Info so I thought I'd post them here for archives sake. Post more in the comments if ya got'em!

The documentation of how to use the 79xx series' phones and features
with Asterisk is really hard to find and put together. The higher end
phones like 7970 are more like converged PC+phone, a thin client to
telephony and network apps. But it's really hard to target it as a
development and deployment platform because the docs and techniques are
so obscure.

There seems to be a fair amount of experts in this asterisk-users list.
And there is a fair amount of info in lots of different voip-info wiki
pages (and elsewhere, including the Cisco website labyrinth). If people
in this discussion could update the wiki pages with current and more
complete info, others (like me, with less info to contribute but willing
to edit for usability) could revise the wiki pages to be more accessible
and less redundant/isolated. Announcing wiki revisions on this -users
list also makes them easier to find, especially since it gives Google
two pages to find.

The wiki pages (there are more which at least mention some detail
relevant to a 79xx phone; please link them together if you add info to a
different one):

Cisco
http://www.voip-info.org/wiki/view/Cisco

Cisco phones
http://www.voip-info.org/wiki/index.php?page=Cisco+Phones

Cisco Phones Table
http://www.voip-info.org/wiki/view/Cisco+Phones+Table

Cisco Phone Headsets
http://www.voip-info.org/wiki/view/Cisco+Phone+Headsets

Asterisk phones
http://www.voip-info.org/wiki/index.php?page=Asterisk%20phones

cisco 79xx
http://www.voip-info.org/wiki/index.php?page=cisco+79xx

Asterisk phone cisco 79xx
http://www.voip-info.org/wiki-Asterisk+phone+cisco+79xx

Covad Voip phone Cisco 79xx
http://www.voip-info.org/wiki/index.php?page=Covad+Voip+phone+cisco+79xx

Configuring Cisco 12SP phones with Asterisk
http://www.voip-info.org/wiki/view/Configuring+Cisco+12SP+phones+with
+Asterisk

Cisco 7905/7912 IP Phones
http://www.voip-info.org/wiki/view/Cisco+7905%252F7912+IP+Phones

Cisco 7940 7960 Single Step Upgrade
http://www.voip-info.org/wiki/index.php?page=Cisco+7940+7960+Single+Step
+Upgrade

Cisco 7940 7960 upgrade to version 7.x
http://www.voip-info.org/wiki/view/Cisco+7940-7960+upgrade+to+version
+7.x

Firmware issues on 7940 - 7960
http://www.voip-info.org/wiki/index.php?page=Firmware+issues+on+7940
+-+7960

Setup SiP on 7940 - 7960
http://www.voip-info.org/wiki/index.php?page=Setup+SiP+on+7940+-+7960

Asterisk phone cisco 7970 SIP
http://www.voip-info.org/wiki/view/Asterisk+phone+cisco+7970
+SIP&view_comment_id=11255

Asterisk phone cisco 7970 SIP
http://www.voip-info.org/wiki/view/Asterisk+phone+cisco+7970+SIP

Cisco 7940-60 disassembly
http://www.voip-info.org/wiki/view/Cisco+7940-60+disassembly

SCCP
http://www.voip-info.org/wiki/view/SCCP

SCCP HOWTO2
http://www.voip-info.org/wiki/index.php?page=SCCP-HOWTO2

Asterisk SCCP channels
http://www.voip-info.org/wiki/index.php?page=Asterisk+SCCP+channels

chan sccp2
http://www.voip-info.org/wiki/view/chan_sccp2

Asterisk Skinny channels
http://www.voip-info.org/wiki/edit.php?page=Asterisk+Skinny+channels

Asterisk Cisco 79XX XML Services
http://www.voip-info.org/wiki/view/Asterisk+Cisco+79XX+XML+Services

Cisco 79XX XML Push
http://www.voip-info.org/wiki/view/Cisco+79XX+XML+Push

Asterisk phone cisco 79x1 xml configuration files for SIP
http://www.voip-info.org/wiki/view/Asterisk+phone+cisco+79x1+xml
+configuration+files+for+SIP

Cisco 7940-7960 auto-answer config
http://www.voip-info.org/wiki/view/Cisco+7940-7960+auto-answer+config

Cisco 7940-7960 Daylight Savings
http://www.voip-info.org/wiki/view/Cisco+7940-7960+Daylight+Savings

Asterisk Linksys NSLU2
http://www.voip-info.org/wiki/view/Asterisk+Linksys+NSLU2

Asterisk Manager AM-WEB
http://www.voip-info.org/wiki/view/Script+to+page+mixed+SIP+%252F+SCCP
+system

Script to page mixed SIP / SCCP system
http://www.voip-info.org/wiki/view/Script+to+page+mixed+SIP+%252F+SCCP
+system

QoS Cisco - voip-info.org
http://www.voip-info.org/wiki/view/QoS+Cisco

Standalone Cisco 7941/7961 without a local PBX
http://www.voip-info.org/wiki/view/Standalone+Cisco+7941%252F7961
+without+a+local+PBX

Asterisk Cisco CallManager Express Integration - voip-info.org
http://www.voip-info.org/wiki/view/Asterisk+Cisco+CallManager+Express
+Integration

Exposing the Cisco Call Manager License Scam
http://www.voip-info.org/wiki/view/Exposing+the+Cisco+Call+Manager
+License+Scam

Cisco POE
http://www.voip-info.org/wiki/index.php?page=Cisco+POE

SSH with PuTTY to Cisco IP Phone
http://www.voip-info.org/wiki/view/SSH+with+PuTTY+to+Cisco+IP+Phone+

(C) Matthew Rubenstein

Bottom