<div dir="ltr"><div><span class="" style="white-space:pre">
Hello Antony. This my customised cfg sample. After this you should call t_relay() func:

One thing - you should handle ACK messages for WS at loose_route. thomething like this:

if (is_request()) {
                if (!has_totag()) {
                        if(t_is_branch_route()) {
                                add_rr_param(";nat=yes");
                        }
                xlog("L_INFO","first {$rm}");
                }
                xlog("L_INFO","It Is request {$rm}");
        
                if ($ru =~ "transport=ws"){
                        $var(received)=0;
                        #$var(to_uri)=$(ru{s.select,0,@});
                        sql_pvquery("ca","select received from location where contact like '$(ru{s.select,0,@})%'","$var(received)");
                        xlog("L_INFO","RECIEVED for {$rm} = {$var(received)}");
                        $du=$var(received);
                }
                
        }</span></div><div><span class="" style="white-space:pre"><br></span></div><div><span class="" style="white-space:pre"><br></span></div><div><span class="" style="white-space:pre">It is very important because ACK message sends to UDP endpoint by default, so you should change $du for this packet, or your call will bend after few seconds  (if WS socket picked up) with message "transaction does not exists". Because ACK messages will be send to UDP endpoint or nowere because contact field at location for WS endpoint have thomething like "dsfs353fwrf@ivalid.sddfsdg:transport=ws". Offcourse this will not be resolve. You need data from received field with right destination address.


there is main cfg
 
                        </span>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>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></div><div><span class="" style="white-space:pre">                                           </span>$du=$var(recieved);</div><div><span class="" style="white-space:pre">                                                </span>xlog("L_INFO","SQL query return recieved {$var(recieved)} for {$tU}. Destination is {$du}\n");</div><div><span class="" style="white-space:pre">                                         </span>append_branch("sip:$tU@$(du{s.select,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></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>$du="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@});</div><div><span class="" style="white-space:pre">                                             </span>$var(UDP_contact)="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@});<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>append_branch("sip:$tU@$(du{s.select,1,:})");</div><div><span class="" style="white-space:pre">                                            </span></div><div><span class="" style="white-space:pre">                                           </span>xlog("L_INFO","Classic Destination URI is {$dbr(ra=>[$var(i),0])} for {$tU}}. Destination is {$du}\n");</div><div><span class="" style="white-space:pre">                                     </span>}</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>}<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>t_on_branch("1");</div><div><span class="" style="white-space:pre">                        </span>return;</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>}</div><div> </div><div>}</div><div><br></div><div><br></div><div>branch_route[1]{</div><div><br></div><div><span class="" style="white-space:pre">       </span>if($du=~"transport=ws"){</div><div><span class="" style="white-space:pre">                 </span>xlog("L_INFO","Websocket Branch is {$du} 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></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>xlog("L_INFO","UDP Branch is {$du)} for {$tU}\n");</div><div><span class="" style="white-space:pre">                     </span>rtpproxy_manage("co-sp");</div><div><span class="" style="white-space:pre">                        </span>t_on_reply("MANAGE_CLASSIC_REPLY");</div><div><span class="" style="white-space:pre">      </span>}</div><div>}</div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-10-27 2:34 GMT+04:00 Anthony Messina <span dir="ltr"><<a href="mailto:amessina@messinet.com" target="_blank">amessina@messinet.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Monday, October 27, 2014 02:20:52 AM Yuriy Gorlichenko wrote:<br>
> I fixed this. rtpengine must handle each of branches at branch_route(). Not<br>
> that is fine. Thanks for link. It was not my issue but with it i find right<br>
> way.<br>
<br>
</span>Yuriy, I'm fairly new to Kamailio and have been following your issue as I may<br>
be seeing something similar when I try to parallel fork a call which issues<br>
RTP/AVP to one branch and RTP/SAVP to another (group call with various<br>
endpoints).<br>
<br>
It may be related to <a href="https://github.com/sipwise/rtpengine/issues/39" target="_blank">https://github.com/sipwise/rtpengine/issues/39</a> but to be<br>
honest, I'm not certain I've got Kamilio set up properly.<br>
<br>
Would you mind sharing your kamilio.cfg routes related to rtpengine and<br>
branch_route?<br>
<br>
Thanks.  -A<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Anthony - <a href="https://messinet.com/" target="_blank">https://messinet.com/</a> - <a href="https://messinet.com/~amessina/gallery
8F89" target="_blank">https://messinet.com/~amessina/gallery<br>
8F89</a> 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E<br>
</font></span><br>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>