[OpenSIPS-Users] Hunt Group with Opensips

Deon Vermeulen vermeulen.deon at gmail.com
Wed Aug 25 09:27:17 CEST 2010


Thanks Brad.
Really Appreciated.

This helps a lot.

Kind Regards


On Aug 25, 2010, at 9:11 AM, Brad Bendy wrote:

> Deon,
> 
> It's kind of sloppy as was thrown together for testing, but it works.
> 
> 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.
> 
> We made the hunt_list static for testing, but avp_db_load or memcached it was will be used in production.
> 
> 
> route[hunt] {
> 
>   $avp(s:hunt_timeout) = 20;
> #hunt list is number_to_hunt,dest1,dest2,dest3
> 
>   $avp(s:hunt_list) = "3,5000,5001,5002";
>   $avp(s:total_hunts) = $(avp(s:hunt_list){s.select,0,,});
> #Are we starting the hunt or picking up?
>   if(!is_avp_set("$avp(s:hunt_pos)")){
>     #Set to 1 as its first try
>     $avp(s:hunt_pos) = 1;
>     $avp(s:hunt_num) = $(avp(s:hunt_list){s.select,$avp(s:hunt_pos),,});
>     xlog("L_NOTICE","***Initial hunting***: Starting to hunt for Call ID: $ci with Source ANI of: $fU");
>     xlog("L_NOTICE","***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)");
> 
>   } else {
>     #Not the 1st time, let's pull the next in order
>     $avp(s:hunt_num) = $(avp(s:hunt_list){s.select,$avp(s:hunt_pos),,});
>     xlog("L_NOTICE","***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");
>     #pull the next number to call from the set 
>     $avp(s:hunt_num) = $(avp(s:hunt_list){s.select,$avp(s:hunt_pos),,});
>   }
>   #send the call
>   $rU = $avp(s:hunt_num);
>   
>   $rd = '1.1.1.1;
> 
>   t_on_branch("hunt");
>   t_on_reply("hunt");
>   t_on_failure("hunt");
> 
>   if (!t_relay()) {
>     sl_reply_error();
>   };
>   exit();
> 
> }
> 
> failure_route[hunt] {
>   xlog("L_NOTICE","hit failure");
>   if (t_was_cancelled()) {
>     xlog("L_NOTICE","Call 487'ed");
>     exit();
>   }
> 
>   xlog("L_NOTICE","Hit failure route, num of hunts: $avp(s:total_hunts) hunt pos: $avp(s:hunt_pos)");
>   #route advance on certain codes
>   if($avp(s:total_hunts) == $avp(s:hunt_pos)){
>     xlog("L_NOTICE","All hunting members tried, forwarding to final destination");
>     seturi("sip:$rU at 2.2.2.2");
>     t_relay();
>     exit();
>   }
>   if(t_check_status("480")){
>     t_reply("480","Request timeout");
>     exit();
>   }
>   if(t_check_status("404")) {
>     t_reply("404","Not found");
>     exit();
>   }
> 
>   if(t_check_status("400|408|483|486|503|500|603|403")) {
>     #Adtran will either send a 480 or 408 or 486 depending on the status of extension being called
>     $avp(s:hunt_pos) = $(avp(s:hunt_pos){s.int}) + 1;
>     xlog("L_NOTICE","hunt pos in failure route after add: $avp(s:hunt_pos)");    
>   route(hunt);
>     exit();
>   }
> 
> }
> 
> 
> On Wed, 2010-08-25 at 07:54 +0200, Deon Vermeulen wrote:
>> Brad
>> 
>> 
>> would you be so kind and show a sample config for how you setup the serial fork?
>> 
>> 
>> I have to set this up but have no idea where to start.
>> 
>> 
>> Some sort of template would be great just to give an idea of how this is done.
>> 
>> 
>> I should be able to figure out the rest as I go along.
>> 
>> 
>> Thanks
>> 
>> Kind Regards
>> 
>> 
>> 
>> On Aug 25, 2010, at 5:20 AM, Brad Bendy wrote:
>> 
>>> I just setup serial hunting and it was pretty easy.
>>> 
>>> 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.
>>> 
>>> 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.
>>> 
>>> 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.
>>> 
>>> On Tue, 2010-08-24 at 20:13 -0700, osiris123d wrote:
>>>> 
>>>> I saw a post saying it was possible to do hunt groups with col, but i wasn't
>>>> sure how one would keep up with calls to each group user so that one could
>>>> do "least called user" or even the user that was next in line to be called. 
>>>> I am guessing avps and contact array could help, but i was just wondering
>>>> what solutions some people might have used.  I was even thinking that i
>>>> might be able to relay the calls to a hunt group number to asterisk and let
>>>> asterisk handle the hunt group logic, but i am not sure if that would work.
>>> 
>>> 
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>> 
>> 
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> -- 
> Brad Bendy
> Chief Technical Officer
> brad.bendy at benganetworks.com
> 
> Benga Networks, LLC.
> 10115 E. Bell Rd, Ste. 107-451
> Scottsdale, AZ 85260-2189
> 
> Toll Free:    877-44-BENGA
> Local:          480-970-5200
> Cell:             602-550-4004
> Fax:             866-852-4468
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20100825/6d590a99/attachment-0001.htm 


More information about the Users mailing list