Provider P-prefred-Identity header

Hello all !

Sipgate wants the P-prefred-Identity header in order to show the CID on an outgoing call.

We have two freepbx installations. One is online (we call it “pbxonline”) and one is local at our office (we call it “pbxoffice”).

pbxonline has a pjsip trunk to sipgate (“sipgatepjsip”). Calls from and to the outside are shipped through sipgate.

pbxonline has several pjsip extensions for our external employees (working from home).

pbxoffice has several sip extensions for the office workers.

The two installations pbxonline and pbxoffice are linked by an IAX2 trunk.

In order to set the CID by indicating it in the P-prefred-Identity header as requested by Sipgate we followed these instructions:

When an extension on the pbxonline installation places a call to the outside it is routed by an outgoing route (“sipgate_out”) to the sipgate trunk (“sipgatepjsip”) which has “Asterisk Trunk Dial Options” set to "B(custom-sip-header^s^1)" as indicated in the mentioned instructions. This works fine meaning that the extenion’s Outbound CID is shown to the called party by Sipgate!

BUT now comes the problem:

If a call is placed by an extension on the pbxoffice installation, the outgoing call is first routed by an outgoing route (“pbxonline_out”) to the aix2 trunk (“pbxonline”). Arriving at the pbxonline installation the call is routed by an inbound route (DID: Any, CID: Any) to the trunk sipgatepjsip (don’t know if this is proper ?!). For some reason those calls are not provided with the P-prefred-Identity header. And therefore the Outbound CID set by the calling extension on the pbxoffice installation is not shown by Sipgate.

I must admit that I am not that firm in asterisk and in general in voip principles. And I would be very thankful if someone could help me to get this fixed. Thanks !

Th method in the linked post is out of date. The best method right now for adding custom headers to SIP trunks is to use this method: Custom SIP header on outgoing calls

What is the callerid of the call leaving the pbxoffice system, is it the PSTN caller ID or the local extension? Are you using the intracompay option in the route to pbxonline?

1 Like

Hi Lorne, thanks a lot for your attention !

Are you using the intracompay option in the route to pbxonline?

I did not activate the intracompany option on the pbxonline route - should I ?

What is the callerid of the call leaving the pbxoffice system, is it the PSTN caller ID or the local extension?

At the pbxoffice extensions we set the PSTN Outbound CID (ex. 491234567812). And we do not touch the CID further more during the routing.

The best method right now for adding custom headers to SIP trunks is to use this method

Honestly I do not understand this method. Could you be so kind and help me how to introduce the P-prefred-Identity header with it ? As stated the name of the outgoing trunk on the pbxonline installation is “sipgatepjsip”

Thanks a lot for any further help.

Hey Lorne, I just gave it a try and activated the intracompany option on the outgoing route on the pbxoffice installation … and voilà, it works (still with your old method).

Thanks for the great help !

Glad it’s fixed, but I can’t think of any reason why intracomany would work in this case and you are still using a dated method to add headers. Be prepared to revisit this in the future if it breaks again.

Lorne, you are right. In fact I was to fast - I wrongly thought to have done the test with an extension of the pbxoffice installation but in fact I was using an extension of the pbxonline installation from where the old methode is working.
So I would be very glad if you could go through my questions in answer to your first post …

@lgaetz - I would be very thankful if you could have a look at my questions

This is something you’re going to need to figure out on your own. Get a call trace of a working call and a non-working call and compare the two. You can share the trace via pastebin:
https://wiki.freepbx.org/display/SUP/Providing+Great+Debug#ProvidingGreatDebug-AsteriskLogs-PartII

Hi Igaetz,
I did the trace and your guess is right - the call leaves the pbxoffice system with the local extension number (20) instead of outgoing CID (49123456789) as CID. Do you have any idea, where I could change this? Thanks a lot for any further advice !

chan_iax2.c: VERSION : 2
chan_iax2.c: CALLED NUMBER : 0145232145
chan_iax2.c: CODEC_PREFS : (ulaw|alaw|gsm)
chan_iax2.c: CALLING NUMBER : 20
chan_iax2.c: CALLING PRESNTN : 0
chan_iax2.c: CALLING TYPEOFN : 0
chan_iax2.c: CALLING TRANSIT : 1
chan_iax2.c: CALLING NAME : Myname
chan_iax2.c: LANGUAGE : en
chan_iax2.c: USERNAME : pbxonline
chan_iax2.c: FORMAT : 4
chan_iax2.c: CAPABILITY : 14
chan_iax2.c: ADSICPE : 2
chan_iax2.c: DATE TIME : 2020-05-02 01:14:40

Btw the pbxoffice system is an old installation (elastix):

Name Package Name Version Release
FreePBX
freePBX 2.7.0 9
Name Package Name Version Release
Asterisk
asterisk 1.6.2.13 0
asterisk-perl 0.10 2
asterisk-addons 1.6.2.1 0

And here my iax2 trunk settings:

[PEER Details]
username=pbxonline
type=peer
secret=xxxxxxxxxxxx
qualify=yes
host=pbxonline.xxxxxxxx.com
context=from-trunk

[USER Details]
type=user
secret=xxxxxxxxxxxxxxxx
qualify=yes
host=pbxonline.xxxxxxxxxxx.com
context=from-trunk

If anybody has an idea on this, I would be very thankful !

You’re asking questions about config of FreePBX 2.7 system, circa 2009 or so. It’s long past time for migration to a supportable version.

I see. That will be quite some work as I suppose that I have to do a reinstall from scratch. Or do you think I could go for an update?

If it was mine, I wouldn’t even consider upgrading in place, and the version is too old to use any of the migration tools. I fear your only option is setup a new 14/15 system side by side and copy and paste from one to another.

Don’t neglect the next one for a decade.

Don’t neglect the next one for a decade.

:sweat_smile: ok - see you

I’ve recently been using the new backup module in FreepBX 15 with a backup file from 2.8.

Currently, most of the bugs I found and reported from that process are resolved. The biggest issue now is the chan_sip port getting reassigned to 5062 instead of taking over 5060. But the new tool to migrate all the extensions to pjsip will work around that, once I get a chance to test it.

1 Like

thanks for sharing !
It’s incredible how a decade passed by in a glimpse …