Incorrect Caller ID with custom context

Greetings!

I am attempting to build a voice mail server for our MetaSwitch softswitch.

I am running FreePBX 2.8.1.5 / Asterisk 1.8.18.0 on CentOS 6.

On the FreePBX box, I have extensions configured that have the same 10-digit numbers as our softswitch subscriber lines. There is a SIP trunk between FreePBX and the softswitch. The MetaSwitch is configured to use the FreePBX box as an “application server”.

In order to route the call to the correct mailbox, I use the following custom context to swap in the RDNIS for the trunk number before passing the call on to from-trunk.

[custom-get-did-sip]
exten => _.,1,Noop(Fixing DID using RDNIS)
exten => _.,n,Set(pseudodid=${CALLERID(rdnis)})
exten => _.,n,Goto(from-trunk,${pseudodid},1)

This context is then used on the extensions and the SIP trunk.

There are two inbound routes for each extension:

any DID / 360XXX1234
360XXX1234 / any CID

The first goes to misc destination for *97, while the second goes to the extension (and thus voicemail).

On each extension, I am using the IP of the softswitch as the host rather than ‘dynamic’ (for MWI).

This mostly works. Calls sent to voicemail do reach the correct extensions and interaction with the menu is fine. Calling in to the trunk to check for voicemail also works.

But a strange thing happens:

The caller ID on the inbound calls is reported in the console as the lowest 10-digit extension on the box, not the calling number. If I create another extension that has a number lower than current lowest extension, that extension’s number is then used as the caller ID. This occurs whether I am calling the trunk number to check voicemail or if a call is passed to the trunk to leave voicemail.

There is one exception: when calling the trunk number or another number whose voicemail is served by this box, if the calling number matches the number of an extension on the box, the caller ID is correct.

I have looked through the various bits of the dial plan trying to figure out how this is happening, but I am stumped.

Any ideas?

I can provide further info, of course, but will wait to see what is requested.

Thanks in advance!

Why is it that every time I finally come to a forum with my tail between my legs, I find my solution minutes later?

It was as simple as setting Type to User on each extension.

I think I’ve been working on this one for too long. :wink: