[Kamailio-Users] Registrar: Save modified contact / set the qvalue
Daniel-Constantin Mierla
miconda at gmail.com
Tue Mar 30 19:15:28 CEST 2010
Hello,
for <= 1.5 is not easy to get to it, unless you use db mode only and
play directly to database.
In 3.0+ you can change the contact header and then use msg_apply_changes():
http://kamailio.org/docs/modules/stable/modules_k/textops.html#id2749047
then do save to location.
Cheers,
Daniel
On 3/30/10 7:03 PM, NeoTel Lists wrote:
> Again sorry, too much trial&error makes a lot of noise ...
>
> if (avp_subst("$(avp(contact))", "/;phone-context=q([01]\.[0-9]+)(.*>)?([^>]*)/\2\3;q=\1/i")) {
> # just to have it handy int that var(Q)
> $var(Q) = $(avp(contact){s.select,1,>}{param.value,q});
> remove_hf("Contact");
> append_hf("Contact: $(avp(contact))\r\n"); # must not add q= twice
> }
>
> -> Same result: q=-1 in Database.
>
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at lists.kamailio.org [mailto:users-bounces at lists.kamailio.org] Im Auftrag von NeoTel Lists
> Gesendet: Dienstag, 30. März 2010 18:56
> An: Alex Balashov; users at lists.kamailio.org
> Betreff: Re: [Kamailio-Users] Registrar: Save modified contact / set the qvalue
>
> Sorry for being unclear: I meant: Modify the contact in the script, then do save().
>
> E.g.
> $(avp(contact)) = $ct;
> # Those Patton can't send the q value ... Misuse their ;phone-context param
> if (avp_subst("$(avp(contact))", "/;phone-context=q([01]\.[0-9])(.*>)?([^>]*)/\2\3;q=\1/i")) {
> # just to have it handy int that var(Q)
> $var(Q) = $(avp(contact){s.select,1,>}{param.value,q});
> remove_hf("Contact");
> append_hf("Contact: $(avp(contact));q=$var(Q)r\n");
> # subst() does the same, also not save()ed
> }
> ...
> setbflag(1);
> fix_nated_register();
> save("contactimpl_nat", "0x02");
>
> Br
> Walter
>
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at lists.kamailio.org [mailto:users-bounces at lists.kamailio.org] Im Auftrag von Alex Balashov
> Gesendet: Dienstag, 30. März 2010 17:58
> An: users at lists.kamailio.org
> Betreff: Re: [Kamailio-Users] Registrar: Save modified contact / set the q value
>
> On 03/30/2010 11:36 AM, NeoTel Lists wrote:
>
>
>> Hello Everybody!
>> Is there any way to save(domain, 0x02) the contact after it has been
>> changed somehow in Kamailio<= 1.5?
>>
> If it were not possible, how would nathelper:fix_nated_contact() work?
>
>
>
--
Daniel-Constantin Mierla * http://www.asipto.com/ *
http://twitter.com/miconda *
http://www.linkedin.com/in/danielconstantinmierla
More information about the Users
mailing list