P-Prefered-Identity

My provider told me that I have to send the Outbound CID from my Extensions as “P-Prefered-Identity” in the SIP header. The same issue is with the Followme Option. To see the original callers ID I have to send that CID not in the “from” field, as the “Default” does, but I have to send that ID also as “P-Prefered-Identity”.

Can anybody help me to add the scripts for this matter?

Many thanks!

I think this should do the trick.

Look in “Settings|Advanced Settings” find the field “SIP sendrpid”. It is probably ser to “no”, set it to “pia”.

Hover your cursor over the help icon for “SIP sendrpid” and read the help popup for additional info.

That advanced setting only changes the default for new extensions. Also “pai” makes it send P-Asserted-Identity, not P-Preferred-Identity. To send the latter you will need to do some custom dialplan. Something like this in /etc/asterisk/extensions_custom.conf perhaps:
[font=Courier]
[macro-dialout-trunk-predial-hook]
exten => _X.,1,SipAddHeader(P-Preferred-Identity:sip:${CALLERID(num)})
[/font]

Let’s try that again.

Escaping the angle brackets helps!

[macro-dialout-trunk-predial-hook]
exten => _X.,1,SipAddHeader(P-Preferred-Identity:<sip:${CALLERID(num)}>)

Hi miken32, thankyou for the information.

I tried it, because I need the P-Preferred-Identity to send the outgoing number.
I changed the extensions_custom.conf to:

[macro-dialout-trunk-predial-hook]
exten => _X.,1,SipAddHeader(P-Preferred-Identity:sip:${CALLERID(num)})

But the outgoing CID does not work.
Can you help me please to get the P-Preferred-Identity to work?

I use Stable-4.211.64-5 Release Date-07-31-13 FreePBX 2.11, Centos 6.4 Asterisk Version 11 and Sipgate as the sip provider.

With the old FreePBX Version 1 outgoing CID works with sipgate. With the new version, the default CID, setup by sipgate, is shown on every call.

Kind regards,
Marco

Hello Marco, Miken

I have the same problem, did you fixed it ?

thanks in adavance for any help!

I am also having the same issue. Did anyone find a resolution to this issue?

I need to set p-preferred-identity header on all my calls over my trunk.

To set outgoing Sipgate CID it´s mandatory to use the international format 49 without any prefix (00 or +). The leading 0 has to replaced by 49.

This code works for me (placed in appropriate context and saved in extensions_custom.conf or extensions_override_freepbx.conf):

exten => _X.,n,SipAddHeader(P-Preferred-Identity:sip:49${CALLERID(number):1}@sipconnect.sipgate.de)

NO additional changes in asterisk needed (sendrpid as default).

Helo DrKupka,

what is a appropriate context? is that the context from the trunk settings i have to set in the PEER Details?

Do i have to write the priority “1” and not “n” if this was my only entry in the conf file?

Thanks for answer

Dominique

Sure, if it´s the FIRST line in context priority has to be “1”.
You have to modify your outgoing context (or alternatively incoming in case of CF) in extensions_override_freepbx.conf or extensions_custom.conf.

Helo DrKupka,

thanks for answer. First, i have first read about custom dialplans in freepbx, i hope i will than understand the system… :wink:

Thanks dominique

Helo DrKupka,

i don’t understand the system of the custom dialplan.

maybe you can give me a rough overview of the necessary steps.

I’m disoriented.

Many thanks in advance

Dominique

All you have to do is to add these two lines to extensions_custom.conf

[macro-dialout-trunk-predial-hook]
exten => s,1,SipAddHeader()
exten => s,n,MacroExit()

Between SipAddHeader parentheses add desired field, ie. what works with your SIP provider:
; P-Preferred-Identity: “Name” <sip:[email protected]>
or
; P-Asserted-Identity: “Name” <sip:[email protected]>
; P-Asserted-Identity: tel:+12345678901

mIRO

Halo vmiro,

thanks for answer :wink:

I have found the solutuion with [macro-dialout-trunk-predial-hook] yesterday and it works for me.

exten => s,1,ExecIf($["${TRUNKOUTCID}" = " tipe the number of your trunk CID "]?SipAddHeader(P-Preferred-Identity:sip:49${CALLERID(number):1}@sipconnect.sipgate.de))

Thanks

Thanks

Hello all,
and thank you very much for your ideas and solutions.
I put the following lines to the extensions_custom.conf

[macro-dialout-trunk-predial-hook]
exten => s,1,SipAddHeader(P-Preferred-Identity sip:${CALLERID(number)}@sipconnect.sipgate.de)

Now i can set the Outgoing number in the User extension (Outbound CID).

I remarked that it makes no differents, if i change the following in "Settings->Advanced Settings"
SIP trustrpid
SIP sendrpid
yes, no, pai is possible.
I hope that someone can use this infos.
Thanks

In my code is a mistake !!!
I forgot the ":"
The correct Code is:

[macro-dialout-trunk-predial-hook]
exten => s,1,SipAddHeader(P-Preferred-Identity:sip:${CALLERID(number)}@sipconnect.sipgate.de)

Greetings Daniel

I remarked that it makes no differents, if i change the following in “Settings->Advanced Settings”
SIP trustrpid
SIP sendrpid
yes, no, pai is possible.

I can confirm this in 6.12.65-26. I tried systematically all different options, also on extension level. I never got a P-Asserted-Identity String to be added to the header via any gui options / combinations.

[macro-dialout-trunk-predial-hook]
exten => s,1,SipAddHeader(P-Preferred-Identity:sip:${CALLERID(number)}@sipconnect.sipgate.de)

${CALLERID(number)} didn’t work for me, but hardcoding any number out of the trunk solved the problem.