<HTML dir=ltr><HEAD><TITLE>Re: [OpenSIPS-Users] dynamic routing -prefixing on inbound</TITLE>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.6001.18148" name=GENERATOR></HEAD>
<BODY>
<DIV id=idOWAReplyText46400 dir=ltr>
<DIV dir=ltr><FONT face="Courier New" color=#000000 size=2>Thank you, this solution is conveniant to intergrate in a web interface</FONT></DIV>
<DIV dir=ltr><FONT face="Courier New" size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>
<H2><FONT face="Courier New">adding prefix dynamicaly with the dialplan module </FONT></H2><PRE><FONT size=3># 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 ;
</FONT></PRE><PRE><FONT size=3>+----+------+----+----------+------------+-----------+-----------+----------+-------+
| id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp | attrs |
+----+------+----+----------+------------+-----------+-----------+----------+-------+
| 1 | 0 | 0 | 1 | 10.0.8.11 | 0 | | 33 | |
+----+------+----+----------+------------+-----------+-----------+----------+-------+
</FONT></PRE><PRE><FONT size=3>dp_reload</FONT>
</PRE></FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Bogdan-Andrei Iancu [mailto:bogdan@voice-system.ro]<BR><B>Sent:</B> Wed 22/07/2009 9:58 AM<BR><B>To:</B> Julien Chavanton<BR><B>Cc:</B> Brett Nemeroff; users@lists.opensips.org<BR><B>Subject:</B> Re: [OpenSIPS-Users] dynamic routing -prefixing on inbound<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>Hi Julian,<BR><BR>What you need to do is to create some rules to detect some IPs and to<BR>return the prefix to add to RURI. So, see the 1.4.1.2. String<BR>translation (regexp detection, replacement) in<BR><A href="http://www.opensips.org/html/docs/modules/1.5.x/dialplan.html#id227206">http://www.opensips.org/html/docs/modules/1.5.x/dialplan.html#id227206</A>.<BR><BR>With the prefix returned in a variables (let;s say $var(prefix) ), do :<BR> $rU = $var(prefix) + $rU ;<BR><BR>Regards,<BR>Bogdan<BR><BR>Julien Chavanton wrote:<BR>> Do you have a suggestion on how to do this more dynamicaly ?<BR>> <BR>><BR>> ------------------------------------------------------------------------<BR>> *From:* Brett Nemeroff [<A href="mailto:brett@nemeroff.com">mailto:brett@nemeroff.com</A>]<BR>> *Sent:* Tue 21/07/2009 3:12 PM<BR>> *To:* Julien Chavanton<BR>> *Cc:* Bogdan-Andrei Iancu; users@lists.opensips.org<BR>> *Subject:* Re: [OpenSIPS-Users] dynamic routing -prefixing on inbound<BR>><BR>> Once again.. another good use for the dialplan module. :)<BR>><BR>> You really don't want to do this with a static subst I don't think..<BR>> -Brett<BR>><BR>><BR>> On Tue, Jul 21, 2009 at 8:30 AM, Julien Chavanton <jc@atlastelecom.com<BR>> <<A href="mailto:jc@atlastelecom.com">mailto:jc@atlastelecom.com</A>>> wrote:<BR>><BR>> Thank you, we will move to 1.6.0 later.<BR>> <BR>> We have partner not sending tech prefix, we need to add it<BR>> ourselves, I found this fix, but I wanted to be able to do<BR>> everything from OpenSip control panel to keep things manageable.<BR>> <BR>> do_routing("0");<BR>> # happend prefix to keep track of originating trunk/gateway<BR>> (1.1.1.1==1111#)<BR>> if ( search("From:.*<sip:.*@1.1.1.1 <<A href="http://1.1.1.1/">http://1.1.1.1/</A>>>") ) {<BR>> xlog("L_NOTICE", "*****************call<BR>> from[1.1.1.1]*****************\n");<BR>> subst_uri('/^sip:([0-9]+)@(.*)$/sip:1111#\1@\2;/i');<BR>> };<BR>><BR>> ------------------------------------------------------------------------<BR>> *From:* Bogdan-Andrei Iancu [<A href="mailto:bogdan@voice-system.ro">mailto:bogdan@voice-system.ro</A><BR>> <<A href="mailto:bogdan@voice-system.ro">mailto:bogdan@voice-system.ro</A>>]<BR>> *Sent:* Tue 21/07/2009 11:06 AM<BR>> *To:* Julien Chavanton<BR>> *Cc:* users@lists.opensips.org <<A href="mailto:users@lists.opensips.org">mailto:users@lists.opensips.org</A>><BR>> *Subject:* Re: [OpenSIPS-Users] dynamic routing -prefixing on inbound<BR>><BR>> Hi Julien,<BR>><BR>> Yes it is, but only in 1.6.0 (current devel version) . See the<BR>> is_from_gw() function:<BR>> <BR>> <A href="http://www.opensips.org/html/docs/modules/1.6.x/drouting.html#id272676">http://www.opensips.org/html/docs/modules/1.6.x/drouting.html#id272676</A><BR>><BR>> The 1.5 version has no support for prefixing, but only for stripping:<BR>> <BR>> <A href="http://www.opensips.org/html/docs/modules/1.5.x/drouting.html#id272676">http://www.opensips.org/html/docs/modules/1.5.x/drouting.html#id272676</A><BR>><BR>> Regards,<BR>> Bogdan<BR>><BR>> Julien Chavanton wrote:<BR>> ><BR>> > I found this in the README of the source code :<BR>> ><BR>> > * bidirectional behavior - inbound and outbound processing<BR>> > (strip and prefixing when sending and receiving from a<BR>> > destination/GW)<BR>> ><BR>> > I would like to happend a prefix when a call comes in from a certain<BR>> > gateway, I found that "PRI PREFIX" is currently applied on when call<BR>> > it outbound to the gateway but not when a call comes from a gateway.<BR>> ><BR>> > Is it already doable ?<BR>> ><BR>> ><BR>> ------------------------------------------------------------------------<BR>> ><BR>> > _______________________________________________<BR>> > Users mailing list<BR>> > Users@lists.opensips.org <<A href="mailto:Users@lists.opensips.org">mailto:Users@lists.opensips.org</A>><BR>> > <A href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</A><BR>> > <BR>><BR>><BR>> _______________________________________________<BR>> Users mailing list<BR>> Users@lists.opensips.org <<A href="mailto:Users@lists.opensips.org">mailto:Users@lists.opensips.org</A>><BR>> <A href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</A><BR>><BR>><BR><BR></FONT></P></DIV></BODY></HTML>