Inbound forwarded calls - inbound CID priority route

THE BACK STORY
Some of our field workers forward their cell phones to the main DID when they are in the office.

The incoming call that is forwarded from the cell phone (along with direct calls to the DID) lands in an IVR where it prompts a user to dial a extension.

When a call that is forwarded from a cell phone lands on a Sangoma S505, the caller ID display shows the following;

415-222-3333
Via: 916-222-3333

The top number (415-222-3333) is the originating party’s caller id
The lower number (Via: 916-222-3333) is the caller ID of the cell phone that is forwarding the call

THE QUESTION
how can I build an incoming route that watches for caller ID of the cell phone (Via: 916-222-3333) that is forwarding the call to the DID?

The goal is to identify forwarded calls from cell phones and direct them to the proper extension without going through the IVR.

a stepping stone to a solution.

Stewart at this thread;

I don’t understand what he means by “context from-trunk”


START OF POST FROM STEWART

Assuming that your incoming trunk context is from-trunk, add or put this code into
/etc/asterisk/extensions_custom.conf

[from-trunk-checkdivert]
exten => _X!,1,Noop(RDNIS=${CALLERID(rdnis)})
exten => _X!,n,Goto(from-trunk,${EXTEN},1)

Change the context for the trunk to from-trunk-checkdivert
Apply config and make a test incoming forwarded call. Look at the Asterisk log for a line with something like
RDNIS=2125551212
showing the number that forwarded the call. If RDNIS is null, either the forwarding carrier doesn’t add a Diversion header, or your trunking provider doesn’t send it. If it is present, note the exact format and modify extensions_custom.conf to look like this

[from-trunk-checkdivert]
exten => _X!,1,Noop(RDNIS=${CALLERID(rdnis)})
exten => _X!,n,GotoIf($["${CALLERID(rdnis)}" = "2125551212"]?from-internal,*1234,1)
exten => _X!,n,Goto(from-trunk,${EXTEN},1)

Apply config and make another test call. The forwarded call should now be sent to voicemail for extension 1234.

Once this is working, add a similar GotoIf statement for each number for which you want to handle forwarding.

If you have trouble, post details including country, trunking provider and forwarding carrier.

END OF POST FROM STEWART


I figured it out.

The context in my trunk WAS from-ptsn
that needed to change to from-ptsn-checkdivert

then the code sample provided by Stewart works.

Stewarts code essentially takes the call out of the trunk, runs it through this quick code snippet and then returns the call to the truck to exit the trunk and do normal PBX items.

[from-ptsn-checkdivert]
exten => _X!,1,Noop(RDNIS=${CALLERID(rdnis)})
exten => _X!,n,GotoIf($["${CALLERID(rdnis)}" = "2125551212"]?from-internal,*1234,1)
exten => _X!,n,Goto(from-ptsn,${EXTEN},1)

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