08-19-2005 12:19 PM - edited 03-13-2019 10:12 AM
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?
08-22-2005 09:00 AM
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.
09-22-2013 11:46 PM
Hi avanq2004,
How do you put the serial number as a description? will ip phone pass this piece of info to the call manager?
09-24-2013 02:15 AM
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
09-24-2013 01:35 PM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide