This what pjsip show endpoints tells me:
Endpoint: 999/061xxxxxx9 Not in use 0 of inf
InAuth: auth999/999
Aor: 999 1
Contact: 999/sip:999@217xx.yy.221:5061 e5bfb8c1a8 NonQual nan
Endpoint: mytrunk Not in use 0 of inf
OutAuth: mytrunk/061xxxxxx5
Aor: mytrunk 0
Contact: mytrunk/sip:sip.mytrunk.ch:5060 21687a2abb NonQual nan
Identify: mytrunk/mytrunk
Match: 212.xx.yy.132/32
Match: 77.xx.yy.155/32
Asterisk is registered to my provder:
mail*CLI> pjsip show registrations
<Registration/ServerURI..............................> <Auth....................> <Status.......>
==========================================================================================
efon/sip:sip.mytrunk.ch efon Registered (exp. 2273s)
And this shows the pjsip logger when dialing a number:
<--- Received SIP request (1304 bytes) from UDP:217.xx.yy.221:5061 --->
INVITE sip:078xxxxxxx@sip.myasterisk.ch SIP/2.0
Via: SIP/2.0/UDP 217.xx.yy.221:32907;branch=z9hG4bK992722553;rport
From: "Richard Klingler" <sip:999@sip.myasterisk.ch>;tag=762898078
To: <sip:078xxxxxxx@sip.myasterisk.ch>
Call-ID: 2015672201-5061-37@CBH.CC.BCI.CCB
CSeq: 360 INVITE
Contact: "Richard Klingler" <sip:999@217.xx.yy.221:5061>
X-Grandstream-PBX: true
Max-Forwards: 70
User-Agent: Grandstream GXP2160 1.0.11.64
Privacy: none
P-Preferred-Identity: "Richard Klingler" <sip:999@sip.myasterisk.ch>
P-Access-Network-Info: IEEE-EUI-48;eui-48-addr=04-B4-FE-86-91-D9
P-Emergency-Info: IEEE-EUI-48;eui-48-addr=00-0B-82-F8-EB-B3
Supported: replaces, path, timer
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Type: application/sdp
Accept: application/sdp, application/dtmf-relay
Content-Length: 437
v=0
o=999 8000 8000 IN IP4 217.xx.yy.221
s=SIP Call
c=IN IP4 217.xx.yy.221
t=0 0
m=audio 10710 RTP/AVP 0 8 4 18 9 97 2 123 101
a=sendrecv
a=rtpmap:0 PCMU/8000
a=ptime:20
a=rtpmap:8 PCMA/8000
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:9 G722/8000
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:2 G726-32/8000
a=rtpmap:123 opus/48000/2
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
<--- Transmitting SIP response (508 bytes) to UDP:217.xx.yy.221:5061 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 217.xx.yy.221:32907;rport=5061;received=217.xx.yy.221;branch=z9hG4bK992722553
Call-ID: 2015672201-5061-37@CBH.CC.BCI.CCB
From: "Richard Klingler" <sip:999@sip.myasterisk.ch>;tag=762898078
To: <sip:078xxxxxxx@sip.myasterisk.ch>;tag=z9hG4bK992722553
CSeq: 360 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1714036503/08de41e1df2ab5c899b9e7fa55dd4fdb",opaque="7a15431d7b41ea81",algorithm=MD5,qop="auth"
Server: Asterisk PBX 21.2.0
Content-Length: 0
<--- Received SIP request (318 bytes) from UDP:217.xx.yy.221:5061 --->
ACK sip:078xxxxxxx@sip.myasterisk.ch SIP/2.0
Via: SIP/2.0/UDP 217.xx.yy.221:32907;branch=z9hG4bK992722553;rport
From: "Richard Klingler" <sip:999@sip.myasterisk.ch>;tag=762898078
To: <sip:078xxxxxxx@sip.myasterisk.ch>;tag=z9hG4bK992722553
Call-ID: 2015672201-5061-37@CBH.CC.BCI.CCB
CSeq: 360 ACK
Content-Length: 0
<--- Received SIP request (1580 bytes) from UDP:217.xx.yy.221:5061 --->
INVITE sip:078xxxxxxx@sip.myasterisk.ch SIP/2.0
Via: SIP/2.0/UDP 217.xx.yy.221:32907;branch=z9hG4bK472423144;rport
From: "Richard Klingler" <sip:999@sip.myasterisk.ch>;tag=762898078
To: <sip:078xxxxxxx@sip.myasterisk.ch>
Call-ID: 2015672201-5061-37@CBH.CC.BCI.CCB
CSeq: 361 INVITE
Contact: "Richard Klingler" <sip:999@217.xx.yy.221:5061>
Authorization: Digest username="999", realm="asterisk", nonce="1714036503/08de41e1df2ab5c899b9e7fa55dd4fdb", uri="sip:078xxxxxxx@sip.myasterisk.ch", response="905ece8c6b4c892546d4e6a77a7a6ea9", algorithm=MD5, cnonce="00369037", opaque="7a15431d7b41ea81", qop=auth, nc=00000001
X-Grandstream-PBX: true
Max-Forwards: 70
User-Agent: Grandstream GXP2160 1.0.11.64
Privacy: none
P-Preferred-Identity: "Richard Klingler" <sip:999@sip.myasterisk.ch>
P-Access-Network-Info: IEEE-EUI-48;eui-48-addr=04-B4-FE-86-91-D9
P-Emergency-Info: IEEE-EUI-48;eui-48-addr=00-0B-82-F8-EB-B3
Supported: replaces, path, timer
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Type: application/sdp
Accept: application/sdp, application/dtmf-relay
Content-Length: 437
v=0
o=999 8000 8000 IN IP4 217.xx.yy.221
s=SIP Call
c=IN IP4 217.xx.yy.221
t=0 0
m=audio 10710 RTP/AVP 0 8 4 18 9 97 2 123 101
a=sendrecv
a=rtpmap:0 PCMU/8000
a=ptime:20
a=rtpmap:8 PCMA/8000
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:9 G722/8000
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:2 G726-32/8000
a=rtpmap:123 opus/48000/2
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
<--- Transmitting SIP response (335 bytes) to UDP:217.xx.yy.221:5061 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 217.xx.yy.221:32907;rport=5061;received=217.xx.yy.221;branch=z9hG4bK472423144
Call-ID: 2015672201-5061-37@CBH.CC.BCI.CCB
From: "Richard Klingler" <sip:999@sip.myasterisk.ch>;tag=762898078
To: <sip:078xxxxxxx@sip.myasterisk.ch>
CSeq: 361 INVITE
Server: Asterisk PBX 21.2.0
Content-Length: 0
-- Executing [078xxxxxxx@from-klingler:1] Verbose("PJSIP/999-0000000c", "1, "Calling, 078xxxxxxx") in new stack
"Calling, 078xxxxxxx
-- Executing [078xxxxxxx@from-klingler:2] Dial("PJSIP/999-0000000c", "PJSIP/078xxxxxxx@efon") in new stack
-- Called PJSIP/078xxxxxxx@efon
Somehow my provers server isn’t involved at all…
Also seem not to accept the P-Preferred-Identity as set in the dial plan:
exten => _0[1-8]XXXXXXXX,1,Set(PJSIP_HEADER(add,P-Preferred-Identity=<sip:${CALLERID(num)}@e-fon.ch>)