Hi all,
I'm getting crazy trying to setup a kamailio to do a parallel call forward to multiple destinations based on a query to the DB.
I do the db query and get the RURI's of the destinations I could forward the call to in parallel, then when I get the resulset I do:
[...]
$var(cf_idx) = 0; while(is_avp_set("$(avp(s:cf_destinations)[0])")) { $ru = $(avp(s:cf_destinations)[0]); # Set the new RURI to call to $(avp(s:cf_destinations)[0]) = $null; # Setting it to $null pull the value from the stack $(avp(s:callee_fr_inv_timer)[*]) = $(avp(s:cf_timeouts)[0]) * 1000; t_set_fr("$avp(s:callee_fr_inv_timer)"); $(avp(s:cf_timeouts)[0]) = $null; route(ROUTE_ACC_CF); # Do the ACC $(avp(s:acc_state)[*]) = "cfna"; $(avp(s:hih_cause)[*]) = "404"; $var(cf_idx) = $var(cf_idx) + 1; append_branch(); } route(ROUTE_EXECUTE_CF_LOOP); # Some final task and then t_relay
[...]
But only the last RURI get called
How do I do to accomplish this? ... I need to change the $ru of each new branch, so when request get loop-back to the proxy, it do again all the lookup logic.
Best regards
Hello,
you should not use index when setting an avp to null -- remove the [0].
Then you can print details of branches voa $branch(...) variable to see what are the results of your operations.
A branch can be added also by providing the uri as parameter for append_branch() -- see the documentation of the function in the corex module.
Cheers, Daniel
On 09/02/15 08:18, Raúl Alexis Betancor Santana wrote:
Hi all,
I'm getting crazy trying to setup a kamailio to do a parallel call forward to multiple destinations based on a query to the DB.
I do the db query and get the RURI's of the destinations I could forward the call to in parallel, then when I get the resulset I do:
[...]
$var(cf_idx) = 0; while(is_avp_set("$(avp(s:cf_destinations)[0])")) { $ru = $(avp(s:cf_destinations)[0]); # Set the new RURI to call to $(avp(s:cf_destinations)[0]) = $null; # Setting it to $null pull the value from the stack $(avp(s:callee_fr_inv_timer)[*]) = $(avp(s:cf_timeouts)[0]) * 1000; t_set_fr("$avp(s:callee_fr_inv_timer)"); $(avp(s:cf_timeouts)[0]) = $null; route(ROUTE_ACC_CF); # Do the ACC $(avp(s:acc_state)[*]) = "cfna"; $(avp(s:hih_cause)[*]) = "404"; $var(cf_idx) = $var(cf_idx) + 1; append_branch(); } route(ROUTE_EXECUTE_CF_LOOP); # Some final task and then t_relay
[...]
But only the last RURI get called
How do I do to accomplish this? ... I need to change the $ru of each new branch, so when request get loop-back to the proxy, it do again all the lookup logic.
Best regards
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
I did not use the index to erase pull from the stack I directly set it to null
$(avp(s:cf_destinations)[0]) = $null;
If I do this:
$var(new_ru) = $(avp(s:cf_destinations)[0]); ... append_branch($var(new_ru)); ...
I got the same result ... just the LAST $ru I set is the one thats called.
De: "Daniel-Constantin Mierla" miconda@gmail.com Para: "Kamailio (SER) - Users Mailing List" sr-users@lists.sip-router.org Enviados: Lunes, 9 de Febrero 2015 9:19:23 Asunto: Re: [SR-Users] Parallel call forward
Hello,
you should not use index when setting an avp to null -- remove the [0].
Then you can print details of branches voa $branch(...) variable to see what are the results of your operations.
A branch can be added also by providing the uri as parameter for append_branch() -- see the documentation of the function in the corex module.
Cheers, Daniel
On 09/02/15 08:18, Raúl Alexis Betancor Santana wrote:
Hi all,
I'm getting crazy trying to setup a kamailio to do a parallel call forward to multiple destinations based on a query to the DB.
I do the db query and get the RURI's of the destinations I could forward the call to in parallel, then when I get the resulset I do:
[...]
$var(cf_idx) = 0; while(is_avp_set("$(avp(s:cf_destinations)[0])")) { $ru = $(avp(s:cf_destinations)[0]); # Set the new RURI to call to $(avp(s:cf_destinations)[0]) = $null; # Setting it to $null pull the value from the stack $(avp(s:callee_fr_inv_timer)[*]) = $(avp(s:cf_timeouts)[0]) * 1000; t_set_fr("$avp(s:callee_fr_inv_timer)"); $(avp(s:cf_timeouts)[0]) = $null; route(ROUTE_ACC_CF); # Do the ACC $(avp(s:acc_state)[*]) = "cfna"; $(avp(s:hih_cause)[*]) = "404"; $var(cf_idx) = $var(cf_idx) + 1; append_branch(); } route(ROUTE_EXECUTE_CF_LOOP); # Some final task and then t_relay
[...]
But only the last RURI get called
How do I do to accomplish this? ... I need to change the $ru of each new branch, so when request get loop-back to the proxy, it do again all the lookup logic.
Best regards
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio World Conference, May 27-29, 2015 Berlin, Germany - http://www.kamailioworld.com
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Setting to $null means deleting the avp -- so remove the [0] from that assignment.
What function are you using to send out the request? Can you sent the cfg execution trace (see debugger module)?
Also, have you tried to troubleshoot using $branch(...) variables?
Cheers, Daniel
On 09/02/15 13:50, Raúl Alexis Betancor Santana wrote:
I did not use the index to erase pull from the stack I directly set it to null
$(avp(s:cf_destinations)[0]) = $null;
If I do this:
$var(new_ru) = $(avp(s:cf_destinations)[0]); ... append_branch($var(new_ru)); ...
I got the same result ... just the LAST $ru I set is the one thats called.
*De: *"Daniel-Constantin Mierla" <miconda@gmail.com> *Para: *"Kamailio (SER) - Users Mailing List" <sr-users@lists.sip-router.org> *Enviados: *Lunes, 9 de Febrero 2015 9:19:23 *Asunto: *Re: [SR-Users] Parallel call forward Hello, you should not use index when setting an avp to null -- remove the [0]. Then you can print details of branches voa $branch(...) variable to see what are the results of your operations. A branch can be added also by providing the uri as parameter for append_branch() -- see the documentation of the function in the corex module. Cheers, Daniel On 09/02/15 08:18, Raúl Alexis Betancor Santana wrote: Hi all, I'm getting crazy trying to setup a kamailio to do a parallel call forward to multiple destinations based on a query to the DB. I do the db query and get the RURI's of the destinations I could forward the call to in parallel, then when I get the resulset I do: [...] $var(cf_idx) = 0; while(is_avp_set("$(avp(s:cf_destinations)[0])")) { $ru = $(avp(s:cf_destinations)[0]); # Set the new RURI to call to $(avp(s:cf_destinations)[0]) = $null; # Setting it to $null pull the value from the stack $(avp(s:callee_fr_inv_timer)[*]) = $(avp(s:cf_timeouts)[0]) * 1000; t_set_fr("$avp(s:callee_fr_inv_timer)"); $(avp(s:cf_timeouts)[0]) = $null; route(ROUTE_ACC_CF); # Do the ACC $(avp(s:acc_state)[*]) = "cfna"; $(avp(s:hih_cause)[*]) = "404"; $var(cf_idx) = $var(cf_idx) + 1; append_branch(); } route(ROUTE_EXECUTE_CF_LOOP); # Some final task and then t_relay [...] But only the last RURI get called How do I do to accomplish this? ... I need to change the $ru of each new branch, so when request get loop-back to the proxy, it do again all the lookup logic. Best regards _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users -- Daniel-Constantin Mierla http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio World Conference, May 27-29, 2015 Berlin, Germany - http://www.kamailioworld.com _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
This is what I testet:
route[ROUTE_EXECUTE_CF_LOOP_NR] { xlog("L_NOTICE", "ROUTE_EXECUTE_CF_LOOP_NR"); if(!t_is_failure_route()) { record_route(); } $var(count_dlg) = 0; route(ROUTE_SET_CALLER_DIALOG); $du = "sip:192.168.20.100:5060"; xlog("L_INFO", "Trigger CF loop NR to '$du' for call to '$ru' - [% logreq -%]\n"); t_on_failure("FAILURE_ROUTE_HUNT"); t_on_branch("BRANCH_ROUTE_FWD_LOOP"); }
while(is_avp_set("$(avp(s:cf_destinations)[0])")) { $ru = $(avp(s:cf_destinations)[0]); $var(new_ruri) = $(avp(s:cf_destinations)[0]); $(avp(s:cf_destinations)[0]) = $null; xlog("L_NOTICE", "1 DST: $ru"); append_branch($avp(new_ruri)); route(ROUTE_EXECUTE_CF_LOOP_NR); } t_relay_to("0x01"); exit;
With $avp(s:cf_destinations)[0] = "555@dom1.com" and $avp(s:cf_destinations)[1] = "666@dom1.com", what I get on the logs is ...
[...] 1 DST: sip:555@dom1.com 1 DST: sip:666@dom1.com Appending P-D-URI 'sip:192.168.20.100:5060' - R=sip:666@dom1.com ID=54d8f17fbb4a-m5l3n9j3xd73 Appending P-D-URI 'sip:192.168.20.100:5060' - R=sip:666@dom1.com ID=54d8f17fbb4a-m5l3n9j3xd73 [...]
Meaning (from my ignorance), that the last $ru it's used for both 'appended_branches', no matter what I pass to append_branch
When I expected: [...] 1 DST: sip:555@dom1.com 1 DST: sip:666@dom1.com Appending P-D-URI 'sip:192.168.20.100:5060' - R=sip:555@dom1.com ID=54d8f17fbb4a-m5l3n9j3xd73.1 Appending P-D-URI 'sip:192.168.20.100:5060' - R=sip:666@dom1.com ID=54d8f17fbb4a-m5l3n9j3xd73.2 [...]
Are there any example of parallel forking, that works like this? ... I'm doing something terrible wrong?
Best regards
In fact ... 666 subscriber get's 2 calls ...
De: "Raúl Alexis Betancor Santana" rabs@dimension-virtual.com Para: miconda@gmail.com CC: "Kamailio (SER) - Users Mailing List" sr-users@lists.sip-router.org Enviados: Lunes, 9 de Febrero 2015 17:56:08 Asunto: Re: [SR-Users] Parallel call forward
This is what I testet:
route[ROUTE_EXECUTE_CF_LOOP_NR] { xlog("L_NOTICE", "ROUTE_EXECUTE_CF_LOOP_NR"); if(!t_is_failure_route()) { record_route(); } $var(count_dlg) = 0; route(ROUTE_SET_CALLER_DIALOG); $du = "sip:192.168.20.100:5060"; xlog("L_INFO", "Trigger CF loop NR to '$du' for call to '$ru' - [% logreq -%]\n"); t_on_failure("FAILURE_ROUTE_HUNT"); t_on_branch("BRANCH_ROUTE_FWD_LOOP"); }
while(is_avp_set("$(avp(s:cf_destinations)[0])")) { $ru = $(avp(s:cf_destinations)[0]); $var(new_ruri) = $(avp(s:cf_destinations)[0]); $(avp(s:cf_destinations)[0]) = $null; xlog("L_NOTICE", "1 DST: $ru"); append_branch($avp(new_ruri)); route(ROUTE_EXECUTE_CF_LOOP_NR); } t_relay_to("0x01"); exit;
With $avp(s:cf_destinations)[0] = "555@dom1.com" and $avp(s:cf_destinations)[1] = "666@dom1.com", what I get on the logs is ...
[...] 1 DST: sip:555@dom1.com 1 DST: sip:666@dom1.com Appending P-D-URI 'sip:192.168.20.100:5060' - R=sip:666@dom1.com ID=54d8f17fbb4a-m5l3n9j3xd73 Appending P-D-URI 'sip:192.168.20.100:5060' - R=sip:666@dom1.com ID=54d8f17fbb4a-m5l3n9j3xd73 [...]
Meaning (from my ignorance), that the last $ru it's used for both 'appended_branches', no matter what I pass to append_branch
When I expected: [...] 1 DST: sip:555@dom1.com 1 DST: sip:666@dom1.com Appending P-D-URI 'sip:192.168.20.100:5060' - R=sip:555@dom1.com ID=54d8f17fbb4a-m5l3n9j3xd73.1 Appending P-D-URI 'sip:192.168.20.100:5060' - R=sip:666@dom1.com ID=54d8f17fbb4a-m5l3n9j3xd73.2 [...]
Are there any example of parallel forking, that works like this? ... I'm doing something terrible wrong?
Best regards
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
After playing with the $brach(...) ... I found what was happening and fixed it. A missing call to setup the $du of the branches ... now working as expected.
Thanks
De: "Raúl Alexis Betancor Santana" rabs@dimension-virtual.com Para: "Kamailio (SER) - Users Mailing List" sr-users@lists.sip-router.org Enviados: Lunes, 9 de Febrero 2015 18:11:50 Asunto: Re: [SR-Users] Parallel call forward
In fact ... 666 subscriber get's 2 calls ...
De: "Raúl Alexis Betancor Santana" rabs@dimension-virtual.com Para: miconda@gmail.com CC: "Kamailio (SER) - Users Mailing List" sr-users@lists.sip-router.org Enviados: Lunes, 9 de Febrero 2015 17:56:08 Asunto: Re: [SR-Users] Parallel call forward
This is what I testet:
route[ROUTE_EXECUTE_CF_LOOP_NR] { xlog("L_NOTICE", "ROUTE_EXECUTE_CF_LOOP_NR"); if(!t_is_failure_route()) { record_route(); } $var(count_dlg) = 0; route(ROUTE_SET_CALLER_DIALOG); $du = "sip:192.168.20.100:5060"; xlog("L_INFO", "Trigger CF loop NR to '$du' for call to '$ru' - [% logreq -%]\n"); t_on_failure("FAILURE_ROUTE_HUNT"); t_on_branch("BRANCH_ROUTE_FWD_LOOP"); }
while(is_avp_set("$(avp(s:cf_destinations)[0])")) { $ru = $(avp(s:cf_destinations)[0]); $var(new_ruri) = $(avp(s:cf_destinations)[0]); $(avp(s:cf_destinations)[0]) = $null; xlog("L_NOTICE", "1 DST: $ru"); append_branch($avp(new_ruri)); route(ROUTE_EXECUTE_CF_LOOP_NR); } t_relay_to("0x01"); exit;
With $avp(s:cf_destinations)[0] = "555@dom1.com" and $avp(s:cf_destinations)[1] = "666@dom1.com", what I get on the logs is ...
[...] 1 DST: sip:555@dom1.com 1 DST: sip:666@dom1.com Appending P-D-URI 'sip:192.168.20.100:5060' - R=sip:666@dom1.com ID=54d8f17fbb4a-m5l3n9j3xd73 Appending P-D-URI 'sip:192.168.20.100:5060' - R=sip:666@dom1.com ID=54d8f17fbb4a-m5l3n9j3xd73 [...]
Meaning (from my ignorance), that the last $ru it's used for both 'appended_branches', no matter what I pass to append_branch
When I expected: [...] 1 DST: sip:555@dom1.com 1 DST: sip:666@dom1.com Appending P-D-URI 'sip:192.168.20.100:5060' - R=sip:555@dom1.com ID=54d8f17fbb4a-m5l3n9j3xd73.1 Appending P-D-URI 'sip:192.168.20.100:5060' - R=sip:666@dom1.com ID=54d8f17fbb4a-m5l3n9j3xd73.2 [...]
Are there any example of parallel forking, that works like this? ... I'm doing something terrible wrong?
Best regards
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@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@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users