Incoming Caller-ID in P-Asserted-Identity

Hi,

Was searching the forums about this but only found some information for outgoing calls but nothing for incoming calls.

My trunk is set to pass the incoming caller ID in the SIP Header P-Asserted-Identity (not in from). How can I get the callerID from this SIP Header so extensions are showing the correct Caller-ID?

Thanks a lot in advance for any help on this.

Best regards

Marc

What context do you have your trunk setup to be from?

It’s on Context “from-trunk”

I am dealing with the same issue right now. I have a Grandstream HT503 configured as a trunk with IP auth (no username and password) with inbound and outbounds via HT503. I believe you need to create a custom context in

/etc/asterisk/extensions_custom.conf

I came up with this but have not tested it yet!

[from-pstn-passerted]
exten => _X!,1,Set(CALLERID(num)=${SIP_HEADER(P-Asserted-Identity)})
exten => _X!,n,Goto(from-trunk,${EXTEN},1)

then you send your call must use the context from-pstn-passerted and be passed to from-trunk

likewise if you wanted to prefix say a 1 or a zero you could prefix a 1 like in the example below

[from-pstn-passerted]
exten => _X!,1,Set(CALLERID(num)=1${SIP_HEADER(P-Asserted-Identity)})
exten => _X!,n,Goto(from-trunk,${EXTEN},1)

And last but not least if the header is Remote Party ID

[from-pstn-rpid]
exten => _X!,1,Set(CALLERID(num)=${SIP_HEADER(Remote-Party-Id)})
exten => _X!,n,Goto(from-trunk,${EXTEN},1)

All of this of course assumes we are dealing with a trunk and not an extension because Asterix/FreePBX will overwrite this with extension info based on default contexts

Guess what, it’s also a Grandstream HT503. And I’m also using it for dialing in and out without authentication. So if I understood you correct, I would have to change the context in the trunk’s settings to the custom one and it should work, is that correct? Btw: it’s off topic but does you’re HT503 also have problems with PSTN disconnect detection? If not what country are you living in and could you please PM me or b post here a screenshot of your pstn and ac termination settings?

Hi,

I tested it and it doesn’t work. I did set the trunks context to “context=from-pstn-passerted” and added the [from-pstn-passerted] in the extensions_custom.conf. As soon as I set the trunks context to “from-pstn-passerted” no extension is ringing anymore. I even tried rebooting the system but it doesn’t work.

Does anybody know why the extensions stop ringing?

Thx a lot

THIS CONFIG WORKS!

Mine IS authenticating (much like an IP auth but with a dynamic hostname). Mine actually is configured on Elastix , and Here is what I have in the trunk

name trunkName
details:
host=my.ddns.com
port=5092
type=peer
insecure=port,invite
canreinvite=no
directmedia=no
disallow=all
allow=ulaw&ilbc
context=from-pstn
trustrpid=yes
qualify=yes

user settings TrunkName-in

insecure=port,invite
disallow=all
allow=ulaw&ilbc
canreinvite=no
directmedia=no
context=from-pstn
trustrpid=yes
port=5092

Other settings that may have an impact:

if using a dynamic hostname , edit /etc/asterisk dnsmanager.conf and avtivate it by commenting out lines and changing updates to 60. This ensures that ddns hostname is not stale

Asterisk SIP settngs at bottom of page in the blank fields add:
match_auth_username = yes

As I can not get to the grandstream at the moment I can not post the HT503 config here now but maybe later. If you do not authenticate you need to enable anonymous SIP inbounds which I only recommend to my worst enemies.

I can say that the grandstream shares the username and password that is used in asterisk and points to the asterisk IP with the call forward settings configured to [email protected]

Mark

Hello Markosjal,

No offense meant and thanks for trying to help but. Did you really read what the problem is about? Nobody is talking about authenticating or something. So please read and understand what this thread is about.

The point is that HT503 can transmit the Caller-ID also in a different SIP Header fields, one of them being “P-Asserted-Identity”. On some forums they say that this is more reliable and so I tried to configure freepbx/asterisk to make use of them. As you see the above sultion which looked quite promising doesn’t work, I have no clue why but then extension for incoming calls from the HT503 stops working.

No offense

that is what I still get out of it.

I am passing caller ID in p asserted identity as well and the config I posted works.

If you actually try it you might just find it works for you. I only pointed out that I AM authenticating and a few other variables that may affect it.

In my scenario I do not need a custom context

take a flying leap if you don’t want help. That is all I tried to offer