[OpenSIPS-Users] Change Contact info in REGISTER messages

Răzvan Crainea razvan at opensips.org
Fri Jun 20 13:06:41 CEST 2014


Hi, Miguel!

So basically what you want to achieve from OpenSIPS is when the 
SipEndPoint calls a number that has been previously registered to B2BUA, 
the INVITEs should be sent to B2BUA, not to the WebClient?
Am I missing something?

Best regards,

Razvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 06/19/2014 10:51 AM, Miguel Oyarzo wrote:
> 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
> <mailto: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 <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>
>         <mailto: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>
>
>
>         <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
>         <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>>
>                  <mailto:sips%3A61370000000 at 10.
>         <mailto:sips%253A61370000000 at 10.>____10.1.120
>                  <mailto:sips%253A61370000000 at __10.10.1.120
>         <mailto:sips%25253A61370000000 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>>
>                  <mailto: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>>
>
>
>
>
>         <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>
>
>                  <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>>>
>                           <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://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>>
>
>                           <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>>
>                  <mailto:Users at lists.opensips.
>         <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>>
>
>
>         <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>>
>                  <mailto:Users at lists.opensips.
>         <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>>
>
>
>           <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://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
>



More information about the Users mailing list