[SR-Users] parallel forking

Yuriy Gorlichenko ovoshlook at gmail.com
Fri Oct 17 18:41:32 CEST 2014


Forget some things:
All calls going form asterisk viaUDP.
t_relay calling out of loop. At the end.

When t_relay at loop first packet goes great but INVITE to second
destinationd not going and ended with ERROR "can't generate 200 reply when
a final 200 was sent out"

2014-10-17 20:33 GMT+04:00 Yuriy Gorlichenko <ovoshlook at gmail.com>:

> Hello. I try to do parallel  fork calls to endpoints that have same
> username and different destination URI. Logic of my script:
> checking location table for rows with needed account
> get info from contact at loop
>
> for every step
>
> check technology (sip or ws)
> append_branch with existing destination for this account
> rewrite packet with rtpengine to needed technology
>
>
> forward packets via t_relay
>
>
>
> sql_query("ca", "select contact from location where username='$tU'", "ra");
> xlog("rows: $dbr(ra=>rows) cols: $dbr(ra=>cols)\n");
>  if($dbr(ra=>rows)>0){
> $var(i)=0;
>  while($var(i)<$dbr(ra=>rows)){
>  xlog("L_INFO","SQL query return contact {$dbr(ra=>[$var(i),0])} for
> {$tU} at step {$var(i)}\n");
>  if ($dbr(ra=>[$var(i),0])=~"transport=ws"){
> xlog("L_INFO", "This is a Websocket call to endpoint");
> sql_pvquery("ca", "select received from location where
> contact='$dbr(ra=>[$var(i),0])'","$var(recieved)");
> xlog("L_INFO","SQL query return recieved {$var(recieved)} for {$tU}\n");
> $du=$var(recieved);
> xlog("L_INFO", "Request going FROM ASTERISK to WS. Destination is
> {$du}\n");
> xlog("L_INFO","Websocket Destination URI is {$var(recieved)} for {$tU}\n");
> rtpproxy_manage("froc+SP");
> t_on_reply("REPLY_FROM_WS");
> append_branch("sip:$tU@$du");
> $var(i) = $var(i) + 1;
> }
>  else
> {
> xlog("L_INFO", "This is a classic UDP call to endpoint");
>  $du="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@});
> xlog("L_INFO","Classic Destination URI is {$dbr(ra=>[$var(i),0])} for
> {$tU}\n");
> rtpproxy_manage("co");
> t_on_reply("MANAGE_CLASSIC_REPLY");
> append_branch("sip:$tU@$du");
> $var(i) = $var(i) + 1;
> }
> #append_branch("sip:$tU@$du");
>  }
> }
> return 1;
>
>
> So it customised schema of standart example
>
>
>   seturi("sip:a at example.com");
>   append_branch("sip:b at example.com");
>   append_branch("sip:c at example.com");
>   append_branch("sip:d at example.com");
>
>   t_relay();
>
> At my test I have 2 endpoints with WS and UDP phones (at fist step ir WS
> and 2 step it UDP). when I do these steps (at my script) I see packet at
> TCP dump and saw that sended only one packet to UDP but body of packet is
> WS. Then I saw log of kamailio. I see that at second step packet changed
> body to WS body (so strange because other steps before and after goes for
> UDP (as at logic of script))
>
> What I need to do for send parallel INVITES to multiple endpoints
> correctly? Thanks
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20141017/ef06b073/attachment.html>


More information about the sr-users mailing list