Plivo Endpoint - Use SIP phones with Plivo

    Overview

    Plivo Endpoint expands the capabilities of your existing SIP phones, allowing you to add custom business logic when you make or receive calls. Traditionally, SIP phones had very basic functionality and would need to be connected to the PBX to bring it to life. With Plivo Endpoints, you no longer need to set up and manage your phone system. Any Plivo application can implement the business logic needed to control your SIP phone. And best of all, this business logic can be written using any of your favorite web languages without any need to understand the details of telecommunications. Plivo supports all common SIP-based soft phones and hardware phones such as Bria, Cisco, Polycom, etc. Here are some useful examples to add to your current SIP phones:

    1. Instant Conferencing - Calls made via a SIP phone registered with Plivo can be directly added to the conference bridge.
    2. Access Control - With a few lines of code, you can add the ability to restrict calls made from SIP phones or limit the phone to accept calls only.
    3. Monitoring and Reporting - Monitor and report all calls made or received on a SIP phone. You can also build custom dashboards to analyze the data obtained using the APIs.
    4. Smart Routing - Add intelligent extensions and shortcuts which route calls to/from traditional phone networks and WebRTC enabled phones.

    How It Works

    Once you configure & set up your SIP phone, your device will establish a connection with Plivo by registering to it. When you initiate a call using the SIP Phone, you don’t connect directly to another phone or extension. Instead, you are instructing Plivo to fetch the XML from the attached application on your server to handle the call request. This is similar to the way that Plivo handles incoming calls from a regular phone number. All Plivo XML elements are available for use, to handle the call request. You can also use the <Dial> element to dial to a regular phone, WebRTC device or any other SIP phone.

    Getting Started

    1. Sign up for a Plivo Account.

    2. Create an Endpoint by visiting this link. Click on ‘New Endpoint’ and fill in the required details.

    3. Make a note of the username Plivo assigns you. Plivo will add random numbers in front of your username. Your username will appear to be yodaXXXXXX. For the purpose of this tutorial, Username - yodaXXXXXX, Password - obiwan, Alias - obiwan

    Configure your SIP Phone

    • Create an account in Bria portal and download the app.

    • To conigure a Voice account, use the Plivo SIP endpoint details that was created in the getting started section.

      X-lite preference

    • Download and install it. If you are on Mac or Windows, download X-lite(is now Bria). On Linux you should download Blink. For this tutorial we will use the X-Lite(is now Bria) Softphone.

    • Open the app and enable auto import Voice account details to auto-import the SIP account details.

    • Credentials of the endpoint you created will be auto-imported.

      Note: Field names may vary based on make and model of the SIP phone. All the configuration will remain in each case.

    X-lite account

    1. Click on OK when you’re done.

    2. Your endpoint entry in the list would be shown as Enabled. This indicates that your SIP phone has successfully registered with Plivo.

    Using a Default Dialer App

    • To start making call, attach the default direct dial app to the endpoint you just created now.

    • If you have already created the endpoint - go to the endpoints tab and click on the endpoint username. This will open an endpoint edit window. Select the direct_dial app from the “Plivo App” dropdown list.

    SIP Endpoint

    • If you creating a new endpoint - select the direct_dial app from the “Plivo App” dropdown list.

    Customizing the Endpoint App

    When you make a call from the softphone, Plivo sends a request to the ‘Answer URL’ of the application attached to the endpoint with the call-related parameters. To process the call, Plivo requires a valid XML response from the Answer URL. Let’s say, in our case, that we want to create a quick dial application and make an outbound call to the number entered from the softphone. The answer URL will receive a request with the ‘From’ and ‘To’ parameters. We need to parse these parameters and return the XML dial with the correct attributes.

    <response>
      <dial callerid="18004321321">
      <number>18001231234</number>
    </dial>
    </response>

    When the above XML is returned to the request, Plivo will make an outbound call to 18001231234 and connect it to the softphone.

    Examples

    We have examples of direct dial app written in multiple languages. Check out the code on Github and customize it based on your needs.