Twilio recordingStatusCallback is never called - twilio

Trying to receive recordings of calls. I'm self hosting this twiml code.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial timeout="40"
recordingStatusCallbackEvent="in-progress,completed"
recordingStatusCallback="http://server.com/recording/">
<Number
url="http://server.com/whisper/"
statusCallbackEvent="completed"
statusCallback="http://server.com/status/">
+12142142144
</Number>
</Dial>
</Response>
Everything works as expected except the recording url is never called. The call forwards, the whisper is spoken, the status url is called, but not the recording url.

Twilio Developer Evangelist here. 👋
It looks like you're missing the record attribute. (https://www.twilio.com/docs/voice/twiml/dial#record) If it's not set it's defaulting to do-not-record.
<Response>
<Dial record="record-from-ringing-dual"
recordingStatusCallback="www.myexample.com">
<Number>+15558675310</Number>
</Dial>
</Response>
Can you add it and give it a try? Happy to help if that's not the issue. :)

Related

Two-way recording with twilio SIP

I have set-up a SIP Domain on twilio and I've configured with the following TwinML :
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial callerId="{{#e164}}{{From}}{{/e164}}">
{{#e164}}{{To}}{{/e164}}
</Dial>
</Response>
I would like to record all inbound and outbound calls coming on this number but it fails.
I have tried this code :
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial callerId="{{#e164}}{{From}}{{/e164}}">
{{#e164}}{{To}}{{/e164}}
</Dial>
<Dial record="record-from-ringing-dual"
recordingStatusCallback="https://sample.org/api/1.1/wf/twiliocalllog"
>
<Number>+339999999</Number>
</Dial>
</Response>
Can you tell me how can I handle this issue?
(For Inbound calls, I did it with Studio and it works properly, but for outbound calls, I can't find the best way).
For the outbound call you need to use the record attribute on the <Dial> that places the call. Like so:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial callerId="{{#e164}}{{From}}{{/e164}}" record="record-from-ringing-dual" recordingStatusCallback="https://sample.org/api/1.1/wf/twiliocalllog">
{{#e164}}{{To}}{{/e164}}
</Dial>
</Response>

Convert TWIML (Gather and Dial) to use API and VOIP

I'm currently looking at a basic example of create call https://www.twilio.com/docs/voice/api/call#create-a-call-resource.
The TWIML fetched in the url parameter uses the <Gather> verb to call a number via the action attribute then <Say> something on a loop. Once the DTMF input is detected it dials a second number:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather input="dtmf" action="/dial/john" method="POST">
<Say loop="0">Press a key to connect to John</Say>
</Gather>
</Response>
response at /dial/john:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>415-123-4567</Dial>
<Hangup/>
</Response>
Now, my question is would it be possible to use the API to do the exact same and reduce costs? The cost per minute for each call is GBP0.0175 whereas I believe it could be lower using the API / SIP / VOIP?
TIA
Using you can tell Twilio you want to connect to a PSTN phone <Number>, a <Sip> endpoint, a <Client> ID or even a Twilio Programmable Wireless <Sim> card.
Depending on which if these you use they will have different costs.
Hope that helps.

Can I insert a variable into TwiML? In particular, to insert the phone number of the number called?

Is there a way to implement the following in TwiML? The goal is to produce a reasonably-sounding voicemail on Twilio.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Pause length="15"/>
<Say voice ="woman">
You have reached the voice mail of ##The_Phone_Number_One_has_Called##.
Please leave a message at the beep.
</Say>
<Record
transcribe="true"
/>
</Response>
I have a bunch of Twilio numbers and would like to have the string "##The_Phone_Number_One_has_Called##" replaced by the number that the caller is calling. Please advice if I should deploy a dedicated TwiML for each phone number.
Using Templates with a TwiML Bin, and Polly voices, try something like this for the bin:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Pause length="15"/>
<Say voice="Polly.Joanna">
You have reached the voice mail of
<say-as interpret-as="telephone">{{To}}</say-as>.
Please leave a message at the beep.
</Say>
<Record
transcribe="true"
/>
</Response>
How to use templates with TwiML Bins
(https://support.twilio.com/hc/en-us/articles/230878368-How-to-use-templates-with-TwiML-Bins)
Amazon Polly
(https://www.twilio.com/docs/voice/twiml/say/text-speech#amazon-polly)
You could do it on your server's code. Just replace the "##The_Phone_Number_One_has_Called##" with the phone that the user called.
Remember that you get the number that the user dialed on the post param "To" on each of Twilio's requests to your server, so from your server you could return:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Pause length="15"/>
<Say voice ="woman">
You have reached the voice mail of $POST["To"].
Please leave a message at the beep.
</Say>
<Record
transcribe="true"
/>
</Response>
And your server will render a different phone each time, and Twilio's will say it. Just a heads up, the $POST["To"] has the format "+1XXXXXXXXXX", so you might want to remove the +1.

Setup whisper for callee - So when I answer, I know where the call is coming from

I am sorry. I am a new to this so forgive me in advance. I'm searching for an answer and I was not able to understand when searching previous inquiries.
I am starting a TwiML Bin and so far my code is
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>This call is being recorded for quality assurance purposes</Say> .
<Dial record="true">+1 858-220-8650</Dial>
</Response>
When I receive the forwarded phone call, and I answer it, I want a message to say "phone call from website xyz" and then connect the call.
Is this possible from just within the TwiML Bin? Or do I have to utilize some external code?
You can do it with TwiML Bins, you will need to use the URL attribute on the Number noun to "chain" them together.
First create your whisper bin:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>phone call from website xyz</Say>
</Response>
Then use this with the URL attribute on your existing bin, like this:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>This call is being recorded for quality assurance purposes</Say>
<Dial record="true">
<Number url="https://handler.twilio.com/twiml/xxxxxxxxxxxxxxxxxxxxxxx">
18582208650
</Number>
</Dial>
</Response>
When the call is answered it will say the message from the whisper bin immediately before connecting the calls. Hope this helps! :)

Cut and paste from Twilio blog is returning invalid TwiML

I'm trying to do something pretty simple that is straight from the Twilio blog at https://www.twilio.com/blog/2009/05/dialing-multiple-numbers-simultaneously-with-twilio.html
Namely, this:
<?xml version=“1.0” encoding=“UTF-8”?>
<Response>
<Dial action=“/handleDialStatus.php” method=“GET”>
<Number>877-555-1212</Number>
<Number>877-999-1234</Number>
<Number>877-123-4567</Number>
</Dial>
</Response>
But it's returning 'Invalid TwiML'.
Any ideas?
Twilio developer evangelist here.
As Devin suggested in the comments, it looks like the blog post had smart quotes in the XML. The XML you need instead is:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial action="/handleDialStatus.php" method="GET">
<Number>877-555-1212</Number>
<Number>877-999-1234</Number>
<Number>877-123-4567</Number>
</Dial>
</Response>
I've updated the original blog post to fix this issue there too.
Let me know if this helps at all.

Resources