Daniel
Daniel

Reputation: 4173

How to control a cisco IP-Phone from the CLI?

I've a Cisco IP-Phone 7945 and I want to control it from my CLI. For example I want to start a command like

call start 12345 #12345 is the number I want to call

or

call cancel

Anybody knows a tool or something similiar?

I'm writing a rails app and I want to start a call from within the app after a certain action.

Upvotes: 4

Views: 11029

Answers (2)

David Carter
David Carter

Reputation: 41

I know this is an old thread, but thought I'd post this working code example in Ruby. Tested on the CP-8941 phone. Username & password schemes will vary. Our system is set up to interface to Active Directory, so the username and password are those of our 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)

Upvotes: 4

Bill
Bill

Reputation: 76

The 7945 has a web interface that permits execution of commands, including a "Dial" command, by authenticated users.

Your rails app would connect to the phone at http://phone-ip-address/CGI/Execute and POST some XML that looks like this:

<CiscoIPPhoneExecute>
  <ExecuteItem URL="Dial:12345" />
</CiscoIPPhoneExecute>

The authentication is done with HTTP Basic Auth and the back-end authenticator is determined by what phone system your 7945 is connected to. If Cisco Call Manager, it uses the assigned Call Manager user information.

Look for the IP Phone Services guides on cisco.com for details. Quick links:

Short answer: it's not a CLI but it is straightforward to program a dialer by interacting with the phone over HTTP.

Upvotes: 6

Related Questions