Include RPID in first Ringing (180) sent to trunk

My setup is FreePBX ( + Cisco Unified Call Manager Edition (CME).
I had created trunks on both. I can make calls in both directions. What I want is displaying callee name when I make call. I need Remote-Party-ID. On FreePBX I set
in extension properties and in trunk properties.
If I make call from FreeBPX to CME then trasfering Remote-Party-ID to caller phone works normally.

If I make call from CME to FreePBX it doesn’t work.
While SIP debug I see that picture:

In point 1: FreePBX sends SIP ringing (180) WITHOUT Remote-Party-ID to CME. CME forwards this sip-ringing to caller phone adding Remote-Party-ID containing only phone number. Caller phone gets Ringing with Remote-Party-ID which contains number but DOESN’T contain name.

In point 2: called phone send SIP ringing (180) WITH Remote-Party-ID (containing proper name) to FreePBX. FreePBX forwards this sip-ringing to CME, but CME doesn’t forward this message to caller phone.

I debug local call on FreePBX (between two phones registered on FreePBX). During local call FreePBX send proper Remote-Party-ID in very first ringing(180) sip-message.

How can I get the FreePBX to include the proper Remote-Party-ID in first ringing (180) sent to trunk in point 1 ?

Well first the CallerID is from the person calling and therefore part of the INVITE. A 180/183 is a REPLY from the PBX, the PBX would not be sending back CallerID in a reply because that’s really not how it works. Yes, it is possible but that’s not how Asterisk works.

So Caller Phone is going to send it’s CallerID to the CME which should pass that through to FreePBX, when FreePBX sends the 18X message back, there’s no CallerID in those messages. It will pass the CallerID to the final destination.

You have to look at what the CME is doing, because it is in the way and well Cisco is known for doing things their own way and not standard.

But there is no callerid in replies only in requests.

A 180/183 is a REPLY from the PBX, the PBX would not be sending back CallerID in a reply because that’s really not how it works

As far as I see in SIP debugs it works during local calls - first Ringing reply includes proper RPID:
Remote-Party-ID: “called namesip:[email protected]

But if incoming channel is sip-trunk then first Ringing 180 reply (generated by FreePBX before answer from called phone) doesn’t include proper RPID. Second Ringing reply (generated called phone) includes proper RPID, but CME handling only first answer.
In this case it is first Ringing reply prevents proper displaying called name on caller’s phone.

It turns out this is known problem in asterisk. In this commit ( developers talk about this problem. They talked about creating the rpid_immediate option for chan_pjsip driver. And for chan_sip driver rpid_immediate option existing for a long time.

excerpt from comment in source:

rpid_immediate default=no
Send connected line updates on unanswered incoming calls immediately
Send 180 Ringing or 183 Progress response messages to the caller if the connected line information is updated before the call is answered. This can send a 180 Ringing response before the call has even reached the far end. The caller can start hearing ringback before the far end even gets the call
Many phones tend to grab the first connected line information and refuse to update the display if it changes. The first information is not likely to be correct if the call goes to an endpoint not under the control of the first Asterisk box

I will try to play with rpid_immediate option after weekend.

Hello @LamerDrv,

Read this article as well. It will help you to understand more the issue:

Thank you,

Daniel Friedman
Trixton LTD

May be this will help somebody.
Solution for my problem is to remove “r” letter from Settings -> Advanced Settings -> Asterisk Dial Options.
Default value for this setting in FreePBX is “Ttr”.