[OpenSIPS-Users] Access to listen/advertised IP Addresses

Bogdan-Andrei Iancu bogdan at opensips.org
Tue Apr 7 16:29:51 EST 2020


No need, just use in script, where ever you need 
$socket_in(advertised_ip) and it will be evaluated for the current 
socket (used for receiving the request)

Regardsm

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   https://www.opensips-solutions.com
OpenSIPS Summit, Amsterdam, May 2020
   https://www.opensips.org/events/Summit-2020Amsterdam/

On 4/7/20 6:56 PM, Mark Farmer wrote:
> I was thinking something like:
>
> modparam("cfgutils", "varset", "extip=s:$in_socket.advertised_ip")
>
>
> On Tue, 7 Apr 2020 at 14:40, Bogdan-Andrei Iancu <bogdan at opensips.org 
> <mailto:bogdan at opensips.org>> wrote:
>
>     Hi Mark,
>
>     ingenious solution :)
>
>     In regards to the proposed solution, I do not understand the
>     question about varset (cfgutils), as there is no relation between
>     the script vars and these new $socket vars. Maybe I'm missing
>     something from your question.
>
>     Regards,
>
>     Bogdan-Andrei Iancu
>
>     OpenSIPS Founder and Developer
>        https://www.opensips-solutions.com
>     OpenSIPS Summit, Amsterdam, May 2020
>        https://www.opensips.org/events/Summit-2020Amsterdam/
>
>     On 4/7/20 2:10 PM, Mark Farmer wrote:
>>     Hi Bogdan
>>
>>     The root of my issue is that I need 2 variables containing the
>>     IP's of my 2 interfaces (mhomed=yes) but the advertised address
>>     of the NAT'd DMZ interface while keeping changes per server to a
>>     bare minimum to ease deployment.
>>
>>     I actually solved my issue by using include_file and using
>>     cfgutils to set 2 script variables. So now all deployment changes
>>     are confined to a much simpler/smaller file.
>>
>>     However, the proposed changes would make things even nicer. Would
>>     cfgutils be able to accept those variables as parameters to the
>>     'varset' function?
>>
>>     Regards
>>     Mark.
>>
>>
>>
>>     On Tue, 7 Apr 2020 at 11:44, Bogdan-Andrei Iancu
>>     <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>>
>>         Hi guys,
>>
>>         Maybe adding a new core variable like $in_socket.XXXX, to
>>         give access to various fields, like $in_socket.ip,
>>         $in_socket.port, $in_socket.advertised_ip, etc. This will
>>         replace the $Ri and $Rp
>>
>>         And we can also add $out_socket, that will similarly replace
>>         the $fs (forced socket)
>>
>>         Regards,
>>
>>         Bogdan-Andrei Iancu
>>
>>         OpenSIPS Founder and Developer
>>            https://www.opensips-solutions.com
>>         OpenSIPS Summit, Amsterdam, May 2020
>>            https://www.opensips.org/events/Summit-2020Amsterdam/
>>
>>         On 4/6/20 6:00 PM, Johan De Clercq wrote:
>>>         It,s not exposed I think. I can’t find it back either
>>>
>>>         Outlook voor iOS <https://aka.ms/o0ukef> downloaden
>>>         ------------------------------------------------------------------------
>>>         *Van:* Users <users-bounces at lists.opensips.org>
>>>         <mailto:users-bounces at lists.opensips.org> namens David
>>>         Villasmil <david.villasmil.work at gmail.com>
>>>         <mailto:david.villasmil.work at gmail.com>
>>>         *Verzonden:* Monday, April 6, 2020 4:49:36 PM
>>>         *Aan:* OpenSIPS users mailling list
>>>         <users at lists.opensips.org> <mailto:users at lists.opensips.org>
>>>         *Onderwerp:* Re: [OpenSIPS-Users] Access to
>>>         listen/advertised IP Addresses
>>>         No, you’re right. It’s not in the core variables and I can’t
>>>         find it either. Which makes me think it’s either not exposed
>>>         or somewhere in a module (it’s not in proto_udp)
>>>
>>>         I will research a little to try and find it..
>>>
>>>         On Mon, 6 Apr 2020 at 14:04, Mark Farmer <farmorg at gmail.com
>>>         <mailto:farmorg at gmail.com>> wrote:
>>>
>>>             Thanks David. But I see no reference to the same
>>>             variable in OpenSIPS.
>>>
>>>             https://www.opensips.org/Documentation/Script-CoreVar-2-4
>>>
>>>             Am I missing something?
>>>
>>>
>>>             On Mon, 6 Apr 2020 at 13:45, David Villasmil
>>>             <david.villasmil.work at gmail.com
>>>             <mailto:david.villasmil.work at gmail.com>> wrote:
>>>
>>>                 Right here:
>>>
>>>                 https://www.kamailio.org/wiki/cookbooks/5.2.x/pseudovariables#rai_-_received_advertised_ip_address
>>>
>>>                 Regards,
>>>
>>>                 David Villasmil
>>>                 email: david.villasmil.work at gmail.com
>>>                 <mailto:david.villasmil.work at gmail.com>
>>>                 phone: +34669448337
>>>
>>>
>>>                 On Mon, Apr 6, 2020 at 12:08 PM Mark Farmer
>>>                 <farmorg at gmail.com <mailto:farmorg at gmail.com>> wrote:
>>>
>>>                     Many thanks for the reply.
>>>
>>>                     $Ri is certainly useful when the request comes
>>>                     from a non-natted interface. Thanks for pointing
>>>                     that out :)
>>>
>>>                     Is there a way to reference the advertised IP
>>>                     address defined in the listen statement?
>>>
>>>                     listen=udp:xxx.xxx.xxx.xxx:5060 as
>>>                     xxx.xxx.xxx.xxx:5060
>>>
>>>                     Thanks
>>>                     Mark.
>>>
>>>
>>>                     On Thu, 2 Apr 2020 at 17:32, Sharad Kumar via
>>>                     Users <users at lists.opensips.org
>>>                     <mailto:users at lists.opensips.org>> wrote:
>>>
>>>                         Hi Mark,
>>>
>>>                          If your initial goal is to get the
>>>                         interface IP where request is received then
>>>                         you can try these variables.
>>>
>>>                         *$Ri* - reference to IP address of the
>>>                         interface where the request has been received
>>>
>>>                         *$Rp* - reference to the port where the
>>>                         message was received
>>>
>>>                         _______________________________________________
>>>                         Users mailing list
>>>                         Users at lists.opensips.org
>>>                         <mailto:Users at lists.opensips.org>
>>>                         http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>>
>>>                     -- 
>>>                     Mark Farmer
>>>                     farmorg at gmail.com <mailto:farmorg at gmail.com>
>>>                     _______________________________________________
>>>                     Users mailing list
>>>                     Users at lists.opensips.org
>>>                     <mailto:Users at lists.opensips.org>
>>>                     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
>>>
>>>
>>>
>>>             -- 
>>>             Mark Farmer
>>>             farmorg at gmail.com <mailto:farmorg at gmail.com>
>>>             _______________________________________________
>>>             Users mailing list
>>>             Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>>>             http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>         -- 
>>>         Regards,
>>>
>>>         David Villasmil
>>>         email: david.villasmil.work at gmail.com
>>>         <mailto:david.villasmil.work at gmail.com>
>>>         phone: +34669448337
>>>
>>>         _______________________________________________
>>>         Users mailing list
>>>         Users at lists.opensips.org  <mailto:Users at lists.opensips.org>
>>>         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
>>
>>
>>
>>     -- 
>>     Mark Farmer
>>     farmorg at gmail.com <mailto:farmorg at gmail.com>
>>
>>     _______________________________________________
>>     Users mailing list
>>     Users at lists.opensips.org  <mailto:Users at lists.opensips.org>
>>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> -- 
> Mark Farmer
> farmorg at gmail.com <mailto:farmorg at gmail.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200407/30c294fb/attachment-0001.html>


More information about the Users mailing list