<div dir="ltr">Hello. I need parallel forking calls with the  same username. (Call to all contacts with name for example User123), my endpoints may be  WebSocket based and standart UDP endpoints. And I use rtpengine_manage for nmanaging calls wor webphones and standart softh/hard phones.<br><br>I get all contacts manually and than at the branch route set rtpengine_manage settings for every call.<br><br>It works fine but it works for one kamailio server. <br><br>When I use 2 kamailio servers as load balansers Server that handle call get all endpoints from location but call to only one, that registred only at ths server<br><br>for example I call user123<br>I have 3 contacts<br><a href="mailto:user123@1.2.3.4" target="_blank">user123@1.2.3.4</a> - was registered at kamailio 1<br><a href="mailto:user123@3.2.1.4" target="_blank">user123@3.2.1.4</a> - was registered at kamailio 2<br><a href="mailto:user123@4.3.2.1" target="_blank">user123@4.3.2.1</a> - was registered at kamailio 1<br><br>So if call goes through kamailio 1 it call only to <a href="mailto:user123@1.2.3.4" target="_blank">user123@1.2.3.4</a> and <a href="mailto:user123@4.3.2.1" target="_blank">user123@4.3.2.1</a><br><br>I use this settings for usrloc  at 2 kamailios to share all table between 2 servers<br><br><div>modparam("usrloc", "db_url", DBURL)</div><div>modparam("usrloc", "db_mode", 3)</div><div>modparam("usrloc", "user_column", "username")</div><div>modparam("usrloc", "contact_column", "contact")</div><div>modparam("usrloc", "expires_column", "expires")</div><div>modparam("usrloc", "q_column", "q")</div><div>modparam("usrloc", "callid_column", "callid")</div><div>modparam("usrloc", "cseq_column", "cseq")</div><div>modparam("usrloc", "methods_column", "methods")</div><div>modparam("usrloc", "cflags_column", "cflags")</div><div>modparam("usrloc", "user_agent_column", "user_agent")</div><div>modparam("usrloc", "received_column", "received")</div><div>modparam("usrloc", "socket_column", "socket")</div><div>modparam("usrloc", "path_column", "path")</div><div>modparam("usrloc", "ruid_column", "ruid")</div><div>modparam("usrloc", "instance_column", "instance")</div><div>modparam("usrloc", "use_domain", 1)</div><br>and this code for calling them<br><br>[GET_CONTACTS]<br>{<br><div><div><span style="white-space:pre-wrap">                      </span>sql_query("ca", "select contact from location where username='$tU'", "ra");</div><div><span style="white-space:pre-wrap">                        </span>xlog("rows: $dbr(ra=>rows) cols: $dbr(ra=>cols)\n");</div><div><span style="white-space:pre-wrap">                     </span>if($dbr(ra=>rows)>0){</div><div><span style="white-space:pre-wrap">                      </span><span style="white-space:pre-wrap">        </span>$var(i)=0;</div><div><span style="white-space:pre-wrap">                       </span><span style="white-space:pre-wrap">        </span> while($var(i)<$dbr(ra=>rows)){</div><div><span style="white-space:pre-wrap">                   </span></div><div><span style="white-space:pre-wrap">                 </span><span style="white-space:pre-wrap">                </span>xlog("L_INFO","SQL query return contact {$dbr(ra=>[$var(i),0])} for {$tU} at step {$var(i)}\n");</div><div><span style="white-space:pre-wrap">                  </span><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                 </span><span style="white-space:pre-wrap">                </span>if ($dbr(ra=>[$var(i),0])=~"transport=ws"){<span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">                 </span><span style="white-space:pre-wrap">                        </span>xlog("L_INFO", "This is a Websocket call to endpoint");</div><div><span style="white-space:pre-wrap">                      </span><span style="white-space:pre-wrap">                        </span>sql_pvquery("ca", "select received from location where contact='$dbr(ra=>[$var(i),0])'","$var(recieved)");</div><div><span style="white-space:pre-wrap">                      </span><span style="white-space:pre-wrap">                        </span></div><div><span style="white-space:pre-wrap">                 </span><span style="white-space:pre-wrap">                        </span>$du=$var(recieved);</div><div><span style="white-space:pre-wrap">                      </span><span style="white-space:pre-wrap">                        </span>xlog("L_INFO","SQL query return recieved {$var(recieved)} for {$tU}. Destination is {$du}\n");</div><div><span style="white-space:pre-wrap">                       </span><span style="white-space:pre-wrap">                        </span>append_branch("sip:$tU@$(du{s.select,1,:})");</div><div><span style="white-space:pre-wrap">                  </span><span style="white-space:pre-wrap">                        </span></div><div><span style="white-space:pre-wrap">                 </span><span style="white-space:pre-wrap">                        </span></div><div><span style="white-space:pre-wrap">                 </span><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">                        </span></div><div><span style="white-space:pre-wrap">                 </span><span style="white-space:pre-wrap">                </span>else</div><div><span style="white-space:pre-wrap">                     </span><span style="white-space:pre-wrap">                </span>{<span style="white-space:pre-wrap">       </span></div><div><span style="white-space:pre-wrap">                 </span><span style="white-space:pre-wrap">                        </span>xlog("L_INFO", "This is a classic UDP call to endpoint");</div><div><span style="white-space:pre-wrap">                    </span><span style="white-space:pre-wrap">                        </span>$var(recieved)='';</div><div><span style="white-space:pre-wrap">                       </span><span style="white-space:pre-wrap">                        </span>sql_pvquery("ca", "select received from location where contact='$dbr(ra=>[$var(i),0])'","$var(recieved)");</div><div><span style="white-space:pre-wrap">                      </span><span style="white-space:pre-wrap">                        </span>xlog("L_INFO", "SQL query return RECIEVED {$var(recieved)}");</div><div><span style="white-space:pre-wrap">                        </span><span style="white-space:pre-wrap">                        </span>if ($var(recieved)==0){</div><div><span style="white-space:pre-wrap">                  </span><span style="white-space:pre-wrap">                                </span>xlog("L_INFO", "Recieved string is EMPTY");</div><div><span style="white-space:pre-wrap">                  </span><span style="white-space:pre-wrap">                                </span>$du="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@});</div><div><span style="white-space:pre-wrap">                   </span><span style="white-space:pre-wrap">                        </span>}</div><div><span style="white-space:pre-wrap">                        </span><span style="white-space:pre-wrap">                        </span>else {</div><div><span style="white-space:pre-wrap">                   </span><span style="white-space:pre-wrap">                                </span>xlog("L_INFO", "Recieved string is {$var(recieved)}");</div><div><span style="white-space:pre-wrap">                       </span><span style="white-space:pre-wrap">                                </span>$du=$var(recieved);</div><div><span style="white-space:pre-wrap">                      </span><span style="white-space:pre-wrap">                        </span>}</div><div><span style="white-space:pre-wrap">                        </span><span style="white-space:pre-wrap">                        </span>$var(UDP_contact)="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@});<span style="white-space:pre-wrap">                                            </span></div><div><span style="white-space:pre-wrap">                 </span></div><div><span style="white-space:pre-wrap">                 </span><span style="white-space:pre-wrap">                        </span>append_branch("sip:$tU@$(du{s.select,1,:})");</div><div><span style="white-space:pre-wrap">                  </span><span style="white-space:pre-wrap">                        </span></div><div><span style="white-space:pre-wrap">                 </span><span style="white-space:pre-wrap">                        </span>xlog("L_INFO","Classic Destination URI is {$dbr(ra=>[$var(i),0])} for {$tU}}. Destination is {$du}\n");</div><div><span style="white-space:pre-wrap">                   </span><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">                        </span><span style="white-space:pre-wrap">                </span>$var(i) = $var(i) + 1;</div><div><span style="white-space:pre-wrap">                   </span><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                 </span><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">                        </span><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">                 }</span></div><div><span style="white-space:pre-wrap">                        </span>t_on_branch("1");</div><div><span style="white-space:pre-wrap">                      </span>return;</div><div><span style="white-space:pre-wrap">                  </span></div><div><span style="white-space:pre-wrap">         </span>}</div><div><span style="white-space:pre-wrap">        </span>}</div><div> </div><div>}</div><div><br></div><div><br>branch_route[1]{<br></div><div><br></div><div><span style="white-space:pre-wrap">  </span>if($du=~"transport=ws"){</div><div><span style="white-space:pre-wrap">                       </span>xlog("L_INFO","Websocket Branch is {$du} for {$tU}\n");</div><div><span style="white-space:pre-wrap">                      </span>rtpengine_manage("internal extenal force trust-address replace-origin replace-session-connection ICE=force RTP/SAVPF");</div><div><span style="white-space:pre-wrap">                        </span>t_on_reply("REPLY_FROM_WS");</div><div><span style="white-space:pre-wrap">                   </span></div><div><span style="white-space:pre-wrap">                 </span>}</div><div><span style="white-space:pre-wrap">        </span>else{</div><div><span style="white-space:pre-wrap">                    </span>xlog("L_INFO","UDP Branch is {$du)} for {$tU}\n");</div><div><span style="white-space:pre-wrap">                   </span>rtpengine_manage("replace-origin replace-session-connection ICE=remove RTP/AVP");</div><div><span style="white-space:pre-wrap">                      </span>t_on_reply("MANAGE_CLASSIC_REPLY");</div><div><span style="white-space:pre-wrap">    </span>}</div><div><span style="font-size:13.3333339691162px">}</span><br style="font-size:13.3333339691162px"><br style="font-size:13.3333339691162px"><br style="font-size:13.3333339691162px"><span style="font-size:13.3333339691162px">When it try to branch endpoint without registration at server that handle call I get errors that tm module can not build Via header </span><br style="font-size:13.3333339691162px"><br style="font-size:13.3333339691162px"><pre style="white-space:pre-wrap"><font color="#000000"><i>*via_builder(): TCP/TLS connection (id: 0) for WebSocket could not be
 found*
 *ERROR: <core> [msg_translator.c:1725]: build_req_buf_from_sip_req():
 could not create Via header*
 *ERROR: <core> [forward.c:607]: forward_request(): ERROR:
 forward_request: building failed*
</i><i><br></i></font></pre><pre style="white-space:pre-wrap"><font color="#000000"><font face="arial, helvetica, sans-serif">UDP calls get errors something like above (sorry than can not share error code, This situation not often).</font>
<i>
</i></font></pre><pre style="white-space:pre-wrap"><font color="#000000" face="arial, helvetica, sans-serif">So I think I have this trouble because I use manually handling call and tried to substitute to lookup_branches function. but I have no Idea how to set rtpengine_manage paraments for each endpoint depending this is websocket or standart call.

IF there is write problem for callings thhrough 2 kamailios as loadbalansers pleas let me know about how to set rtpengine_manage parametrs wor endpoints for every fork.  If not- can you tell me how I can call to all endpoints endepending of registration server (kamailio 1 or 2).

Thanks.</font></pre></div></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div></div>