[SR-Users] subst + insert_hf issue

Daniel-Constantin Mierla miconda at gmail.com
Fri Jul 3 23:57:37 CEST 2015


Hello,

On 03/07/15 14:24, Igor Potjevlesch wrote:
>
> Hello Daniel,
>
>  
>
> Thanks for your reply.
>
>  
>
> The doc of msg_apply_changes is scary.
>
it is not that bad to use it, just don't abuse it. Sometime is the only
option, with current cpu power, the performances are not really affected.
>
>  
>
> The use of $fn instead of subst would be something to try to solve
> this issue? For some cases, I must also change the username part. $fU
> = anonymous at anonymous.invalid <mailto:anonymous at anonymous.invalid>"
> would be more safety?
>

$fU is username part of From URI, but then you set username at domain in
your example. For domain part use $fd, or use $fu for full uri.

Cheers,
Daniel

>  
>
> Regards,
>
>  
>
> Igor.
>
>  
>
> *De :*sr-users [mailto:sr-users-bounces at lists.sip-router.org] *De la
> part de* Daniel-Constantin Mierla
> *Envoyé :* jeudi 2 juillet 2015 08:39
> *À :* Kamailio (SER) - Users Mailing List
> *Objet :* Re: [SR-Users] subst + insert_hf issue
>
>  
>
> Hello,
>
> if you just want to update the dispay name in From header, you can use:
>
> $fn = "Anonymous";
>
> To avoid conflicts in replacements, use mag_apply_changes() after
> first changes -- in your case, after subst(...) -- read carefully the
> docs for msg_apply_changes() to understand its impact and limitations.
>
> Cheers,
> Daniel
>
> On 01/07/15 17:34, Igor Potjevlesch wrote:
>
>     Hello,
>
>      
>
>     I'm doing a subst on the From header for some particular cases,
>     like this one: subst('/^(From|f):(.*)<sip:(.*)@/\1
>     <sip:%28.*%29@/%5C1>: "Anonymous" <sip:\3@/g <sip:%5C3@/g>');
>
>      
>
>     In the same route (REQUEST_ROUTE called "INVITE"), I do the
>     following: insert_hf("X-CarrierName: $avp(s:carrier_id)\r\n");
>
>      
>
>     For many User-Agent, the X-CarrierName header is inserted after
>     the @ into the user part of the From. So the From: looks like this:
>
>      
>
>     From:"Anonymous" <sip:0123456789 at X-CarrierName: ABCDE\r\n
>
>      
>
>     The domain name part of the From is on the next line:
>
>      
>
>     <domain>:5060>;tag=3fdce0-a658bfa-13c4-50029-55941ccd-5eab9369-55941ccd\r\n
>
>      
>
>     I can't reproduce.
>
>      
>
>     The only potential explanation is that this impact the User-Agent
>     that have the From at the top of the headers.
>
>      
>
>     If someone know what could going wrong here.
>
>      
>
>     Regards,
>
>      
>
>     Igor
>
>
>
>
>     _______________________________________________
>
>     SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>
>     sr-users at lists.sip-router.org <mailto:sr-users at lists.sip-router.org>
>
>     http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
>
> -- 
> Daniel-Constantin Mierla
> http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> - http://www.linkedin.com/in/miconda
> Book: SIP Routing With Kamailio - http://www.asipto.com

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150703/03b064ea/attachment.html>


More information about the sr-users mailing list