Asterisk fails to pick up SIP RPID and resend it as CallerID

We use OpenSER (1.2.2 )primarily as our SIP server. Meaning every user originates on OpenSER. We use Asterisk (1.4.11) as a PSTN-GW connected via zaptel (wcte11xp) to our phone network.

When routing SIP messages through Asterisk the users phone number gets misplaced. It seems asterisk is guessing the ${CALLERID(num)} is the username part of the SIP uri contact… which in our case it is not. Instead we are relying on adding Remote-Party-ID and/or P-Asserted-Identity… this works fine with other commercial PSTN-GW’s we’ve been testing!

However, I can’t seem to make Asterisk pick it up. Running sip debug on the console shows that the RPID does arrive at asterisk. But it isn’t used for anything… Manually overriding the outgoing id with Set(CALLERID(54321)) works - so I know asterisk can send it across the pri/zap interface to the network - but that is not a solution.

Any ideas?! I’ve tried the trust_rpid, send_rpid options in sip.conf, but it’s my understanding those are only valid for outbound sip connections FROM asterisk?!

An example of our invite and what happens in the simple dialling scheme we have in extensions.conf grabbed from the console;

INVITE sip:12345@asterisk:5062 SIP/2.0 Record-Route: <sip:openser.domain.net;lr;ftag=65k7wbrrxe> Via: SIP/2.0/UDP openser.domain.net;branch=z9hG4bK0aea.2ca4bdb3.0 Via: SIP/2.0/UDP client.domain.net:5060;branch=z9hG4bK-nmbzi2tbal3d;rport=5060 From: "Full Name" <sip:username@domain.net>;tag=65k7wbrrxe To: <sip:12345@domain.net> Call-ID: 3c27c524cd14-rj2115v4lwyu@snom360-00041323858B CSeq: 2 INVITE Max-Forwards: 69 Contact: <sip:username@client.domain.net:5060;line=k6kb9uu9>;flow-id=1 P-Key-Flags: resolution="31x13", keys="4" User-Agent: snom360/6.5.10 Accept: application/sdp Allow: INVITE, ACK, CANCEL, BYE, REFER, OPTIONS, NOTIFY, SUBSCRIBE, PRACK, MESSAGE, INFO Allow-Events: talk, hold, refer Supported: timer, 100rel, replaces, callerid Session-Expires: 3600;refresher=uas Min-SE: 90 Content-Type: application/sdp Content-Length: 477 Remote-Party-ID: <sip:54321@domain.net>

-- Executing [12345@from_openser:1] NoOp("SIP/domain.net-081dc5d0", "num: username") in new stack -- Executing [12345@from_openser:2] NoOp("SIP/domain.net-081dc5d0", "name: Full Name") in new stack -- Executing [12345@from_openser:3] NoOp("SIP/domain.net-081dc5d0", "ani: username") in new stack -- Executing [12345@from_openser:4] NoOp("SIP/domain.net-081dc5d0", "dnid: 12345") in new stack -- Executing [12345@from_openser:5] NoOp("SIP/domain.net-081dc5d0", "rdnis:") in new stack -- Executing [12345@from_openser:6] Dial("SIP/domain.net-081dc5d0", "Zap/g1/12345||r") in new stack -- Requested transfer capability: 0x00 - SPEECH -- Called g1/12345