Building a SIP Registrar with Jambonz

Introduction

Since inception of the TelecomsXChange (TCXC) platform, it was designed for wholesale communication service providers that did not require SIP registration to send traffic, so we never had the need to add SIP Registrar to the SIP Stack. Recently, two of our enterprise customers had change in their infrastructure and no longer will be able to send traffic from without SIP registration, so they asked us to enable SIP registration for them on TCXC platform.

To deal with this request we had two choices here:

1- Add a SIP registrar module to the TCXC Platform.

2- Say no to the customer and let them go.

We really did not want to deal with adding SIP registration module to the platform for several security and performance reasons, but at the same time we did not want to say no to our customers. But still needed a way to serve them without the overhead of adding SIP Registrar to the platform.

To solve this, we thought what if we can move SIP registration to the edge using CPaaS and simply route the customer calls to TCXC for completion using a SIP trunk between CPaaS and TCXC.

Why Jambonz?

Jambonz is the open-source CPaaS platform that is designed to plug-and-play with your any SIP/SMPP carriers, recently we have been working closely with Jambonz founder Dave Horton to give CPaaS developers the power of Choose Your Own Carrier by integrating Jambonz and TCXC platforms together.

Building a SIP Registrar at the Edge with Jambonz

We made a short list of our needs to run this idea successfully:

1- Registrar Authentication: the SIP clients need to register with a username / password and stay alive on the server. So we need an online registrar 24×7 that SIP clients will be registered to. We created a new sub-domain (register.telecomsxchange.com) and pointed it to Jambonz in our DNS records.

For this we chose to use the cloud hosted https://jambonz.us so we do not have to maintain any additional servers, when a SIP registration request comes us Jambonz will call a SIP Registration web-hook URL to check if the user entered proper username and password. if the credentials are correct the SIP client will register successfully.

2- Dial Plan Rules: The SIP clients need special caller-id rules for their use case, which means when they call destination A 1234567 will show up and when the same customer calls destination B a different caller id must be sent. For that Dave Horton (Thank you!), wrote a web-hook very quickly for us to apply these rules whenever a call is made.

3- Outbound Calling: Finally, routing out the calls to TCXC SIP Providers using different credentials for each customer. Since both customers calls will originate from the same Jambonz IP-addresses, we need to differentiate billing and routing for each customer. To achieve this, we created a different buyer account for each customer on TCXC platform with unique SIP Digest Authentication to each one in order to differentiate billing and routing for each customer,

The below code few lines of code are responsible for handling all the business rules that we needed:


{
  "register.telecomsxchange.com": {
    "AcmeInc": {
      "password": "sip-pass",
      "techPrefix": "444242#",
      "outboundAuth": {
        "username": "siptrunk1-username",
        "password": "siptrunk1-password"
      },
      "callerId": {
       "default":"+18009992222",
        "patterns": [;
          { "match":"^966", "callerId": "0598888833" },
          { "match":"^971", "callerId": "045677777" }
        ]
      }
    },
    "JaneDoe": {
      "password": "sip-password",
      "techPrefix": "444924#", 
      "outboundAuth": {
        "username": "siptrunk2-username",
        "password": "siptrunk2-password
      },
      "callerId": "+12127771222"
    }
  }
}

Full Web Hook App Source Code available here

Conclusion

To keep customers happy we needed to serve them with a SIP registrar which we did not want to maintain nor add to TCXC platform stack currently. We explored the idea of moving the SIP registrar to the edge and think of it as a micro-service, in the matter of couple hours and with the help of Jambonz creator Dave Horton, we were able to build a SIP registrar service for our enterprise customers using Jambonz hosted + web-hooks and route their calls via TCXC platform.

Jambonz is cloud-native, the hosted service runs on AWS and supports auto-scaling and Geo-distribution by design, so we did not only keep our old customers happy but now can offer SIP registrar to new customers and don’t worry about scaling up.

Share
%d bloggers like this: