<div dir="ltr">That'll do it..</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 17 Apr 2020 at 16:00, Mark Farmer <<a href="mailto:farmorg@gmail.com">farmorg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">OK, fixed it.<div><br></div><div>Turned out to be this breaking it by overwriting $acc_extra(customer_id) with a blank value.</div><div><br></div><div>...</div><div><div style="color:rgb(0,0,0)">else $acc_extra(Call_Flow) = "Internal";</div><div style="color:rgb(0,0,0)">                $acc_extra(customer_id) = $var(rule_attrs);</div></div><div style="color:rgb(0,0,0)">...</div><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)">Changed it to:</div><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)">...</div><div style="color:rgb(0,0,0)"><div>else if (isflagset(TPTY_PBX) || isflagset(PBX_TPTY)) {</div><div>                $acc_extra(Call_Flow) = "Internal";</div><div>                $acc_extra(customer_id) = $var(rule_attrs);</div><div>...</div><div><br></div></div><div style="color:rgb(0,0,0)">And all works nicely :)</div><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)">Thanks for the help!</div><div style="color:rgb(0,0,0)">Mark.</div><div style="color:rgb(0,0,0)"><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 17 Apr 2020 at 14:08, Mark Farmer <<a href="mailto:farmorg@gmail.com" target="_blank">farmorg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Thats what I thought :)<div><br></div><div><div dir="ltr" style="color:rgb(0,0,0)">This is getting quite odd now.</div><div dir="ltr" style="color:rgb(0,0,0)"><div>I am adding 2 extra fields, Call_Flow & customer_id. The odd thing is that Call_Flow is working perfectly in all cases.</div><div>customer_id works fine for the latter 2 scenarios but in the first scenario the customer_id data is never added to the database.</div><div><br></div><div>I have this configured for the acc module:</div><div>modparam("acc", "extra_fields", "db: from_usr; to_usr; customer_id; Call_Flow")<br></div><div><br></div><div>The variable is set earlier on:</div><div>...</div><div>do_routing("3",,,"$var(custID)");<br></div><div>...</div><div><br></div><div>And I am doing all of the accounting in a dedicated route:</div><div><br></div><div><div>route[ACCEXTRA] {</div><div>        do_accounting("db","cdr");</div><div>        xlog("CUSTOM_LOG: Adding extra accounting: from_usr: $fU customer_id: $var(rule_attrs) $var(custID)"); <b># variable is visible here</b></div><div>        $acc_extra(from_usr) = $fU;</div><div>        $acc_extra(to_usr) = $tU;</div><div>        if (isflagset(PBX_PSTN) || isflagset(TPTY_PSTN)) {</div><div>                xlog("CUSTOM_LOG: Customer ID = $var(custID)"); <b># variable is visible here</b></div><div>                $acc_extra(Call_Flow) = "Outbound";</div><div>                $acc_extra(customer_id) = $var(custID);</div><div>                xlog("CUSTOM_LOG: $$acc_extra(customer_id) = $acc_extra(customer_id)"); <span style="font-family:-webkit-standard;font-size:medium"><b># variable is visible here</b></span></div><div>        } else if (isflagset(PSTN_TPTY) || isflagset(PSTN_PBX)) {</div><div>                $acc_extra(Call_Flow) = "Inbound";</div><div>                $acc_extra(customer_id) = $var(rule_attrs);</div><div>        } else $acc_extra(Call_Flow) = "Internal";</div><div>                $acc_extra(customer_id) = $var(rule_attrs);</div><div>}</div></div><div><br></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 17 Apr 2020 at 13:50, Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <tt>Mark,<br>
      <br>
      You can populate the $acc_extra() from whatever other variable or
      string operations. Most probably your issue is in other place, in
      regards to the acc logic.<br>
      <br>
      Regards,<br>
    </tt>
    <pre cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a href="https://www.opensips-solutions.com" target="_blank">https://www.opensips-solutions.com</a>

</pre>
    <div>On 4/17/20 1:40 PM, Mark Farmer wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">Thanks Bogdan, that's mostly working now.
            <div><br>
            </div>
            <div>My issue now is with passing that identifier into
              acc_extra() as a variable which does not seem to be
              working.</div>
            <div>Using xlog() I can see that the variable is populated
              right before calling acc_extra()</div>
            <div><br>
            </div>
            <div>...</div>
            <div>
              <div>if (isflagset(PBX_PSTN) || isflagset(TPTY_PSTN)) {</div>
              <div>                xlog("CUSTOM_LOG: Customer ID =
                $var(custID)");</div>
              <div>                $acc_extra(customer_id) =
                $var(custID);</div>
            </div>
            <div>...</div>
            <div>do_accounting("db","cdr");<br>
            </div>
            <div>}</div>
            <div><br>
            </div>
            <div>Does acc_extra() not accept variables as input?</div>
            <div><br>
            </div>
            <div>Thanks again!</div>
            <div>Mark.</div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div><br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Fri, 17 Apr 2020 at 09:15,
          Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div bgcolor="#FFFFFF"> <tt>Hey Mark,<br>
              <br>
              It is not nice, but you can do:<br>
              <br>
              $var(tmp) = $rU;<br>
              $rU = $fU<br>
              do_routing();<br>
              $rU = </tt><tt><tt>$var(tmp);<br>
                <br>
                Regards,<br>
              </tt></tt>
            <pre cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a href="https://www.opensips-solutions.com" target="_blank">https://www.opensips-solutions.com</a>

</pre>
            <div>On 4/17/20 11:13 AM, Mark Farmer wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">Hi Bogdan, I will try to explain better.
                <div><br>
                </div>
                <div>In rule_attrs I have a customer identifier which is
                  used by acc to add the identifier into the CDR
                  database.</div>
                <div>This works fine for calls from PSTN which are
                  routed to another SIP gateway but calls from that
                  gateway routed to PSTN can come from multiple
                  customers and there is no way to identify which. So
                  I'd like to match the incoming $fU to the rule that
                  would match $rU in the from PSTN scenario in order to
                  retrieve the rule_attrs (the customer identifier) from
                  that rule.</div>
                <div><br>
                </div>
                <div>Does that make sense?</div>
                <div><br>
                </div>
                <div>Many thanks and regards</div>
                <div>Mark.</div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div><br>
                </div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Thu, 16 Apr 2020 at
                  16:55, Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                  <div bgcolor="#FFFFFF"> <tt>Hi Mark,<br>
                      <br>
                      What kind of matching you want to do between $fU
                      and the dr prefixes ? You want to do the same as
                      what drouting() does with $rU ?<br>
                      <br>
                      Regards,<br>
                    </tt>
                    <pre cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a href="https://www.opensips-solutions.com" target="_blank">https://www.opensips-solutions.com</a>

</pre>
                    <div>On 4/16/20 6:14 PM, Mark Farmer wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <div dir="ltr">Hi everyone
                        <div><br>
                        </div>
                        <div>I am looking for a way to compare $fU in
                          INVITE to the matching drouting() prefix of
                          another group and retrieve the rule_attrs from
                          that rule.</div>
                        <div><br>
                        </div>
                        <div>At the moment I am thinking I'll have to
                          run a custom DB query so I have 2 questions:</div>
                        <div><br>
                        </div>
                        <div>1. Is there a better way to do this?</div>
                        <div>2. If not, what is the best way to run
                          custom DB queries?</div>
                        <div><br>
                        </div>
                        <div>I have been reading through the drouting()
                          documentation but that hasn't helped.</div>
                        <div><br>
                        </div>
                        <div>OpenSIPS 2.4.7</div>
                        <div><br>
                        </div>
                        <div>Many thanks!</div>
                        <div>Mark.</div>
                        <div><br>
                        </div>
                      </div>
                      <br>
                      <fieldset></fieldset>
                      <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
                    </blockquote>
                    <br>
                  </div>
                </blockquote>
              </div>
              <br clear="all">
              <div><br>
              </div>
              -- <br>
              <div dir="ltr">Mark Farmer<br>
                <a href="mailto:farmorg@gmail.com" target="_blank">farmorg@gmail.com</a></div>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr">Mark Farmer<br>
        <a href="mailto:farmorg@gmail.com" target="_blank">farmorg@gmail.com</a></div>
    </blockquote>
    <br>
  </div>

</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr">Mark Farmer<br><a href="mailto:farmorg@gmail.com" target="_blank">farmorg@gmail.com</a></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr">Mark Farmer<br><a href="mailto:farmorg@gmail.com" target="_blank">farmorg@gmail.com</a></div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>

<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-align:justify"><font size="3" face="Verdana"><span style="font-size:8px;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"></span></font></p><div><a href="https://www.x-on.co.uk/service/surgery-connect/coronavirus.htm" target="_blank"><img src="https://www.x-on.co.uk/email/footer/banner-awards-coronavirus.jpg"></a></div><div><br></div><div><div><div><font size="4"><b><sup><font face="Verdana">0333 332 0000  |  <a href="https://www.x-on.co.uk" target="_blank">x-on.co.uk</a>  |  <sub> </sub></font></sup></b></font><font size="4"><b><sub><sup><font face="Verdana"><a href="https://www.linkedin.com/company/x-on" target="_blank"><img src="http://www.x-on.co.uk//images/icon/linkedin.png" width="24" height="24"></a>  <a href="https://www.facebook.com/XonTel" target="_blank"><img src="http://www.x-on.co.uk//images/icon/facebook.png" width="24" height="24"></a>  <a href="https://twitter.com/xonuk" target="_blank"><img src="http://www.x-on.co.uk//images/icon/twitter.png" width="24" height="24"></a></font></sup></sub> </b></font><b style="font-size:large"><sup><font face="Verdana">  |  <a href="https://www.x-on.co.uk/service/surgery-connect/coronavirus.htm" target="_blank">Coronavirus</a></font></sup></b><br><p><span style="font-family:Verdana;font-size:8px"><a href="http://www.itspa.org.uk/itspa-awards" target="_blank">THE ITSPA AWARDS 2020</a> AND Best ITSP - Mid Market, Best Software and Best Vertical Solution are trade marks of the Internet Telephony Services Providers' Association, used under licence.</span></p><p><span style="font-size:6.0pt;font-family:Verdana;color:black">X-on
is a trading name of Storacall Technology Ltd a limited company registered in
England and Wales.<br>
Registered Office : Avaland House, 110 London Road, Apsley, Hemel Hempstead,
Herts, HP3 9SD. Company Registration No. 2578478.<br>
The information in this e-mail is confidential and for use by the addressee(s)
only. If you are not the intended recipient, please notify X-on immediately on <span>+44(0)333 332 0000</span> and delete the<br>message from your computer. If you are not a named addressee you must not use,
disclose, disseminate, distribute, copy, print or reply to this email. </span><span style="font-size:6.0pt;font-family:Verdana;color:black">Views
or opinions expressed by an individual<br>within this email may not necessarily
reflect the views of X-on or its associated companies. Although X-on routinely
screens for viruses, addressees should scan this email and any attachments<br>for
viruses. X-on makes no representation or warranty as to the absence of viruses
in this email or any attachments.</span></p>





<p><span style="font-size:6.0pt;font-family:Verdana;color:black"></span><font size="2"><span style="font-size:6.0pt;font-family:Verdana;color:black"></span></font></p></div></div></div>