[OpenSIPS-Users] Issues with avp_db_query in opensips 2.2.2

Liviu Chircu liviu at opensips.org
Mon Jan 16 11:39:07 EST 2017


Hi, Ahmed!

You actually found a script syntax bug. Here is a workaround for it, 
until a fix is available:

avp_db_query("SELECT Outpulse_number,setid FROM Prefix_data where 
Program_prefix = $var(pg_prefix)", "$avp(outpluse),$avp(trunkid)");

$var(res) = $retcode; # or you can just use $retcode!

You may track the progress for this issue here [1].

Regards,

[1]: https://github.com/OpenSIPS/opensips/issues/1022

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 16.01.2017 17:20, Ahmed Munir wrote:
> Hi,
>
> I've currently upgraded opensips from 1.8.8 to 2.2.2. The issue 
> currently facing after upgrade as getting error messages and failed to 
> start to opensips service when using avp_db_query () function like;
>
> $var(res) = avp_db_query("SELECT Outpulse_number,setid FROM
> Prefix_data where Program_prefix = $var(pg_prefix)", "$avp(outpluse),
> $avp(trunkid)");
>
> Errors below;
>
> ERROR:avpops:__fixup_db_query_avp: no db url defined to be used by
> this function
> ERROR:core:fix_actions: fixing failed (code=-6) at
> //etc/opensips/opensips.cfg:207
> CRITICAL:core:fix_expr: fix_actions error
> ERROR:core:main: failed to fix configuration with err code -6
>
>
> Whereas, variable $var(res) is storing return code after executing DB 
> query.
>
> If I add this line: avp_db_query("SELECT 1"); above to my $var(res) db
> query, opensips service starts successfully and don't see the errors.
>
> Please advise the steps do I need to take to fix above issues.
>
> BTW, declared avpops 'db_url' in module parameters.
>
> modparam("dispatcher|avpops","db_url","mysql://opensips:opensipsrw@localhost/opensips")
>
> -- 
> Regards,
>
> Ahmed Munir Chohan
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20170116/91eeb395/attachment.html>


More information about the Users mailing list