1
votes

I followed this page to update a call to a conference room. Everytime I try to call the update function, I get an error: No 'To' number is specified. Even if I go the standard Twiml where the call entered, it says that. Nowhere in the document is stated that you need a To number.

The code I used:

$call = $tokens['client']->account->calls->get($call_sid);
$call->update(array(
        "Url" => $app["request"]->getSchemeAndHttpHost() . "/dial/api/assign_redirect?callsid=" . $call_sid,
        "Method" => "POST"
    ));

The twiml where it is redirected to:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman">Thank you for your patience. You are now connecting with an agent</Say>
<Dial record="true">
    <Conference startConferenceOnEnter="false" endConferenceOnExit="true" eventCallbackUrl="{{ url('API-record') }}" record="record-from-start">{{ callsid }}</Conference>
</Dial>

The other Twiml where the call is accepted:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Dial record='record-from-answer' callerId='{{ callerId }}'>
        {{ numberOrClient|raw }}
    </Dial>
</Response>

Twilio support was no help, they pointed me at: https://www.twilio.com/docs/errors/21201 which makes no sense.

I tried a bunch of question on SO already like :

Only the last one worked for me. But that creates a third leg. I want to stick to the existing ones. Anyone has a clue how to fix this?

Thanks in advance!

Edit: I am using the v4 of the PHP library.

1
Can I ask which version of the PHP library are you using? v4 or v5? Thanks!philnash
Hey, I am using the v4 version.Duncan
Is there anything else going on around that first block of code? An update sent to a call resource with a call SID should never need a To number, so I'm just wondering if there's more context to it?philnash
Not much, I use the v1.3 JS library for the client. The client can choose to reject, accept or forward the call to a conference. The first two work, the third one gives me a hard time. I got a second workflow using the workspace of Twilio, using the v4 PHP library, where I use roughly the same code and there it works, only I get the call sid from an iterator instead of the js library.Duncan
Sorry to keep asking questions. Are you passing the SID from the front end to this code? And is it definitely arriving correctly? Can you log the call sid and the call object before making the call to updatephilnash

1 Answers

1
votes

I fixed it by getting both call_sids of the legs and creating an iterator like in the docs. If you forward the result the To error is gone, it is a bit more extensive and is way slower then the get, but it works.