Call via the terminal with Cisco IP Phone

Handwritten on 26 Apr 2019

Call via the terminal with Cisco IP Phone

In our office we use Cisco phones all over te place. Since I am not a frequent caller, I always have some trouble dialing a phone number. At those moments I am thinking that I am dialing the wrong number. After all, we all received phone calls that were not meant for us.

Cisco phones have the possibility to consume requests and execute a command internally. This means we can send a XML request to the IP address of the phone. Execution of this XML message is done immediately, so after posting the request you can pick up the phone of the hook.

Sample XML message:

<CiscoIPPhoneExecute>
  <ExecuteItem Priority="0" URL="Dial:00316424xxxxx"/>
</CiscoIPPhoneExecute>

The above XML envelope needs to be sended as x-www-form-urlencoded with the key XML. The URL pattern that you can use to post data is:

// Sample IP Address: 192.168.1.10
http://192.168.1.10/CGI/Execute

Free Tip: you can also POST requests via Postman or Insomnia.

To make this request via the Terminal it would look like this:

curl -X POST \
  http://<IP>/CGI/Execute \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'XML=<CiscoIPPhoneExecute><ExecuteItem Priority="0" URL="Dial:00316424xxxxx"/></CiscoIPPhoneExecute>'

At this point you would think dialing manually a number is still fast, I agree! But we can make a bash script of this request. You can save this command in a call.sh file somewhere in your path:

#!/bin/bash

// You can see that the phone number will be passed as an argument here: $1
curl -X POST \
  http://10.0.5.5/CGI/Execute \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'XML=<CiscoIPPhoneExecute><ExecuteItem Priority="0" URL="Dial:'$1'"/></CiscoIPPhoneExecute>'

Now, when you want to make a phone call, you can type:

sh call.sh 00316424xxxxx

Happy ringing 📞

cisco terminal

© 2019 Handcrafted in Nijmegen