Command line dialing on Cisco 7940/7960 IP Phone

I decided to share my perl script which I am using to dial numbers on my Cisco 7960 from command line. It can be used for integration with callto:// links, PIM or just to dial from console. To dial script using telnet interface on the phone, so it must be enabled. Script using “test” which emulates buttons on the phone. Pause between commands is required to work correctly, without it phone will go mad.


use Net::Telnet;
use Time::HiRes;

# cisco phone host name
my $host='';
# cisco phone password
my $password='cisco';
# mute on a dial 0/1
my $mute=0;

my $sleeptime=.2;
my $prompt='/> $/';

my $argc = @ARGV;
if ($argc!=1){
    print "Usage: <number>\n";
my $number=@ARGV[0];

if($number!~/^[0-9*#]+$/) {
    print "Error: wrong characters in the numer\n";
    exit 2;
$telnet = new Net::Telnet ( Timeout=>3, Errmode=>'die');
# connecting
$telnet->waitfor('/Password :$/i'); 

$telnet->print('test open');
$telnet->print('test key spkr');
    $telnet->print('test key mute');
$telnet->print("test key ".$number."#");
$telnet->print('test close');
Tagged , , ,

7 thoughts on “Command line dialing on Cisco 7940/7960 IP Phone

  1. Thank you … that’s what i search

  2. Weiss Benjamin says:

    I added the following two lines to delete blanks and replace ‘+’ with ’00’.

    $number =~ s/[ ]| //gi;
    $number =~ s/[+]/00/g;

    With the following AppleScript I can now make calls directly from my Mac OS X Address Book.

    using terms from application “Address Book”
    on action property
    return “phone”
    end action property

    on action title for aPerson with phoneNumber
    return (“Call ” & (value of phoneNumber as string))
    end action title

    on should enable action for aPerson with phoneNumber
    return true
    end should enable action

    on perform action for aPerson with phoneNumber
    do shell script “perl /my/script/location/ ‘” & (value of phoneNumber as string) & “‘”
    end perform action
    end using terms from

    Works like a charm. Thanks for your work.

    • sammczk says:

      Thank you for your comment ) Yes, it could be used for different purposes, including callto links, dialing from PIM or integration with CRM, for example. I am glad that it is also helpful for MacOSX users.

  3. Weiss Benjamin says:

    A little bit more elegant:

    # Replace first ‘+’ with ’00’ and delete everything else but Numbers, ‘*’ and ‘#’
    $number =~ s/[+]/00/;
    $number =~ s/[^0-9*#]//g;

  4. […] Continue reading here: Command line dialing on Cisco 7940/7960 IP Phone « smallhacks […]

  5. […] script will dial into bridge and then enter conference id + # sign. For the Cisco 7940/7960 users my old script with minimal changes should work […]

  6. […] now we need to add the PERL script that will do the dialling. I pinched this from smallhacks which is an excellent guide. Click here to see the original post, and thanks to smallhacks for it. […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: