Twilio if You Know Your Partys Extension

If your PBX solution does non natively allow for remote working and y'all need to act fast, this solution is for you. This tutorial shows you how to create a solution with Twilio Programmable Voice and a SIP softphone software or an SIP IP Phone that enables employees to work from their homes.

Configure the Programmable Vocalism SIP Endpoint

Yous tin forward incoming calls to Twilio numbers registered to SIP endpoints, and use a free softphone as an endpoint while working from home, as shown below:

Flow for how employees can work from home using Twilio

To get started with the project you will demand the following:

  • A Twilio account. Sign up for a free trial account and get a $x credit.
  • A call-enabled Twilio Telephone Number.
  • SIP endpoint (IP Phones (e.m. Obihai) or Softphones (east.g. Zoiper or Ten-Lite)).

Create the application

Go to twilio.com and sign up for a gratuitous business relationship or log in to your existing account.

If y'all don't currently own a Twilio phone number with Voice functionality, y'all'll demand to purchase one. Navigate to the Buy a Number page, cull the prefix you want to utilise under the "Search criteria" - "Search past digits or phrases" and click "Search."

Choose Voice-enabled when buying a phone number

You lot'll so see a list of available phone numbers and their capabilities. Find a number that you similar and click "Purchase" to add information technology to your business relationship.

Select a number with voice capabilities.

In this solution, we will demand to purchase a unique number for each employee you want to frontward calls to. The employee can place and receive calls on this new Twilio number and besides configure his/her office number to be forwarded to this new Twilio number.

TwiML Bins are a simple serverless solution that assist you provide Twilio-hosted instructions to your Twilio applications. Y'all tin can use Twilio Functions for this as it is outlined on this nice blog mail, merely in this example nosotros want to keep things very simple to exist implemented. In order to utilise TwiML bins for inbound and outbound calls, we must cull the aforementioned number we bought as a SIP domain user name (due east.g. 19727872680@twiliosipblog.sip.twilio.com).

The adjacent step is to create a TwiML bin to allow the remote worker to place outbound calls.

Go to TwiML Bins on Console:

Create a TwiML Bin.

Select the "+" and create a TwiML bin for our outbound calls.

Populate the TwiML Bin with the code.

TwiML Bins take some built in mustache templates, such as {{To}}, {{From}}, {{#e164}} and others. Yous tin find out more in our post, How to apply templates with TwiML Bins.

Give the TwiML Bin a friendly proper name like 'TwilioSipDemoOutbound'. Paste in the TwiML beneath (replacing the existing content):

            <?xml version="1.0" encoding="UTF-8"?> <Response>     <Dial answerOnBridge="true" callerId="{{#e164}}{{From}}{{/e164}}">{{#e164}}{{To}}{{/e164}}</Dial> </Response>                      

At the bottom of the edit box, it should say: 'Valid Vox TwiML' if everything went well. Click the 'Create' Push.

Go dorsum to the TwiML Bin page and click on the "+" again. Give the TwiML Bin a friendly name like 'TwilioSIPDemo_your number', in this instance we used 'TwilioSIPDemo_19727872680'.

Paste in the TwiML beneath (replacing the existing content):

            <?xml version="i.0" encoding="UTF-8"?> <Response>     <Dial timeout="xx">         <Sip> username@yourdomain.sip.twilio.com</Sip>     </Dial> </Response>                      

In our instance we used:

            <?xml version="1.0" encoding="UTF-eight"?> <Response>     <Dial timeout="xx">         <Sip> 19727872680@twiliosipblog.sip.twilio.com</Sip>     </Dial> </Response>                      

At the bottom of the edit box, information technology should say: 'Valid Voice TwiML' if everything went well. Click the 'Create' Button.

Create button after valid TwiML

Associate the TwiML bin to the number you purchased. Become to your Agile Numbers and nether the Voice & Fax, "A Phone call COMES IN", select the TwiML bin we simply created:

Associate the TwiML Bin with the number you purchased

Click the blue "Salve" button.

For each employee, you will demand to create separate TwiML bins for inbound calls (PSTN to SIP) and associate them with their Twilio numbers.

The next step is to create a SIP domain for your account. A SIP Domain resource describes a custom DNS hostname that can accept SIP traffic for your account.

Think almost this as your address for calls to achieve you on the public telephone network. In VoIP (voice over IP), a SIP URI serves equally your global unique address, similar to a telephone number in the PSTN (public switched telephone network). Nosotros will need this to configure the softphones to register to your Twilio business relationship.

Go to the Phonation SIP Domains. In this example, we volition create the domain twiliosipblog.sip.twilio.com – you will need to specify the "twiliosipblog" this way. You lot should see a screen similar this one:

Adding a Programmable SIP Domain

Select the "+".

Under Properties - blazon a FRIENDLY NAME - in our case we used "Twilio SIP Blog"

For the SIP URI field - type a unique name for your domain. Bank check if the domain is available:

Check if a SIP domain is available

For example, "twiliosipblog" was available. This will create the SIP Domain twiliosipblog.sip.twilio.com.

Nether Voice Authentication, click on the "+" sign and add an IP Admission Command LIST. This is optional, merely it is recommended for extra security.

Add an IP Access Control list

Create a new Access Control Listing which contains a listing of IP Addresses resources that tin can access your SIP Domain. Requests to your SIP Domain from an IP address that is non in the ACL volition be blocked.

Create a new access control list.

The "CIDR NETWORK Accost" is the IP address range of your SIP clients.

Check with your employees which IP addresses their Service Provider assigned to them (e.g., 47.189.34.10/32). For each employee, you will need to add together their IP addresses to this Access List. In this instance, we chose to open up access to a big block of IP addresses (for testing purposes - yous can narrow down to unique /32 IP addresses later using the call logs and the IP addresses of the clients).

Click on the "+" for CREDENTIAL List. Create a new SIP Credential List resource, which contains the credentials of the employees who are allowed to reach your SIP Domain. Twilio will only let traffic from employees who accept their credentials in the credential list.

Create a new credential list

In this example, we used the username "19727872680" and countersign "Twiliosipdemo123".

Update Voice Authentication ACLs.

Under Telephone call Control Configuration, select for "A CALL COMES IN" => "TwiML BIN" and then the TwiML Bin we configured for outbound calls "TwilioSIPDemoOutbound".

Call control configuration setting a TwiML Bin

For each employee, you volition need to create separate usernames and passwords. And add to the CREDENTIAL LISTS. For example:

Adding credential lists

Under SIP REGISTRATION, make sure you plough SIP Registration to ENABLED and add your Credential Lists too.

Enable SIP registration

Hit the "Salve" push button.

Your new SIP DOMAIN should wait like this:

SIP blog post work from home overview settings

Connect a softphone to our Twilio SIP endpoint

Next, nosotros need to configure your SIP endpoint. This can vary depending on which finish bespeak y'all chose. There are many options available, softphones or IP phones. We'll comprehend an example of a softphone in this department, and then an IP telephone in the adjacent section.

A softphone is an awarding that runs installed on a reckoner or and uses the internet to make calls. In this tutorial, we are using Zoiper'due south softphone, which you can download hither, but this configuration should work with any softphone of your choice.

Download the Zoiper's softphone, install and you will be prompted to add together a username and password. This is the aforementioned username and countersign we used in your Twilio Credential Lists (username: 19727872680 / password: Twiliosipdemo123).

Install Zoiper

Hitting "Login" instead of "Create business relationship". On the hostname, copy and paste the SIP Domain we merely created: twiliosipblog.sip.twilio.com

Fill in the SIP hostname.

Hit "Next" and "Skip" on the adjacent screen, so "Aye" on the alert.

Click "Yes" button on warning screen.

Select "configure" and test your audio and microphone. On the configuration for the SIP account, select "Advanced" to see the "Caller ID Name" field. Enter the Twilio number for that user. In our example information technology is "19727872680".

You should see your client registered correctly like this:

Update SIP credentials in Zoiper.

In case yous do not see the dark-green checkmark by your account, follow these troubleshooting steps:

Starting time, check connectivity to the internet, for instance:

            youruser$ ping  twiliosipblog.sip.twilio.com PING twiliosipblog.sip.twilio.com (54.172.sixty.2): 56 information bytes 64 bytes from 54.172.60.2: icmp_seq=0 ttl=253 time=36.575 ms 64 bytes from 54.172.60.ii: icmp_seq=1 ttl=253 time=43.808 ms 64 bytes from 54.172.60.ii: icmp_seq=2 ttl=253 time=37.087 ms 64 bytes from 54.172.60.2: icmp_seq=three ttl=253 time=38.060 ms 64 bytes from 54.172.60.2: icmp_seq=four ttl=253 time=43.529 ms 64 bytes from 54.172.60.2: icmp_seq=5 ttl=253 time=37.499 ms ^C --- twiliosipblog.sip.twilio.com ping statistics --- 6 packets transmitted, half dozen packets received, 0.0% parcel loss round-trip min/avg/max/stddev = 36.575/39.426/43.808/3.034 ms                      

Brand certain to double bank check the SIP domain, username and countersign. You should as well reset the application or try a dissimilar softphone awarding such as X-Lite.

For each employee, they will need to install the client and configure their unique username/passwords (e.thousand. employee 1 is 19727872680, employee ii is 19727872681, ...).

We are ready to try and run across if it all works. Endeavor calling your Twilio telephone number from the PSTN (your cellular or home number). You should hear your SIP enabled softphone ring. Respond, and verify you have 2 way audio.

Test that your call in Zoiper works.

In case you do not hear audio on both directions, follow the troubleshooting steps:

  • Cheque if there is a firewall or NAT (Network Address Translation) device - encounter if it is configured to permit packets to and from your SIP client:
    • Signaling IP Ports: 5060 (UDP/TCP), 5061 (TLS)
    • Media IP Port Range: ten,000 to xx,000 (UDP)
  • Cheque if your client is using a codec supported past Twilio - G. 711 μ-law (PCMU) and A-law (PCMA)
  • Try a different softphone

Endeavor calling from your SIP enabled Softphone to the PSTN (your cellular or abode number). You should hear the other terminate ring. Answer, and verify you lot take two mode sound.

Testing a call in Zoiper.

In example the call does not complete, follow the troubleshooting steps:

  • Go to the debugger - cheque for the error message.
  • If information technology is a "13214 - Dial: Invalid callerid value" - make sure you have configured the caller id properly on your softphone customer. This is a skilful guide.

Finally, configure your PBX solution to forward the calls to your Twilio phone numbers. Test if a call to the extension defined gets forwarded to the correct Twilio number, and if the right SIP softphone rings, and when answered, sound is good.

We are now all fix to work from dwelling!

Connect an IP Phone to our Twilio SIP endpoint

Now that you've seen how to connect a softphone to Twilio for both inbound and outbound calls between the softphone and PSTN, permit's dive into how this works with an IP Phone instead of a softphone.

For our example IP Telephone, we're going to use an OBi2162 from OBiTALK, but the setup will be similar with other Obihai IP Phones. Equally for other IP Phones from different manufacturers (eg. Cisco, Grandstream, etc), each may provide unlike Bring-Your-Own-Device (ie. BYOD) spider web-based capabilities for configuring 3rd party VOIP settings, so delight follow the manufacturer instructions for the initial setup of the IP Telephone itself.

Now, to get started with our OBi2162 IP Phone, the first step is to connect it to the internet. This particular phone is wireless with a touchscreen, and then setting upwardly wifi is equally simple every bit any other wireless device these days.

Adjacent, hop onto a web browser and gear up an OBiTALK account (unless you already accept one). Once you've created an business relationship, navigate to the Configuration Dashboard and select your OBi2162 (or specific IP Telephone). This will take you to the Device Configuration, where you lot can read your OBi No., MAC Address and Serial No., and edit the additional settings (eg. Device Display Name).

OBiTALK overview

From here, yous can begin to configure the IP Phone with Twilio by selecting "Service Provider Ready-upward" -> OBiTALK Uniform Service Providers -> Twilio. Discover the settings provided to you include a Domain, Username, and Password (at that place are other settings for more advanced users, but nosotros'll stick to the basics here)

The Domain will be the aforementioned as your Twilio SIP Domain prefix (ie. your SIP URI prefix as configured in the Twilio console), and the Username and Countersign will exist the aforementioned as your Credential Listing for your Twilio SIP Domain.

The Twilio setup from earlier in this post shows you lot how to configure a SIP Domain and setup TwiML Bins for both inbound and outbound calling, and so you lot can only pause here, echo those steps with an available domain proper noun of your choosing, and then finish this Twilio setup from inside ObiTALK.

Adding Twilio as a service provider in ObiTALK

Once you've finished the setup within OBiTALK, hit the Submit button (make certain your Obihai IP Telephone is continued to the cyberspace during this pace). The setup will so asynchronously update your IP Phone over the internet with the Twilio settings, and Register the Twilio SIP Domain with OBiTALK. While this is occurring, you should observe your IP Phone restarting and applying the settings, and when finished, your IP Phone should now be set up!

For the OBi2162 specifically, y'all should see something like the beneath, where the phone shows it'south connected to the internet, and the phone line (eg. SP1) has your username displayed.

OBi2162 connected and authenticated with Twilio

In OBiTALK, your Twilio Status should show as "Registered".

Registered status with Twilio and ObiTALK

That'due south it! At present you should be able to place calls from your Obihai IP Phone to the PSTN and also from the PSTN to your IP Telephone.

Note: If you lot run into problems with Registration, you may need to restart your device, reconfigure the internet connectedness, or double bank check your Twilio settings from within the Twilio Console or inside OBiTALK. If yous're having trouble with inbound/outbound calls, make sure your TwiML Bins for both inbound and outbound are setup properly per the instructions in this blog.

Example of Obihai's phones:

https://www.amazon.com/OBi202-2-Port-Adapter-Support-Service/dp/B007D930YO/

https://www.amazon.com/Obihai-OBi1022-Phone-Power-Supply/dp/B00TEJOYYQ/

https://world wide web.amazon.com/Obihai-OBi2000-Gigabit-Phones-OBi2182/dp/B076JKV5CL/

Follow this guide to configure the Obihai with Twilio:

https://twilio-cms-prod.s3.amazonaws.com/documents/Give-Your-OBIHAI-Phone-Telephone-Connectivity.pdf

Guides for other IP Phones are hither:

https://www.twilio.com/docs/voice/api/sip-registration#configure-your-sip-endpoint

Use Twilio Programmable Voice to enable working from home

In this blog mail, you have learned how to use Twilio Programmable Vocalism to create a uncomplicated solution to allow employees to work from domicile.

Possible alternatives

  • Consider using Twilio Functions instead of TwiML bins if y'all have a big number of extensions or if you desire to utilize a custom SIP user name to detect the "From" parameter and do logic off of it.
  • Use X-Lite/Bria as a softphone instead of Zoiper.

Additional resources

The following reference resource volition provide you with in-depth information on some of the topics mentioned in this post:

  • Programmable Voice – The Twilio documentation includes quickstarts for pop programming languages, including C#, and reference information on avant-garde features.
  • TwiML for Programmable Voice – The documentation for TwiML, the Twilio Markup Language, volition tell you all about the special XML tags you can use to build programmable vox applications.
  • Registering a SIP Phone Directly to Twilio (and and then much more...)

Al Kiramoto is a Solutions Architect at Twilio. He lives in Dallas - TX and enjoys working with customers and solving business problems - besides a good barbecue and TexMex food. He can be reached at akiramoto [at] twilio.com

Chris Feehan is a Solutions Architect at Twilio. Chris has a history of architecting and edifice custom solutions and integrations for customers in both the public and individual sectors. Chris can be reached at cfeehan [at] twilio.com.

schultzbulget.blogspot.com

Source: https://www.twilio.com/blog/enable-work-from-home-programmable-voice

0 Response to "Twilio if You Know Your Partys Extension"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel