<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <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 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>

</pre>
    <div class="moz-cite-prefix">On 4/17/20 1:40 PM, Mark Farmer wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOvQDes2bNoPmiGT00t5SiGV6GiJ2YjPyfyKsS9vgzXviHhK5A@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <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"
            moz-do-not-send="true">bogdan@opensips.org</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color: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" moz-do-not-send="true">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"
                    moz-do-not-send="true">bogdan@opensips.org</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color: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" moz-do-not-send="true">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" moz-do-not-send="true">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank" moz-do-not-send="true">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"
                  moz-do-not-send="true">farmorg@gmail.com</a></div>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr" class="gmail_signature">Mark Farmer<br>
        <a href="mailto:farmorg@gmail.com" target="_blank"
          moz-do-not-send="true">farmorg@gmail.com</a></div>
    </blockquote>
    <br>
  </body>
</html>