0
votes

can someone help me with solving my problem?

I try to implement voice mail, I knew about tutorials about my problem, they were useful during building voice mail on first steps. I have endpoint for incoming calls, there I create response with dial TwiML for bind incoming call from SDK with call receiver. Below i will show you a TwiML example.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Dial action="{{HOST}}/api/v1/voice_mails/start_recording" callerId="client:[client identity]" timeout="15">
        <Client>[Client identity]</Client>
    </Dial>
</Response>

the call happens, but if you wait 15 seconds + (5 seconds twillio adds) without answering, you get a request to record voicemail and call status callback, without "To" and "Called" params, they are blank. There is example of action="{{HOST}}/api/v1/voice_mails/start_recording" request params below

ApplicationSid  "My Application Sid"
ApiVersion  "2010-04-01"
Called  ""
Caller  "client:[identity]"
DialCallSid "DialCallSid"
CallStatus  "in-progress"
CallSid "Call Sid"
To  ""
From    "client:[identity]"
DialCallStatus  "no-answer"
Direction   "inbound"
AccountSid  [My AccountSid]

May be it will useful: my client identity format is number without "+" if phone number is "+1234567890" then identity will be "1234567890"

1

1 Answers

0
votes

Twilio developer evangelist here.

Hmm, that's interesting. I think this happens because, when you generate a call from a client the initial leg of the call doesn't have an idea of the To. Instead it requests TwiML from your TwiML application. In this case it gets a <Dial> but that's not necessary, therefore there's no To number that is intrinsic to the initial call itself.

We can work around this though. Instead of relying on the regular To field on the webhook for the record action, we can add it to the URL ourselves as a URL parameter.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Dial action="{{HOST}}/api/v1/voice_mails/start_recording?clientID=[client identity]" callerId="client:[client identity]" timeout="15">
        <Client>[Client identity]</Client>
    </Dial>
</Response>

You can then retrieve the client identity from the URL query parameters in the next action.

Let me know if that helps at all.