[Kamailio-Users] Rewrite $tU

David kamailio.org at spam.lublink.net
Thu Dec 10 17:06:34 CET 2009


Hey,

I won't pretend to be an expert in Kamailio, someone will probably 
suggest a better way. But here is how I rewrote my SIP packet's TO 
header before relaying it to the next hop :

# Rewrite RURI
avp_printf("$rU", "prefix_$rU");

# Remove existing header
remove_hf("To") ;

# Add new header which is copied from RURI
insert_hf("To: $ru\r\n", "From");


DISCLAIMER : Several threads have said that changing the TO header is a 
bad idea, so I only recommend using this as a last resort.

David





David a écrit :
> Hey,
>
> I do understand that normally the TO header should not be written, my
> problem is that I am using the presence_dialoginfo module which uses the
> TO header and not the RURI, which means that in order to tell the
> difference between customer A's extension 101 and Customer B's extension
> 101, I rewrite the TO header to add context.
>
> This is actually the ame problem that I started discussing here :
> http://lists.kamailio.org/pipermail/users/2009-August/024316.html
>
> Trouble is I have not had time to work on this since then.
>
> Thanks,
>
> David
>
> Olle E. Johansson a écrit :
>> 10 dec 2009 kl. 15.04 skrev Iñaki Baz Castillo:
>>
>>  
>>> El Jueves, 10 de Diciembre de 2009, David escribió:
>>>    
>>>> Hey,
>>>>
>>>> I need to rewrite the $tU variable on a packet before it is 
>>>> relayed. It
>>>> is ok if the change is only on the relayed packet and the $tU variable
>>>> change. The important thing is that I modify the To header, it seems
>>>> that rewritting $tU would be the easiest.
>>>>       
>>> $tU is not writable, but just readable.
>>> If you want to change the "To" header you should do some "dirty" 
>>> replacing operation (see textops module).
>>>     
>>
>> This is propably something we need to change and make the To and From 
>> headers writable.
>> It's not dirty to change them any more.
>>
>> David: In the original SIP 1.0 protocol the To/From headers was part 
>> of the dialog identification, thus you where not allowed to change 
>> them in a proxy. THis was kept in RFC3261 - sip v2 - but has been 
>> removed in an additional RFC a short while ago (seen from SIP history).
>>
>> Regards,
>> /O
>> _______________________________________________
>> Kamailio (OpenSER) - Users mailing list
>> Users at lists.kamailio.org
>> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
>> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
>>   
>
>
>
> _______________________________________________
> Kamailio (OpenSER) - Users mailing list
> Users at lists.kamailio.org
> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users





More information about the sr-users mailing list