0

I'm writing a small program to check my voicemail and email the recording to me at set intervals. Here's the python code for the call portion, at least up to testing basic call & AUDIX option tree navigation once the call connects:

from twilio.rest import TwilioRestClient

# put your own credentials here
ACCOUNT_SID = ""
AUTH_TOKEN = ""

client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
ext = ""
ext_passwd = ""
digs = "wwwwww#ww" + ext + "wwww" + ext_passwd + "#wwwwww2"


call = client.calls.create(
        to="+",
        from_="+",
        url="",
        send_digits=digs,
        record="true"
)

print call.sid

The url parameter is required, and it seems the target has to be TwiML containing a reference to an audio file that will play when the call connects. I want a silent call, at least from that end, and just to send the digits necessary to navigate my voice mail.

I assume I'm missing something? Or do I really need to host a TwiML file, and reference an "empty" mp3 with a second or two of silence in it?

Odj fourth
  • 649
  • 1
  • 9
  • 16

1 Answers1

0

Try removing the send_digits and record parameters, instead use a url which describes a similar flow in TwiML.

In the XML returned at url, you can use the digits attribute of the <Play> tag to send dialpad digits and the <Record> tag to capture the subsequent audio on call. You could even transcribe the voicemails to text this way.

Here's an example of what the TwiML at url might look like:

<?xml version="1.0" encoding="UTF-8"?> <Response> <Play digits="wwwwww#ww1234wwww4321#wwwwww2"></Play> <Record timeout="10" transcribe="true" transcribeCallback="/handle_transcribe" /> </Response>

beanserver
  • 652
  • 3
  • 6
  • This is now working. Oddly though, the recording will not start until all of the "digits" have completed, even with trim set to "do-not-trim". I'll have to play around to see what can be done about that, otherwise I won't be able to iterate through messages. That will be a new question though, if necessary. – Odj fourth Nov 26 '14 at 18:29