// Blog

Making Twilio Call Recordings Searchable

Originally published on the Clarify.io blog. View archived copy.

“This call may be recorded for quality assurance.”

You’ve heard it a thousand times but how often is it true? How often does a company record those calls? More importantly, what do they do with those recordings?

Many organizations don’t do anything with the recordings. They go into the giant network storage in the sky to collect digital dust. Other organizations attach the recordings to customer records along with some notes and call it a day. Finally, other organizations are investing in making these calls searchable, collecting common words, and trying to identify common threads of problems earlier.

So how can you accomplish the same without spending millions of dollars and months of effort?

The easiest way is to integrate your call recording system directly with Clarify. In fact, if you use a system like Twilio – which has Recording Callbacks – you can make the indexing near-realtime with almost no effort.

Install Twilio & Clarify libraries

Our first step is getting the helper libraries for both Twilio and Clarify. Luckily, through the power that is Composer, we can do that with a simple configuration file and single command. Here’s our composer.json:

and then we run composer install which will configure our libraries automatically.

Next, we need to accept the incoming phone call and record it. This can be accomplished with a trivial amount of TwiML (or Twilio XML) to greet the caller and record:

Using the Recording Webhook

The key aspect of that snippet is the action attribute on the Record TwiML. Once the recording is completed, Twilio will make an HTTP POST to the file specified in it. In addition to the regular call information we receive – To and From for example – the POST will also include a RecordingUrl. That gives us the next step: audio indexing.

In this case, we’ll collect those three parameters – To, From, RecordingUrl – and pass them into Clarify. The RecordingUrl takes the place of our media url and is parsed accordingly. On the other hand, we use the To and From information in our metadata field. As Ivo talked about in “Searching Audio and Video Metadata” earlier this week, we can use this information to do advanced searches and even filtering. By inserting the To and From information, we can build a query that says “show me every time anyone from this number said this word.” If we wanted, we could query a CRM and add even more information to our metadata fields.. but that’s beyond the scope of this post.

Embedding the Clarify Audio Player

From here, we our stock audio player from Github and plug in our PHP helper library and our API key and in minutes we have a player that looks like the screencap below:

Twilio recordings made searchable

How many phone calls does your company make? How many of them are recorded and collect digital dust? We hope to change that and let you open that information to drive new and useful insights and features for your organization. You can explore and continue this project from the Clarify/Twilio on Github.

If you’d like to get in touch, don’t hesitate: keith@clarify.io or @CaseySoftware on Twitter.