<div dir="ltr">Hello. I try to do parallel  fork calls to endpoints that have same username and different destination URI. Logic of my script: <br>checking location table for rows with needed account<div>get info from contact at loop</div><div><br></div><div>for every step</div><div><br></div><div>check technology (sip or ws)<br>append_branch with existing destination for this account<br>rewrite packet with rtpengine to needed technology<br><br></div><div><br></div><div>forward packets via t_relay</div><div><br></div><div><br><br><div>sql_query("ca", "select contact from location where username='$tU'", "ra");</div><div><span class="" style="white-space:pre">                   </span>xlog("rows: $dbr(ra=>rows) cols: $dbr(ra=>cols)\n");</div><div><span class="" style="white-space:pre">                       </span></div><div><span class="" style="white-space:pre">                   </span>if($dbr(ra=>rows)>0){</div><div><span class="" style="white-space:pre">                                </span>$var(i)=0;</div><div><span class="" style="white-space:pre">                         </span> while($var(i)<$dbr(ra=>rows)){</div><div><span class="" style="white-space:pre">                      </span></div><div><span class="" style="white-space:pre">                                   </span>xlog("L_INFO","SQL query return contact {$dbr(ra=>[$var(i),0])} for {$tU} at step {$var(i)}\n");</div><div><span class="" style="white-space:pre">                                    </span></div><div><span class="" style="white-space:pre">                                   </span>if ($dbr(ra=>[$var(i),0])=~"transport=ws"){<span class="" style="white-space:pre">  </span></div><div><span class="" style="white-space:pre">                                           </span>xlog("L_INFO", "This is a Websocket call to endpoint");</div><div><span class="" style="white-space:pre">                                                </span>sql_pvquery("ca", "select received from location where contact='$dbr(ra=>[$var(i),0])'","$var(recieved)");</div><div><span class="" style="white-space:pre">                                                </span>xlog("L_INFO","SQL query return recieved {$var(recieved)} for {$tU}\n");</div><div><span class="" style="white-space:pre">                                               </span>$du=$var(recieved);</div><div><span class="" style="white-space:pre">                                                </span>xlog("L_INFO", "Request going FROM ASTERISK to WS. Destination is {$du}\n");</div><div><span class="" style="white-space:pre">                                           </span>xlog("L_INFO","Websocket Destination URI is {$var(recieved)} for {$tU}\n");</div><div><span class="" style="white-space:pre">                                            </span>rtpproxy_manage("froc+SP");</div><div><span class="" style="white-space:pre">                                              </span>t_on_reply("REPLY_FROM_WS");</div><div><span class="" style="white-space:pre">                                             </span>append_branch("sip:$tU@$du");</div><div><span class="" style="white-space:pre">                                            </span>$var(i) = $var(i) + 1;</div><div><span class="" style="white-space:pre">                                     </span>}</div><div><span class="" style="white-space:pre">  </span></div><div><span class="" style="white-space:pre">                                   </span>else</div><div><span class="" style="white-space:pre">                                       </span>{<span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre">                                           </span>xlog("L_INFO", "This is a classic UDP call to endpoint");</div><div><span class="" style="white-space:pre">                                              </span></div><div><span class="" style="white-space:pre">                                           </span>$du="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@});</div><div><span class="" style="white-space:pre">                                             </span>xlog("L_INFO","Classic Destination URI is {$dbr(ra=>[$var(i),0])} for {$tU}\n");</div><div><span class="" style="white-space:pre">                                            </span>rtpproxy_manage("co");</div><div><span class="" style="white-space:pre">                                           </span>t_on_reply("MANAGE_CLASSIC_REPLY");</div><div><span class="" style="white-space:pre">                                              </span>append_branch("sip:$tU@$du");</div><div><span class="" style="white-space:pre">                                            </span>$var(i) = $var(i) + 1;</div><div><span class="" style="white-space:pre">                                     </span>}</div><div><span class="" style="white-space:pre">                                  </span>#append_branch("sip:$tU@$du");</div><div><span class="" style="white-space:pre">                                   </span></div><div><span class="" style="white-space:pre">                           </span>}<span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre">                   </span>}</div><div><span class="" style="white-space:pre">                  </span>return 1;</div></div><div><br></div><div><br></div><div>So it customised schema of standart example <br><br><br><div>  seturi("<a href="mailto:sip%3Aa@example.com">sip:a@example.com</a>");</div><div>  append_branch("<a href="mailto:sip%3Ab@example.com">sip:b@example.com</a>");</div><div>  append_branch("<a href="mailto:sip%3Ac@example.com">sip:c@example.com</a>");</div><div>  append_branch("<a href="mailto:sip%3Ad@example.com">sip:d@example.com</a>");</div><div><br></div><div>  t_relay();</div></div><div><br></div><div>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))<br><br>What I need to do for send parallel INVITES to multiple endpoints correctly? Thanks</div><div><br></div></div>