Make voice call using Twilio Client JS, a subaccount and access token - twilio

I am trying to make a voice call from a subaccount and keep getting the error:
callerId must be provided for TwilioClient and SIP calls when using Dial
I have verified my application SID, Account SID, api key SID and secret and all match up. The body of the response logged in the Twilio debugger is:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial answerOnBridge="true" callerId="PHONE NUMBER OF PARENT ACCOUNT">
<Number>THE PHONE NUMBER IM TRYING TO CALL (A REAL PHONE)</Number>
</Dial>
</Response>
I cant find anywhere in the docs that show this with the JS library. I have tried setting the From field in the options for Device.connect with no luck.
Do i have to specify anything for the voice grants?
Another odd thing, everything works if I dial from the parent account's number, but When i go and look at the parent account, it doesnt have voice enabled.

Related

Link physical ip phone with Twilio via SIP

I'm attempting to run a physical ip phone with Twillio via SIP and I'm missing something as the connection is not being made. Here is what I've done.
I setup a phone on twilio with incoming voice "A Call Comes In" set to this TwiMLBin:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial answerOnBridge="true">
<Sip>
{{To}}#hcs.sip.twilio.com
</Sip>
</Dial>
</Response>
Then in Programmable SIP Domains I have setup the SIP URI
hcs.sip.twilio.com
I have also set:
Voice Authentication with a credential list of username and password.
Call Control Configuration:
A Call Comes in WebHook to http://demo.twilio.com/welcome/voice HTTP GET
SIP Registration:
Enabled Credential lists: HCS Usr
Then in the phone I have the following settings. Excuse the imgs. Note the myusrid, I actually use an idea, I replaced it just for security reasons.
enter image description here
When I dial the number it says the number has been disconnected.
Any idea what I'm doing wrong?
Make sure your SIP Username (username in credential list) is in E.164 format. So + and then country code. Register using this username.
For example:
+13055551212
Also, check the Debugger in console, to see the errors.

Sip register user in twilio

I'm currently getting the following error:
Your TwiML tried to Dial a Twilio SIP Registered User that is not currently registered
Apparently my SIP Registered user is not being recongized.
In SIP Domains I've created a sip uri
myexample.sip.twilio.com
I then create a credentials list with my username
Example Usr
+13105551212
password
In sip registration I have enabled it with
SIP Registration Authentication using Example Usr
I then have this twiml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial answerOnBridge="true">
<Sip>
{{To}}#myexample.sip.us1.twilio.com
</Sip>
</Dial>
</Response>
I have also tried {{To}}#myexample.siptwilio.com and
+13105551212#myexample.sip.us1.twilio.com
When I dial the number associated with this I get the error mentioned above.
Error - 32009
Dialing SIP Endpoint failure - User not registered
The error also says:
Prior to dialing, you can verify that your SIP Endpoint has successfully registered in the Console "Registered SIP Endpoints" tab found on the SIP Domains page.
When I go to the page "Registered SIP Endpoints" There is nothing on this page, no users listed.
Am I missing a step to register the sip end point? Any idea what I"m doing wrong?
From your previous screenshot, change outgoing call without registration to no. Most likely your SIP Softphone is not registering.

<Pay> verb raises " Invalid content was found starting with element 'Pay'. One of '{Play"

I'm attempting to use the new feature and every attempt at testing results in a hangup on the outgoing call and a Schema warning in the Debugger that says, " Invalid content was found starting with element 'Pay'. One of '{Play"
My TWiML:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Pay paymentConnector="Default" amount="5.25" action="https://www.website.io/pay_action" />
</Response>
The call setup is: a Twilio js client initiates an outbound call to the twilio application, which requests TWiML from the server, returning a <Dial> verb. At some point, the caller (js client-side) presses a button, which updates the live call with the above TWiML, which then disconnects.
Any help would be greatly appreciated!!
Spoke with someone from Twilio support and the problem was that I hadn't enabled PCI in my account settings. I had clicked "Enable PCI" and agreed to the terms, but hadn't saved the setting on the page. This cleared the problem up!

How do I forward a Twilio number to a VoIP phone?

Twilio noob + VoIP noob here, so brace yourself for a double-dumb question.
I have a local Twilio number that currently points to a text-to-speech voicemail greeting. I get a lot of hang-ups (empty voicemail messages), so I would prefer to start routing my incoming calls to a VoIP phone during business hours.
I only have one question about this so far: HOW?
Forwarding voice calls from a Twilio number to a VoIP client.
Example with Zoiper VoIP client (https://www.zoiper.com/).
Twilio configuration
Step 1 - Configure credentials
Log on to your Twilio console (Master Account or switch to a Subaccount), then go to: Programmable Voice >> SIP Domains >> Credential Lists https://www.twilio.com/console/voice/sip/cls
Click on "Create new Credential List"
Remember the username and password, you will need it for Zoiper VoIP client configuration.
Step 2 - Configure SIP domain
Once you've created a credential list, go to Voice SIP Domains https://www.twilio.com/console/voice/sip/endpoints
Click on "Create new SIP Domain"
Enter values for:
FRIENDLY NAME: "My SIP Domain"
SIP URI: "something" (the 'something' has to be some unique name) you will need this something when you configure Zoiper.
then for CREDENTIAL LISTS select "My List" (the one you created on 'Credential Lists'.
also for SIP Registration section, down the page, select ENABLED and again for CREDENTIAL LISTS select "My List"
Don't forget to "Save"
Step 3 - Configure a TwiML Bin
Next, you need to create a TwiML Bin, go to https://www.twilio.com/console/runtime/twiml-bins and let's call it "SipBin" with the folowing code:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Sip>
alex#something.sip.us1.twilio.com
</Sip>
</Dial>
</Response>
Note the alex#something part is alex from when we created the credential list and something from when we created the SIP domain.
Save this bin.
Step 4 - Configure Twilio phone number
Next configure the Twilio phone number, as when a voice call comes in to run the TwiML from the bin. https://www.twilio.com/console/phone-numbers/incoming
Save the phone number configuration. Next, let's configure Zoiper.
Zoiper configuration
Download and install the Zoiper VoIP client app on your smartphone (https://www.zoiper.com/).
Launch the app, click on the "hamburger" menu at top left then go to Settings then to Accounts.
Select the "SIP" tab, then click on the "+" (plus) sign to add an account. It will ask you for a "Username/Login" and a "Password".
Enter the ones you used when you created the credential list at Twilio.
Click the "Login" button, it will take you to next page to enter "hostname or provider".
Enter something.sip.us1.twilio.com, replace something with your name choice when you configured the SIP URI at Twilio.
Click "Next", it will take you to a page regarding "provider/PBX authentication or outbound proxy".
Do not check the box, click "Skip".
On the next page, wait until Zoiper connects to Twilio, it will automatically find "SIP TLS" , it will go green.
You can now click "Finish".
You're done, call your Twilio number and Zoiper will ring.
Update: Outgoing Calls Configuration (only needed at Twilio)
Step 1
To make outgoing calls work you will need to create a second Twilio Bin, let's call it SipBinOut with the folowing code:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial callerId="+13335557777">{{#e164}}{{To}}{{/e164}}</Dial>
</Response>
replace +13335557777 with your Twilio number.
After you save the bin, retain (copy) the bin's URL from the Properties section at the top (see picture below).
Step 2
Go to the Sip Domain Configuration page for your SIP Domain (the one where you entered the FRIENDLY NAME and the SIP URI).
In the section for Voice Configuration configure the REQUEST URL, paste the SipBinOut URL from the previous step (keep the method HTTP POST).
Save with the button at the bottom.

Call Twilio Client from Twimlet

Dialing a Twilio client app requires the <client> twiml noun. Is there a way to generate the Twiml necessary to forward a call to a client using a Twimlet? Ideally, the simulring would accept client OR numbers, but it does not appear to.
You can use something like this to simulring a mixture of clients
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial callerId="+1234567890">
<Client>Bob</Client>
<Client>Steve</Client>
<Client>Ted</Client>
</Dial>
</Response>
Remember that you must provide a valid callerId when calling out to a client or the call will fail.
If you want something like the sumulring TwiMLet you can host this code by pasting your TiwML into the Echo TwiMLet https://www.twilio.com/labs/twimlets/echo or by using TwiMLbin http://twimlbin.com/.

Resources