Re: [OpenSIPS-Users] Dispatcher module with multiple groups

2012-06-01 Thread Diego Barberio
Hi JPS,

 

I'm kind of newbie to opensips, so I don't know all the modules I will
investigate dialplan module.

 

Thanks for your suggestion

Diego

 

 

From: users-boun...@lists.opensips.org
[mailto:users-boun...@lists.opensips.org] On Behalf Of Jamuel Starkey
Sent: jueves, 31 de mayo de 2012 04:17 p.m.
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Dispatcher module with multiple groups

 

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

ATT1.c

 

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] Dispatcher module with multiple groups

2012-05-31 Thread Diego Barberio
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

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Dispatcher module with multiple groups

2012-05-31 Thread Jamuel Starkey
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
ATT1.c

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users