<div>Well there are a lot of ways to do this. First you'll need to do *something* to convert the IP to an "id" of sorts. I convert IP to a trunk ID using the memcache module + avpops. Then you can pass that ID into do_routing to get a specific route/gateway with the right pri prefix.</div>
<div><br></div><div>The other way to do it is the dialplan module. You'll also need to pass it some sort of ID to filter out which rule to use. Check it out:</div><div><a href="http://www.opensips.org/html/docs/modules/1.5.x/dialplan.html#id271074">http://www.opensips.org/html/docs/modules/1.5.x/dialplan.html#id271074</a></div>
<div><br></div><div>Of course, you can do this literally dozens of other ways too. memcache, static routes, I think even dispatcher has some methods you can use.. <br><div>-Brett<br></div><div><br></div><div><br><br><div class="gmail_quote">
On Mon, Jul 13, 2009 at 10:47 AM, Lasse Johnsen <span dir="ltr"><<a href="mailto:lasse@freebsdcluster.org">lasse@freebsdcluster.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Brett,<br>
<br>
Thank you for taking the time to respond.<br>
<br>
The do_routing function adds the prefix of the pri_prefix function for the gateway the call is destined "to".<br>
<br>
I would like to add the prefix based on the gateway the call is "from".<br>
<br>
The function is_from_gw is able to strip based on the originating gateway. I would instead like to prepend / add a prefix - my question pertained to adding a prefix based on the "from" gateway.<br>
<br>
So suppose I have:<br>
<br>
gwid type address strip pri_prefix attrs description<br>
1 10 X.X.X.X 0 NULL Internal gateway<br>
2 20 1.2.3.4 0 101 NULL External gateway 1<br>
3 20 5.6.7.8 0 102 NULL External gateway 2<br>
<br>
If a call comes from 1.2.3.4 I would like to prepend "101" before sending the call to the "Internal gateway".<br>
If on the other hand the call comes from 5.6.7.8 I would like to prepend "102" before sending the call to the "Internal gateway".<br>
<br>
I hope that makes sense.<br>
<br>
<br>
/Lasse<div><div></div><div class="h5"><br>
<br>
<br>
<br>
<br>
On 13 Jul 2009, at 16:25, Brett Nemeroff wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That should be done automatically by the do_routing function, unless of course you are writing the output of that function to an AVP instead of a RURI. Where it'll end up in the AVP.<br>
<br>
-Brett<br>
<br>
<br>
On Sun, Jul 12, 2009 at 7:40 PM, Lasse Johnsen <<a href="mailto:lasse@freebsdcluster.org" target="_blank">lasse@freebsdcluster.org</a>> wrote:<br>
Hi,<br>
<br>
I use the is_from_gw function in drouting to authenticate what<br>
gateways are allowed to talk to my OpenSIPS server.<br>
<br>
I understand that I can strip something from the R-URI using this<br>
function. Is there anyway I can add the gateway db entry's pri_prefix<br>
in the same fashion.<br>
<br>
I essentially want to prepend the r-uri based on the originating<br>
gateway. What is the best way of doing this.<br>
<br>
<br>
/Lasse<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
</blockquote>
<br>
<br></div></div>
-- <br>
Best regards,<br>
<br>
Lasse L. Johnsen<br>
CEO, VoIP-X Communications Limited<br>
<br>
E <a href="mailto:lasse.johnsen@voip-x.net" target="_blank">lasse.johnsen@voip-x.net</a><br>
M +44 7832 335 392<br>
F +44 2075 262 178<br>
<br>
<br>
<br>
<br>
</blockquote></div><br></div></div>