How to manage a cisco IP phone from the CLI?
I have a Cisco 7945 IP phone and I want to control it from my CLI. For example, I want to run a command like
call start 12345 #12345 is the number I want to call
or
call cancel
Does anyone know a tool or something similar?
I am writing a rails application and I want to start calling from the application after a certain action.
source to share
The 7945 has a web interface that allows authenticated users to execute commands, including the "Dial" command.
Your rails app will connect to phone in http://phone-ip-address/CGI/Execute
and out POST
XML which looks like this:
<CiscoIPPhoneExecute>
<ExecuteItem URL="Dial:12345" />
</CiscoIPPhoneExecute>
Authentication is done using HTTP Basic Auth, and the background authenticator is determined by which phone system your 7945 is connected to. If Cisco Call Manager uses custom assigned Call Manager information.
Search IP telephony service directories on cisco.com for more information. Quick links:
Short answer: this is not a CLI, but simply to program the dialer to interact with the phone over HTTP.
source to share
I know this is an old thread, but I thought I'd post this example working code in Ruby. Tested on CP-8941 phone. The username and password scheme will be different. Our system is configured to interact with Active Directory, so the username and password is the Windows login.
require "net/http"
require "uri"
phone = "ip-of-your-phone"
user = "your-username-goes-here"
secret = "your-password-goes-here"
prefix = "91"
todial = "number-to-dial-goes-here"
uri = URI.parse("http://#{phone}/CGI/Execute")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
request.basic_auth(user, secret)
request.set_form_data({"XML" => %(<CiscoIPPhoneExecute><ExecuteItem URL="Dial:#{prefix}#{todial}" /></CiscoIPPhoneExecute>) })
response = http.request(request)
source to share