<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Aug 10, 2017 at 9:05 AM, Daniel Tryba <span dir="ltr"><<a href="mailto:d.tryba@pocos.nl" target="_blank">d.tryba@pocos.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On Thu, Aug 10, 2017 at 08:51:24AM -0400, Ryan Wagoner wrote:<br>
> Thanks for the explanation! I finally got the dispatcher working in an<br>
> active / passive Kamailio cluster in front of three FreePBX servers. I was<br>
> using the Asipto Kamailio and Asterisk real time guide as a starting point<br>
> so it had the WITHINDLG route. I ended up modifying the TOASTERISK route to<br>
> call ds_select_dst and the FROMASTERSK route uses an htable for matching<br>
> IPs off a mySQL view of the Kamailio dispatcher table.<br>
<br>
</span>Am I interpreting this as: you wanto check if a message is coming from a<br>
dispatcher?<br>
If yes, take a look at ds_is_from_list:<br>
<a href="https://kamailio.org/docs/modules/stable/modules/dispatcher.html#dispatcher.f.ds_is_from_list" rel="noreferrer" target="_blank">https://kamailio.org/docs/<wbr>modules/stable/modules/<wbr>dispatcher.html#dispatcher.f.<wbr>ds_is_from_list</a><br>
<span class="gmail-"><br></span><div class="gmail-HOEnZb"><div class="gmail-h5"><br></div></div></blockquote><div><br></div><div>Exactly so the traffic from asterisk is trusted and isn't modified. I just swapped my while loop for that function and it's good to go. I can't believe I didn't see that earlier.</div><div><br></div><div>In my REGFWD route I have this chunk of code to lookup the dispatcher IP/port from the same hash table before calling uac_req_send(). The regserver column contains the dispatcher set id. Is there a way I can call ds_select and then access the IP / port variables directly?</div><div><br></div><div><div>#!if WITH_DISPATCHER</div><div>        sql_query("castdb", "select regserver from sipusers where name = '$au'","ra");</div><div><br></div><div>        if($dbr(ra=>rows)>0)</div><div>        {</div><div>                $var(rip) = $sht(dispatcherHosts=>set::$dbr(ra=>[0,0])[0]);</div><div>                $var(rport) = $sht(dispatcherHosts=>port::$var(rip));</div><div>        }</div><div>        else</div><div>        {</div><div>                return;</div><div>        }</div><div><br></div><div>        sql_result_free("ra");</div><div>#!else</div><div>        $var(rip) = $sel(cfg_get.asterisk.bindip);</div><div>        $var(rport) = $sel(cfg_get.asterisk.bindport);</div><div>#!endif</div><div><br></div><div>        $uac_req(method)="REGISTER";</div><div>        $uac_req(ruri)="sip:" + $var(rip) + ":" + $var(rport);</div><div>        $uac_req(furi)="sip:" + $au + "@" + $var(rip);</div><div>        $uac_req(turi)="sip:" + $au + "@" + $var(rip);</div><div>        $uac_req(hdrs)="Contact: <sip:" + $au + "@"</div><div>                                + $sel(cfg_get.kamailio.bindip)</div><div>                                + ":" + $sel(cfg_get.kamailio.bindport) + ">\r\n";</div><div>        if($sel(contact.expires) != $null)</div><div>                $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n";</div><div>        else</div><div>                $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n";</div><div>        uac_req_send();</div></div><div><br></div><div>Thanks,</div><div>Ryan</div></div><br></div></div>