[SR-Users] Kamilio+asterisk = deregister after 2-3 minute

Sergio Charrua sergio.charrua at voip.pt
Fri Dec 11 22:33:10 CET 2020


I will assume that you use Kamailio as SIP Proxy between a SIP Provider
(TelCo) and your Asterisk boxes (using SIP.conf), and that Kamailio is
receiving OPTIONS messages from TelCo, and forwarding those OPTIONS to
Asterisk who will fail to answer.
This is a common implementation with TelCos.The solution is to set Kamailio
to Reply to TelCo, adding following route:

route {
        # OPTIONS requests without a username in the Request-URI but one
        # of our domains or IPs are addressed to the proxy itself and
        # can be answered statelessly.
        if (is_method("OPTIONS"))
        {
                sl_send_reply("200","OK");
                exit;
        }
[.....]

It will then reply SIP 200 to TelCo.
Usually, Asterisk does not answer to SIP OPTION messages coming from TelCos
(and thus acting like a SIP Agent) but it does send OPTIONS to SIP Agents
and peers, which in turn will reply (I think it is set by the Qualify which
pings the SIP peers).
So, in this case, Kamailio should be the one to reply to Telco's SIP OPTION
request with a 200 OK response (if it replies 404 NOT FOUND the TelCo will
then set your servers as OFFLINE and you won't receive calls or SIP
messages anymore, just like it is happening to you in the present).

I think that Asterisk with PJSIP allows replies to OPTION messages, but I
still haven't used PJSIP.....

Hope this helps.

*Sérgio Charrua*


*www.voip.pt <http://www.voip.pt/>*
Tel.: +351  <callto:+351+91+104+12+66>21 130 71 77

Email : *sergio.charrua at voip.pt <sergio.charrua at voip.pt>*

This message and any files or documents attached are strictly confidential
or otherwise legally protected.

It is intended only for the individual or entity named. If you are not the
named addressee or have received this email in error, please inform the
sender immediately, delete it from your system and do not copy or disclose
it or its contents or use it for any purpose. Please also note that
transmission cannot be guaranteed to be secure or error-free.








On Fri, Dec 11, 2020 at 8:00 PM Joel Serrano <joel at textplus.com> wrote:

> You can also set 404 as a valid response to the OPTIONS in Kam.
>
> On Fri, Dec 11, 2020 at 05:36 Barry Flanagan <barry at flanagan.ie> wrote:
>
>> On 11/12/2020 13:23, Mihai Cezar wrote:
>>
>> Hello, You right, i've found something, seems that the kamailio-probe it
>> puts the destination down. Any ideas why it's doing this ?
>>
>>
>> "OPTIONS-Request was finished with code 404"
>>
>> The OPTIONS returns a 404. You need to put something into your default
>> context in Asterisk so it returns 200. If your default context is "default"
>> then this would work in extensions.conf:
>>
>> *[default]*
>>
>> *exten => s,1,Hangup()*
>>
>> Then do a "dialplan reload" in asterisk.
>>
>> Hope this helps
>>
>> -Barry Flanagan
>>
>>
>> : ds_run_route(): ds_run_route event_route[dispatcher:dst-down
>> : ds_run_route(): route does not exist 8(24491) DEBUG: {2 10 OPTIONS
>> 3afe874f6d71811b-24504 at 127.0.0.1} dispatcher
>> : ds_options_callback(): OPTIONS-Request was finished with code 404 (to
>> sip:10.1.2.2;transport=udp, group 1)
>> : ds_update_state(): update state for sip:10.1.2.2;transport=udp in
>> group 1 to 10
>> : ds_update_state(): destination did not replied 10 times, threshold 10
>> : ds_update_state(): deactivate destination, threshold 10 reached
>> : ds_run_route(): ds_run_route event_route[dispatcher:dst-down
>> : ds_run_route(): route does not exist 8(24491) DEBUG: {2 10 OPTIONS
>> 3afe874f6d71811c-24504 at 127.0.0.1} dispatcher [dispatch.c:2805
>> : ds_manage_routes(): set 1
>>
>> On Thu, Dec 10, 2020 at 11:53 AM Володимир Іванець <
>> volodyaivanets at gmail.com> wrote:
>>
>>> Hello,
>>>
>>> Can you see some warnings or errors in the Kamailio log file? If no, try
>>> to increase the verbosity level.
>>>
>>> Also, how does the third REGISTER compares to the first or second one?
>>>
>>> чт, 10 груд. 2020 о 09:08 Mihai <m at mokalife.ro> пише:
>>>
>>>> Hi,
>>>>
>>>> I am forwarding all the traffic to my asterisk server ( including
>>>> registers)
>>>> everything seems to work when i first register but if stay idle 2-3
>>>> minute it gets unregistered and then i can't register back unless i restart
>>>> kamailio
>>>> see attached print screen
>>>> _______________________________________________
>>>> Kamailio (SER) - Users Mailing List
>>>> sr-users at lists.kamailio.org
>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>
>>> _______________________________________________
>>> Kamailio (SER) - Users Mailing List
>>> sr-users at lists.kamailio.org
>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing Listsr-users at lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>> --
>> -Barry
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20201211/3038091b/attachment.htm>


More information about the sr-users mailing list