[OpenSIPS-Users] Dispatcher module with multiple groups

Jamuel Starkey jamuel at hcvoip.com
Thu May 31 21:16:59 CEST 2012


Have you tried the dialplan module?  We route TN's to various backend media servers based on a regexp match and then use the avp that you get upon a match from dp_translate to identify the media server to route to.

Then we can update the dialplan rules and use dp_reload without penalty to "activate" any changes.

modparam("dialplan", "attrs_pvar", "$avp(dest)")
#Initial value for dialplan group
$avp(dpid)=0;

dp_translate("$avp(dpid)","$ruri.user/$ruri.user");
if ($avp(dest)==NULL) {
        xlog("L_INFO", "$ruri.user not found.");
        sl_send_reply("404", "Not Found");
        exit;
}

Then do_something based on  $avp(dest) being set based on the match from dp_translate maybe even call your ds_select_dst based on $avp(dest) being one value or another (assuming you set the $avp(dest) to "MATCH" in your dialplan rules table:

if ($avp(dest)=="MATCH") {
    ds_select_dst("2", "4");
}
else
{
     ds_select_dst("1", "4");
}

Hope that helps . . .

Cheers,

JPS
On May 31, 2012, at 11:59 AM, Diego Barberio wrote:

Hi All,

I’m using dispatcher module to forward incoming INVITEs to two destination groups.
I have a set of 8 telephone numbers, if the call goes or comes from any of that numbers I have to send the call to a group otherwise to the other. Right now I’m doing this to select the group:

if($rU=~ '^*40109615*' || $rU=~ '^*40109541*' || $rU=~ '^*40285849*' || $rU=~ '^*40284592*' || $rU=~ '^*40117817*' || $rU=~ '^*40117830*' || $rU=~ '^*40489340*' || $rU=~ '^*40489455*' || $fU= ~ '^*40109615*' || $fU=~ '^*40109541*' || $fU=~ '^*40285849*' || $fU=~ '^*40284592*' || $fU=~ '^*40117817*' || $fU=~ '^*40117830*' || $fU=~ '^*40489340*' || $fU=~ '^*40489455*' ){
ds_select_dst("2", "4");
}else{
               ds_select_dst("1", "4");
}

Is there any better way to do this, I mean something like:
if(is_in_file($fU, ‘numbers.txt’) || is_in_file($rU, ‘numbers.txt’))

Of course any option will be welcome, however it would be very nice if there’s an option which allows me to modify the numbers list without restarting opensips.

Thanks a lot
Diego
<ATT00001.c>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20120531/a33e752f/attachment-0001.htm>


More information about the Users mailing list