A sample nodejs project for implementing a "blast dial" feature using the CMS API.
The auto-dial service exposes an HTTP API that can be used to configure what remote destinations are associated with a space. The API lives at /api/configs
on port 8444
To create a new config POST
/api/configs
To modify an existing config PUT
/api/configs/<id>
To delete a config and start over DELETE
/api/configs/<id>
To view a config GET
/api/configs/<id>
To view all configs GET
/api/configs
The configs
node accepts a JSON object during POST
and PUT
operations :
{
"cospace":"String",
"participants":[Array]
}
If you have an existing nodejs and mongodb environment:
- Clone the repo
git clone https://github.com/ciscocms/auto-dial.git
- Install the node modules used in the project
npm install
- Edit
config.js
with your deployment specific details - Alternately you can set the following environment variables to configure the service.
CMS_HOST
CMS_API_USERNAME
CMS_API_PASSWORD
API_PORT
MONGO_HOST
E.g.;export CMS_HOST="cms.empire.net:444"
- Start the service
node app.js
- In Webadmin add a CDR receiver that points to the host running the service on the port you specified in
config.js
http://ip:port/api/cdr
- Identify a space that you would like to target for the auto-dial function
- Retrieve the space GUID from the CMS API. You can use a browser and simply browse to
https://ip:port/api/v1/cospaces?filter=vader
You'll get back a cospace object that has a GUID
<coSpaces total="1">
<coSpace id="4855289f-0ae9-4253-af1a-c8f5f12eb596">
<name>Vader's Space</name>
<autoGenerated>false</autoGenerated>
<uri>vaders.space</uri>
<callId>333879826</callId>
</coSpace>
</coSpaces>
POST
tohttp://ip:port/api/configs
with the space GUID and an array of URIs that you want to be dialed when the space generates acallStart
CDR record
{
"cospace":"4855289f-0ae9-4253-af1a-c8f5f12eb596",
"participants":["tarkin@empire.net", "krennic@empire.net"]
}
curl
as an API client
- Create a config -
curl -X "POST" "http://ip:port/api/configs" -H "Content-Type: application/json; charset=utf-8" -d $'{"cospace": "4855289f-0ae9-4253-af1a-c8f5f12eb596","participants": ["r2d2@hoth.org"]}'
- Get a config
curl "http://ip:port/api/configs/<id>"
- Delete a config
curl -X "DELETE" "http://ip:port/api/configs/<id>"
- The project includes a Vagrantfile to speed up the deployment
- The Vagrantfile includes a shell provisioner for Debian
- You'll need to modify
config.vm.box = ""
to match a Debian box that you already have or you can download a new one. The project is built on Debian jessie - The default networking mode is
public_network
"bridged". Modifyconfig.vm.network
as needed for your environment