Endpoints and context

Hello,

I’ve installed asterisk on a Raspi with the default Debian package.

*CLI> core show version
Asterisk 13.14.1~dfsg-2+deb9u4 built by buildd @ testbuildd on a armv7l running Linux on 2018-10-16 23:52:28 UTC

The pjsip.conf looks like the following:

$ cat /etc/asterisk/pjsip.conf
[transport_home]
type = transport
protocol = udp
bind = 0.0.0.0:5064
[620]
type = endpoint
aors = 620
auth = 620_auth
context = phones-home
disallow = all
allow = alaw
[620]
type = aor
max_contacts = 1
[620_auth]
type = auth
auth_type = userpass
username = 620
password = 1234

The dialplan is just for testing:

$ cat /etc/asterisk/extensions.conf
[phones-home]
exten => 12345,1,NoOp(hit)

The above leads to following errors:

[Feb 21 21:25:44] NOTICE[26506][C-00000001] chan_sip.c: Call from ‘’ (192.168.22.243:5064) to extension ‘12345’ rejected because extension not found in context ‘public’.

But as soon as I change in extensions.conf the section “phone-home” to “public” it works.

Why isn’t asterisk using the context “phones-home” given in the endpoint section?

It seems as if “p->username” is empty.

The “invite” looks like this:

Session Initiation Protocol (INVITE)
Request-Line: INVITE sip:12345@telast01.lan.[…].de;user=phone SIP/2.0
Message Header
Via: SIP/2.0/UDP 192.168.22.243:5064;branch=z9hG4bK49439c149c3c329aa162b085409179f4;rport
From: “620” <sip:620 @ telast01.lan.[…].de>;tag=28312718
To: <sip:12345 @ telast01.lan.[…].de;user=phone>
Call-ID: 1596384277@192_168_22_243
CSeq: 2 INVITE
Contact: <sip:620 @ 192.168.22.243:5064>
Max-Forwards: 70
User-Agent: C430A GO/42.248.00.000.000
Supported: replaces
Allow-Events: message-summary, refer, ua-profile, talk, check-sync
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, SUBSCRIBE, NOTIFY, REFER, UPDATE
Content-Type: application/sdp
Content-Length: 199
Message Body

The “register” like this:

Session Initiation Protocol (REGISTER)
Request-Line: REGISTER sip:telast01.lan.[…].de SIP/2.0
Message Header
Via: SIP/2.0/UDP 192.168.22.243:5064;branch=z9hG4bKeb81d84ddd6120eca8582007758a4132;rport
From: “620” <sip:620 @ telast01.lan.[…].de>;tag=4231048868
To: “620” <sip:620 @ telast01.lan.[…].de>
Call-ID: 396621903@192_168_22_243
CSeq: 687 REGISTER
Contact: <sip:620 @ 192.168.22.243:5064>
Max-Forwards: 70
User-Agent: C430A GO/42.248.00.000.000
Expires: 60
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, SUBSCRIBE, NOTIFY, REFER, UPDATE
Content-Length: 0

(I had to put whitespaces around some @ signs, since there are interpreted as links and new users can only add two links per post. Strange!)

I would appreciate any ideas!

Thanks in advance!

Alex

Your call attempt is using chan_sip, not chan_pjsip. If you want to use chan_pjsip then you’ll have to ensure the endpoint is sending traffic to port 5064.

Looking at the traffic it appears instead that you have configured your endpoint to listen on and send from 5064 instead.

Yes, you were right!

The phone issued the register request against asterisk port 5064 (as expected), but the invite request against port 5060 (not as expected). It’s not really intuitive, but I was finally able to configure it appropriately in the phone’s web ui.

And to be honest: I didn’t expect asterisk to be listening on port 5060, since I didn’t configure the old sip module at all (must be default behaviour). Now I disabled the old sip module and netstat tells me, that asterisk isn’t grabbing port 5060 anymore. Fine!

Thanks a lot!