Privacy enabled makes Asterisk send call "Asterisk"

Using our Gateway to send calls from ISDN to Asterisk. When Privacy is enabled on our Gateway, we send the invite to Asterisk running version 1.8.9.2 and when we have the Privacy header set to “none” and the P-Asserted header is sent as well, Asterisk then sends the new call with “Asterisk” in the from header but the Remote-Party-ID is still as the P-Asserted header was. When we do not send with the Privacy Header, it sends the call out as expected with the correct caller-ID.

Here is a Verbose log of a call:

[Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [03068020@sn10k01port1in:1] Set("SIP/sn10k01port1-001f0997", "GROUP(08738258009)=OUTBOUND_GROUP") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [03068020@sn10k01port1in:2] NoOp("SIP/sn10k01port1-001f0997", "appels simultanes de 08738258009 : 1") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [03068020@sn10k01port1in:3] GotoIf("SIP/sn10k01port1-001f0997", "0?10:4") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (sn10k01port1in,03068020,4) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [03068020@sn10k01port1in:4] Set("SIP/sn10k01port1-001f0997", "GROUP(TG768)=OUTBOUND_GROUP") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [03068020@sn10k01port1in:5] NoOp("SIP/sn10k01port1-001f0997", "TG768=2") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [03068020@sn10k01port1in:6] Set("SIP/sn10k01port1-001f0997", "GROUP(sn10k01port1)=OUTBOUND_GROUP") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [03068020@sn10k01port1in:7] NoOp("SIP/sn10k01port1-001f0997", "sn10k01port1=1") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [03068020@sn10k01port1in:8] Set("SIP/sn10k01port1-001f0997", "CALLERID(number)=8738258009") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [03068020@sn10k01port1in:9] Goto("SIP/sn10k01port1-001f0997", "entrants,3068020,1") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (entrants,3068020,1) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [3068020@entrants:1] Goto("SIP/sn10k01port1-001f0997", "entrants,4183068107,1") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (entrants,4183068107,1) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@entrants:1] Set("SIP/sn10k01port1-001f0997", "__SIPprivacy=none") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@entrants:2] Set("SIP/sn10k01port1-001f0997", "__calleridnum=8738258009") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@entrants:3] Set("SIP/sn10k01port1-001f0997", "__callerid=TEST AXION") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@entrants:4] GotoIf("SIP/sn10k01port1-001f0997", "0?5:8") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (entrants,4183068107,8) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@entrants:8] GotoIf("SIP/sn10k01port1-001f0997", "0?9:13") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (entrants,4183068107,13) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@entrants:13] Set("SIP/sn10k01port1-001f0997", "__calledid=4183068107") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@entrants:14] Set("SIP/sn10k01port1-001f0997", "__vmcalledid=4183068107") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@entrants:15] Set("SIP/sn10k01port1-001f0997", "GROUP(8738258009)=OUTBOUND_GROUP") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@entrants:16] NoOp("SIP/sn10k01port1-001f0997", "1") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@entrants:17] GotoIf("SIP/sn10k01port1-001f0997", "0?19:18") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (entrants,4183068107,18) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@entrants:18] Goto("SIP/sn10k01port1-001f0997", "incoming,4183068107,1") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (incoming,4183068107,1) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:1] AGI("SIP/sn10k01port1-001f0997", "call_forward_check2.php,calledid=4183068107") in new stack [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- Launched AGI Script /vdl/asterisk/var/lib/asterisk/agi-bin/call_forward_check2.php [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- <SIP/sn10k01port1-001f0997>AGI Script call_forward_check2.php completed, returning 0 [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:2] AGI("SIP/sn10k01port1-001f0997", "call_manager.php,direction=in,callerid=8738258009") in new stack [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- Launched AGI Script /vdl/asterisk/var/lib/asterisk/agi-bin/call_manager.php [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- AGI Script Executing Application: (Set) Options: (__enable=1) [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- AGI Script Executing Application: (Set) Options: (__voicemail=1) [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- AGI Script Executing Application: (set) Options: (__vartestdebug=8738258009) [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- AGI Script Executing Application: (Set) Options: (__suspend=0) [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- AGI Script Executing Application: (Set) Options: (__callwaiting=0) [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- AGI Script Executing Application: (Set) Options: (__calldisplay=1) [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- AGI Script Executing Application: (Set) Options: (__sonnerie=1) [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- AGI Script Executing Application: (Set) Options: (__ring=1) [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- AGI Script Executing Application: (Set) Options: (__ringdelay=12) [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- AGI Script Executing Application: (Set) Options: (__sonnerieduree=12) [Apr 1 14:56:58] VERBOSE[1322] res_agi.c: -- <SIP/sn10k01port1-001f0997>AGI Script call_manager.php completed, returning 0 [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:3] GotoIf("SIP/sn10k01port1-001f0997", "0?estacade,4183068107,1:4") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (incoming,4183068107,4) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:4] GotoIf("SIP/sn10k01port1-001f0997", "0?suspend,s,1:5") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (incoming,4183068107,5) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:5] GotoIf("SIP/sn10k01port1-001f0997", "0?suspend,s,1:6") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (incoming,4183068107,6) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:6] GotoIf("SIP/sn10k01port1-001f0997", "0?callblock,s,1:7") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (incoming,4183068107,7) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:7] GotoIf("SIP/sn10k01port1-001f0997", "0?ld_spam,s,1:8") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (incoming,4183068107,8) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:8] NoOp("SIP/sn10k01port1-001f0997", "") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:9] NoOp("SIP/sn10k01port1-001f0997", "") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:10] NoOp("SIP/sn10k01port1-001f0997", "") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:11] GotoIf("SIP/sn10k01port1-001f0997", "0?12:14") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (incoming,4183068107,14) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:14] GotoIf("SIP/sn10k01port1-001f0997", "0?17:15") in new stack [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Goto (incoming,4183068107,15) [Apr 1 14:56:58] VERBOSE[1322] pbx.c: -- Executing [4183068107@incoming:15] Dial("SIP/sn10k01port1-001f0997", "SIP/4183068107,12") in new stack [Apr 1 14:56:58] VERBOSE[1322] netsock2.c: == Using SIP RTP CoS mark 5 [Apr 1 14:56:58] VERBOSE[1322] app_dial.c: -- Called SIP/4183068107 [Apr 1 14:56:58] VERBOSE[1322] app_dial.c: -- SIP/4183068107-001f0998 is ringing [Apr 1 14:57:09] VERBOSE[1322] pbx.c: == Spawn extension (incoming, 4183068107, 15) exited non-zero on 'SIP/sn10k01port1-001f0997' [Apr 1 14:57:09] VERBOSE[1322] pbx.c: -- Executing [h@incoming:1] ResetCDR("SIP/sn10k01port1-001f0997", "w") in new stack [Apr 1 14:57:09] VERBOSE[1322] pbx.c: -- Executing [h@incoming:2] NoCDR("SIP/sn10k01port1-001f0997", "w") in new stack [Apr 1 14:57:09] VERBOSE[1322] pbx.c: -- Executing [h@incoming:3] GotoIf("SIP/sn10k01port1-001f0997", "0?4:8") in new stack [Apr 1 14:57:09] VERBOSE[1322] pbx.c: -- Goto (incoming,h,8) [Apr 1 14:57:09] VERBOSE[1322] pbx.c: -- Executing [h@incoming:8] GotoIf("SIP/sn10k01port1-001f0997", "0?9:10") in new stack [Apr 1 14:57:09] VERBOSE[1322] pbx.c: -- Goto (incoming,h,10) [Apr 1 14:57:09] VERBOSE[1322] pbx.c: -- Executing [h@incoming:10] AGI("SIP/sn10k01port1-001f0997", "callin_hangup.php,lastcaller=8738258009,exten=4183068107,confidentiel=,clid=TEST AXION") in new stack [Apr 1 14:57:09] VERBOSE[1322] res_agi.c: -- Launched AGI Script /vdl/asterisk/var/lib/asterisk/agi-bin/callin_hangup.php [Apr 1 14:57:09] VERBOSE[1322] res_agi.c: -- <SIP/sn10k01port1-001f0997>AGI Script callin_hangup.php completed, returning 0 [Apr 1 14:57:09] VERBOSE[1322] pbx.c: -- Executing [h@incoming:11] GotoIf("SIP/sn10k01port1-001f0997", "0?13:12") in new stack [Apr 1 14:57:09] VERBOSE[1322] pbx.c: -- Goto (incoming,h,12) [Apr 1 14:57:09] VERBOSE[1322] pbx.c: -- Executing [h@incoming:12] Hangup("SIP/sn10k01port1-001f0997", "") in new stack [Apr 1 14:57:09] VERBOSE[1322] pbx.c: == Spawn extension (incoming, h, 12) exited non-zero on 'SIP/sn10k01port1-001f0997' [root@amun asterisk]#

Here is the dialplan:

[sn10k01port1]
exten => _X.,1,Set(GROUP(TG768)=OUTBOUND_GROUP)
exten => _X.,2,Noop(TG768=${GROUP_COUNT(OUTBOUND_GROUP@TG768)})
exten => _X.,3,GotoIf($[${GROUP_COUNT(OUTBOUND_GROUP@TG768)} < 45]?4:10)
exten => _X.,4,Noop(${GROUP_COUNT(OUTBOUND_GROUP@sn10k01port1)})
exten => _X.,5,GotoIf($[${GROUP_COUNT(OUTBOUND_GROUP@sn10k01port1)} < 23]?6:9)
exten => _X.,6,Set(GROUP(sn10k01port1)=OUTBOUND_GROUP)
exten => _X.,7,Dial(SIP/${EXTEN}@sn10k01port1,180)
exten => _X.,8,Goto(sn10k01port1-${DIALSTATUS},${EXTEN},1)
exten => _X.,9,Playtones(Busy)

[extrants]
;exten => _X.,1,SipGetHeader(Privacy=Privacy)
exten => _X.,1,Set(__SIPprivacy=${SIP_HEADER(Privacy)})
exten => _X.,2,Set(__calleridnum=${CALLERID(NUM)})
exten => _X.,3,Set(__callerid=${CALLERID(NAME)})
exten => _X.,4,GotoIf($["${SIPprivacy}" = "id"]?5:8)
exten => _X.,5,Set(__privacy=1)
exten => _X.,6,Noop()
exten => _X.,7,Noop()
exten => _X.,8,GotoIf($["${privacy}" = "1"]?9:13)
exten => _X.,9,Set(CDR(userfield)=confidentiel)
exten => _X.,10,ResetCDR(w)
exten => _X.,11,Set(CALLERID(number)=Anonyme)
exten => _X.,12,Set(CALLERID(name)=Anonyme)
exten => _X.,13,Set(__calledid=${EXTEN})
exten => _X.,14,Set(__vmcalledid=${EXTEN})
exten => _X.,15,Set(GROUP(${CALLERID(NUM)})=OUTBOUND_GROUP) ; compte appels simultanés d'un même caller
exten => _X.,16,Noop(${GROUP_COUNT(OUTBOUND_GROUP@${CALLERID(NUM)})})
exten => _X.,17,GotoIf($["${GROUP_COUNT(OUTBOUND_GROUP@${CALLERID(NUM)})}" > "20" && "${CALLERID(NUM)}" = "4188735010"]?19:18)
;exten => _X.,15,Noop()
;exten => _X.,16,Noop()
;exten => _X.,17,GotoIf($[${GROUP_COUNT(OUTBOUND_GROUP@${CALLERID(NUM)})} < 21]?18:19)
;exten => _X.,17,Noop()
;exten => _X.,15,Noop()
;exten => _X.,15,GotoIf($[$["${CALLERID(NUM)}" = "8006682355"] | $["${CALLERID(NUM)}" = "5144473085"] | $["${CALLERID(NUM)}" = "5147887766"] | $["${CALLERID(NUM)}" = "390109344600"] | $["${CALLERID(NUM)}" = "12538020308"] | $["${CALLERID(NUM)}" = "8663609791"] | $["${CALLERID(NUM)}" = "14075887840"] | $["${CALLERID(NUM)}" = "8663970741"] | $["${CALLERID(NUM)}" = "8776751964"]]?17:16)
;exten => _X.,15,GotoIf($[$["${CALLERID(NUM)}" = "8006682355"] | $["${CALLERID(NUM)}" = "390109344600"] | $["${CALLERID(NUM)}" = "12538020308"] | $["${CALLERID(NUM)}" = "8663609791"] | $["${CALLERID(NUM)}" = "14075887840"] | $["${CALLERID(NUM)}" = "8663970741"] | $["${CALLERID(NUM)}" = "8776751964"]]?17:16)
;exten => _X.,15,SIPDtmfMode(rfc2833)
;exten => _X.,15,NooP()
exten => _X.,18,Goto(incoming,${EXTEN},1)
exten => _X.,19,Hangup(17)
;exten => _X.,19,Answer()
;exten => _X.,20,Playtones(congestion)
;exten => _X.,21,Wait(120)
;exten => _X.,22,StopPlaytones()
;exten => _X.,23,Hangup

[incoming]
exten => 4183068107,1,Agi(call_forward_check2.php,calledid=${calledid})    
exten => 4183068107,2,Agi(call_manager.php,direction=in,callerid=${calleridnum})
exten => 4183068107,3,GotoIf($[${EXTEN} = 4183371555]?estacade,${EXTEN},1:4)
exten => 4183068107,4,GotoIf($["${enable}" = "0"]?suspend,s,1:5)
exten => 4183068107,5,GotoIf($["${suspend}" = "1"]?suspend,s,1:6)
exten => 4183068107,6,GotoIf($["${callblock}" = "1"]?callblock,s,1:7)
exten => 4183068107,7,GotoIf($["${ld_spam}" = "1"]?ld_spam,s,1:8)
exten => 4183068107,8,NoOp()
exten => 4183068107,9,NoOp()
exten => 4183068107,10,NoOp()
exten => 4183068107,11,GotoIf($["${did}" = "1"]?12:14) ; Check si did
exten => 4183068107,12,Dial(SIP/${vmcalledid}@${calledid})
exten => 4183068107,13,Hangup
exten => 4183068107,14,GotoIf($["${ringdelay}" = "0"]?17:15) ; Check si 0 sonnerie
exten => 4183068107,15,Dial(SIP/${calledid},${ringdelay})
exten => 4183068107,16,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?17:21)
exten => 4183068107,17,GotoIf($["${voicemail}" = "1"]?voicemail,${vmcalledid},1:18)
exten => 4183068107,18,Agi(cfda_check.php,calledid=${calledid},cdruserfield=${CDR(userfield)})
exten => 4183068107,19,Dial(SIP/${calledid},180)
exten => 4183068107,20,Hangup
exten => 4183068107,21,Agi(cfbl_check.php,calledid=${calledid},cdruserfield=${CDR(userfield)})
exten => 4183068107,22,GotoIf($["${voicemail}" = "1"]?voicemail,${vmcalledid},1:23) ; Check si abonne vm
exten => 4183068107,23,Busy ; GotoIf jumped here if the was more than 1 call using labels

Why would Asterisk change the FROM header name to “Asterisk” when this Privacy Header is sent?

Thanks.

As you can see, we send the following Invite to Asterisk.

INVITE sip:03068020@172.16.100.101 SIP/2.0
Content-Type:application/sdp
To:sip:03068020@172.16.100.101
From:"TEST AXION"<sip:08738258009@172.16.100.77>;tag=E17130303939373400500968
Privacy:none
P-Asserted-Identity:"TEST AXION"<sip:08738258009@172.16.100.77>
Allow:INVITE,ACK,OPTIONS,BYE,CANCEL,REGISTER,INFO,UPDATE,PRACK,REFER,SUBSCRIBE,NOTIFY
Supported:100rel
Expires:120
Date:Tue, 01 Apr 2014 17:28:38 GMT
Call-ID:0205538359814000000043DC@SN00A0BA06E8A0_VOIP0.SN00A0BA06E8A0
CSeq:1 INVITE
Route:<sip:172.16.100.101:5060;lr;transport=udp>
Max-Forwards:70
Timestamp:5245288
User-Agent:xxxxx
Contact:sip:08738258009@172.16.100.77:5060
Via:SIP/2.0/UDP 172.16.100.77:5060;branch=z9hG4bK6F0A897CA59E4F8631BB5021DBB42095;rport
Content-Length:146

v=0
o=- 3730731677 1 IN IP4 172.16.100.77
s=-
c=IN IP4 172.16.100.77
t=0 0
m=audio 20068 RTP/AVP 0 8 101
a=rtpmap:101 telephone-event/8000

When Asterisk receives this and processes the request, it then sends out the new invite and it seems it honored the Privacy even though it was set to “None”.

INVITE sip:4183068107@10.6.41.198:5060 SIP/2.0
Via: SIP/2.0/UDP 172.16.100.207:5060;branch=z9hG4bK5e1bb18b;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@172.16.100.207>;tag=as3677375c
To: <sip:4183068107@10.6.41.198:5060>
Contact: <sip:asterisk@172.16.100.207:5060>
Call-ID: 5a4acdbb07a9c7f8203af5a578280557@172.16.100.207:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.8.9.2
Date: Tue, 01 Apr 2014 18:56:58 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces
Remote-Party-ID: "TEST AXION" <sip:8738258009@172.16.100.207>;party=calling;privacy=full;screen=no<sip:8738258009@172.16.100.207>;party=calling;privacy=full;screen=no
Content-Type: application/sdp
Content-Length: 209

v=0
o=root 459894039 459894039 IN IP4 172.16.100.207
s=Asterisk PBX 1.8.9.2
c=IN IP4 172.16.100.207
t=0 0
m=audio 28166 RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv