[Kamailio-Users] Use Carrierroute to rewrite from_uri based on prefix table

Henning Westerholt henning.westerholt at 1und1.de
Tue Dec 16 15:11:34 CET 2008


On Tuesday 16 December 2008, rod wrote:
> I've been able to rewrite R_URI based on prefix matching in the
> carrierroute module, using:
> cr_route("default", "0", "$rU", "$rU", "call_id")

Hello Rod,

> [..]
> What I'd like to do is to use the carrierroute module to do the same but
> for from uri:
>     ex: I receive a call on my phone with a caller using e164 (from_uri:
> 331 20 20 20 20) and I'd like to present this number as 01 20 20 20 20
> to the callee.
> I added a prefix 331 in the carrierroute tables.
>
> I tried this:
>     - cr_route("default", "0", "$fU", "$fU", "call_id")

This rewrites the uri in the default tree, domain 0, uses the from user for 
prefix matching and as rewrite source, hashes over callid.

>     - cr_route("default", "0", "$fU", "$fU", "from_uri")

Same as above, hashes over from_uri.

>     - cr_route("default", "0", "$fU", "$rU", "call_id")

Uses the request URI user as rewrite source.

>     - cr_route("default", "0", "$fU", "$rU", "from_uri")

hash over from_uri instead of callid as above.

> but I've been unsuccessful with this.
>
> Is there a way to achieve from_uri translation using the carrierroute
> module.

Carrierroute rewrites the R-URI because you normally want to route your 
message according them. So this is hardcoded in the logic of the module. The 
from uri user (like you've tried above) can be only used as the user part for 
the R-URI. Mangling your from uri is normally not related to routing 
decisions. But you can use the uac module functions to change this, for 
example.

Cheers,

Henning




More information about the sr-users mailing list