[OpenSIPS-Users] dynamic routing -prefixing on inbound

Julien Chavanton jc at atlastelecom.com
Thu Jul 23 22:03:14 CEST 2009


Thank you, this solution is conveniant to intergrate in a web interface
 

adding prefix dynamicaly with the dialplan module 

# find if there is a prefix for traffic from the IP address
dp_translate("0", "$src_ip/$avp(s:prefix)");
xlog("prefix for IP[$src_ip]=[$avp(s:prefix)]\n");
$rU  =  $avp(s:prefix) + $rU ;

+----+------+----+----------+------------+-----------+-----------+----------+-------+
| id | dpid | pr | match_op | match_exp  | match_len | subst_exp | repl_exp | attrs |
+----+------+----+----------+------------+-----------+-----------+----------+-------+
|  1 |    0 |  0 |        1 | 10.0.8.11  |         0 |           | 33       |       | 
+----+------+----+----------+------------+-----------+-----------+----------+-------+

dp_reload

 

________________________________

From: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro]
Sent: Wed 22/07/2009 9:58 AM
To: Julien Chavanton
Cc: Brett Nemeroff; users at lists.opensips.org
Subject: Re: [OpenSIPS-Users] dynamic routing -prefixing on inbound



Hi Julian,

What you need to do is to create some rules to detect some IPs and to
return the prefix to add to RURI. So, see the 1.4.1.2. String
translation (regexp detection, replacement) in
http://www.opensips.org/html/docs/modules/1.5.x/dialplan.html#id227206.

With the prefix returned in a variables (let;s say $var(prefix) ), do :
       $rU  =  $var(prefix) + $rU ;

Regards,
Bogdan

Julien Chavanton wrote:
> Do you have a suggestion on how to do this more dynamicaly ?
> 
>
> ------------------------------------------------------------------------
> *From:* Brett Nemeroff [mailto:brett at nemeroff.com]
> *Sent:* Tue 21/07/2009 3:12 PM
> *To:* Julien Chavanton
> *Cc:* Bogdan-Andrei Iancu; users at lists.opensips.org
> *Subject:* Re: [OpenSIPS-Users] dynamic routing -prefixing on inbound
>
> Once again.. another good use for the dialplan module. :)
>
> You really don't want to do this with a static subst I don't think..
> -Brett
>
>
> On Tue, Jul 21, 2009 at 8:30 AM, Julien Chavanton <jc at atlastelecom.com
> <mailto:jc at atlastelecom.com>> wrote:
>
>     Thank you, we will move to 1.6.0 later.
>     
>     We have partner not sending tech prefix, we need to add it
>     ourselves, I found this fix, but I wanted to be able to do
>     everything from OpenSip control panel to keep things manageable.
>     
>      do_routing("0");
>      # happend prefix to keep track of originating trunk/gateway
>     (1.1.1.1==1111#)
>      if ( search("From:.*<sip:.*@1.1.1.1 <http://1.1.1.1/>>") ) {
>        xlog("L_NOTICE", "*****************call
>     from[1.1.1.1]*****************\n");
>        subst_uri('/^sip:([0-9]+)@(.*)$/sip:1111#\1@\2;/i');
>      };
>
>     ------------------------------------------------------------------------
>     *From:* Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro
>     <mailto:bogdan at voice-system.ro>]
>     *Sent:* Tue 21/07/2009 11:06 AM
>     *To:* Julien Chavanton
>     *Cc:* users at lists.opensips.org <mailto:users at lists.opensips.org>
>     *Subject:* Re: [OpenSIPS-Users] dynamic routing -prefixing on inbound
>
>     Hi Julien,
>
>     Yes it is, but only in 1.6.0 (current devel version) . See the
>     is_from_gw() function:
>       
>     http://www.opensips.org/html/docs/modules/1.6.x/drouting.html#id272676
>
>     The 1.5 version has no support for prefixing, but only for stripping:
>        
>     http://www.opensips.org/html/docs/modules/1.5.x/drouting.html#id272676
>
>     Regards,
>     Bogdan
>
>     Julien Chavanton wrote:
>     >
>     > I found this in the README of the source code :
>     >
>     >  * bidirectional behavior - inbound and outbound processing
>     >        (strip and prefixing when sending and receiving from a
>     >        destination/GW)
>     >
>     > I would like to happend a prefix when a call comes in from a certain
>     > gateway, I found that "PRI PREFIX" is currently applied on when call
>     > it outbound to the gateway but not when a call comes from a gateway.
>     >
>     > Is it already doable ?
>     >
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > Users mailing list
>     > Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>     > 
>
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.opensips.org <mailto: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/20090723/201c6b22/attachment-0001.htm 


More information about the Users mailing list