<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <tt>Yes, the note about the AVP name is 100% correct. Even if at the
      opensips cfg level it is ok and the actual name of the AVP will be
      "s:callfwd", it will not match the naming from the DB table.<br>
      <br>
      So just drop the "s:" prefix in the avp name at the script level.<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>
OpenSIPS Summit 2020 online
  <a class="moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2020Distributed/">https://www.opensips.org/events/Summit-2020Distributed/</a></pre>
    <div class="moz-cite-prefix">On 9/9/20 5:08 PM, Brett Nemeroff
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAPwC5wz==E1M+1z8FEW6FpPF=SFAs76EuGyG3x7Ymp8kCW4unQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hello Nayani,
        <div>Your avp spec is for a much older version of OpenSIPs. I'm
          not sure if that's your problem or not, but the "s:" syntax is
          dated for 2.4.x. </div>
        <div><br>
        </div>
        <div>Here's the documentation you should reference for your
          version of OpenSIPs: </div>
        <div><a
href="https://opensips.org/html/docs/modules/2.4.x/avpops.html#func_avp_db_load"
            moz-do-not-send="true">https://opensips.org/html/docs/modules/2.4.x/avpops.html#func_avp_db_load</a><br>
        </div>
        <div><br>
        </div>
        <div>Also, see Bogdan's comment above, did avp_db_load return
          false? </div>
        <div><br>
        </div>
        <div>Just my perspective, but for these kinds of "DB Loads", I
          almost always prefer a avp_db_query over a avp_db_load. The
          syntax is clearer for me, but I also just really like SQL to
          begin with. The original avp_db_load syntax was more inline
          with how OpenSIPs/OpenSER works from "back in the day". Would
          love other's feedback on that. Perhaps avp_db_load is easier
          for simple matches, but I think under the hood it's just doing
          a simple query anyway. avp_db_query just gives you full access
          to the actual SQL if you are into that kind of thing. </div>
        <div><br>
        </div>
        <div>-Brett</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Sep 9, 2020 at 12:25
          AM Nayani Nikeshala via Users <<a
            href="mailto:users@lists.opensips.org"
            moz-do-not-send="true">users@lists.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>
            <div style="font-family:"Helvetica
              Neue",Helvetica,Arial,sans-serif;font-size:16px">
              <div dir="ltr">Hi!</div>
              <div dir="ltr"><br>
              </div>
              <div dir="ltr">I'm using OpenSIPS 2.4.7. With the below
                script, call was not forwarded as configured. Is there
                any issue with my script or is there an alternative
                method to do this ?</div>
              <div dir="ltr"><br>
              </div>
              <div dir="ltr"><br>
              </div>
              <div><br>
              </div>
            </div>
            <div
              id="gmail-m_2207947096525326095ydp80ae7aa4yahoo_quoted_0125967366">
              <div style="font-family:"Helvetica
Neue",Helvetica,Arial,sans-serif;font-size:13px;color:rgb(38,40,42)">
                <div> On Tuesday, September 8, 2020, 10:48:27 PM
                  GMT+5:30, Bogdan-Andrei Iancu <<a
                    href="mailto:bogdan@opensips.org" target="_blank"
                    moz-do-not-send="true">bogdan@opensips.org</a>>
                  wrote: </div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div>
                  <div
                    id="gmail-m_2207947096525326095ydp80ae7aa4yiv0350315889">
                    <div> <tt>Hi,<br clear="none">
                        <br clear="none">
                        What version of OpenSIPS do you use ? And your
                        experience is that the avp_db_load fails ?<br
                          clear="none">
                        <br clear="none">
                        Regards,<br clear="none">
                      </tt>
                      <pre>Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a shape="rect" href="https://www.opensips-solutions.com" rel="nofollow" target="_blank" moz-do-not-send="true">https://www.opensips-solutions.com</a>
OpenSIPS Summit 2020 online
  <a shape="rect" href="https://www.opensips.org/events/Summit-2020Distributed/" rel="nofollow" target="_blank" moz-do-not-send="true">https://www.opensips.org/events/Summit-2020Distributed/</a></pre>
                      <div
                        id="gmail-m_2207947096525326095ydp80ae7aa4yiv0350315889yqt77118">
                        <div>On 9/7/20 1:51 PM, Nayani Nikeshala via
                          Users wrote:<br clear="none">
                        </div>
                        <blockquote type="cite"> </blockquote>
                      </div>
                    </div>
                    <div
                      id="gmail-m_2207947096525326095ydp80ae7aa4yiv0350315889yqt38872">
                      <div>
                        <div style="font-family:"Helvetica
                          Neue",Helvetica,Arial,sans-serif;font-size:16px">
                          <div dir="ltr">Hello,</div>
                          <div dir="ltr"><br clear="none">
                          </div>
                          <div dir="ltr">I'm trying to do a simple blind
                            call forwarding with the below script added
                            into "<span>main request routing logic".
                              (123 dials 789 and 789 is forwarded to
                              456)</span></div>
                          <div dir="ltr">
                            <div>
                              <p
                                style="margin-bottom:0.0001pt;line-height:normal;background:white"><span
style="font-size:12pt;font-family:sans-serif;color:black"><br
                                    clear="none">
                                </span><span
                                  style="font-size:10pt;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    color="#a46016">if(avp_db_load("$ru","$avp(s:callfwd)"))
                                    {</font></span></p>
                              <p
                                style="margin-bottom:0.0001pt;line-height:normal;background:white"><span
style="font-size:10pt;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    color="#a46016">$ru =
                                    $avp(s:callfwd);</font></span></p>
                              <p
                                style="margin-bottom:0.0001pt;line-height:normal;background:white"><span
style="font-size:10pt;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    color="#a46016">xlog("forwarded to:
                                    $avp(s:callfwd)");</font></span></p>
                              <p
                                style="margin-bottom:0.0001pt;line-height:normal;background:white"><span
style="font-size:10pt;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    color="#a46016">route(1);</font></span></p>
                              <p
                                style="margin-bottom:0.0001pt;line-height:normal;background:white"><span
style="font-size:10pt;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    color="#a46016">exit;</font></span></p>
                              <p
                                style="margin-bottom:0.0001pt;line-height:normal;background:white"><span
style="font-size:10pt;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    color="#a46016">}</font></span></p>
                            </div>
                          </div>
                          <div dir="ltr">
                            <div><br clear="none">
                            </div>
                            <div dir="ltr">My usr_preferences table is
                              as below. </div>
                            <div dir="ltr"><br clear="none">
                            </div>
                            <div dir="ltr">
                              <p><span
                                  style="font-size:10pt;line-height:107%;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    color="#a46016">opensips=> select
                                    * from usr_preferences;</font></span></p>
                              <p><span
                                  style="font-size:10pt;line-height:107%;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    color="#a46016"><span> </span>id |
                                    uuid | username | domain | attribute
                                    | type |<span>         </span>value<span>         
                                    </span>|<span>    </span>last_modified<span>   
                                    </span></font></span></p>
                              <p><span
                                  style="font-size:10pt;line-height:107%;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    color="#a46016">----+------+----------+--------+-----------+------+------------------------+---------------------</font></span></p>
                              <p><span
                                  style="font-size:10pt;line-height:107%;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    color="#a46016"><span>  </span>1 |<span>     
                                    </span>| 789<span>      </span>|<span>       
                                    </span>| callfwd<span>   </span>|<span>   
                                    </span>0 | <a shape="rect"
                                      moz-do-not-send="true">sip:456@xxxxxxxxxxx</a><span>  
                                    </span><span> </span>| 1900-01-01
                                    00:00:01</font></span></p>
                              <p><span
                                  style="font-size:10pt;line-height:107%;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    color="#a46016">(1 row)</font></span></p>
                              <div><span
                                  style="font-size:10pt;line-height:107%;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    color="#a46016">opensips=></font></span></div>
                              <div><span
                                  style="font-size:10pt;line-height:107%;font-family:Consolas"><br
                                    clear="none">
                                </span></div>
                              <div dir="ltr"><span
                                  style="line-height:107%;font-family:Consolas"><font
                                    style="background-color:inherit"
                                    size="3">I have added the avpops
                                    module as below. </font></span></div>
                              <div dir="ltr">
                                <p><span
                                    style="font-size:10pt;line-height:107%;font-family:Consolas"><font
                                      style="background-color:inherit"
                                      color="#a46016">#AVPOPS module</font></span></p>
                                <p><span
                                    style="font-size:10pt;line-height:107%;font-family:Consolas"><font
                                      style="background-color:inherit"
                                      color="#a46016">loadmodule
                                      "avpops.so"</font></span></p>
                                <p><span
                                    style="font-size:10pt;line-height:107%;font-family:Consolas"><font
                                      style="background-color:inherit"
                                      color="#a46016">modparam("avpops",
"db_url","postgres://opensips:xxxxxxxx@localhost/opensips")</font></span></p>
                                <div><span
                                    style="font-size:10pt;line-height:107%;font-family:Consolas"><font
                                      style="background-color:inherit"
                                      color="#a46016">modparam("avpops","avp_table","usr_preferences")</font></span></div>
                              </div>
                            </div>
                            <div dir="ltr">
                              <div dir="ltr"><span></span><br
                                  clear="none">
                              </div>
                              <div dir="ltr">Anyways, this script does
                                not do the call forwarding task. Anyone
                                could help on this please. Could there
                                be a problem of the position that I have
                                added the script in <span><span
style="color:rgb(0,0,0);font-family:Helvetica,Arial,sans-serif;font-size:16px">"</span><span
style="color:rgb(0,0,0);font-family:Helvetica,Arial,sans-serif;font-size:16px">main
                                    request routing logic". </span></span></div>
                              <div dir="ltr"><br clear="none">
                              </div>
                              <br clear="none">
                            </div>
                          </div>
                        </div>
                        <br clear="none">
                        <fieldset></fieldset>
                        <pre>_______________________________________________
Users mailing list
<a shape="rect" href="mailto:Users@lists.opensips.org" rel="nofollow" target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a>
<a shape="rect" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="nofollow" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
                        <br clear="none">
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          _______________________________________________<br>
          Users mailing list<br>
          <a href="mailto:Users@lists.opensips.org" target="_blank"
            moz-do-not-send="true">Users@lists.opensips.org</a><br>
          <a
            href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
            rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>