<div>Thanks for your quick replys.</div>
<div> </div>
<div>Here is the syntax that is working for me:</div>
<div> </div>
<div>route{</div>
<div> # initial sanity checks -- messages with<br> # max_forwards==0, or excessively long requests<br> if (!mf_process_maxfwd_header("10")) {<br> sl_send_reply("483","Too Many Hops");<br>
exit;<br> };</div>
<div> if (msg:len >= 2048 ) {<br> sl_send_reply("513", "Message too big");<br> exit;<br> };</div>
<div><br> if(alias_db_lookup("dbaliases")) {<br> t_relay();</div>
<div> </div>
<div> }else{</div>
<div> </div>
<div> ds_select_dst("1", "4");<br> t_on_failure("1");<br> t_relay();<br> }<br>}</div>
<div><br>failure_route[1] {<br> ds_next_dst();<br> forward();<br> }<br><br></div>
<div class="gmail_quote">On Wed, Nov 18, 2009 at 3:45 PM, Alex Balashov <span dir="ltr"><<a href="mailto:abalashov@evaristesys.com">abalashov@evaristesys.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">JR,<br><br>Like many lookup functions, the alias_db_lookup() function has a return value. You should check it for a negative result before proceeding further in the script:<br>
<br>Example:<br><br> if(!alias_db_lookup("dbaliases")) {<br> sl_send_reply("404", "Not Found");<br> exit;<br> }<br><br>Error handling in general is a must.<br><br>-- Alex<br>
<br>JR Richardson wrote:<br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div></div>
<div class="h5">Hi All,<br> I have a real simple load balancer proxy setup using the dispatcher module, works great. I want to do an alias lookup before I send the calls through to the dispatcher, but I can't seem to find a good example of how that should be setup in the config script. I've tried different things, the aliase_db_lookup is working but if a user is not in the database, the call loops and does not continue on to the dispatcher. Here is my current route script (this does not work):<br>
route{<br> # initial sanity checks -- messages with<br> # max_forwards==0, or excessively long requests if (!mf_process_maxfwd_header("10")) {<br> sl_send_reply("483","Too Many Hops");<br>
exit;<br> };<br> if (msg:len >= 2048 ) {<br> sl_send_reply("513", "Message too big");<br> exit;<br> };<br><br> alias_db_lookup("dbaliases");<br>
t_on_failure("1");<br> t_relay();<br> ds_select_dst("1", "4");<br> t_on_failure("1");<br> t_relay();<br>}<br><br>failure_route[1] {<br> ds_next_dst();<br>
forward();<br> }<br>I think there should be an 'if' 'then' or 'if' 'else' separating the alias_db_lookup and the ds_select functions, but I'm not sure of the syntax and where the curly brackets need to be.<br>
Thanks.<br> JR<br>-- <br>JR Richardson<br>Engineering for the Masses<br><br><br></div></div>------------------------------------------------------------------------<br><br>_______________________________________________<br>
Kamailio (OpenSER) - Users mailing list<br><a href="mailto:Users@lists.kamailio.org" target="_blank">Users@lists.kamailio.org</a><br><a href="http://lists.kamailio.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.kamailio.org/cgi-bin/mailman/listinfo/users</a><br>
<a href="http://lists.openser-project.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.openser-project.org/cgi-bin/mailman/listinfo/users</a><br></blockquote><br><br>-- <br>Alex Balashov - Principal<br>Evariste Systems<br>
Web : <a href="http://www.evaristesys.com/" target="_blank">http://www.evaristesys.com/</a><br>Tel : (+1) (678) 954-0670<br>Direct : (+1) (678) 954-0671<br></blockquote></div><br>-- <br>JR Richardson<br>Engineering for the Masses