Prank calling people with Twilio

●2 MIN READ

Prank calling people with Twilio

Confessions of a prankster.

One of my favorite pranks is fake calling people with Twilio, especially when I’m in the same room as them. Fake calling goes like this:

First I pick a target. The only thing I need is his/her phone number and my Twilio account.

Then, I pick the scenario I want to call them with. A scenario is an XML file with a set of instructions of what Twilio should do. An example could be:

<?xml version="1.0" encoding="UTF-8" ?>
<Response>
    <Pause length="2"/>
    <Play>https://urltofile.com/hallo.mp3</Play>
    <Pause length="2"/>
    <Play>https://urltofile.com/naamvanrossem.mp3</Play>
    <Pause length="4"/>
    <Play>https://urltofile.com/wordopgebeld.mp3</Play>
    <Pause length="5"/>
    <Play>https://urltofile.com/helemaalni.mp3</Play>
    <Pause length="3"/>
    <Play>https://urltofile.com/televisie.mp3</Play>
    <Pause length="3"/>
    <Play>https://urltofile.com/voorwatbellen.mp3</Play>
    <Pause length="2"/>
    <Play>https://urltofile.com/manmanmantoch.mp3</Play>
    <Pause length="15"/>
</Response>

In this scenario we tell Twilio to:

  1. Pause 2 seconds (because the other party picks up the phone, they’ll probably introduce themselves first, which takes 2 seconds on average)
  2. Play an MP3 file
  3. Pause another 2 seconds for the other person to reply
  4. etc..

This is far from perfect for obvious reasons, but that’s all we have.

I have around five scenarios to choose from. Different scenarios for different…needs.

1944fo

When I picked the right scenario, I make a simple API call to Twilio or I use the Twilio API explorer to make the call. An example API call (with curl) would be:

curl 'https://api.twilio.com/2010-04-01/Accounts/My Account SID/Calls.json' -X POST \

// the number I want to call
--data-urlencode 'To=+32498112233' \ 

// the number I bought in Twilio
--data-urlencode 'From=+32498445566' \ 

// URL of the XML file with the scenario I want to use
--data-urlencode 'Url=https://website.com/scenario.xml' \ 

// let's record the call!
--data-urlencode 'Record=true' \ 

-u AccountSID:AuthToken

When we make this API call, Twilio will hopefully give us a 2xx response in return with the RecordingSID. This is the unique ID of the recording of the call. As soon as the call is finished, the recording will be available for us to download.

curl 'https://api.twilio.com/2010-04-01/Accounts/MyAccountSID/Recordings/RecordingSID.json' -u AccountSID:AuthToken

This will return a JSON with links to a .WAV and .MP3 file for us to download.

You can then share this MP3 with your friends or colleagues in Slack and laugh all together about the fact that Dave from accounting thought he was really talking to Jean-Pierre van Rossem on the phone.

More polaroids I want to share

CLICK OR DRAG THE TOP ONE ASIDE

You've reached the end of the shoebox. More polaroids and other posts live on my Instagram.

@GMJELLE →
Polaroid of a calm lake at dusk reflecting pink clouds and dark hills, at a wild campsite near Adana, Turkey
Polaroid of Josip Broz Tito's marble tomb seen through plant leaves in Belgrade, Serbia
Polaroid of a motorcycle parked at a Soviet-era bus stop decorated with a flower mosaic in Moldova
Polaroid of a large stone statue of a bearded man in a long coat on a hillside near Buzludzha, Bulgaria
Polaroid of the saucer-shaped Buzludzha Monument on a distant hilltop above the trees in Bulgaria
Polaroid of a man standing in front of the Buzludzha Monument and its tower in Bulgaria
Polaroid of a valley of pale, cone-shaped rock formations in Cappadocia, Turkey
Polaroid of hot air balloons silhouetted against the dawn sky in Cappadocia, Turkey
Polaroid of the brutalist Cosmos Hotel tower in Chisinau, Moldova
Polaroid of the Tomb of Cyrus the Great on its stepped stone base at Pasargadae, Iran
Polaroid of a close view of the Tomb of Cyrus the Great at Pasargadae, Iran
Polaroid of a converted red fire truck camper and a motorcycle at a campsite on the west coast of Turkey
Polaroid of a mosque minaret and domes silhouetted against a cloudy sky in Edirne, Turkey
Polaroid of the Mimar Sinan statue in front of the Selimiye Mosque in Edirne, Turkey
Polaroid of the courtyard of a historic house with a fountain and colored-glass windows in Isfahan, Iran
Polaroid of a man standing next to an Isfahan city emblem sign on a sidewalk in Isfahan, Iran
Polaroid of the tiled dome and entrance portal of the Sheikh Lotfollah Mosque in Isfahan, Iran
Polaroid of the tiled entrance portal and twin minarets of the Shah Mosque in Isfahan, Iran
Polaroid of a columned palace silhouetted at sunset behind a fountain pool on Naqsh-e Jahan Square, Isfahan, Iran
Polaroid of a dark interior lit through colorful stained-glass windows in a historic house in Isfahan, Iran
Polaroid of rocky ridges and rock formations under a cloudy sky near Goreme, Cappadocia, Turkey
Polaroid of a loaded motorcycle parked by a desert road with mountains behind it in Iran
Polaroid of a loaded motorcycle with a helmet on the mirror, parked on a coastal road near Izmir, Turkey
Polaroid of a Soviet-era mosaic of workers and a motorcyclist on a building wall in Lutsk, Ukraine
Polaroid of a Soviet-era mosaic of a crowned woman holding scales, framed by tree leaves in Lviv, Ukraine
Polaroid of the Lviv Opera House facade with a fountain in front in Lviv, Ukraine
Polaroid of a Soviet WWII memorial column with a stork's nest on top in northern Moldova
Polaroid of a large Soviet-era mural of figures on a wall beside a tree in Moldova
Polaroid of royal tombs carved into the cliff face at Naqsh-e Rustam near Persepolis, Iran
Polaroid of a stone relief of a Persian soldier holding a spear at Persepolis, Iran
Polaroid of the Gate of All Nations with its winged bull statues and columns at Persepolis, Iran
Polaroid of four men sharing dinner at a table in a traditional hostel in Shiraz, Iran
Polaroid of the tiled courtyard and reflecting pool of the Nasir al-Mulk (Pink) Mosque in Shiraz, Iran
Polaroid of two men smiling at a restaurant table in Tabriz, Iran
Polaroid of the mirrored hall of Golestan Palace lit by large chandeliers in Tehran, Iran
Polaroid of the bronze statue of Leonidas raising a spear at the Thermopylae monument, Greece
Polaroid of a man looking up at the wooden Trojan Horse from the Troy film in Canakkale, Turkey
Polaroid of a backgammon board on a table overlooking the sea at a campsite in Turkey
Polaroid of a Soviet-era mosaic of a woman in traditional dress under a Ukrainian coat of arms in Ukraine
Polaroid of a motorcycle parked at a bus stop with a mosaic of three knights in Ukraine
Polaroid of a man standing on a boardwalk in front of the stairway of the Ziggurat of Ur, Iraq
Polaroid looking up the brick stairway of the Ziggurat of Ur, Iraq
Polaroid of eroded mud-brick ruins with a small sign in front at Uruk, Iraq
Polaroid of a man and two boys crouching by a freshly slaughtered sheep on grass on the road to Van, Turkey
Polaroid looking up at the curved glass Zlota 44 skyscraper in Warsaw, Poland
Polaroid of the Palace of Culture and Science lit at dusk in Warsaw, Poland
Polaroid of the Zoroastrian Fire Temple with a round reflecting pool in Yazd, Iran