[Spce-user] Rewirite dynamic using header fields

Andreas Granig agranig at sipwise.com
Thu Sep 13 07:12:31 EDT 2012


Hi John,

On 09/13/2012 01:45 AM, John Murray wrote:
> Hello,
> 
>  
> 
> Is it possible to rewrite dynamically using headers in the INVITE itself?
> 
> I have a MVNO scenario where a call to the mobile number is sent to a
> gateway where I can divert the call to the SPCE by giving a geo number
> that is routed to the SPCE via SIP.
> 
>  
> 
> I divert the call to one number but get the original dialled number in a
> Diversion: header.
> 
> If I could re-write the Divert into the RURI: or To: I could route as
> normal.
> 
>  
> 
> Is this possible?

You need to do it in your own proxy.cfg.customtt.tt2. Check
http://www.kamailio.org/wiki/cookbooks/3.3.x/pseudovariables and
http://www.kamailio.org/wiki/cookbooks/3.3.x/transformations, which are
the tools needed for this job.

It works like this (completely untested):

if($di != $null && /* from your specific gw doing this */) {
  $rU = $(di{uri.user});
  remove_hf("Diversion");
}

You need to perform the proper check in the if() to only do it where
necessary. If you need the domain part as well, assign uri.domain to $rd
also. I guess you get the idea.

Andreas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 897 bytes
Desc: OpenPGP digital signature
URL: <http://lists.sipwise.com/pipermail/spce-user_lists.sipwise.com/attachments/20120913/294a39b9/attachment-0001.asc>


More information about the Spce-user mailing list