There are somewhat ugly ways to do this. I did it in SER v0.9.x but admit my
approach was not very elegant. SER v2 has a module to do sequential hunting in
a more elegant fashion.
In my approach I check if the extension has permission to use call hunting and
if hunting is enabled at this time. I use two avp flags for this as follows. I
also use a new table call "sam" which can store multiple entries for the same
extension where the extension is a primary key and duplicate keys are
permitted. Huntlist is the attribute name which contains the extension to which
the call should hunt.
# hunting (serial forking)
if (avp_db_load("$ruri/username", "s:allow_hunt")) {
if (avp_check("s:allow_hunt", "eq/y/i")) {
if (avp_db_load("$ruri/username", "s:use_hunt")) {
if (avp_check("s:use_hunt", "eq/y/i")) {
avp_write("$ruri/username", "$ocn");
avp_delete("s:allow_hunt");
xlog("L_INFO", "\n[SER]: [%Tf] [%ci] Call Hunting Enabled
for <%ru>\n");
avp_db_load("$ruri/username", "s:huntlist/sam");
xlog("L_INFO", "\n[SER]: [%Tf] [%ci] Call Hunting Started
to <%ru>\n");
t_on_failure("6");
t_relay();
break;
};
} else {
xlog("L_INFO", "\n[SER]: [%Tf] [%ci] Call Hunting allowed but
use_hunt is undefined <%ru>\n");
avp_delete("s:allow_hunt");
avp_delete("s:use_hunt");
break;
}; # end load use_hunt
};
};
Then in failure_route[6] iterate through each huntlist entry. "ocn" is the
original called number and is saved so we can redirect an unanswered call to
that extension's voicemail mailbox
# Iterate through extension list for subscribers with call hunting enabled
failure_route[6] {
xlog("L_INFO", "\n[SER]: [%Tf] [%ci] Failure Block #6: CALL HUNTING for <%ru>
from <%fu> at <%is>\n");
# use the first element of the list (if any) and delete it from list
if (avp_pushto("$ruri/username", "s:huntlist"))
{
xlog("L_INFO", "\n[SER]: [%Tf] [%ci] FB#6: Substitute huntlist member for
R-URI. Change R-URI to <%ru> for <%tu>\n");
route(10);
xlog("L_INFO", "\n[SER]: [%Tf] [%ci] FB#6: Checking if huntlist member
should be skipped. <%ru>,<%tu>\n");
if (avp_check("$huntskip","eq/y/i")) {
xlog("L_INFO", "\n[SER]: [%Tf] [%ci] FB#6: Skipping huntlist member.
<%ru>,<%tu>\n");
avp_delete("s:huntlist");
rewriteuser("010101");
avp_write("1", "inv_timeout"); # new
} else {
xlog("L_INFO", "\n[SER]: [%Tf] [%ci] FB#6: Do NOT skip huntlist member.
Trying <%ru> for <%tu>\n");
avp_delete("s:huntlist");
avp_delete("$afn");
avp_write("$ruri/username", "$afn");
};
xlog("L_INFO", "\n[SER]: [%Tf] [%ci] FB#6: Check complete. Looking up
location for <%ru> to <%tu>\n");
lookup("location");
append_branch();
t_on_failure("6");
xlog("L_INFO", "\n[SER]: [%Tf] [%ci] RB#6: Preparing to relay call to next
huntlist member To <%tu> R-uri: <%ru>: \n");
t_relay();
} else {
xlog("L_INFO", "\n[SER]: [%Tf] [%ci] FB#6: No more huntlist members for
<%ru>. Going to voicemail\n");
avp_pushto("$ruri/username", "$ocn");
route(9);
break;
};
xlog("L_INFO", "\n[SER]: [%Tf] [%ci] FB#6: END CALL HUNTING for <%ru> from
<%fu> at <%is>\n");
break;
}
-Steve
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Bogdan-Andrei Iancu
Sent: Tuesday, April 21, 2009 6:54 AM
To: Mauro Davi'
Cc: [email protected]
Subject: Re: [OpenSIPS-Users] R: R: Ring Group - Memory Hunt - with serial
forking?
Hi Mauro,
yes, you can can obtain a sequential forking, but what Chris is a
parallel forking but with delayed branches.
Regards,
Bogdan
Mauro Davi' wrote:
> Sorry,
>
> and if I can change the qvalue with the lookup function (how with the path
> proposed) I cannot obtain a working sequential forking (i.e. the first call
> is sent to the first contact after the ring timeout the call (with the
> next_branch function) is forwarded to the second contact and so on...)?
>
> Regards,
> MD
>
> -----Messaggio originale-----
> Da: Bogdan-Andrei Iancu [mailto:[email protected]]
> Inviato: martedì 21 aprile 2009 11:11
> A: Mauro Davi'
> Cc: Chris Maciejewski; [email protected]
> Oggetto: Re: R: [OpenSIPS-Users] Ring Group - Memory Hunt - with serial
> forking?
>
> Hi Mauro,
>
> not really (as I understand it). What Chris wants to do is not to start
> all branches (for parallel forking) in the same time (as you do), but to
> start them one by one (ad different time intervals).
>
> Regards,
> bogdan
>
> Mauro Davi' wrote:
>
>> Sorry Bogdan,
>>
>> If I understand, this is the scenarious that I implemented.
>>
>> With the lookup function patch (that add the q value to the input parameter,
>> the same assigned to you) Chris can invoke the lookup function three time
>> with the three subscriber and obviously three different qvalue. After he can
>> invoke the serialize_branches(1) function.
>> Finally he can use the next_branch route in the failure route block to fork
>> sequentially the INVITE on the next subscriber...
>> And when the next_branch function return "no other branches" he can forward
>> the call to the voicemail...
>>
>> I don't know if the patch is applied but in this way, I think, that Chris
>> can solve his problem...
>>
>> Regards,
>> MD
>>
>>
>> -----Messaggio originale-----
>> Da: [email protected]
>> [mailto:[email protected]] Per conto di Bogdan-Andrei Iancu
>> Inviato: martedì 21 aprile 2009 10:39
>> A: Chris Maciejewski
>> Cc: [email protected]
>> Oggetto: Re: [OpenSIPS-Users] Ring Group - Memory Hunt - with serial forking?
>>
>> Hi Chris,
>>
>> Chris Maciejewski wrote:
>>
>>
>>> Hi,
>>>
>>> I am trying to implement a Ring Group with
>>> a Memory Hunt ring strategy.
>>>
>>> The scenario looks as follows:
>>>
>>> There is a subscriber A, B and C. All of them are members of the same
>>> Ring Group.
>>>
>>> When there is a INVITE to a "Ring Group" Opensips should send an
>>> INVITE to subscriber A, after 10 seconds it should send an INVITE to
>>> subscriber B and after another 10 seconds one more INVITE
>>> to subscriber C. If there is no 200 OK from A,B or C in 40 seconds,
>>> call should be forwarded to Voicemail server.
>>>
>>>
>>>
>> This is something you cannot do right now - to wait N seconds and create
>> another branch of an existing call (without cancelling the previous
>> branches).
>>
>> What you want to do is a kind of "asynchronous" parallel forking.
>>
>> Regards,
>> Bogdan
>>
>>
>> _______________________________________________
>> Users mailing list
>> [email protected]
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>
>
>
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users