Asterisk 1.8 INbound Caller ID from registered SPA3000

I have been struggling with this for a while and can not seem to find the solution. I admit this is Elastix, but months now and no answer so I thought I would try here

Asterisk 1.8 (LAN 1)
SPA 3000 connected to PSTN line (LAN 2)
asterisk and SPA communicate over the interent, and SPA 3000 registers to asterisk for inbound and outbound calls via PSTN connection on SPA3000

All works perfectly except when I receive a call I wait 2 seconds so the SPA gets the caller ID before sending the call over the internet to asterisk, which I can see in the SIP header below the caller ID is present.

At the point the call goes to the ring group it appears with the extension caller ID 5010 in this case . I have looked at various methods to bypass this and get the original caller ID to pass which is available in the “from” as well as “Remote Party ID” fields.

It must be relatively simple to bypass this and assert the inbound caller ID. Perhaps I need to swap the caller ID? I think because asterisk sees that device as registered it will overwrite the caller id with the extension.

I have a very simple dial string at present delivering those calls to a ring group. This was to defeat any caller ID manipulation from Elastix/freepbx. I have tried MANY dial strings. I always get 5010 displayed no matter what I try

exten => 2222222,1,Set(CALLERID(name)=${CUT(CALLERID(number),@,1)})
exten => 2222222,n,Dial(local/600@from-pstn)
exten => 2222222,h,Hangup

SIP/2.0 200 OK
Via: SIP/2.0/UDP;branch=z9hG4bK-bd7e388c;;rport=5066
From: 5010;tag=7bd238ebe1ac27cco1
CSeq: 102 INVITE
Server: FPBX-2.8.1(
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 267

Extensions don’t have caller IDs.

Incoming devices can have their caller-ID overridden, but you would have to have specified callerid=… for that. Maybe you misunderstood that setting.

I do not understand what you are referring to. What setting are you saying I might be misunderstanding?

I need to NOT overwrite the caller ID but I think asterisk does this by default because the call comes from a registered trunk, so caller CID is changed to extension number.

Please be specific

How would I craft the dial string to call the ring group directly from the incoming extension to ring group while preserving CID and not have it overwritten with the extension number?

Caller ID will be preserved by default.

Note that “ring group”! is not an Asterisk concept, so it is possible that your problems are being caused by a third party dialplan, such as that which comes with FreePBX.

The setting I’m referring to is:

[quote]; Standard configurations not using templates look like this:
;context=from-sip ; Where to start in the dialplan when this phone calls
[color=#FF0000];callerid=John Doe <1234> ; Full caller ID, to override the phones config
; on incoming calls to Asterisk[/color]
;host= ; we have a static but private IP address
; No registration allowed
;directmedia=yes ; allow RTP voice traffic to bypass Asterisk[/quote]

Davisd, you go from one vague reason to the other of which none apply.

It is not the ring group!

It has nothing to with a TRUNK config. The SPA 3000 Registers as an extension.

The fact that it is an extension is the very problem. When a call comes in I see the extension caller ID

I want to swap extension caller ID for what I see in the remote party ID line

Remote-Party-ID: 5010 sip:1234567890@;screen=yes;party=calling
I can see that there is an

asterisk sip header function that will likely allow me to get the cvontents of the RPID and pass it along instead. … SIP_HEADER

The problem I have is simple and that is how to replace the bogus extension for RPID.

You can convolute it all you whish but that is the short version

You don’t have a trustrpid=yes line. Without that, Asterisk will use the From header as the caller ID, even if an RPID header is present.

You did not mention RPID before, and that was key to the question, but you did use confusing terminology. Asterisk extensions are things that appear in extensions.conf. An external device need not even have one extension number associated with and may have many.

Also you definitely did introduce ring groups into the question:

I’m guessing the SPA3000 is a SIP PSTN gateway, in which case it isn’t even an extension in FreePBX terms.