Asterisk Responds 404 to OPTIONS from Provider

Hello,

I have a fairly simple installation of Asterisk PBX 11.3.0.

I am noticing when I ‘sip set debug peer provider’, though, that Asterisk is frequently responding ‘404 Not Found’ to OPTIONS messages from my VoIP Provider.

Here is a sample of the SIP debug, with some limited redaction for a public forum:

<--- SIP read from UDP:[PROVIDER-IP]:5060 --->
OPTIONS sip:[DID-FROM-PROVIDER]@[ASTERISK-IP]:5060 SIP/2.0
Via: SIP/2.0/UDP [PROVIDER-IP];rport;branch=z9hG4bKguggnwwe
To: <sip:[DID-FROM-PROVIDER]@[ASTERISK-IP]>
From: <sip:ping@[PROVIDER-DOMAIN].com>;tag=519136
Call-ID: 8d2c61052bbef8e9-5191@ping.[PROVIDER-DOMAIN].com
CSeq: 35099 OPTIONS
Contact: <sip:ping@[PROVIDER-IP]>
Accept: application/sdp
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Looking for 5678 in default (domain [ASTERISK-IP])

<--- Transmitting (no NAT) to [PROVIDER-IP]:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP [PROVIDER-IP];rport;branch=z9hG4bKguggnwwe;received=[PROVIDER-IP]
From: <sip:ping@[PROVIDER-DOMAIN].com>;tag=519136
To: <sip:[DID-FROM-PROVIDER]@[ASTERISK-IP]>;tag=as69a5b089
Call-ID: 8d2c61052bbef8e9-5191@ping.[PROVIDER-DOMAIN].com
CSeq: 35099 OPTIONS
Server: Asterisk PBX 11.3.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0

extensions.conf looks like this:

[incoming]
exten => 5678,1,Dial(SIP/softphone,60)
exten => 5678,n,Hangup()

[outgoing]
exten => _X.,1,Dial(SIP/${EXTEN}@provider)
exten => _X.,n,Hangup()

sip.conf looks like this:

[general]
disallow=all
allow=ulaw
allow=alaw
allow=g729
qualify=yes
directrtpsetup=yes
allowguest=no
alwaysauthreject=yes
udpbindaddr=0.0.0.0:5060
tcpenable=yes
tcpbinaddr=0.0.0.0:5060
maxexpiry=720
defaultexpiry=600
register => [PROVIDER-CREDENTIALS]@[PROVIDER-SIP-SERVER]/5678

[provider]
defaultusername=[REDACTED]
username=[REDACTED]
fromuser=[REDACTED]
type=peer
secret=[REDACTED]
insecure=port,invite
host=[PROVIDER-SIP-SERVER]
qualify=5000
dtmfmode=auto
context=incoming
transport=udp

[softphone]
type=friend
context=outgoing
host=dynamic
secret=[REDACTED]
transport=tcp
qualify=0

Any thoughts on how to fix the 404 repsonse to OPTIONS from the provider?

Thanks.

default != incoming

Thanks. I am sure is this most naive question you have ever heard (learning Asterisk on my own from scratch), but how do I best remedy that?

Do I set the default context somehow, and if so, how?

Thanks.

Take a look on www.asteriskdocs.org

About your issue change the context of your trunk, your debug seems looking for “deafult” context and you have defined “incoming” so, or you change default for incoming or create default too.

It normally doesn’t need fixing, e.g. when Asterisk sends options to check a connection, it considers a 404 response to indicate a good connection.

If you want to send something other than 404, you will need to define an extension called ping. I would rather suspect if it is using that user part that it will be happy with a 404 response.

I was able to supress the 404 and get a 200 instead by adding a [default] context in extensions.conf which was a duplicate of the [incoming] context:

[incoming]
exten => 5678,1,Dial(SIP/softphone,60)
exten => 5678,n,Hangup()

[outgoing]
exten => _X.,1,Dial(SIP/${EXTEN}@provider)
exten => _X.,n,Hangup()

[default]
exten => 5678,1,Dial(SIP/softphone,60)
exten => 5678,n,Hangup()

No changes were made to sip.conf.

Anything wrong with this?

Any security implications I am not thinking about?

Thanks!

You need to be more careful about the allowguest setting as unknown callers will now be treated the same as your ITSP.

If OPTIONS really is handled in a different context from incoming calls from the same ITSP, there may be a bug, but, as I said, it hasn’t concerned us, because we have always found 404 an acceptable response.

In sip.conf, I already have:

[general]
...
allowguest=no
...

Would that not suffice? Should I reassert ‘allowguest=no’ in the [default] context? Would that do it?