<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.16.3">
</HEAD>
<BODY>
Deon,<BR>
<BR>
It's kind of sloppy as was thrown together for testing, but it works.<BR>
<BR>
The IAD we were sending calls to sends a 486 if the line is in use, we then route advance on the 486 until all destinations have been tried.<BR>
<BR>
We made the hunt_list static for testing, but avp_db_load or memcached it was will be used in production.<BR>
<BR>
<BR>
route[hunt] {<BR>
<BR>
&nbsp; $avp(s:hunt_timeout) = 20;<BR>
 #hunt list is number_to_hunt,dest1,dest2,dest3<BR>
<BR>
&nbsp; $avp(s:hunt_list) = &quot;3,5000,5001,5002&quot;;<BR>
&nbsp; $avp(s:total_hunts) = $(avp(s:hunt_list){s.select,0,,});<BR>
#Are we starting the hunt or picking up?<BR>
&nbsp; if(!is_avp_set(&quot;$avp(s:hunt_pos)&quot;)){<BR>
&nbsp;&nbsp;&nbsp; #Set to 1 as its first try<BR>
&nbsp;&nbsp;&nbsp; $avp(s:hunt_pos) = 1;<BR>
&nbsp;&nbsp;&nbsp; $avp(s:hunt_num) = $(avp(s:hunt_list){s.select,$avp(s:hunt_pos),,});<BR>
&nbsp;&nbsp;&nbsp; xlog(&quot;L_NOTICE&quot;,&quot;***Initial hunting***: Starting to hunt for Call ID: $ci with Source ANI of: $fU&quot;);<BR>
&nbsp;&nbsp;&nbsp; xlog(&quot;L_NOTICE&quot;,&quot;***Initial hunting***: Number to hunt to: $avp(s:hunt_num) with hunt pos: $avp(s:hunt_pos) with timeout of $avp(s:hunt_timeout) seconds and hunt list: $avp(s:hunt_list)&quot;);<BR>
<BR>
&nbsp; } else {<BR>
&nbsp;&nbsp;&nbsp; #Not the 1st time, let's pull the next in order<BR>
&nbsp;&nbsp;&nbsp; $avp(s:hunt_num) = $(avp(s:hunt_list){s.select,$avp(s:hunt_pos),,});<BR>
&nbsp;&nbsp;&nbsp; xlog(&quot;L_NOTICE&quot;,&quot;***Trying #$avp(s:hunt_pos) of $avp(s:total_hunts) in seq*** Number to hunt to: $avp(s:hunt_num) Call ID: $ci with Source ANI of: $fU&quot;);<BR>
&nbsp;&nbsp;&nbsp; #pull the next number to call from the set <BR>
&nbsp;&nbsp;&nbsp; $avp(s:hunt_num) = $(avp(s:hunt_list){s.select,$avp(s:hunt_pos),,});<BR>
&nbsp; }<BR>
&nbsp; #send the call<BR>
&nbsp; $rU = $avp(s:hunt_num);<BR>
&nbsp; <BR>
&nbsp; $rd = '1.1.1.1;<BR>
<BR>
&nbsp; t_on_branch(&quot;hunt&quot;);<BR>
&nbsp; t_on_reply(&quot;hunt&quot;);<BR>
&nbsp; t_on_failure(&quot;hunt&quot;);<BR>
<BR>
&nbsp; if (!t_relay()) {<BR>
&nbsp;&nbsp;&nbsp; sl_reply_error();<BR>
&nbsp; };<BR>
&nbsp; exit();<BR>
<BR>
}<BR>
<BR>
failure_route[hunt] {<BR>
&nbsp; xlog(&quot;L_NOTICE&quot;,&quot;hit failure&quot;);<BR>
&nbsp; if (t_was_cancelled()) {<BR>
&nbsp;&nbsp;&nbsp; xlog(&quot;L_NOTICE&quot;,&quot;Call 487'ed&quot;);<BR>
&nbsp;&nbsp;&nbsp; exit();<BR>
&nbsp; }<BR>
<BR>
&nbsp; xlog(&quot;L_NOTICE&quot;,&quot;Hit failure route, num of hunts: $avp(s:total_hunts) hunt pos: $avp(s:hunt_pos)&quot;);<BR>
&nbsp; #route advance on certain codes<BR>
&nbsp; if($avp(s:total_hunts) == $avp(s:hunt_pos)){<BR>
&nbsp;&nbsp;&nbsp; xlog(&quot;L_NOTICE&quot;,&quot;All hunting members tried, forwarding to final destination&quot;);<BR>
&nbsp;&nbsp;&nbsp; seturi(&quot;sip:$<A HREF="mailto:rU@69.71.55.2">rU@2.2.2.2</A>&quot;);<BR>
&nbsp;&nbsp;&nbsp; t_relay();<BR>
&nbsp;&nbsp;&nbsp; exit();<BR>
&nbsp; }<BR>
&nbsp; if(t_check_status(&quot;480&quot;)){<BR>
&nbsp;&nbsp;&nbsp; t_reply(&quot;480&quot;,&quot;Request timeout&quot;);<BR>
&nbsp;&nbsp;&nbsp; exit();<BR>
&nbsp; }<BR>
&nbsp; if(t_check_status(&quot;404&quot;)) {<BR>
&nbsp;&nbsp;&nbsp; t_reply(&quot;404&quot;,&quot;Not found&quot;);<BR>
&nbsp;&nbsp;&nbsp; exit();<BR>
&nbsp; }<BR>
<BR>
&nbsp; if(t_check_status(&quot;400|408|483|486|503|500|603|403&quot;)) {<BR>
&nbsp;&nbsp;&nbsp; #Adtran will either send a 480 or 408 or 486 depending on the status of extension being called<BR>
&nbsp;&nbsp;&nbsp; $avp(s:hunt_pos) = $(avp(s:hunt_pos){s.int}) + 1;<BR>
&nbsp;&nbsp;&nbsp; xlog(&quot;L_NOTICE&quot;,&quot;hunt pos in failure route after add: $avp(s:hunt_pos)&quot;);&nbsp;&nbsp;&nbsp; <BR>
&nbsp; route(hunt);<BR>
&nbsp;&nbsp;&nbsp; exit();<BR>
&nbsp; }<BR>
<BR>
}<BR>
<BR>
<BR>
On Wed, 2010-08-25 at 07:54 +0200, Deon Vermeulen wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
    <FONT COLOR="#000000">Brad</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <FONT COLOR="#000000">would you be so kind and show a sample config for how you setup the serial fork?</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <FONT COLOR="#000000">I have to set this up but have no idea where to start.</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <FONT COLOR="#000000">Some sort of template would be great just to give an idea of how this is done.</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <FONT COLOR="#000000">I should be able to figure out the rest as I go along.</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <FONT COLOR="#000000">Thanks</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <B><FONT COLOR="#000000">Kind Regards</FONT></B><BR>
    <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <FONT COLOR="#000000">On Aug 25, 2010, at 5:20 AM, Brad Bendy wrote:</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BLOCKQUOTE TYPE=CITE>
        <FONT COLOR="#000000">I just setup serial hunting and it was pretty easy.</FONT><BR>
        <BR>
        <FONT COLOR="#000000">We stored the list of users to be called in memcached, counted how many total users need to be called and advanced to the next one in failure_route as needed, set a ring timeout and then have it go to a voicemail server or wherever it needed to go.</FONT><BR>
        <BR>
        <FONT COLOR="#000000">I think you could do the same thing by just tracking the last user rang and use that as your starting point for the next call to take place, then after that is called update memcached or your avp and start all over again on the next call.</FONT><BR>
        <BR>
        <FONT COLOR="#000000">I saw a post that said there was a module to do hunting, but ive yet to find it, as I don't think it does exist.</FONT><BR>
        <BR>
        <FONT COLOR="#000000">On Tue, 2010-08-24 at 20:13 -0700, osiris123d wrote: </FONT>
        <BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">I saw a post saying it was possible to do hunt groups with col, but i wasn't</FONT>
<FONT COLOR="#000000">sure how one would keep up with calls to each group user so that one could</FONT>
<FONT COLOR="#000000">do &quot;least called user&quot; or even the user that was next in line to be called. </FONT>
<FONT COLOR="#000000">I am guessing avps and contact array could help, but i was just wondering</FONT>
<FONT COLOR="#000000">what solutions some people might have used.  I was even thinking that i</FONT>
<FONT COLOR="#000000">might be able to relay the calls to a hunt group number to asterisk and let</FONT>
<FONT COLOR="#000000">asterisk handle the hunt group logic, but i am not sure if that would work.</FONT>
</PRE>
        </BLOCKQUOTE>
        <TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<BR>
<BR>
</TD>
</TR>
</TABLE>
    </BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BLOCKQUOTE TYPE=CITE>
        <FONT COLOR="#000000">_______________________________________________</FONT><BR>
        <FONT COLOR="#000000">Users mailing list</FONT><BR>
        <FONT COLOR="#000000"><A HREF="mailto:Users@lists.opensips.org">Users@lists.opensips.org</A></FONT><BR>
        <FONT COLOR="#000000">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</FONT>
    </BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">_______________________________________________</FONT>
<FONT COLOR="#000000">Users mailing list</FONT>
<FONT COLOR="#000000"><A HREF="mailto:Users@lists.opensips.org">Users@lists.opensips.org</A></FONT>
<FONT COLOR="#000000"><A HREF="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</A></FONT>
</PRE>
</BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
-- <BR>
Brad Bendy<BR>
Chief Technical Officer<BR>
<A HREF="mailto:brad.bendy@benganetworks.com">brad.bendy@benganetworks.com</A><BR>
<BR>
Benga Networks, LLC.<BR>
10115 E. Bell Rd, Ste. 107-451<BR>
Scottsdale, AZ 85260-2189<BR>
<BR>
Toll Free: &nbsp;&nbsp; 877-44-BENGA<BR>
Local:&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 480-970-5200<BR>
Cell:&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 602-550-4004<BR>
Fax:&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 866-852-4468
</TD>
</TR>
</TABLE>
</BODY>
</HTML>