Using Plivo with FreePBX / Asterisk

I was trying to setup Plivo to be used as a SIP trunk with Asterisk / FreePBX. I couldn’t find a comprehensive guide anywhere that described how to setup Plivo trunks. I found the following docs Plivo’s site which hardly explain anything:

I emailed their support and never heard back.

I’ve made plenty of progress on this, I have inbound and outbound calls working, My outbound calls go via plivo’s zentrunk.

Inbound come in via the Plivo endpoint registered as a sip trunk.

Here is a great guide:

The problem is, as it said at the top of the guide, Plivo does not send DID over registration or Trunk, so your pbx will not know what number the caller actually dialed.

I have made some steps to fix this using custom extensions, But the best case i can get is

With some clever regex & find and replace in the custom context i have managed to identify a single DID on the pbx when it comes in.

I just thought if i want to separate out number streams I need to create different applications, Different Endpoints in plivo and different context strings in Freepbx AND different inbound routes in the freepbx to manage different DiD’s

I am trying to work on a simpler solution that will pass plivo DID’s directly to the FreePBX. but as yet have failed.

I did get some support by email from plivo, and a call from plivo but i was busy, They never called back.

Its important to note plivo is a no frills service designed for developers and built around XML, so i acknowledge the way i’m trying to use it is not the official supported way, The easiest thing would be if Plivo enabled Inbound calls Across the zentrunk passing DID, but i think thats not for a while.

I will keep you posted if i have any updates.

Look at a couple of the other threads by me for relevant links to what i have achived so far, and i will probebly do a full write up once i have cracked it.