[OpenSIPS-Users] Change Contact info in REGISTER messages
Răzvan Crainea
razvan at opensips.org
Thu Jun 19 09:04:29 CEST 2014
Hi, Miguel!
The save() function[1] only accepts a pseudovariable, not a format as
parameter. And the way you build the $avp(aor) is not a valid syntax.
You should have something like:
$avp(aor) = "sip:" + $tU + "@" + $si + ":5092";
[1] http://www.opensips.org/html/docs/modules/1.11.x/registrar#id294034
Best regards,
Razvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com
On 06/19/2014 10:00 AM, Miguel Oyarzo wrote:
>
> Hi Razvan,
>
> Thanks for your reply.
> That was a good question. I want to change the contact in database.
>
> Would like to get something like
> balancer=# SELECT username,contact from location;
> username | contact
> -------------+-----------------------------------------------------------------------
> 61370000000 | sips:61370000000 at 10.10.1.120
> <mailto:sips%3A61370000000 at 10.10.1.120>
>
> I was thinking in something like ' $avp(aor)="sip:$tU@$si:5092" '
> but the variables $tU@$si doesn't like to be expanded in save().
>
> I must be dynamic (not hard-code)
>
> Any idea how to do it?
>
>
>
> On Thu, Jun 19, 2014 at 4:39 PM, Răzvan Crainea <razvan at opensips.org
> <mailto:razvan at opensips.org>> wrote:
>
> Hi, Miguel!
>
> Do you only want to change the Contact info that is stored in
> OpenSIPS database or change the Contact header in the REGISTER message?
> The code you pasted changes only the info in the location table. If
> you want to change the header, you can remove it and add a new one.
> Something like:
>
> remove_hf("Contact");
> append_hf("Contact: <sip:$tU@$si:5092>\r\n");
>
> See [1] for more details.
>
> [1]
> http://www.opensips.org/html/__docs/modules/devel/sipmsgops#__id249696
> <http://www.opensips.org/html/docs/modules/devel/sipmsgops#id249696>
>
> Best regards,
>
> Razvan Crainea
> OpenSIPS Core Developer
> http://www.opensips-solutions.__com <http://www.opensips-solutions.com>
>
>
> On 06/19/2014 09:10 AM, Miguel Oyarzo wrote:
>
>
> Hi,
>
> How can I change the Contact info in REGISTER messages?
>
> I have tried
> if (is_method("REGISTER"))
> {
>
> if (!save("location","","sip:__61370000000 at 10.10.1.120:5090
> <http://sip:61370000000@10.10.1.120:5090>
> <http://sip:61370000000@10.10.__1.120:5090
> <http://sip:61370000000@10.10.1.120:5090>>")) { .... }
>
> - and -
> $avp(aor)="sip:$tU@$si:5092";
> if (!save("location","f","$avp(__aor))") { ... }
>
> }
>
> But doesn't work.
>
> Any suggestion?
>
>
>
> --
> "Efficiency is doing things right; effectiveness is doing the right
> things(Peter Drucker)"
>
>
> Miguel Oyarzo
> DevOps & VoIP Engineer
> Linux User: # 483188 - counter.li.org <http://counter.li.org>
> <http://counter.li.org>
> http://au.linkedin.com/in/__mikeaustralia
> <http://au.linkedin.com/in/mikeaustralia>
> Melbourne, Australia
>
>
> _________________________________________________
> Users mailing list
> Users at lists.opensips.org <mailto:Users at lists.opensips.org>
> http://lists.opensips.org/cgi-__bin/mailman/listinfo/users
> <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
>
>
> _________________________________________________
> Users mailing list
> Users at lists.opensips.org <mailto:Users at lists.opensips.org>
> http://lists.opensips.org/cgi-__bin/mailman/listinfo/users
> <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
>
>
>
>
> --
> "Efficiency is doing things right; effectiveness is doing the right
> things(Peter Drucker)"
>
> Miguel Oyarzo
> DevOps & VoIP Engineer
> Linux User: # 483188 - counter.li.org <http://counter.li.org>
> http://au.linkedin.com/in/mikeaustralia
> Melbourne, Australia
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
More information about the Users
mailing list