cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

AMA-CUCM Troubleshooting: Best Practices for Reading Trace Files

2072
Views
0
Helpful
4
Replies
Highlighted
Beginner

Looking for script to get Cisco IP phone serial numbers

I know there is no easy way to get serial numbers but I have seen several posts saying to write a script to connect to a phone's webpage and collect the serial number.

Does anyone actually have an example of a script they are using?

4 REPLIES 4
Beginner

Re: Looking for script to get Cisco IP phone serial numbers

this is not very efficient but you can put the serial number as the Description and use BAT to do a report based on description.

Beginner

Re: Looking for script to get Cisco IP phone serial numbers

Hi avanq2004,

How do you put the serial number as a description? will ip phone pass this piece of info to the call manager?

Rising star

Re: Looking for script to get Cisco IP phone serial numbers

No it won't. CUCM has no knowledge of a phone serial number.

There are some 3rd party apps that do allow you to do this (UnifiedFX from memory is one). I also have a perl script that will do this for you. It's ugly but it works (at least it did last time I tested it).

The perl script looks like:

#!/usr/bin/perl

$argument1 = $ARGV[0];

use LWP::Simple;

$website_content = get($argument1);

open LOGFILE, ">log.file";

print  LOGFILE $website_content;

close LOGFILE;

This connects to the web server on the phone, captures the home page, and writes to a file called "log.file". The IP address of the phone is passed to the script. The home page served by the phone contains the serial number.

I then have a wrapper which calls the perl script, which I have written in a language called REXX - simply because my Perl is appalling.

/* */

perl_exe="c:\strawberry\perl\bin\perl.exe"
perl_file="c:\strawberry\perl\bin\web.pl"
file_name="c:\strawberry\perl\bin\log.file"

do i = 12 to 41
  target="10.150.108."||i
  ping target "-w 1000 -n 3 > DUMMY"
  if rc=0 then do
     webtarget="http://"||target
     perl_exe perl_file webtarget
     do while lines(file_name) > 0
        s=""
        junk = linein(file_name)
        s=s||junk
     end
     parse var junk . "Serial Number" rest
     parse var rest . "" Serial_Number "" rest
     say Serial_Number
     rc = stream(file_name, "c", "close")
  end
  else do
  end
end
fs

So the attached scans IP Addresses 10.150.108.12 -> 41. It pings them first, and if they respond calls the Perl stub to capture the web page. The REXX wrapper then goes through the file, and looks for the starting "Serial Number" and extracts it.

As I say, ugly, but it works.

HTH

Barry Hesk
Intrinsic Network Solutions

Rising star

Re: Looking for script to get Cisco IP phone serial numbers

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards