A2billing DID CID

Written by admin on November 17, 2014. Posted in A2billing

I recently carried out some work for client who had the following requirement:

He had clients with DID numbers. Some of the clients wanted the caller ID displayed when the DID was called to be that of the originating caller and others preferred the DID number to show up instead. 

The solution was as follows, i know it took me a long time to figure it out that is why i did this article to remember by.

The DID provider was passing  the DID number in the header and the originating call as caller name. So the process involves extracting the DID number for those who wanted the DID Caller ID. So in /etc/asterisk/extensions_custom.conf  i created two instances of settings for DID passing to a2billing.

# nano /etc/asterisk/extensions_custom.conf

exten => _X.,1,Noop
exten => _X.,2,Set(pseudodid=${CUT(CUT(SIP_HEADER(To),@,1),:,2)})
exten => _X.,3,Set(CALLERID(name)=${pseudodid})
exten => _X.,4,Set(CALLERID(num)=${pseudodid})
exten => _X.,5,deadAGI(a2billing.php,1,did)
exten => _X.,6,Hangup

exten => _X.,1,deadAGI(a2billing.php,1,did)
exten => _X.,2,Hangup
Ctrl X  and then Y
Now add custom destinations to FreePBX via FreePBX GUI>Tools>Custom Destinations
Custom Destination: custom-a2billing-did,${EXTEN},1
Destination Quick Pick: (pick destination)
Description: A2Billing - DID
Custom Destination: custom-a2billing-did2,${EXTEN},1
Destination Quick Pick: (pick destination)
Description: A2Billing - DID2
Start or restart FreePBX
amportal restart
Now all those clients who want DID numbers as CID can be set up on A2Billing - DID and those who want originating numbers can be set on A2Billing - DID2
This is how its done
Go to FreePBX and click on Inbound routes. Enter your DID and set destination to A2Billing - DID if you want to pass the DID number or A2Billing - DID2 for originating CID.

Trackback from your site.