[SR-Users] question about dlg_var

张顺通 shuntongzhang at gmail.com
Tue Mar 8 07:51:39 CET 2016


*Thank you for your help,$avp and flag is ok.*

2016-03-03 17:22 GMT+08:00 Julia Boudniatsky <juliabo at gmail.com>:

> Hello,
>
>
>
> I am using two different on_reply routes:
>
>
>
> if (is_method("INVITE") && !has_totag()) {
> .......
>        t_on_reply(REPLY_TO_SOURCE);
> }
>
> route[WITHINDLG] {
>
> if(has_to_tag()) {
> ........
>       t_on_reply(REPLY_IN_DIALOG);
> }
>
> May be it will help.
>
>
>
> Best regards,
>
> Julia.
>
> On Thu, Mar 3, 2016 at 10:57 AM, Federico Cabiddu <
> federico.cabiddu at gmail.com> wrote:
>
>> Hi,
>> If I understood correctly the original question was to identify, in a
>> reply route, a 200 OK coming for an initial INVITE.
>> In the reply route the 200 OK will always have a to tag (unless the UAS
>> is broken), so you cannot this condition.
>>
>> Regards,
>>
>> Federico
>>
>> On Thu, Mar 3, 2016 at 9:05 AM, Serge S. Yuriev <me at nevian.org> wrote:
>>
>>> Hi,
>>>
>>> Sorry, but why not to check has_totag again? Why we need a flag?
>>>
>>> --
>>> Wbr, Serge via mobile
>>>
>>> 03.03.2016, 09:31, "Federico Cabiddu" <federico.cabiddu at gmail.com>:
>>>
>>>
>>> Hi,
>>> $dlg_var is not available at this stage of the dialog:
>>>
>>>
>>>
>>> http://www.kamailio.org/docs/modules/devel/modules/dialog.html#idp19330392
>>>
>>>
>>>
>>> To achieve your goal you can use there an avp or a flag, which are bound
>>> to transactions.
>>> Something like:
>>>
>>>
>>>
>>> #define INIT_FLAG
>>>
>>>
>>> if (is_method("INVITE") && !has_totag()) {
>>>
>>>         $avp(is_init_invite) = 1;
>>>         # or
>>>         # setflag(INIT_FLAG);
>>> }
>>>
>>>
>>> onreply_route {
>>>     if (is_method("INVITE") && t_check_status("200") &&
>>> $avp(is_init_invite) == "1") {
>>>         # or
>>>         # if (is_method("INVITE") && t_check_status("200") &&
>>> isflagset(INIT_FLAG))
>>>         #
>>>         # do somting
>>>     }
>>> }
>>>
>>>
>>> Regards,
>>>
>>>
>>> Federico
>>>
>>>
>>> On Thu, Mar 3, 2016 at 4:55 AM, 张顺通 <shuntongzhang at gmail.com> wrote:
>>>
>>>
>>> I want to distingguish 200 OK is for INVITE or reINVITE。
>>>
>>>
>>> so I do this:
>>> request_route {
>>>     if (is_method("INVITE") && !has_totag()) {
>>>         $dlg_var(is_init_invite) = "1";
>>>     }
>>> }
>>>
>>>
>>> onreply_route {
>>>     xlog("L_INFO","[$rs-$rr][is_init_invite:$dlg_var(is_init_invite)]");
>>>     if (is_method("INVITE") && t_check_status("200") &&
>>> $dlg_var(is_init_invite) == "1") {
>>>         # do somting
>>>         $dlg_var(is_init_invite) = "0";
>>>     }
>>>     xlog("L_INFO","[$rs-$rr][is_init_invite:$dlg_var(is_init_invite)]");
>>> }
>>>
>>>
>>> What I confuse is:
>>> When I recive 100 Trying LOG is
>>> [100 - Trying][is_init_invite:0]
>>> [100 - Trying][is_init_invite:1]
>>>
>>>
>>>
>>> why is_init_invite is 0?
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>> sr-users at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>> sr-users at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>> sr-users at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160308/427fa97e/attachment.html>


More information about the sr-users mailing list