Removing Digits on Inbound Route

I am looking for a way to remove all but the final 4 digits on an inbound call and pass that on to another trunk connected to the system. The catch is that the call has to be only numbers in a specific inbound route, and not all numbers from the originating trunk. The primary inbound trunk receives all of the calls for the system, and I would like to leave everything untouched except for any numbers matching specific routes.

I was able to hack together something that seems to be working, an inbound route pointed at a custom destination of from-trunk,${FROM_DID:-4:4},1 which is caught by a second inbound route based on what the final 4 digits are. This seems like the completely wrong way to do things even if it does work, and I’d love to know if there is a cleaner way to do this.

Slightly cleaner way of doing this would be to create a context to preprocess the inbound calls with something like:

exten => _.,1,Noop(Entering user defined context from-trunk-cinara in extensions_custom.conf)
exten => _.,n,Goto(${EXTEN:-4:4},1)

You then edit the trunk(s) to use the above context and all calls from that trunk will arrive at the inbound routes with a DID of 4 digits.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.