rooms

CISCO xAPI - GET and PUT Requests

I refer to myself as a “cut-&-paste programmer” - I know enough to be dangerous. Google is an excellent source of information and, if you understand the basics, you can piece together code to do almost anything. So - here we go….

This first blog is to just set the stage for using VBScript and the xAPI to interact with a CISCO endpoint. I am accessing the CISCO endpoint API using HTTPS - CISCO refers to it as XMLAPI. With this API you use POST requests to tell the endpoint to do something or to change a configuration and GET requests to get configuration or status information from the endpoint.

For either POST or GET - your script makes a connection to the endpoint, authenticates and returns the results.

Steps involved in VBScript:

Endpoint Info for Examples
Endpoint IP - 192.168.2.11
Authentication User - apiuser
Authentication Password - supersecretpassword

  1. Create the Msxml2.ServerXMLHTTP.6.0 object

  2. Open the connection to the endpoint using either POST or GET

  3. Set the Request Headers

  4. Send the API Commands

  5. Display the response

The script examples below are very basic and do not do any formatting of the responses so you can get an idea of what is sent to the endpoint and what the results look like.

XML POST REQUEST EXAMPLE

This is an script that uses a POST request to initiate a call from the endpoint to the BlueJeans Test Site.

The API commands are XML formatted.

<Command><Dial>
<Number>111@199.48.152.152</Number><Protocol>SIP</Protocol>
</Dial></Command>

The API commands can be found on the support.cisco.com site or by browsing to the commands.xml page from the endpoint.

https://<endpointIP>/command.xml

'====  EXAMPLE FOR MAKING A CALL ====
'1. Create the XMLHttp Object
Set xmlHTTP = CreateObject("Msxml2.ServerXMLHTTP.6.0")
'2. Make the Connection to the Endpoint
xmlHTTP.setOption 2, 13056 'Required to ignore certificate errors
xmlHTTP.Open "POST", "https://192.168.0.1/putxml", false, “apiuser”, “supersecretpassword”
'3. Set the Request Header
xmlHTTP.setRequestHeader "Content-Type", "text/xml"
'4. Send the API commands
xmlHTTP.send "<Command><Dial><Number>111@199.48.152.152</Number><Protocol>SIP</Protocol></Dial></Command>"
'5. Display the Response from the API command
MsgBox xmlHTTP.responseText

xml POST RequesT Example

This is example of a scripted POST request that will return whether the endpoint is muted or not.

You can see the open request is a GET and includes the path to the status information you want, in this case the status of the Microphones.

For a list of the all of the status information you can collect off the endpoint - you can get the status.xml page from the endpoint in a browser.

https:/<endpointIP>/status.xml

'==== EXAMPLE FOR CHECKING MUTE STATUS ====
'1. Create the XMLHttp Object
Set xmlHTTP = CreateObject("Msxml2.ServerXMLHTTP.6.0")
'2. Make the Connection to the Endpoints
xmlHTTP.setOption 2, 13056 ' Required to ignore certificate errors
xmlHTTP.Open "GET", "https://192.168.2.11/getxml?location=/Status/Audio/Microphones", false, "apiuser","supersecretpassword"
'3. Set the Request Headers
xmlHTTP.setRequestHeader "Content-Type", "text/xml"
'4. Send the API Commands
xmlHTTP.send
'5 Display the Response from the API command
MsgBox xmlHTTP.responseText

You will see the the msgbox at the end of the script shows the XML representation of the status of the microphones including the Mute value.

In the image of the msgbox here - you can see Mute is ON.



muteSTATUS.png

Controlling CISCO DX80 with the xAPI

I have been using the new CISCO DX80 for some time now it works great for video calling, as well as, the primary display for my computer.  I had a bit of trouble with the focus of the camera but new firmware and better light it seems to be working well now.

dx80.jpg

While the unit is great - I have struggled a bit with the interface particularly as a busy Tech Guy. This series of blogs will cover some simple tasks I have attempted to automate with the CISCO xAPI that are a little clunky with the DX80.

Most of these will work with any CISCO endpoint but most of the testing was done with a CISCO DX80 and EX90!

The following are some of the functions that I have automated with some pretty simple VBScript on my laptop.

  • Mute/UnMute - This was the first function I wanted to automate. There is a physical button to mute/un-mute but I wanted to do it using a keystroke on my computer.

  • Dialing - This was my biggest pet peeve! I use the DX80 as my primary display. When I open an Outlook meeting invitation with the Virtual Meeting Room (SIP address) in it and touch the screen on my DX80 to dial the address - the on-screen menu displays over top of my Outlook invite so I can’t see the dialing instructions…

  • Pull live call statistics - This was just something I was interested in doing as a network guy.

As mentioned above - I am doing most of this with VBScript but will also share a short post that shows how to send these commands from a Mac using CURL.

For an excellent source of information on the CISCO xAPI - check out the following:

https://developer.cisco.com/site/roomdevices/

Hope you enjoy this series…

Colin