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

Alex Kinch alex at alexkinch.com
Mon Jan 18 18:53:21 EST 2021

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 at XX to sip:XX at 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 at XX", "sip_to": "sip:XX at XX", "dialled": "XX" }

Any suggestions?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20210118/90f0316e/attachment.html>

More information about the Users mailing list