Getting 401 unauthorized and 404 not found when calling from phone

HI everyone, I am trying to make a call from 7007 to 4008. first i get a 401 unauthorized, then a 404 not found. The topology is an asterisk server on a lan, with both endpoints connected to asterisk via ethernet. It’s a very simple set up. Here are my config files… Am I missing anything or did I do anything wrong?

pjsip.conf:

[7007]
type = endpoint
context = internal
allow = all
aors = 7007
auth = auth7007
;dtmf_mode = rfc2833

[7007]
type = aor
max_contacts = 1

[7007]
type = identify
match = 192.168.200.111

[auth7007]
type=auth
auth_type=userpass
password=7007
username=7007

[4008]
type = endpoint
context = internal
allow = all
aors = 4008
;dtmf_mode = rfc2833

[4008]
type = aor
contact = sip:4008@192.168.200.1:5060

[4008]
type = identify
match = 192.168.200.1

[1]
type = endpoint
context = from-external
allow = all
aors = 1
;dtmf_mode = rfc2833

[1]
type = aor
contact = sip:1@192.168.200.1:5060

[1]
type = identify
match = 192.168.200.1

[4010]
type = endpoint
context = internal
allow = all
aors = 4010
;dtmf_mode = rfc2833

[4010]
type = aor
contact = sip:4010@192.168.200.1:5060

[4010]
type = identify
match = 192.168.200.1

extensions.conf:

exten=>_4008,1,Dial(PJSIP/${EXTEN})
exten=>_1,1,Dial(PJSIP/${EXTEN})
exten=>_4010,1,Dial(PJSIP/${EXTEN})
exten=>_7007,1,Dial(PJSIP/${EXTEN})

Does anyone know whats wrong here? or is it something outside of the config?

You haven’t actually shown what happened, just your own analysis and configuration. You need to show an actual SIP trace (pjsip set logger on) and console output.

I’d also add that your extensions.conf in here is incomplete. The given lines aren’t in any context, so if that is what the extensions.conf actually contains that would be your problem.

OK, thank you, I’ll see what the logger says and report back. Also, what do you mean by context? I just want the ability to call any of my endpoints from any of the other endpoints.

On Tuesday 13 August 2024 at 16:06:08, mikealmandeel via Asterisk Community
wrote:

what do you mean by context?

https://docs.asterisk.org/Configuration/Dialplan/Contexts-Extensions-and-
Priorities/

Antony.


The truth is rarely pure, and never simple.

  • Oscar Wilde

                                                Please reply to the list;
                                                      please *don't* CC me.
    

Thank you.

That did get rid of the 403 unauthorized, but we still have issues with a 404 not found. I’ve included the pcap here. I did try using the pjsip logger, but it basically just echoed the packets being exchanged so didn’t help much here.
asterisk_404.zip (11.1 KB)

the 254 host is the asterisk server and the 1 host is the caller.

I did change extensions.conf as follows:

[users]
exten=>_4008,1,Dial(PJSIP/${EXTEN})
exten=>_1,1,Dial(PJSIP/${EXTEN})
exten=>_4010,1,Dial(PJSIP/${EXTEN})
exten=>_7007,1,Dial(PJSIP/${EXTEN})

Your PJSIP configuration is specifying a context named “internal”. You have put those extensions under the context “users”. These don’t match, and so it would not be found.

Oh I get it now… the context in the dialplan and extensions need to match… I wasn’t aware of that. Thank you!

I did change the context in the dialplan, but still getting 404.

nevermind, i noticed that we had a from-external context for the caller, I switched that to internal and the call went thru. Thanks for helping guys.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.