Respond to OPTIONS with 200 OK in Asterisk


We have a Voip provider that uses SIP Options to know if we are still alive.
Our Asterisk is currently responding with SIP 404 Not Found.
How can I make it respond with 200 OK?

I tried adding an extension ‘s’ but it still won’t work.

Thank you for your help.


If you respond 404, you must be alive. That’s how Asterisk handles responses to its outgoing OPTIONS tests.

Thank you for your reply. Is there a way to force Asterisk to reply with 200 OK?
Our VOIP provider won’t send us traffic unless we reply with 200 OK :S

Thank you again for your help

Change the source code to lie.

It looks to me like they have to send a valid user field. “s” would probably have to be explicit.

You really need to get sip debugging output to be sure what is happening.

I copy what I get from tcdump…and substitute the IP numbers with OUR_IP or THEIR_IP

17:02:35.186275 IP (tos 0x0, ttl 244, id 61089, offset 0, flags [none], proto UDP (17), length 357)
THEIR_IP.sip > OUR_IP.sip: SIP, length: 329
OPTIONS sip:OUR_IP:5060;user=phone SIP/2.0
Via: SIP/2.0/UDP THEIR_IP:5060;branch=z9hG4bKylniueunneih7jo8c8cke8ixv
Call-ID: SBCwy6odbyx5266yw6d2eoe59b6obdsseod@SoftX3000
From: sip:THEIR_IP;user=phone;tag=sx6xs96o
To: sip:OUR_IP;user=phone
Max-Forwards: 70
Content-Length: 0

17:02:35.186539 IP (tos 0x0, ttl 64, id 55786, offset 0, flags [none], proto UDP (17), length 508)
OUR_IP.sip > THEIR_IP.sip: SIP, length: 480
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP THEIR_IP:5060;branch=z9hG4bKylniueunneih7jo8c8cke8ixv;received=THEIR_IP;rport=5060
From: sip:THEIR_IP;user=phone;tag=sx6xs96o
To: sip:OUR_IP;user=phone;tag=as53a99574
Call-ID: SBCwy6odbyx5266yw6d2eoe59b6obdsseod@SoftX3000
Server: tom
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0

Do you know how to make the source code to lie?
Thank you again

Just find where it sends 404 and change it into a 200 (in handel_request_options).

I have 2 questions before touching Asterisk source code:

  1. Do I have to compile Asterisk again?
  2. Will I be replying with 200 OK to requests other than OPTIONS?

Thank you again for your help

That part of the code is only used for options (that is why it is called handle_request_[color=#FF0000]options[/color]).

You will need to recompile.

However, first you should try adding /s onto the end of the register line, so that the s extension is explicitly used. If you are using the alternative syntax for registers, I think you will already need to have a callbackextension option, which is the other way of setting this value (i.e. callbackextension=s).

I don’t understand

What do you mean by the end of the register line? Where do I change that?

Thank you again

One more thing, the Voip provider does not register on our Asterisk.
Thank you

But you would typically register on them. If you don’t, you will have to ask them to set it to s at their end.

Thank you David for your help, but I’m afraid they won’t change anything on their end.

I guess the only possibility left is to change Asterisk source code and recompile.