P-Asserted-Identity and Remote-Party-ID header
P-Asserted-Identity and Remote Party ID SIP header
Some wholesale providers are now requiring that packets include P-Asserted-Identity or Remote Party ID in the header of SIP packets.
I spent some time messing with this since there is little to no documentation on such things regarding Asterisk or Trixbox. Since I had such a hard time of it, I thought I would write a really short howto so that maybe others will have it bit easier.
Remote Party ID:
This was the easier of the two. In sip.conf you must set the two variables
sendrpid = yes
trustrpid = no
P-Asserted-Identity:
This was more difficult to figure out and had far less documentation. To add headers we use the SipAddHeader() function in the dial plan, extensions.conf, or for trixbox, extensions_custom.conf.
in our trixbox extensions_custom.conf we have set up the following... assuming you dial from the [from-internal] context
include extensions_trixbox.conf
include extensions_hud.conf
[from-internal-custom]
exten => _1NXXNXXXXXX,1,SipAddHeader(P-Asserted-Identity: <sip:${CALLERIDNUM}>)
exten => _NXXNXXXXXX,1,SipAddHeader(P-Asserted-Identity: <sip:${CALLERIDNUM}>)
include => from-internal-trixbox
You may substitute whatever you want in side the < > a provided ID number or whatever... we just set callerid for demonstration purposes.
Obviously you can also change, or add a dial pattern, or specific extension in place of the _NXX for example
exten => 2000,1,SipAddHeader(P-Asserted-Identity: <sip:${CALLERIDNUM}>)
would only add headers when extension 2000 dialed.
Testing:
To test that your headers are being added, start the asterisk console and make a call that would match the extension pattern. You should see some thing like the following on your cli
-- Executing SIPAddHeader("SIP/2001-0857e7b8", "P-Asserted-Identity: <sip:2001>") in new stack
To further test, you can run tshark (the new name for ethereals command line packet capture tethereal) on your asterisk server when you make the call and capture sip packets to a log file
After you place the call hit ctrl+c to close tshark then open up sip.cap and look for the appropriate header entry in the packet.
Remote-Party-ID: "eric" <sip:2001@123.123.123.123>;privacy=off;screen=no
AND
P-Asserted-Identity: <sip:2001>
Thats it you have both P-asserted-id and Remote-party-id in your sip packet headers!
Some wholesale providers are now requiring that packets include P-Asserted-Identity or Remote Party ID in the header of SIP packets.
I spent some time messing with this since there is little to no documentation on such things regarding Asterisk or Trixbox. Since I had such a hard time of it, I thought I would write a really short howto so that maybe others will have it bit easier.
Remote Party ID:
This was the easier of the two. In sip.conf you must set the two variables
sendrpid = yes
trustrpid = no
P-Asserted-Identity:
This was more difficult to figure out and had far less documentation. To add headers we use the SipAddHeader() function in the dial plan, extensions.conf, or for trixbox, extensions_custom.conf.
in our trixbox extensions_custom.conf we have set up the following... assuming you dial from the [from-internal] context
include extensions_trixbox.conf
include extensions_hud.conf
[from-internal-custom]
exten => _1NXXNXXXXXX,1,SipAddHeader(P-Asserted-Identity: <sip:${CALLERIDNUM}>)
exten => _NXXNXXXXXX,1,SipAddHeader(P-Asserted-Identity: <sip:${CALLERIDNUM}>)
include => from-internal-trixbox
You may substitute whatever you want in side the < > a provided ID number or whatever... we just set callerid for demonstration purposes.
Obviously you can also change, or add a dial pattern, or specific extension in place of the _NXX for example
exten => 2000,1,SipAddHeader(P-Asserted-Identity: <sip:${CALLERIDNUM}>)
would only add headers when extension 2000 dialed.
Testing:
To test that your headers are being added, start the asterisk console and make a call that would match the extension pattern. You should see some thing like the following on your cli
-- Executing SIPAddHeader("SIP/2001-0857e7b8", "P-Asserted-Identity: <sip:2001>") in new stack
To further test, you can run tshark (the new name for ethereals command line packet capture tethereal) on your asterisk server when you make the call and capture sip packets to a log file
- tshark port 5060 -w sip.cap
After you place the call hit ctrl+c to close tshark then open up sip.cap and look for the appropriate header entry in the packet.
Remote-Party-ID: "eric" <sip:2001@123.123.123.123>;privacy=off;screen=no
AND
P-Asserted-Identity: <sip:2001>
Thats it you have both P-asserted-id and Remote-party-id in your sip packet headers!

Comments
333Re: Duplicate fields - problem
GotoIf($["${SIP_HEADER(P-Asserted-Identity).....
333Duplicate fields - problem
333Duplicate fields - problem
333Duplicate fields - problem