parallel forking

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

parallel forking

stefanoIT
Hi everybody,
If I do a parallel forking (changing ruri and appending branches) after I received the OK (200) I'm unable to know who answered (to log it) because I can't see which ruri generated the reply. I can see che Contact header but this is not enought to be sure.
There is a way to do that?
I'm using opensips 1.4.4

thanks

stefano
italy
Reply | Threaded
Open this post in threaded view
|

Re: parallel forking

Bogdan-Andrei Iancu
Hi Stefano,

There is no way to extract the URI from the reply; also there is no way
yo access the internal data structures (like transaction) to get this info.

But what you can do is to use AVPs to store the RURI - use different
specific numes in order to make difference between branches:

    $ru = "first branch RURI";
    $avp(s:uri1) = $ru;
    append_branch("second branch RURI");
    $avp(s:uri2) = "second branch RURI");
    ....

in onreply route, you can do:

    if ($t_branch_idx==1) {
       xlog("RURI was: $avp(s:uri1) \n");
    }  else ($t_branch_idx==1) {
       xlog("RURI was: $avp(s:uri2) \n");
    }
    ...

I know it is not the nicest or most scalable way to do it, but this is a
workable solution with what is now available.

Regards,
Bogdan

stefanoIT wrote:

> Hi everybody,
> If I do a parallel forking (changing ruri and appending branches) after I
> received the OK (200) I'm unable to know who answered (to log it) because I
> can't see which ruri generated the reply. I can see che Contact header but
> this is not enought to be sure.
> There is a way to do that?
> I'm using opensips 1.4.4
>
> thanks
>
> stefano
> italy
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: parallel forking

stefanoIT
Hi Bogdan,
I had read about brach this:

3.75 Branch index
$T_branch_idx - the index (starting with 1 for the first branch) of the branch for which is executed the branch_route[]. If used outside of branch_route[] block, the value is '0'. This is exported by TM module.

Is that true?

regards.
stefano


<quote author="Bogdan-Andrei Iancu">
Hi Stefano,

There is no way to extract the URI from the reply; also there is no way
yo access the internal data structures (like transaction) to get this info.

But what you can do is to use AVPs to store the RURI - use different
specific numes in order to make difference between branches:

    $ru = "first branch RURI";
    $avp(s:uri1) = $ru;
    append_branch("second branch RURI");
    $avp(s:uri2) = "second branch RURI");
    ....

in onreply route, you can do:

    if ($t_branch_idx==1) {
       xlog("RURI was: $avp(s:uri1) \n");
    }  else ($t_branch_idx==1) {
       xlog("RURI was: $avp(s:uri2) \n");
    }
    ...

I know it is not the nicest or most scalable way to do it, but this is a
workable solution with what is now available.

Regards,
Bogdan

Reply | Threaded
Open this post in threaded view
|

Re: parallel forking

Bogdan-Andrei Iancu
yes, it is true:)

Regards,
Bogdan

stefanoIT wrote:

> Hi Bogdan,
> I had read about brach this:
>
> 3.75 Branch index
> $T_branch_idx - the index (starting with 1 for the first branch) of the
> branch for which is executed the branch_route[]. If used outside of
> branch_route[] block, the value is '0'. This is exported by TM module.
>
> Is that true?
>
> regards.
> stefano
>
>
>
> Hi Stefano,
>
> There is no way to extract the URI from the reply; also there is no way
> yo access the internal data structures (like transaction) to get this info.
>
> But what you can do is to use AVPs to store the RURI - use different
> specific numes in order to make difference between branches:
>
>     $ru = "first branch RURI";
>     $avp(s:uri1) = $ru;
>     append_branch("second branch RURI");
>     $avp(s:uri2) = "second branch RURI");
>     ....
>
> in onreply route, you can do:
>
>     if ($t_branch_idx==1) {
>        xlog("RURI was: $avp(s:uri1) \n");
>     }  else ($t_branch_idx==1) {
>        xlog("RURI was: $avp(s:uri2) \n");
>     }
>     ...
>
> I know it is not the nicest or most scalable way to do it, but this is a
> workable solution with what is now available.
>
> Regards,
> Bogdan
>
>
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: parallel forking

stefanoIT
So there is no a solution to my problem. At the moment.

Thanks.

Bogdan-Andrei Iancu wrote
yes, it is true:)

Regards,
Bogdan
Reply | Threaded
Open this post in threaded view
|

Re: parallel forking

Iñaki Baz Castillo
2009/2/2 stefanoIT <[hidden email]>:
>
> So there is no a solution to my problem. At the moment.

You can also process each generated branch in "branch_route" and add
the RURI value as Via or Record-Route parameter. For example:

branch_route[X] {
  add_rr_param(";branch_ruri_user=$rU");
  add_rr_param(";branch_ruri_hostport=$rd:$rp");
}

Later in reply_route you can check those parameters in Record-Route by
using "check_route_param":
  http://kamailio.org/docs/modules/1.5.x/rr.html#check-route-param-id

But Record-route will only exist if the reply is 2XX, if not it's not
required. So using "Via" parameters would be a better choice.


Note however that "@" char is not valid as a header parameter
according to the SIP BNF grammar. This is why I split the TUTI into
user and host parts.



--
Iñaki Baz Castillo
<[hidden email]>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: parallel forking

stefanoIT
Hi Iñaki,
you suggestion was brilliant.
I can store the uri(s) is avp $(avp(s:uri)[n]) = $ru
then put n in via header, and get it on 200 reply.
I'll try.
Thanks

PS I remember that in via header there is alrealy branch number (.1 .2 .3 and so on)

Iñaki Baz Castillo wrote
2009/2/2 stefanoIT <stefano@omnianet.it>:
>
> So there is no a solution to my problem. At the moment.

You can also process each generated branch in "branch_route" and add
the RURI value as Via or Record-Route parameter. For example:

branch_route[X] {
  add_rr_param(";branch_ruri_user=$rU");
  add_rr_param(";branch_ruri_hostport=$rd:$rp");
}

Later in reply_route you can check those parameters in Record-Route by
using "check_route_param":
  http://kamailio.org/docs/modules/1.5.x/rr.html#check-route-param-id

But Record-route will only exist if the reply is 2XX, if not it's not
required. So using "Via" parameters would be a better choice.


Note however that "@" char is not valid as a header parameter
according to the SIP BNF grammar. This is why I split the TUTI into
user and host parts.



--
Iñaki Baz Castillo
<ibc@aliax.net>

_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: parallel forking

Bogdan-Andrei Iancu
Hi guys,

Even if the solution suggested by Inaki is a valid one, it is a terrible
hack (storing the RURI in VIA / RR just to get it at reply time) -
especially when this information is available in the internal
transaction, so it is just a matter of accessing it.

So, I added a new Pseudo Variable in TM module to give access to the
RURI of each outgoing branch: $T_ruri
        http://www.opensips.org/html/docs/modules/1.5.x/tm.html#id272609

This is available in onreply route too, so you can get the RURI of the
corresponding branch from there.

Regards,
Bogdan

stefanoIT wrote:

> Hi Iñaki,
> you suggestion was brilliant.
> I can store the uri(s) is avp $(avp(s:uri)[n]) = $ru
> then put n in via header, and get it on 200 reply.
> I'll try.
> Thanks
>
> PS I remember that in via header there is alrealy branch number (.1 .2 .3
> and so on)
>
>
> Iñaki Baz Castillo wrote:
>  
>> 2009/2/2 stefanoIT <[hidden email]>:
>>    
>>> So there is no a solution to my problem. At the moment.
>>>      
>> You can also process each generated branch in "branch_route" and add
>> the RURI value as Via or Record-Route parameter. For example:
>>
>> branch_route[X] {
>>   add_rr_param(";branch_ruri_user=$rU");
>>   add_rr_param(";branch_ruri_hostport=$rd:$rp");
>> }
>>    

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: parallel forking

stefanoIT
That's wonderful! :-)

regards,
stefano

Bogdan-Andrei Iancu wrote
Hi guys,

Even if the solution suggested by Inaki is a valid one, it is a terrible
hack (storing the RURI in VIA / RR just to get it at reply time) -
especially when this information is available in the internal
transaction, so it is just a matter of accessing it.

So, I added a new Pseudo Variable in TM module to give access to the
RURI of each outgoing branch: $T_ruri
        http://www.opensips.org/html/docs/modules/1.5.x/tm.html#id272609

This is available in onreply route too, so you can get the RURI of the
corresponding branch from there.

Regards,
Bogdan

stefanoIT wrote:
> Hi Iñaki,
> you suggestion was brilliant.
> I can store the uri(s) is avp $(avp(s:uri)[n]) = $ru
> then put n in via header, and get it on 200 reply.
> I'll try.
> Thanks
>
> PS I remember that in via header there is alrealy branch number (.1 .2 .3
> and so on)
>
>
> Iñaki Baz Castillo wrote:
>  
>> 2009/2/2 stefanoIT <stefano@omnianet.it>:
>>    
>>> So there is no a solution to my problem. At the moment.
>>>      
>> You can also process each generated branch in "branch_route" and add
>> the RURI value as Via or Record-Route parameter. For example:
>>
>> branch_route[X] {
>>   add_rr_param(";branch_ruri_user=$rU");
>>   add_rr_param(";branch_ruri_hostport=$rd:$rp");
>> }
>>    

_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: parallel forking

stefanoIT
Hi Bogdan,
is it possible make $T_branch_idx available in reply branch too?
Is it possible to have a $T_from, becouse from can change for each branch now.
Regards,
stefano

stefanoIT wrote
That's wonderful! :-)

regards,
stefano

Bogdan-Andrei Iancu wrote
Hi guys,

Even if the solution suggested by Inaki is a valid one, it is a terrible
hack (storing the RURI in VIA / RR just to get it at reply time) -
especially when this information is available in the internal
transaction, so it is just a matter of accessing it.

So, I added a new Pseudo Variable in TM module to give access to the
RURI of each outgoing branch: $T_ruri
        http://www.opensips.org/html/docs/modules/1.5.x/tm.html#id272609

This is available in onreply route too, so you can get the RURI of the
corresponding branch from there.

Regards,
Bogdan

stefanoIT wrote:
> Hi Iñaki,
> you suggestion was brilliant.
> I can store the uri(s) is avp $(avp(s:uri)[n]) = $ru
> then put n in via header, and get it on 200 reply.
> I'll try.
> Thanks
>
> PS I remember that in via header there is alrealy branch number (.1 .2 .3
> and so on)
>
>
> Iñaki Baz Castillo wrote:
>  
>> 2009/2/2 stefanoIT <stefano@omnianet.it>:
>>    
>>> So there is no a solution to my problem. At the moment.
>>>      
>> You can also process each generated branch in "branch_route" and add
>> the RURI value as Via or Record-Route parameter. For example:
>>
>> branch_route[X] {
>>   add_rr_param(";branch_ruri_user=$rU");
>>   add_rr_param(";branch_ruri_hostport=$rd:$rp");
>> }
>>    

_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: parallel forking

Bogdan-Andrei Iancu
Hi Stefano,

I made a fix on SVN - this will make the $T_branch_idx var available in
onreply route also. Please give it a try.

Regards,
Bogdan

stefanoIT wrote:

> Hi Bogdan,
> is it possible make $T_branch_idx available in reply branch too?
> Is it possible to have a $T_from, becouse from can change for each branch
> now.
> Regards,
> stefano
>
>
> stefanoIT wrote:
>  
>> That's wonderful! :-)
>>
>> regards,
>> stefano
>>
>>
>> Bogdan-Andrei Iancu wrote:
>>    
>>> Hi guys,
>>>
>>> Even if the solution suggested by Inaki is a valid one, it is a terrible
>>> hack (storing the RURI in VIA / RR just to get it at reply time) -
>>> especially when this information is available in the internal
>>> transaction, so it is just a matter of accessing it.
>>>
>>> So, I added a new Pseudo Variable in TM module to give access to the
>>> RURI of each outgoing branch: $T_ruri
>>>         http://www.opensips.org/html/docs/modules/1.5.x/tm.html#id272609
>>>
>>> This is available in onreply route too, so you can get the RURI of the
>>> corresponding branch from there.
>>>
>>> Regards,
>>> Bogdan
>>>
>>> stefanoIT wrote:
>>>      
>>>> Hi Iñaki,
>>>> you suggestion was brilliant.
>>>> I can store the uri(s) is avp $(avp(s:uri)[n]) = $ru
>>>> then put n in via header, and get it on 200 reply.
>>>> I'll try.
>>>> Thanks
>>>>
>>>> PS I remember that in via header there is alrealy branch number (.1 .2
>>>> .3
>>>> and so on)
>>>>
>>>>
>>>> Iñaki Baz Castillo wrote:
>>>>  
>>>>        
>>>>> 2009/2/2 stefanoIT <[hidden email]>:
>>>>>    
>>>>>          
>>>>>> So there is no a solution to my problem. At the moment.
>>>>>>      
>>>>>>            
>>>>> You can also process each generated branch in "branch_route" and add
>>>>> the RURI value as Via or Record-Route parameter. For example:
>>>>>
>>>>> branch_route[X] {
>>>>>   add_rr_param(";branch_ruri_user=$rU");
>>>>>   add_rr_param(";branch_ruri_hostport=$rd:$rp");
>>>>> }
>>>>>    
>>>>>          
>>> _______________________________________________
>>> Users mailing list
>>> [hidden email]
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>>      
>>    
>
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users