JavaScript Remote Call Center Solution: Part 2
March 24th, 2011 by Mark HeaddIn the previous post on this project, I walked through a portion of the JavaScript remote call center solution focusing on CouchDB, the CouchApp serving web pages to remote agents and the Phono SDK.
In this screencast, I will show you how to connect Asterisk to your CouchDB instance using Node.js.
When our solution is in place, inbound calls to our virtual call center may come in through Asterisk. When a call comes in, we will connect to a Node.js script that is acting as an Asterisk Gateway Interface application.
This Node.js script will query our CouchDB server and provide Asterisk with the SIP address for an agent who has Phono loaded and is ready to take an inbound call.
Simple, right? Node.js makes it easy.
Resources
Note, when invoking the Node.js script referenced in this screencast, you may pass in up to 4 parameters to control default settings:
- The host running the instance of CouchDB holding agent identifiers (defaults to 127.0.0.1).
- The bind port for your CouchDB instance (default port is 5984).
- The host that the Node.js TCP server script should bind to (defaults to 127.0.0.1).
- The bind port for the Node.js TCP server script (defaults to 4573, the default port for Asterisk AGI).
So, for example, to designate different servers for my instance of CouchDB and my Node.js TCP script:
node path/to/node/lookup.js 192.168.1.200 5984 192.168.1.201 4573
All of the components in this solution may be run on the same server, on separate servers or even a mix of cloud-based and premise based components. The choice is completely up to you.
If you want to install a local instance of Asterisk, you can download the latest version from here. (Note, I’m using Asterisk 1.8 in this screencast.) If you’re running Ubuntu, you can simply do:
sudo apt-get install asterisk
The “extensions.conf” file discussed in the screencast can be found in the /etc/asterisk directory.
If you’d rather not run your own instance of Asterisk, you can skip this step. In the next segment of this series, we’ll be using the Tropo platform (specifically, the AGItate application) as a proxy for our Asterisk server.
Stay tuned!
No related posts.
Tags: asterisk, couchapp, couchdb, javascript, nodejs

RSS Feed
March 25th, 2011 at 11:01 am
Thanks for the great post!
I had to modify slightly lookup.js to work in my system – I am not sure why … I am running Ubuntu 10.04 desktop.
Original was: // Lookup extension to transfer call to. var request = http.request(couchDBOptions); request.end();
In my system I needed: // Lookup extension to transfer call to. var client = http.createClient(cochDBPort, cochDBHost); var request = client.request(‘GET’, ‘/remoteagent/_design/remoteagent/_view/ready?group=true&limit=1′, {‘host’: cochDBHost}); request.end();
April 9th, 2011 at 2:38 pm
Awesome. A completely web-based call center would be amazing.
p.s. For your next video, you should exit skype. Those little notifications during the video were driving me crazy.
April 9th, 2011 at 7:44 pm
Clint:
Apologies, you’re exactly right. I hear Skype bleeping at me so much all day that I sometimes forget to turn it off before recording.
Glad you enjoyed the project!