|
| 1 | +# Exploring on-board xAPI Macros for Cisco collaboration devices |
| 2 | + |
| 3 | +## Objectives |
| 4 | + |
| 5 | +Learn about the JavaScript 'macro' capabilities for running custom code onboard Cisco CE collaboration devices. |
| 6 | + |
| 7 | +In this lab you will learn about the use-cases, capabilities and limitations of macros, including hands-on deploying and coding a few simple sample macro applications: |
| 8 | + |
| 9 | +* Deploy and run a simple macro app |
| 10 | +* Experiment with a macro application interacting with CE device custom in-room controls |
| 11 | +* Make external HTTP API requests from macro code |
| 12 | + |
| 13 | +## Prerequisites |
| 14 | + |
| 15 | +* A Cisco collaboration device with the following requirements: |
| 16 | + - Cisco DX, SX (except SX10), MX, RoomKit, or Webex Board |
| 17 | + - Running the _Cisco Collaboration Endpoint CE v9.6+_ version of software |
| 18 | + - Registered to the Cisco Webex cloud platform, or to an on-premise Cisco Unified Communications Manager (CUCM) or Cisco Video Control Server (VCS) |
| 19 | + |
| 20 | + Alternatively, you can use one of the [RoomKit Sandboxes](https://github.com/CiscoDevNet/awesome-xapi#sandboxes) offered to DevNet community members free of charge. |
| 21 | + |
| 22 | +* Admin credentials to your device, if it's on-premise registered. If cloud-registered, you need admin access to the [Control Hub](https://admin.webex.com/login) of the organization to which your device blongs. |
| 23 | + |
| 24 | +* Laptop with local or VPN IP connectivity to your device, and the following software tools, recommended: |
| 25 | + - SSH: Mac/Linux (built-in); Windows - [PuTTY](https://www.putty.org/) |
| 26 | + |
| 27 | +**We recommend that you complete the following labs prior to attempting this one:** |
| 28 | + |
| 29 | +* [Introduction to xAPI for Cisco collaboration devices](https://learninglabs.cisco.com/lab/collab-xapi-intro/step/1) |
| 30 | +* [Customizing collaboration devices from code](https://learninglabs.cisco.com/lab/collab-xapi-branding/step/1) |
| 31 | +* [Creating custom in-room controls and xAPI apps](https://learninglabs.cisco.com/lab/collab-xapi-controls/step/1) |
| 32 | + |
| 33 | +## Step 1: About CE customization with xAPI |
| 34 | + |
| 35 | +If you’re new to CE device customization and xAPI, here are a few starting points: |
| 36 | + |
| 37 | +- Your Cisco collaboration device includes an API - known as **xAPI** - that allows bi-directional communication with third-party applications and control systems, such as those from AMX or Crestron |
| 38 | +- There are multiple ways to access xAPI: Telnet/SSH, HTTP, RS-232 serial connection, and via JavaScript using the jsxapi package. Regardless of the method you choose, xAPI has the same general format and behaves similarly |
| 39 | +- In this lab, we’ll focus on running jsxapi based applications using macros |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +>Note: the exact set of customization and xAPI features and supported devices vary depending on the model and version of CE. Please check the [Cisco TelePresence CE software Release Notes](https://www.cisco.com/c/dam/en/us/td/docs/telepresence/endpoint/software/ce9/release-notes/ce-software-release-notes-ce9.pdf) for the complete list of supported devices. |
| 44 | +
|
| 45 | +### Macro overview |
| 46 | + |
| 47 | +In November 2017, CE 9.2.1 introduced a powerful **macro** engine for on-premise devices. Macros provide a JavaScript run-time environment on board the collaboration device itself, where code that can automate or change parts of the video endpoint behavior can run - avoiding the need to deploy a separate application server or have users interact with a separate control system or UI beyond the collaboration devices standard (extensible) interface (Touch10 or DX on-screen.) |
| 48 | + |
| 49 | +CE 9.6 extended macro functionality to cloud-registered devices, as well as adding HttpClient capabilities for interacting with external REST-like APIs. |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +### Node.js xAPI library for JavaScript: jsxapi |
| 54 | + |
| 55 | +In January 2018, the 'jsxapi' Node.js package was [released on npm](https://www.npmjs.com/package/jsxapi), and via an [opensource project on GitHub](https://github.com/cisco-ce/jsxapi). This library wraps xAPI functionality in an easy-to-use Node.js package for server-side JavaScript developers. |
| 56 | + |
| 57 | +The on-board JavaScript runtime environment for macros provides and exposes this jsxapi package for use by scripts, with functionality identical to the NPM package. Apps written for server-side Node.js using jsxapi should be easily portable to the macro environment with minimal changes (notwithstanding the caveats below...) |
| 58 | + |
| 59 | +### Macro environment limitations |
| 60 | + |
| 61 | +While collabation devices have powerful onboard CPU processing capabilities, it is important that these devices protect resources needed to run the high-quality video and collaboration functions they were designed for. As a result, the macro runtime environment for onboard JavaScript apps has some important limitations for security and performance assurance: |
| 62 | + |
| 63 | +* No access to local storage or file systems |
| 64 | +* No ability to install external packages into the JavaScript environment (e.g. via NPM) |
| 65 | +* Certain limitations on the number of macros configurable, memory available, and CPU usage |
| 66 | +* No access to native JavaScript networking capabilities, with the exception of: |
| 67 | +* HttpClient functionality, which is limited to POST/PUT and response status code only (more on this in a bit) |
| 68 | + |
| 69 | +>Interesting fact: the macro runtime environment is based on the [Duktape](https://duktape.org/) embeddable JavaScript engine |
| 70 | +
|
| 71 | +### xAPI documentation |
| 72 | + |
| 73 | +For more details about installation, configuration and extensibility via xAPI, refer to these guides: |
| 74 | + |
| 75 | +- [Docs for DX70 and DX80](http://www.cisco.com/go/dx-docs) |
| 76 | +- [Docs for MX Series](http://www.cisco.com/go/mx-docs) |
| 77 | +- [Docs for SX Series](http://www.cisco.com/go/sx-docs) |
| 78 | +- [Docs for Room Series (RoomKit and Codec Plus)](http://www.cisco.com/go/roomkit-docs) |
| 79 | +- [Docs for Webex Boards](https://www.cisco.com/c/en/us/support/collaboration-endpoints/spark-board/tsd-products-support-series-home.html) |
| 80 | +- [Getting Started Guide](https://www.cisco.com/c/dam/en/us/td/docs/telepresence/endpoint/ce95/dx70-dx80-sx10-sx20-sx80-mx200g2-mx300g2-mx700-mx800-room-kit-getting-started-guide-ce95.pdf) for DX, MX, SX, and Room Series |
| 81 | + |
| 82 | +Note that these guides primarily apply to on-premise registered devices - cloud registered devices may support a more limited set of features depending on model CE version. We’ll cover some of these differences in the next sections. For now, note that you’ll find additional documentation for cloud-registered devices at [Collaboration Help](https://collaborationhelp.cisco.com/article/en-us/jkhs20). |
| 83 | + |
| 84 | +To keep up to date with CE and xAPI developments, you may want to check the [Cisco Collaboration Endpoint software - CE9 release notes](https://www.cisco.com/c/dam/en/us/td/docs/telepresence/endpoint/software/ce9/release-notes/ce-software-release-notes-ce9.pdf) on a regular basis. |
0 commit comments