<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">I am using the avpops module to read from a mysql database to look for CFWD information for the call.  When a call is placed, it appears the command avp_db_load attempts to read the file but all values come back as NULL.  There are no messages
 in the log and of course the call does not process correctly.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">We are using a config that is exactly the same on a 4.3.4 version of kamailio using cento 6.7, with a local version of mysql  Ver 14.14 Distrib 5.1.73, that works perfectly.  When moving the code to kamailio 4.4.4 on Debian 8, Jessie, mysql 
 Ver 14.14 Distrib 5.5.53 the avp_db_load returns no information.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Here is the snippet of the code we are using.  Since I am not used to troubleshooting kamailio, please let me know what other information you need.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Kevin<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Code snippet:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">#!ifdef WITH_CFWD<o:p></o:p></p>
<p class="MsoNormal">        xlog ("$TF Call to $rU made it into WITH_CFWD in route[LOCATION] block\n");<o:p></o:p></p>
<p class="MsoNormal">        # Call forwarding is enabled, so lets do a lookup to pull all AVP's for possible call forwarding types/destinations<o:p></o:p></p>
<p class="MsoNormal">        # Below line should load all AVP's into memory from DB for the username portion of the TO: field from table usr_preferences<o:p></o:p></p>
<p class="MsoNormal">        xlog("script should load from DB usr_preferences next");<o:p></o:p></p>
<p class="MsoNormal">        avp_db_load("$tU","s/usr_preferences");<o:p></o:p></p>
<p class="MsoNormal">        # This line i simple want to print to log when the avp load is complete and what the values are (for debug purposes only and should typically be commented out)<o:p></o:p></p>
<p class="MsoNormal">        xlog("DB load should be complete");<o:p></o:p></p>
<p class="MsoNormal">        xlog("SCRIPT: $TF Call Forwarding Unconditional set to $avp(Unconditional)\n");<o:p></o:p></p>
<p class="MsoNormal">        xlog("SCRIPT: $TF Call Forwarding NoAnswer set to $avp(NoAnswer)\n");<o:p></o:p></p>
<p class="MsoNormal">        xlog("SCRIPT: $TF Call Forwarding Busy set to $avp(Busy)\n");<o:p></o:p></p>
<p class="MsoNormal">        avp_print();<o:p></o:p></p>
<p class="MsoNormal">        # Check to see if the AVP's are set and if so put them in log for logging purposes<o:p></o:p></p>
<p class="MsoNormal">        if(is_avp_set("$avp(Unconditional)"))<o:p></o:p></p>
<p class="MsoNormal">        xlog("SCRIPT: $TF Call Forwarding Unconditional set to $avp(Unconditional)\n");<o:p></o:p></p>
<p class="MsoNormal">        if(is_avp_set("$avp(NoAnswer)"))<o:p></o:p></p>
<p class="MsoNormal">        xlog("SCRIPT: $TF Call Forwarding NoAnswer set to $avp(NoAnswer)\n");<o:p></o:p></p>
<p class="MsoNormal">        if(is_avp_set("$avp(Busy)"))<o:p></o:p></p>
<p class="MsoNormal">        xlog("SCRIPT: $TF Call Forwarding Busy set to $avp(Busy)\n");<o:p></o:p></p>
<p class="MsoNormal">        t_set_fr(16000, 15000); # set fr invite timeout to 16s and no response at all to 15s to meet the specs for call fowarding no answer ringtime<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">        # If Call fowarding Unconditional is set, we need to change the dialed number and sent it off to the original users trunk from subscriber table<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">        # Check to see if unconditional is set<o:p></o:p></p>
<p class="MsoNormal">        if(is_avp_set("$avp(Unconditional)"))<o:p></o:p></p>
<p class="MsoNormal">        # Shove this call into route [PSTN_CFWD] Block<o:p></o:p></p>
<p class="MsoNormal">        route("PSTN_CFWD");<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Here is the syslog for the same snippet:<o:p></o:p></p>
<p class="MsoNormal">09:29 2017 Call to 15703771055 made it into WITH_CFWD in route[LOCATION] block<o:p></o:p></p>
<p class="MsoNormal">Mar 29 14:09:29 Limitless-Calling-Server /usr/local/sbin/kamailio[7831]: ERROR: <script>: script should load from DB usr_preferences next<o:p></o:p></p>
<p class="MsoNormal">Mar 29 14:09:29 Limitless-Calling-Server /usr/local/sbin/kamailio[7831]: ERROR: <script>: DB load should be complete<o:p></o:p></p>
<p class="MsoNormal">Mar 29 14:09:29 Limitless-Calling-Server /usr/local/sbin/kamailio[7831]: ERROR: <script>: SCRIPT: Wed Mar 29 14:09:29 2017 Call Forwarding Unconditional set to <null><o:p></o:p></p>
<p class="MsoNormal">Mar 29 14:09:29 Limitless-Calling-Server /usr/local/sbin/kamailio[7831]: ERROR: <script>: SCRIPT: Wed Mar 29 14:09:29 2017 Call Forwarding NoAnswer set to <null><o:p></o:p></p>
<p class="MsoNormal">Mar 29 14:09:29 Limitless-Calling-Server /usr/local/sbin/kamailio[7831]: ERROR: <script>: SCRIPT: Wed Mar 29 14:09:29 2017 Call Forwarding Busy set to <null><o:p></o:p></p>
<p class="MsoNormal">Mar 29 14:09:29 Limitless-Calling-Server /usr/local/sbin/kamailio[7831]: INFO: avpops [avpops_impl.c:1473]: ops_print_avp(): p=0x7f440ed86f90, flags=0x0113<o:p></o:p></p>
<p class="MsoNormal">Mar 29 14:09:29 Limitless-Calling-Server /usr/local/sbin/kamailio[7831]: INFO: avpops [avpops_impl.c:1477]: ops_print_avp(): #011#011#011name=<direction><o:p></o:p></p>
<p class="MsoNormal">Mar 29 14:09:29 Limitless-Calling-Server /usr/local/sbin/kamailio[7831]: INFO: avpops [avpops_impl.c:1485]: ops_print_avp(): #011#011#011val_str=<INCOMING / 8><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>