Remote server send me OPTION package, but my asterisk server send "404 NOT FOUND" response. Is there any fix in extensions.conf or sip.conf? I am using asterisk 13.38

here’s my extension.conf

[a2billing]
exten => _X.,1,NoOp(a2billing start)
exten => _X.,n,Set(A2BACCOUNTCODE=${CDR(accountcode)})
exten => _X.,n,MYSQL(Connect CONNID ${A2BDBHOST} ${A2BDBUSER} ${A2BDBPASSW} ${A2BDBNAME})
exten => _X.,n,MYSQL(Query RESULTID ${CONNID} SELECT max_concurrent FROM cc_card WHERE username = ${A2BACCOUNTCODE})
exten => _X.,n,GotoIf($[“${MYSQL_STATUS}” = “-1”]?lbl_a2billing_0:)
exten => _X.,n,MYSQL(Fetch vdp_tmp ${RESULTID} MAXCHANNELS)
exten => _X.,n,GotoIf($[“${MYSQL_STATUS}” = “-1”]?lbl_a2billing_0:)
exten => _X.,n,MYSQL(Clear ${RESULTID})
exten => _X.,n,MYSQL(Disconnect ${CONNID})
exten => _X.,n,NoOp(Maximum Channels Allowed = ${MAXCHANNELS})
exten => _X.,n,NoOp(Channels in use = ${GROUP_COUNT(${A2BACCOUNTCODE}@OUT)})
exten => _X.,n,Set(CURRENTCHANNELS=${GROUP_COUNT(${A2BACCOUNTCODE}@OUT)})
exten => _X.,n,Set(REMAININGCHANNELS=${MATH(${MAXCHANNELS}-${CURRENTCHANNELS})})
exten => _X.,n,NoOp(Remaining channels available = ${REMAININGCHANNELS})
exten => _X.,n,Set(GROUP(OUT)=${A2BACCOUNTCODE})
exten => _X.,n,GotoIf($[“${REMAININGCHANNELS}” > “1”]?:lbl_a2billing_1)
exten => _X.,n,NoOp(Call Allowed as channels available)
exten => _X.,n,AGI(a2billing.php,2)
exten => _X.,n,Hangup()
exten => _X.,n(lbl_a2billing_1),NoOp(No More Channels available)
exten => _X.,n,Congestion()
exten => _X.,n(lbl_a2billing_0),MYSQL(Clear ${RESULTID})
exten => _X.,n,MYSQL(Disconnect ${CONNID})
exten => _X.,n,Goto(lbl_a2billing_1)

here’s my sip.conf

[airtel]

type = friend
host = 1.1.1.1
insecure = port,invite
disallow = all
allow = g729
allow = alaw
allow = ulaw
qualify = yes
context = a2billing
canreinvite = no
nat=yes
nat=force_rport,comedia
rtptimeout = 60
rtpholdtimeout = 300
;P-Early-Media=supported
sendrpid=pai
trusrpid=yes
usereqphone=yes
;trust_id_outbound=yes

provider send this report showing trunk status is fault

in my pcap I am returning 404

I appreciate any help to fix this please

"404 Not Found " mean that your asterisk server doesn’t know how to route this call. You need check extensions.conf

thank you for your reply. can you point me to what to check? this same extension.conf I use for other providers and passes calls successfully

The fault lies with the provider. Any response at all to OPTIONS indicates good connectivity, so a 404 should be acceptable.

You need to provide the options request that they actually sent, preferably captured by Asterisk. You need to create an extension which matches the user part of the request URI they used in the OPTIONS, or if there is none, I assume that s will work. I am not sure if you need to answer calls on that extension, as basically this sort of broken behaviour is quite rare.

Please note that Asterisk 13 hasn’t had full support for nearly two years and hasn’t had security fixes for almost a year, and chan_sip is deprecated, effectively unsupported, and will not be included in next year’s release of Asterisk.

type=friend, especially when combined with insecure=invite, is a security risk. It should be type=peer. Your provider is broken if they need anything other than the default nat= setting. If you are actually behind NAT, the correct settings are those for external IP and local networks, which you don’t have. (insecure=port is probably an unnecessary relaxation of security, and the official name for canreinvite changed to directmedia over a decade ago.)

Thank you for your response:

here is you go:

Session Initiation Protocol (OPTIONS)
Request-Line: OPTIONS sip:1.1.1.1:5060 SIP/2.0
Method: OPTIONS
Request-URI: sip: 1.1.1.1:5060
[Resent Packet: False
Message Header
Via: SIP/2.0/UDP 0.0.0.0:5060:branch=z9hG4bK1278vu2k361j3muulzssvkxzz:Role=3Hpt=8f58 16;pth=0;X-HwDim=4
Call-ID:sp22×2xv3v8×2mk7mp6z7ixkk3m6¡73x@0.0.0.0
[Generated Call-ID:sp22x2xv3v8x2mk7mp6z7ixkk3m6¡73x@0.0.0.0]
From: sip:SBC@0.0.0.0;tag=17vuj1pz
To: sip:1.1.1.1
CSeg: 1 OPTIONS
Sequence Number:
Method: OPTIONS
Contact: <sip:0.0.0.0:36696;transport=udp;Hpt=8f58 16>;expires=65535
Accept: application/sdp
Max-Forwards: 70
Contents-Length: 0

There is no user part in the request URI. As I said, extension s might cover that, but the vast majority of providers that probe with OPTIONS do what Asterisk does, accept any response at all as good, so there is not much experience around of providers that get this wrong.

Note that the correct behaviour for OPTIONS is to respond with the same status code as they would respond with for an INVITE to the same URI, so they may be expecting to send the INVITE without a user part as well, in which case you will definitely need an s extension.

Also, people here strongly prefer to have traces as produced by Asterisk; this trace clearly wasn’t as it contains lines that would be invalid in a real request.

I’ve checked the code, and it will treat a missing user part as being s, and it will return 200 OK based purely on the existence of that extension, not on whether it would actually respond with OK to an INVITE.

Pedantic point: you have to be a SIP client to send a request, so the ITSP is client of this transaction.

https://superuser.com/questions/1345823/asterisk-not-found-answer-on-option-request

Someone said this worked for them in the attached link. Can you tell how to input this into my extension.conf as displayed above please?
Please tell me if this can fix my problem. Thank you David

[default]
exten => s,1,NoOp( DEFAULT context )

With a text editor. That’s Asterisk 101. I’d consider providing specifics of that to be providing a free management service for your system, not peer support for a problem

Also, I don’t know to what extent a2billing takes over ownership of extensions.conf. You may find that it overwrites any direct changes.

what I mean is this, which line in this extension.conf will I input this?

exten => s,1,NoOp( DEFAULT context )

please help.

http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/asterisk-DP-Basics-SECT-1.html

Thank you David,

Provider disabled Heartbeat detection = Continuous heartbeat for troubleshooting and call passed. so they said I need to locate the heartbeat setting, align it as Heartbeat detection = Continuous heartbeat

any help on how to set Heartbeat detection = Continuous heartbeat

please.

They don’t know what they are talking about.

They are using terminology that is local to their system and assuming that everything else uses the same terminology. Handling OPTIONS probes is completely passive at the UAS end and UASes don’t care where they are being sent repeatedly, or just once off, so a setting to match a continuous sending one, at the UAC end, doesn’t make any sense.

aha. I understand your view. but please how can I get this done?

Asterisk will ALWAYS respond to OPTIONS probes, whether sent one off, or “continuously”. The only thing you can change is the details of the response code, but if only used as a heartbeat that doesn’t matter. Nonetheless getting an OK response has been discussed above.

thank you David