[SR-Users] Trying to drop invite 200ok reply in onreply_route

nikita nikita at mbdsys.com
Fri Dec 3 16:40:12 CET 2010


On 03/12/2010 11:44, Daniel-Constantin Mierla wrote:
> Hello,
>
> On 12/2/10 4:15 PM, nikita wrote:
>> Hello,
>>
>> Sorry for the late reply, I was a little busy by something else.
>>
>> On 30/11/2010 22:24, Daniel-Constantin Mierla wrote:
>>> Hello,
>>>
>>> do you have
>>>
>>> #!KAMAILIO
>>>
>>> as first line in config file? This is required only for kamailio 3.0,
>>> next versions has the feature of dropping replies by default.
>> Yes I have #!KAMAILIO at the beginning of my kamailio.cfg.
>
> is your config that you pasted located in a tm onreply route or the
> default onreply route? TM onreply route can drop only provisional
> replies (100-199).

Actually I was using the TM onreply route. Since I have switched to the
default onreply_route I'm able to drop the 200OK, thank you for the clue.

>
>> Also, someone notided me that it could be a better idea to do a proper
>> dialog establishment and try to end it after that, for example with
>> dlg_bye("all");
>> So I think I will try to use something like :
>>
>> #!ifdef WITH_MEDIA_PROXY
>>
>>          if (is_method("INVITE")&&  status == "200") {
>>                  use_media_proxy();
>>                  if($rc<  0) {
>>                          xlog("L_ERR", "invite reply error,
>> use_media_proxy() failed with $rc \n");
>>                          if (dlg_get("$ci", "$ft", "$tt"))
>>                          {
>>                                  xlog("L_DBG", "ending a new dialog\n");
>>                                  dlg_bye("all");
>>                          }
>>                  }
>>          }
>> #!endif
>>
>> Anyone has ever tried something like that ?
>
> You will send the BYE before the 200ok is sent to caller, so it will
> get rejected most probably.

To avoid that issue, I have tried to use :

onreply_route {
#!ifdef WITH_MEDIA_PROXY
        if (is_method("INVITE") && status == "200") {
                use_media_proxy();
                if($rc) {
                        xlog("L_ERR", "invite reply error $rc \n");
                        t_reply("480","Temporarily Unavailable");
                        drop();
                }
        }
#!endif
}

And I came across something odd :
The t_reply("480","Temporarily Unavailable"); send a 480 reply to the
caller who reply ACK.
But it also send CANCEL to the callee, which is too late because the
callee have already sent his 200OK.

I'm trying to do the same thing with the dlg_bye("callee"); but I'm
having a problem here too, the following route :

onreply_route {
#!ifdef WITH_MEDIA_PROXY
        if (is_method("INVITE") && status == "200") {
                use_media_proxy();
                if($rc < 0) {
                        xlog("L_ERR", "invite reply error $rc \n");
                        if (dlg_get("$ci", "$tt", "$ft"))
                        {
                                xlog("L_ERR", "dlg  found \n");
                                dlg_bye("callee");
                        }

                }
        }
#!endif
}

generate me that error :

Dec  3 15:49:06 uServer-SIP /usr/local/sbin/kamailio[10084]: ERROR:
dialog [dlg_req_within.c:105]: no contact available
Dec  3 15:49:06 uServer-SIP /usr/local/sbin/kamailio[10084]: ERROR:
dialog [dlg_req_within.c:246]: failed to create dlg_t

I think I have set correctly my dialog flag in my "route {}" route
because if I comment the "setflag" line I have a dialog not found error
instead.

For information, dlg_bye("caller") doesn't give me that error message
and send a bye request to the caller (which like you have said, isn't
what I'm looking for).

I digged a little in the source code of the contact module but I haven't
found why my dlg_cell only contain the caller contact ... I will try to
investigate further this weekend.

Thanks again for your time,
Nikita

>
> Cheers,
> Daniel
>
>> Thanks,
>>
>>> Cheers,
>>> Daniel
>>>
>>> On 11/26/10 12:55 PM, nikita wrote:
>>>> Hello,
>>>>
>>>> I'm using kamailio 3.0 with mediaproxy and I want to cancel calls if
>>>> I have no mediaproxy relay connected to my mediaproxy dispatcher.
>>>>
>>>> In my request route I'm checking if "use_media_proxy()" is returning
>>>> me a positive result and it's working fine :
>>>>
>>>>           use_media_proxy();
>>>>           if($rc<   0) {
>>>>                    sl_send_reply("480","Temporarily Unavailable");
>>>>                    exit;
>>>>           }
>>>>
>>>>
>>>> But I'm also want check in my onreply_route If I still have an active
>>>> relay because I need to rewrite the sdp in the 200/OK reply.
>>>> My problem is that I don't know how to end the transaction, I have
>>>> tried :
>>>>
>>>>           if (is_method("INVITE")&&   status == "200") {
>>>> #!ifdef WITH_MEDIA_PROXY
>>>>                   use_media_proxy();
>>>>                   if($rc<   0) {
>>>>                           xlog("L_ERR", "invite reply error $rc \n");
>>>>                           dlg_bye("all");
>>>>                   }
>>>> #!endif
>>>>           }
>>>>
>>>> and also :
>>>>
>>>>           if (is_method("INVITE")&&   status == "200") {
>>>> #!ifdef WITH_MEDIA_PROXY
>>>>                   use_media_proxy();
>>>>                   if($rc<   0) {
>>>>                           xlog("L_ERR", "invite reply error $rc \n");
>>>>                           drop();
>>>>                   }
>>>> #!endif
>>>>           }
>>>>
>>>> In both case I'm seeing in my log file that use_media_proxy()
>>>> returned me -1, but the reply is routed to the caller ...
>>>>
>>>> Any idea on how I can cancel my call in the onreply_route ?
>>>> Also, I don't know if it's a good thing to make a second call to
>>>> "use_media_proxy" in the onreply_route, mediaproxy module couldn't
>>>> reply me with a different relay address if I have multiple mediaproxy
>>>> relay?
>>>>
>>>> Regards,
>>>>
>





More information about the sr-users mailing list