This article was originally posted on the Telestax blog as “How I Became a Rockstar Thanks to Telestax and Voxbone”
I was going to title this article “How I Became a Rockstar Thanks to Telestax and Voxbone” because this is really what happened. For clarity’s sake though, I used a more generic title.
I walked in the 2015 TADHack London hackathon with the only goal in mind to create something using a Voxbone (the company I work for) product and Telestax’s Restcomm AMI. I ended up winning a prize and became a “rockstar” for a day, all thanks to these two main technologies I used for this hack.
This 4-to-5 parts series will cover how I built this hack with close-ups on each technology and API I used. I’ll try to keep it short!
The idea behind the hack was to build an intelligent click-to-call for webpages (embeddable with a small script) that directs the call to the appropriate sales agent based on context. When the call is over, the information (context) gathered from the call is forwarded to the agent’s email/sms along with a link to the voice recording of the call. I called it Smart Dispatch.
How did I get information about the caller? In order to place the call, the client has to log in with LinkedIn and the information on profile is used as the context and sent over the email and sms when the call is over/
How is the call properly dispatched? I created a management platform for the companies embedding the click to call to link their agents to a particular segment pulled from LinkedIn. For example, if the user calling in has ‘Spanish’ as a language (on its LinkedIn profile), then the agent linked to the ‘Spanish’ segment will receive the call. This can be done for country, industry, or even particular companies (for account managers that want to receive calls only from their customers.)
Below I break down the app with the different technologies I used as an overview. Tutorials for each of them will follow in the next parts.
1. Creating the click-to-call with the Voxbone WebRTC-SIP SDK
Voxbone is a SIP trunk provider and sells DIDs (phone numbers) from all over the world. They provide a WebRTC-to-SIP service by sending a WebRTC browser-initated call to a SIP trunk (through one of their phone numbers). The interesting part here is that the Restcomm platform works by receiving SIP call invites so this was the perfect match!
To get this working:
– I used a free iNum from Voxbone and linked it to a SIP URI for testing (later to be replaced by the Restcomm URI).
– Downloaded the Voxbone WebRTC Node.js library and remodeled it as an embeddable script.
– Placed a call!
More info on how to get started with the Voxbone WebRTC-SIP SDK.
2. Gathering information with the Linkedin API and passing the context in the call
The Voxbone WebRTC-SIP SDK has a very useful SIP header called ‘X-Voxbone-Context’ which is passed along in the SIP invite. I used this to place any JSON object I wanted. In this case: information pull from the user’s LinkedIn profile.
When the user logged in, I placed all the useful info from his profile in a JSON object and put it in the context header to be passed along with the call.
More info on how to get started with LinkedIn authentication (I used OAuth Passport for Node.js)
3. Figuring out who to send the call to with the management tool
In order to get the dispatching dynamic, I created a management tool for the agents to be configured to a particular segment. From this management tool, I created a small API for the click to call to pull this information from. Now, every time someone logs in via LinkedIn on the click2call, I know which segment he’s in and can know dynamically who to call.
I also use this platform/API to configure the agent’s phone number and email address to send the info at the end of the call.
4. Forwarding and recording the call with Restcomm
Half of the application is done. I have all the info I need, and know which agent to send the call to. Now I need to send the call to Restcomm to forward it to the agent’s SIP client and record the call.
Since this is a hack, I made the dynamic dispatch on my end before reaching Restcomm. Ideally, I would use Restcomm as the dispatcher based on this info I sent it.
The great thing was that Restcomm was able to read my X-Voxbone-Context header with all the information I placed in it. This way, I could build anything from an IVR to a call-forward(er) based on the info I passed.
My Restcomm flow will be covered in more details later. Below is the overview:
- When call is launched, pass the context header to Restcomm
- IVR reads name and asks to wait for call to be placed
- Sends to call to agent’s SIP phone (this is where I’d like the intelligent dispatch to happen in the future)
- Starts recording the call
- When call ends, it sends me a link to the recording of the call (back to my REST service). So I can process it in my emails/sms
5. Returning info and recording to agent with Nexmo and Mailgun
The hard part is all done now. I’ve got an intelligent call dispatcher that records the call. I can now send an SMS and an email with all the info: Profile info of the caller, URL the caller was looking at, URL of the voice recording of the call, and more!
Since I have my own database with the agents’ information configured, I know where to send all that info. I used Nexmo and Mailgun for that – they are pretty good APIs and were easy to use for the little time I had left to implement these features!
Here’s the info sent over sms to the agent:
Here’s the info sent over email to the agent (with a link to the recording of the call):
Restcomm has the potential to do many more great things, like sending SMS or email from its own platform. All API/SDK I used were very flexible – remember this was all done in under 20 hours!
TADHack was a fantastic experience and I am eager to attend the next one to see what other cool hacks will get out of it!
I look forward to the second iteration of Smart Dispatch and to the following parts of the tutorial.
Look out on twitter @SachaNacar for Part 2, a LOT more code is coming soon!
[UPDATE] Part 2 is here!