Yes, but I did give the wrong link for [1]. 😊

[1] - https://www.opensips.org/Documentation/Script-CoreVar-3-4#param

I will also note that if you are only using the extra fields for events then 
defining the log name does seem a bit unnecessary as it is only changing the 
name used to access the $param. This could actually be more confusing; maybe 
better to have the $acc_extra and $param names align.

Ben Newlin

From: Bogdan-Andrei Iancu <[email protected]>
Date: Wednesday, June 5, 2024 at 12:31 PM
To: Ben Newlin <[email protected]>, OpenSIPS users mailling list 
<[email protected]>
Subject: Re: [OpenSIPS-Users] E_ACC_EVENT Question
 EXTERNAL EMAIL - Please use caution with links and attachments

________________________________
yes, good spotting, Ben is right here, all the fields provided by an event must 
be fetched via $param()

Regards,


Bogdan-Andrei Iancu



OpenSIPS Founder and Developer

  https://www.opensips-solutions.com<https://www.opensips-solutions.com>

  https://www.siphub.com<https://www.siphub.com>
On 05.06.2024 18:55, Ben Newlin wrote:
If I’m understanding correctly, acc_extra variables are only used during 
message processing; they are not visible in event routes. Parameters passed to 
event routes are accessed using the $param() notation [1].

Per the ACC module docs [2]:


  *   Events accounting - log_name will be the name of the parameter in the 
event raised.

So I believe in your config it would be:

        #Extra Params
        $var(src_ip) = $param(source_ip);

        $var(dst_ip) = $param (destination_ip);

Note that the param name is the log name, not the tag.

As an additional note, your reference to the $si variable as a sanity check is 
not valid as that variable is also only available in a message processing 
route. Its value is not defined in an event route.

[1] - 
https://www.opensips.org/Documentation/Script-Routes-3-4#toc9<https://www.opensips.org/Documentation/Script-Routes-3-4#toc9>
[2] - 
https://opensips.org/docs/modules/3.4.x/acc.html#ACC-extra-id<https://opensips.org/docs/modules/3.4.x/acc.html#ACC-extra-id>

Ben Newlin

From: Users 
<[email protected]><mailto:[email protected]> on 
behalf of Alexander Perkins 
<[email protected]><mailto:[email protected]>
Date: Wednesday, June 5, 2024 at 11:37 AM
To: Bogdan-Andrei Iancu <[email protected]><mailto:[email protected]>
Cc: OpenSIPS users mailling list 
<[email protected]><mailto:[email protected]>
Subject: Re: [OpenSIPS-Users] E_ACC_EVENT Question
 EXTERNAL EMAIL - Please use caution with links and attachments

________________________________
Hi Bogdan.  Thank you for getting back to me.  When we take a look at what 
populates, they are either incorrect (for example, src_ip is always 0.0.0.0, 
but we see it correct in the route block), or they are null.

Let me know if this helps.

Thank you,
Alex

On Wed, Jun 5, 2024 at 11:33 AM Bogdan-Andrei Iancu 
<[email protected]<mailto:[email protected]>> wrote:
Hi Alexander.

When you say "they don't seem to populate correctly", you mean they are NULL 
val, or wrong value?

Regards,

Bogdan-Andrei Iancu



OpenSIPS Founder and Developer

  https://www.opensips-solutions.com<https://www.opensips-solutions.com>

  https://www.siphub.com<https://www.siphub.com>
On 04.06.2024 23:59, Alexander Perkins wrote:
Hi All. We are working on implementing the E_ACC_EVENT so we may use that for 
accounting purposes instead of the DB.  Now, most things appear to work as they 
should.  However, when we attempt to access the extra accounting fields, they 
don't seem to populate correctly (I've highlighted the extra variables).  Here 
is the config:

modparam("acc","extra_fields","evi: src_ip -> source_ip; dst_ip -> 
destination_ip)

event_route [E_ACC_EVENT]
{
        #log on entry
        xlog("L_INFO","entered event_route\n");

        #Default Params
        $var(method) = $param(method);

        #Extra Params
        $var(src_ip) = $acc_extra(src_ip);

        $var(source_test) = $si;

        $var(dst_ip) = $acc_extra(dst_ip);

        #log vars to test
        xlog("L_INFO","heres the ER variable: $var(source_test) and 
$var(src_ip)\n");

}

What am I missing?  Can someone point me in the right direction?  Any help is 
really appreciated.

Thank you,
Alex Perkins


_______________________________________________

Users mailing list

[email protected]<mailto:[email protected]>

http://lists.opensips.org/cgi-bin/mailman/listinfo/users<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>


_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to