PagerDuty Blog

Triggering an alert from a phone call (code sample)

I get a lot of requests to handle & escalate phone calls as well as alerts from monitoring systems. Here’s a code sample that lets you hand out a phone number, let the caller record a message and have that message escalate just like a normal PagerDuty alert. As an added bonus, most smartphones will let you hear the message and call the user back from the SMS.

We have regular hackdays at PagerDuty, where we build things outside the core product without management (another reason you should work here). A few weeks ago, I rolled out a proof of concept Google App Engine script to use Twilio to record a voicemail and then to pass it around like a regular alert. Triggering alerts from phone calls hasn’t made it’s way on to the development roadmap, so I’m sharing this code sample as a work around for our more technically inclined users — so all the usual caveats and disclaimers apply, namely that our SLAs don’t apply.

Twilio will happily turn a phone call into an MP3 and give us a link to it (which means to get this to work you’re going to need to sign up for a Twilio account as well as a Google App Engine account). We then use Google’s URL shortener to shrink the URL into something that will fit in an SMS — all modern smart phones can figure out what to do with that.

End result, assuming you have SMS contact methods set up, they’ll receive an SMS like:

ALRT #145 on Phone in: http://goo.gl/UMmDx +14153490382 Reply 4:Ack, 6:Resolv.

If you’re comfortable deploying code, it’s up on https://github.com/eurica/PagerDutyCallDesk