[SR-Users] Problems with avp_db_load

Kevin Bushong kbushong at carnegietechnologies.com
Wed Mar 29 20:48:56 CEST 2017


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.


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.

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.

Thanks,

Kevin


Code snippet:

#!ifdef WITH_CFWD
        xlog ("$TF Call to $rU made it into WITH_CFWD in route[LOCATION] block\n");
        # Call forwarding is enabled, so lets do a lookup to pull all AVP's for possible call forwarding types/destinations
        # Below line should load all AVP's into memory from DB for the username portion of the TO: field from table usr_preferences
        xlog("script should load from DB usr_preferences next");
        avp_db_load("$tU","s/usr_preferences");
        # 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)
        xlog("DB load should be complete");
        xlog("SCRIPT: $TF Call Forwarding Unconditional set to $avp(Unconditional)\n");
        xlog("SCRIPT: $TF Call Forwarding NoAnswer set to $avp(NoAnswer)\n");
        xlog("SCRIPT: $TF Call Forwarding Busy set to $avp(Busy)\n");
        avp_print();
        # Check to see if the AVP's are set and if so put them in log for logging purposes
        if(is_avp_set("$avp(Unconditional)"))
        xlog("SCRIPT: $TF Call Forwarding Unconditional set to $avp(Unconditional)\n");
        if(is_avp_set("$avp(NoAnswer)"))
        xlog("SCRIPT: $TF Call Forwarding NoAnswer set to $avp(NoAnswer)\n");
        if(is_avp_set("$avp(Busy)"))
        xlog("SCRIPT: $TF Call Forwarding Busy set to $avp(Busy)\n");
        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


        # 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

        # Check to see if unconditional is set
        if(is_avp_set("$avp(Unconditional)"))
        # Shove this call into route [PSTN_CFWD] Block
        route("PSTN_CFWD");


Here is the syslog for the same snippet:
09:29 2017 Call to 15703771055 made it into WITH_CFWD in route[LOCATION] block
Mar 29 14:09:29 Limitless-Calling-Server /usr/local/sbin/kamailio[7831]: ERROR: <script>: script should load from DB usr_preferences next
Mar 29 14:09:29 Limitless-Calling-Server /usr/local/sbin/kamailio[7831]: ERROR: <script>: DB load should be complete
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>
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>
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>
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
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>
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>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20170329/bf470741/attachment.html>


More information about the sr-users mailing list