Ever wanted to modify a CallerID string from a specific trunk in Asterisk / FreePBX? One simple example of why one would want this is to prepend “EXT” to a specific trunk or mark different trunks.
We are leveraging Asterisk contexts to “modify” the inbound call. You can use and modify the following snippet:
[from-ext]
exten => _X.,1,NoOp(Entering from-ext context)
same => n,Set(CALLERID(name)=EXT: ${CALLERID(name)})
same => n,Set(CALLERID(num)=*8${CALLERID(num)})
same => n,Goto(from-internal,${EXTEN},1)
This snippet does the following:
- append “EXT: ” to the CID name
- append *8 to the CID number (this is helpful to stop FreePBX from overriding the CID name)
Be sure to modify your trunk to utilize the newly created context by changing the “context” attribute found in most trunks.
Using FreePBX
If you are using FreePBX installing a context is simple. Use the “Configuration File Editor” and edit “extensions_custom.conf”. Just append and modify your context, then change the context in your trunk and you’re all set.
Links to documentation
https://docs.asterisk.org/Asterisk_16_Documentation/API_Documentation/Dialplan_Functions/CALLERID/
Leave a Reply