Re: [OpenSIPS-Users] Global variable $rm gives number when using $json

2021-02-02 Thread Liviu Chircu

On 03.02.2021 00:14, Alex Kinch wrote:
but there now appears to be another issue whereby $json is outputting 
$socket_in(port) as a string instead of numeric? It's numeric as 
expected if I go back to 3.1.1


Well, you have just uncovered another slight inaccuracy in the $socket() 
variable code, which is now fixed [1]!  Thank you!


[1]: https://github.com/OpenSIPS/opensips/commit/de72c4f829ae0

Cheers,

--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Global variable $rm gives number when using $json

2021-02-02 Thread Alex Kinch
On Tue, 2 Feb 2021 at 20:11, Liviu Chircu  wrote:


> This problem is identical to the previous one and the patch for the
> $json variable should cover both of them.  Make sure you're using the
> nightly 3.1 packages or wait for the 3.1.2 release, after which you can
> test out the fix.


Sorry, me again -  $socket_in(af) is working as expected in nightly 3.1
(thanks again!) but there now appears to be another issue whereby $json is
outputting $socket_in(port) as a string instead of numeric? It's numeric as
expected if I go back to 3.1.1

Thanks,
Alex
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Global variable $rm gives number when using $json

2021-02-02 Thread Alex Kinch
On Tue, 2 Feb 2021 at 20:11, Liviu Chircu  wrote:

This problem is identical to the previous one and the patch for the
> $json variable should cover both of them.  Make sure you're using the
> nightly 3.1 packages or wait for the 3.1.2 release, after which you can
> test out the fix.
>

Thanks Liviu :)

Alex
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Global variable $rm gives number when using $json

2021-02-02 Thread Liviu Chircu

On 02.02.2021 18:32, Alex Kinch wrote:
Just found another similar related issue so thought I'd pop it on the 
same thread.


$socket_in(af) returns INET or INET6 as expected but after passing 
through $json it's numeric and 0 in both cases.


Redacted examples below. I'm on 3.1.1 from Debian/Ubuntu packages.


Hi Alex,

This problem is identical to the previous one and the patch for the 
$json variable should cover both of them.  Make sure you're using the 
nightly 3.1 packages or wait for the 3.1.2 release, after which you can 
test out the fix.


Kind regards,

--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Global variable $rm gives number when using $json

2021-02-02 Thread Alex Kinch
Hi Liviu,

Just found another similar related issue so thought I'd pop it on the same
thread.

$socket_in(af) returns INET or INET6 as expected but after passing through
$json it's numeric and 0 in both cases.

Redacted examples below. I'm on 3.1.1 from Debian/Ubuntu packages.

Thanks,
Alex

Feb  2 16:24:11 [1095] INVITE request from XX to XX received
Feb  2 16:24:11 [1095] AF is INET proto is udp
Feb  2 16:24:11 [1095] Making request to invite service...
Feb  2 16:24:11 [1095] Request is { "call_id": "XX", "ts": "2021-02-02
16:24:11Z", "src_ip": "XX", "src_port": 63412, "dst_ip": "XX", "dst_port":
5060, "dst_af": 0, "proto": "udp", "method": "INVITE", "sip_from":
"sip:XX", "sip_to": "sip:XX", "dialled": "XX" }

Feb  2 16:24:13 [1119] INVITE request from XX to XX received
Feb  2 16:24:13 [1119] AF is INET6 proto is udp
Feb  2 16:24:13 [1119] Making request to invite service...
Feb  2 16:24:13 [1119] Request is { "call_id": "XX", "ts": "2021-02-02
16:24:13Z", "src_ip": "XX", "src_port": 50505, "dst_ip": "XX", "dst_port":
5060, "dst_af": 0, "proto": "udp", "method": "INVITE", "sip_from":
"sip:XX", "sip_to": "sip:XX", "dialled": "XX" }


On Tue, 19 Jan 2021 at 17:22, Alex Kinch  wrote:

> On Tue, 19 Jan 2021 at 17:17, Liviu Chircu  wrote:
>
>
>> For 3.1, I think we're still in the right time window to backport this
>> fix without breaking any opensips.cfg files.
>
>
> I'm using 3.1 so quite happy with that proposal :) Thanks for the fast
> response and fix, much appreciated.
>
> Alex
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Global variable $rm gives number when using $json

2021-01-19 Thread Alex Kinch
On Tue, 19 Jan 2021 at 17:17, Liviu Chircu  wrote:


> For 3.1, I think we're still in the right time window to backport this
> fix without breaking any opensips.cfg files.


I'm using 3.1 so quite happy with that proposal :) Thanks for the fast
response and fix, much appreciated.

Alex
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Global variable $rm gives number when using $json

2021-01-19 Thread Liviu Chircu

On 19.01.2021 19:10, Johan De Clercq wrote:

Liviu,

For that case, why don’t you make an extra parameter ? E.g. 
use-broken-implementation 0|1


Sounds good for 2.4, which is heavily used out there and the risks are 
bigger, thanks!


For 3.1, I think we're still in the right time window to backport this 
fix without breaking any opensips.cfg files.


--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Global variable $rm gives number when using $json

2021-01-19 Thread Johan De Clercq
Liviu,

For that case, why don’t you make an extra parameter ? E.g. 
use-broken-implementation 0|1

Outlook voor iOS<https://aka.ms/o0ukef> downloaden

Van: Users  namens Liviu Chircu 

Verzonden: Tuesday, January 19, 2021 4:38:58 PM
Aan: OpenSIPS users mailling list 
Onderwerp: Re: [OpenSIPS-Users] Global variable $rm gives number when using 
$json

On 18.01.2021 20:53, Alex Kinch wrote:
I get this (identifying data redacted):

Jan 18 18:18:15 [33] request: INVITE from sip:XX@XX to sip:XX@XX
Jan 18 18:18:15 [33] Sending { "call_id": "942887463-1604195939-951239259", 
"ts": "2021-01-18 18:18:15Z", "src_ip": "XX", "dst_ip": "XX", "method": 1, 
"sip_from": "sip:XX@XX", "sip_to": "sip:XX@XX", "dialled": "XX" }

Any suggestions?


Hi Alex,

Thank you for the examples - indeed, that behavior is broken.

I just pushed a fix for this on "master" branch [1].  However, I'm a bit 
reluctant to backport it for the moment, because I haven't fully assessed its 
implications.  For example, could it be possible that people have already 
written code that relies on $json incorrectly returning the integer value of a 
variable which holds both a string and an integer, with string taking 
precedence (e.g. $rm)?

[1]: https://github.com/OpenSIPS/opensips/commit/6191f278a4

--
Liviu Chircu
www.twitter.com/liviuchircu<http://www.twitter.com/liviuchircu> | 
www.opensips-solutions.com<http://www.opensips-solutions.com>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Global variable $rm gives number when using $json

2021-01-19 Thread Liviu Chircu

On 18.01.2021 20:53, Alex Kinch wrote:

I get this (identifying data redacted):

Jan 18 18:18:15 [33] request: INVITE from sip:XX@XX to sip:XX@XX
Jan 18 18:18:15 [33] Sending { "call_id": 
"942887463-1604195939-951239259", "ts": "2021-01-18 18:18:15Z", 
"src_ip": "XX", "dst_ip": "XX", "method": 1, "sip_from": "sip:XX@XX", 
"sip_to": "sip:XX@XX", "dialled": "XX" }


Any suggestions?


Hi Alex,

Thank you for the examples - indeed, that behavior is broken.

I just pushed a fix for this on "master" branch [1]. However, I'm a bit 
reluctant to backport it for the moment, because I haven't fully 
assessed its implications.  For example, could it be possible that 
people have already written code that *relie**s* on $json incorrectly 
returning the integer value of a variable which holds both a string and 
an integer, with string taking precedence (e.g. $rm)?


[1]: https://github.com/OpenSIPS/opensips/commit/6191f278a4

--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] Global variable $rm gives number when using $json

2021-01-18 Thread Alex Kinch
Hi all,

I'm trying to post a few variables in JSON in OpenSIPS 3.1, but $rm is
returning a number instead of the method in the JSON.

If I do something like this:

$json(body) := "{}";
$json(body/call_id) = $ci;
$json(body/ts) = $time(%Y-%m-%d %H:%M:%SZ);
$json(body/src_ip) = $si;
$json(body/dst_ip) = $socket_in(ip);
$json(body/method) = $rm;
$json(body/sip_from) = $fu;
$json(body/sip_to) = $tu;
$json(body/dialled) = $tU;
xlog("L_NOTICE", "request: $rm from $fu to $ru\n");
xlog("L_NOTICE", "Sending $json(body)");

I get this (identifying data redacted):

Jan 18 18:18:15 [33] request: INVITE from sip:XX@XX to sip:XX@XX
Jan 18 18:18:15 [33] Sending { "call_id": "942887463-1604195939-951239259",
"ts": "2021-01-18 18:18:15Z", "src_ip": "XX", "dst_ip": "XX", "method": 1,
"sip_from": "sip:XX@XX", "sip_to": "sip:XX@XX", "dialled": "XX" }

Any suggestions?

Thanks
Alex
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users