Thanks.
I have created a pjsip.conf according to the second example in the document
https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/res_pjsip-Configuration-Examples/#a-sip-trunk-to-your-service-provider-including-outbound-registration
my pjsip.conf
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
; Basic templates, they will be copied for each user
[endpoint_basic](!)
type=endpoint ; endpoint (phone/rpi/pc...)
context=internal ; uses the dial plan defined in extensions.conf
disallow=all ; disabling all audio codecs
allow=ulaw ; except the ULAW codec
allow=alaw ; and the ALAW codec
language=de
[authentication](!)
type=auth ; type of section: authentication
auth_type=userpass ; password authentication
[aor_template](!)
type=aor ; find out where the endpoint can be contacted
max_contacts=1
; Definitions of user accounts associated with equipment
[zoiper](endpoint_basic)
auth=zoiper
aors=zoiper
callerid="Zoiper" <6002>
[zoiper](authentication)
password=zoiper
username=zoiper
[zoiper](aor_template)
[speedport]
type=registration
outbound_auth=speedport
server_uri=sip:**71@192.168.2.1
client_uri=sip:**71@192.168.2.1
retry_interval=60
[speedport]
type = auth
auth_type = userpass
username = nutzer-1@speedport.ip
password = 1234567890
[speedport]
type=aor
contact=sip:192.168.2.1:5060
[speedport]
type=endpoint
context=from-external
disallow=all
allow=ulaw
outbound_auth=speedport
aors=speedport
[speedport]
type = identify
match = 192.168.2.1
endpoint = speedport
my extension.conf
[internal]
;exten => _6XXX,1,Dial(PJSIP/${EXTEN},20)
exten => 6001,1,Dial(PJSIP/doorbird,20)
exten => 6001,2,Hangup
exten => 6002,1,Dial(PJSIP/zoiper,20)
exten => 6002,2,Hangup
[from-external]
; Deutschlandweite Nummern (z.B. 0301234567)
exten => _0[2-9]XXXXXXX,1,Dial(PJSIP/speedport/${EXTEN},20)
exten => _0[2-9]XXXXXXX,n,Hangup()
but the result is
-- Executing [026421513@internal:1] Dial("PJSIP/zoiper-00000000", "PJSIP/speedport/026421513,20") in new stack
[Aug 17 12:51:47] ERROR[34819]: res_pjsip.c:993 ast_sip_create_dialog_uac: Endpoint 'speedport': Could not create dialog to invalid URI '026421513'. Is endpoint registered and reachable?
[Aug 17 12:51:47] ERROR[34819]: chan_pjsip.c:2708 request: Failed to create outgoing session to endpoint 'speedport'
[Aug 17 12:51:47] NOTICE[34909][C-00000001]: app_dial.c:2720 dial_exec_full: Unable to create channel of type 'PJSIP' (cause 3 - No route to destination)
== Everyone is busy/congested at this time (1:0/0/1)
-- Executing [026421513@internal:2] Hangup("PJSIP/zoiper-00000000", "") in new stack
== Spawn extension (internal, 026421513, 2) exited non-zero on 'PJSIP/zoiper-00000000'
I think my speedport router is not a ITSP but SIP:192.168.2.1 is some kind of proxy. asterisk is registered at the router 192.168.2.1 as a SIP phone with the extension **71@192.168.2.1.
asterisk can register successfully
asterisk-PBX*CLI> pjsip show registrations
<Registration/ServerURI..............................> <Auth....................> <Status.......>
==========================================================================================
speedport/sip:**71@192.168.2.1 speedport Registered (exp. 159s)
Objects found: 1
asterisk-PBX*CLI>
and the endpoint is there as well
asterisk-PBX*CLI> pjsip show endpoints
Endpoint: <Endpoint/CID.....................................> <State.....> <Channels.>
I/OAuth: <AuthId/UserName...........................................................>
Aor: <Aor............................................> <MaxContact>
Contact: <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
Transport: <TransportId........> <Type> <cos> <tos> <BindAddress..................>
Identify: <Identify/Endpoint.........................................................>
Match: <criteria.........................>
Channel: <ChannelId......................................> <State.....> <Time.....>
Exten: <DialedExten...........> CLCID: <ConnectedLineCID.......>
==========================================================================================
Endpoint: speedport Not in use 0 of inf
OutAuth: speedport/nutzer-1@speedport.ip
Aor: speedport 0
Contact: speedport/sip:192.168.2.1:5060 45977b638f NonQual nan
Identify: speedport/speedport
Match: 192.168.2.1/32
Endpoint: zoiper/6002 Not in use 0 of inf
InAuth: zoiper/zoiper
Aor: zoiper 1
Contact: zoiper/sip:zoiper@192.168.2.151:35037;tran 1c439b240c NonQual nan
Objects found: 3
asterisk-PBX*CLI>