[SR-Users] How to run MySQL queries in Kamailio
SamyGo
govoiper at gmail.com
Thu Apr 28 19:38:02 CEST 2016
Hi Fuad,
I think you should put the db return value in am avp before using it in the
sl_send_reply.
$avp(ip) = $avp(ra=>ip)
Or whatever the syntax is. Make sure that the DB query is returning the
required value.
Also I guess just using a 302 is not enough and you need to set the proper
contact header in the reply so the calling party make use of it.
Regards,
Sammy
On Apr 28, 2016 1:18 PM, "Ahmad Fuad" <ahmad.fawad4519 at gmail.com> wrote:
> Dear Support,
>
> Kindly find below my Database Table (kamailio.ext). Column names are "ext"
> and "ip"
>
> mysql> select * from ext
> -> ;
> +------+----------------+
> | ext | ip |
> +------+----------------+
> | 202 | 192.168.55.157 |
> | 203 | 192.168.55.158 |
> | 204 | 192.168.55.159 |
> +------+----------------+
> 3 rows in set (0.00 sec)
>
> I want to run this type of queries in kamailio. I have tried following
> command but no luck so far. Although I have added following line in the
> configuration file as well. Thanks
>
> modparam("sqlops", "sqlcon", "cb=>mysql://root:123456@localhost/kamailio")
>
>
> sql_query("cb", "select ip from ext where ext=$rU", "ra");
> sl_send_reply("302","$ra");
>
>
> PLEASE HELP !!! when we see the traces using wireshark it shows internal
> error. Thanks
>
> 275.733635441 192.168.55.144 -> 192.168.55.157 SIP 431 Status: 302
> Internal Server Error |
>
> --
> Best Regards,
>
> Ahmad Fuad
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160428/c7240167/attachment.html>
More information about the sr-users
mailing list