admin管理员组文章数量:1289511
I'm trying to set up a query for routing on Kamailio so that it asks a SQL database.
This is the information that I have in the configuration file:
#!ifdef WITH_MYSQL
loadmodule "db_mysql.so"
modparam("db_mysql", "db_url", "mysql://kamailio:Pablo3090@localhost/kamailio")
#!endif
request_route {
# Handle SIP OPTIONS (Heartbeat)
if (is_method("OPTIONS")) {
sl_send_reply(200, "OK");
exit;
}
if (is_method("INVITE")) {
xlog("L_INFO", "Handling INVITE request\n");
# Query the database for the contact domain based on phone number
if (sql_query("kamailio", "SELECT contact_domain FROM sip_routing WHERE phone_number='$rU'", "result")) {
if ($dbr(result=>rows) > 0) {
$var(contact_domain) = $dbr(result=>[0][0]);
append_to_reply("Contact: <sip:$rU;tgrp=teams_trunk;trunk-context=teams_tk@$var(contact_domain);user=phone>\r\n");
} else {
xlog("L_WARN", "No routing found for $rU\n");
}
sql_query_free("result");
} else {
xlog("L_ERR", "Database query failed!\n");
}
sl_send_reply("300", "Multiple Choices");
exit;
}
}
However when I debug using
sudo kamailio -f /etc/kamailio/kamailio.cfg -DD -E
it fails with this error:
0(55419) CRITICAL: [core/cfg.y:4017]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 553, column 110: unknown command, missing loadmodule?
The line relates to
if (sql_query("kamailio", "SELECT contact_domain FROM sip_routing WHERE phone_number='$rU'", "result")) {
I have searched but I can't seem to find a fix, would anyone have any idea how to fix the query?
本文标签: SIP Kamailio SQL query failingStack Overflow
版权声明:本文标题:SIP Kamailio SQL query failing - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741478989a2381053.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论