<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<font face="monospace">yes, good spotting, Ben is right here, all
the fields provided by an event must be fetched via $param()<br>
<br>
Regards,<br>
</font>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
<a class="moz-txt-link-freetext" href="https://www.siphub.com">https://www.siphub.com</a></pre>
<div class="moz-cite-prefix">On 05.06.2024 18:55, Ben Newlin wrote:<br>
</div>
<blockquote type="cite"
cite="mid:BN0PR10MB5208575D7D604B8D789CD3F795F92@BN0PR10MB5208.namprd10.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator"
content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<style>@font-face
{font-family:Helvetica;
panose-1:0 0 0 0 0 0 0 0 0 0;}@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:10.0pt;
font-family:"Aptos",sans-serif;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}div.WordSection1
{page:WordSection1;}ol
{margin-bottom:0in;}ul
{margin-bottom:0in;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">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].<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Per the ACC
module docs [2]:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<ul style="margin-top:0in" type="disc">
<li class="MsoNormal" style="mso-list:l0 level1 lfo3"><i><span
style="font-size:11.0pt">Events accounting</span></i><span
style="font-size:11.0pt"> - log_name will be the name of
the parameter in the event raised.<o:p></o:p></span></li>
</ul>
<p class="MsoNormal" style="margin-left:.5in"><span
style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">So I believe
in your config it would be:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">
#Extra Params<br>
$var(src_ip) = $param(source_ip);<br>
<br>
$var(dst_ip) = $param (</span><span
style="font-size:12.0pt">destination_ip</span><span
style="font-size:11.0pt">);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Note that
the param name is the log name, not the tag.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">[1] - <a
href="https://www.opensips.org/Documentation/Script-Routes-3-4#toc9"
moz-do-not-send="true" class="moz-txt-link-freetext">
https://www.opensips.org/Documentation/Script-Routes-3-4#toc9</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">[2] - <a
href="https://opensips.org/docs/modules/3.4.x/acc.html#ACC-extra-id"
moz-do-not-send="true" class="moz-txt-link-freetext">
https://opensips.org/docs/modules/3.4.x/acc.html#ACC-extra-id</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Ben
Newlin</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span
style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Users
<a class="moz-txt-link-rfc2396E" href="mailto:users-bounces@lists.opensips.org"><users-bounces@lists.opensips.org></a> on behalf of
Alexander Perkins
<a class="moz-txt-link-rfc2396E" href="mailto:alexanderhenryperkins@gmail.com"><alexanderhenryperkins@gmail.com></a><br>
<b>Date: </b>Wednesday, June 5, 2024 at 11:37 AM<br>
<b>To: </b>Bogdan-Andrei Iancu
<a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org"><bogdan@opensips.org></a><br>
<b>Cc: </b>OpenSIPS users mailling list
<a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a><br>
<b>Subject: </b>Re: [OpenSIPS-Users] E_ACC_EVENT
Question<o:p></o:p></span></p>
</div>
<div>
<div>
<div>
<table class="MsoNormalTable"
style="border-collapse:collapse" cellspacing="0"
cellpadding="0" border="0">
<tbody>
<tr>
<td
style="border:solid #B60000 1.0pt;background:white;padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><b><span
style="font-size:12.0pt;font-family:"Calibri",sans-serif;color:#B60000"> EXTERNAL
EMAIL - Please use caution with links
and attachments <o:p></o:p></span></b></p>
</td>
</tr>
</tbody>
</table>
</div>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:Helvetica"><o:p> </o:p></span></p>
<div class="MsoNormal" style="text-align:center"
align="center"><span
style="font-size:12.0pt;font-family:Helvetica">
<hr width="100%" size="1" align="center">
</span></div>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt">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.<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Let
me know if this helps.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Thank
you,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Alex<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">On
Wed, Jun 5, 2024 at 11:33</span><span
style="font-size:12.0pt;font-family:"Arial",sans-serif"> </span><span
style="font-size:12.0pt">AM Bogdan-Andrei Iancu <<a
href="mailto:bogdan@opensips.org"
moz-do-not-send="true"
class="moz-txt-link-freetext">bogdan@opensips.org</a>>
wrote:<o:p></o:p></span></p>
</div>
<blockquote
style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span
style="font-size:12.0pt;font-family:"Courier New"">Hi
Alexander.<br>
<br>
When you say "they don't seem to populate
correctly", you mean they are NULL val, or wrong
value?<br>
<br>
Regards,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<pre>Bogdan-Andrei Iancu</pre>
<pre><o:p> </o:p></pre>
<pre>OpenSIPS Founder and Developer</pre>
<pre> <a href="https://www.opensips-solutions.com"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://www.opensips-solutions.com</a></pre>
<pre> <a href="https://www.siphub.com"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://www.siphub.com</a></pre>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">On
04.06.2024 23:59, Alexander Perkins wrote:<o:p></o:p></span></p>
</div>
<blockquote
style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt">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:
<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt">modparam("acc","extra_fields","evi:
src_ip -> source_ip; dst_ip ->
destination_ip)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt">event_route
[E_ACC_EVENT]<br>
{<br>
#log on entry<br>
xlog("L_INFO","entered
event_route\n");<br>
<br>
#Default Params<br>
$var(method) = $param(method);<br>
<br>
#Extra Params<br>
<span
style="color:black;background:yellow">
$var(src_ip) = $acc_extra(src_ip);</span><br>
<br>
$var(source_test) = $si;<br>
<br>
<span
style="color:black;background:yellow">$var(dst_ip)
= $acc_extra(dst_ip);</span><br>
<br>
#log vars to test<br>
xlog("L_INFO","heres the ER
variable: $var(source_test) and
$var(src_ip)\n");<br>
<br>
}<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt">What am I missing?
Can someone point me in the right
direction? Any help is really appreciated.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt">Thank you,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt">Alex Perkins<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span
style="font-size:12.0pt"><o:p> </o:p></span></p>
<pre>_______________________________________________</pre>
<pre>Users mailing list</pre>
<pre><a href="mailto:Users@lists.opensips.org"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">Users@lists.opensips.org</a></pre>
<pre><a
href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></pre>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>