[OpenSIPS-Users] drouting is_from_gw prepending with pri_prefix
Brett Nemeroff
brett at nemeroff.com
Mon Jul 13 17:56:07 CEST 2009
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.
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:
http://www.opensips.org/html/docs/modules/1.5.x/dialplan.html#id271074
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..
-Brett
On Mon, Jul 13, 2009 at 10:47 AM, Lasse Johnsen <lasse at freebsdcluster.org>wrote:
> Hi Brett,
>
> Thank you for taking the time to respond.
>
> The do_routing function adds the prefix of the pri_prefix function for the
> gateway the call is destined "to".
>
> I would like to add the prefix based on the gateway the call is "from".
>
> 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.
>
> So suppose I have:
>
> gwid type address strip pri_prefix attrs description
> 1 10 X.X.X.X 0 NULL Internal gateway
> 2 20 1.2.3.4 0 101 NULL External gateway 1
> 3 20 5.6.7.8 0 102 NULL External gateway 2
>
> If a call comes from 1.2.3.4 I would like to prepend "101" before sending
> the call to the "Internal gateway".
> 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".
>
> I hope that makes sense.
>
>
> /Lasse
>
>
>
>
>
> On 13 Jul 2009, at 16:25, Brett Nemeroff wrote:
>
> 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.
>>
>> -Brett
>>
>>
>> On Sun, Jul 12, 2009 at 7:40 PM, Lasse Johnsen <lasse at freebsdcluster.org>
>> wrote:
>> Hi,
>>
>> I use the is_from_gw function in drouting to authenticate what
>> gateways are allowed to talk to my OpenSIPS server.
>>
>> I understand that I can strip something from the R-URI using this
>> function. Is there anyway I can add the gateway db entry's pri_prefix
>> in the same fashion.
>>
>> I essentially want to prepend the r-uri based on the originating
>> gateway. What is the best way of doing this.
>>
>>
>> /Lasse
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>
> --
> Best regards,
>
> Lasse L. Johnsen
> CEO, VoIP-X Communications Limited
>
> E lasse.johnsen at voip-x.net
> M +44 7832 335 392
> F +44 2075 262 178
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20090713/2cb71c67/attachment.htm
More information about the Users
mailing list