[OpenSIPS-Users] Change Contact info in REGISTER messages

Miguel Oyarzo miguelaustro at gmail.com
Thu Jun 19 09:51:07 CEST 2014


Hi Razvan,

I need to register some clients in Opensips. Those clients will come from
different IP addresses.

Then, allow Opensips to redirect INVITES to those registered clients to
B2BUA gateway. In that B2BUA  server there is an identical location entry
as per Opensips received.

Scenario is:

WebCliente--------- REGISTER ---------------------Opensips------SipEndpoint
                        \------- REGISTER---B2BUA

- WebClient is sending now two REGISTER messages to both B2BUA and
SipEndpoint
- Opensips must save() and replace Contact IP:Port  to point to B2BUA
(that's the Contact change I would like to do)
- Then,  INVITE from SipEndpoint to Opensips must search for this
registered user and then send the call to B2BUA
  (not to WebCliente)


Do you think, it's not possible to update contact in location database?




On Thu, Jun 19, 2014 at 5:30 PM, Răzvan Crainea <razvan at opensips.org> wrote:

> Hi, Miguel!
>
> There is no way you can change the contact header - it is something taken
> from the SIP message. What you are changing there is the AOR username and
> domain of that customer.
> May I ask you what are you trying to achieve? Perhaps there's a different
> way of doing it.
>
>
> Best regards,
>
> Razvan Crainea
> OpenSIPS Core Developer
> http://www.opensips-solutions.com
>
> On 06/19/2014 10:13 AM, Miguel Oyarzo wrote:
>
>>
>> Ok, thanks.
>>
>> I did
>>
>> if (is_method("REGISTER")) # WebRTC  (accepts anything for now)
>> {
>>
>>          $avp(aor) = "sip:" + $tU + "@" + $si + ":5092";
>>          if (!save("location","","$avp(aor)")) {
>>                  sl_reply_error();
>>                  xlog("Location could not be saved");
>>          }
>>                  xlog("$si has been registered  [tU:$tU/si:$si]");
>>          exit;
>> }
>>
>> restart OK.
>> log: Jun 19 17:13:04 ip-10-10-1-105 /usr/sbin/opensips[22253]:
>> 10.10.1.120 has been registered  [tU:61370000000/si:10.10.1.120]
>>
>> But,
>> balancer=# SELECT username,contact from location;
>>    username   |                                contact
>> -------------+----------------------------------------------
>> -------------------------
>>   61370000000 |
>> sips:61370000000 at df7jal23ls0d.invalid;rtcweb-breaker=no;transport=wss
>>
>>
>> Contact is still the original. Any idea?
>>
>>
>>
>>
>>
>> On Thu, Jun 19, 2014 at 5:04 PM, Răzvan Crainea <razvan at opensips.org
>> <mailto:razvan at opensips.org>> wrote:
>>
>>     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
>>
>>     <http://www.opensips.org/html/docs/modules/1.11.x/registrar#id294034>
>>
>>
>>     Best regards,
>>
>>     Razvan Crainea
>>     OpenSIPS Core Developer
>>     http://www.opensips-solutions.__com <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>
>>         <mailto:sips%3A61370000000 at 10.__10.1.120
>>         <mailto:sips%253A61370000000 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>
>>         <mailto: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>
>>
>>
>>
>>         <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
>>
>>         <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>>
>>                  <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://counter.li.org>
>>         http://au.linkedin.com/in/____mikeaustralia
>>         <http://au.linkedin.com/in/__mikeaustralia>
>>
>>                  <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>
>>         <mailto: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>
>>
>>         <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>
>>         <mailto: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>
>>
>>              <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://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
>>
>>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> 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://au.linkedin.com/in/mikeaustralia
Melbourne, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140619/65b0d20f/attachment-0001.htm>


More information about the Users mailing list