Asterisk HMR Rules

Hello, I’m working with a customer that has to interact with our system in a very specific way, and our Acme SBCs are set up to expect traffic in a very specific way, which is causing some issues with the way we would like to present outbound caller ID from their device.

The scenario I’m looking to find a solution to should work like this:

Asterisk box received inbound call from 111-222-3333.
Asterisk box forwards call out to 999-888-7777.
We need the Asterisk box to present caller the caller ID of “111-222-3333” on that call rather than the number registered to this trunk. In order to do that within the context of how our SBCs are set up we need this information to be provided in the P-Asserted-Identity header.

From what I’ve been able to gather thus far this is probably a two part resolution, the first part is to use CUT to remove the information from the “From” header of the call that is being presented. When calls come into us, at the moment, they are being presented with the “From” header shown as such:

From: “1112223333” sip:user@domain;tag=as4ba66c63

I have looked around and have not been able to find a way to use the CUT function on just that specific chunk of the From header that is shown in bold/quotation marks above.

From there the rest of it seems pretty straight forward, I would just have to take that information and use "SipAddHeader(P-Asserted-Identity: sip:${whateverfunctionitisthatiputhere})

Does anyone have any idea what direction I could go to make this work the way that we want it to work?

Irrespective of the fact that the information within the From-Header should be present in and accessible from the CALLERID(num)-Variable, the CUT-function is widely documented (e.g. http://www.voip-info.org/wiki/view/Asterisk+func+cut).

Whenever CALLERID(num) may not usable for any reason, You need to use the CUT-function on the SIP_HEADER(From)-Variable, field separator may be the double quote, in such cases CUT needs to be used twice (or nested respectively).

This link will very useful for you and also there are multiple examples of the CUT function freepbx.org/support/document … nd-it-and-

Unless I’ve missed something, this is one step:

sip.conf: sendrpid=pai