我正在尝试使用mongodb作为后端来设置kamailio拨号方案模块。这个配置可以使用mysql作为后端,我使用的其他模块(订阅者、位置)现在可以很好地使用mongodb。
Kamailio.cfg中的相关配置:
#!define DBURL "mongodb://localhost/kamailio"
loadmodule "dialplan.so"
modparam("dialplan", "db_url", DBURL)在我使用的主要途径中:
if (dp_translate("100")) {
xlog("dialplan: translation succeeded\n");
}
else {
xlog("dialplan: translation failed\n");
}在mongodb中,我得到了:
> db.getCollection("version").find({"table_name":"dialplan"})
{ "_id" : ObjectId("589de6af3d305445959b19d9"), "table_name" : "dialplan", "table_version" : 2 }
> db.dialplan.find()
{ "_id" : ObjectId("589dec2f3d305445959b19db"), "dpid" : 100, "pr" : 50, "match_op" : 1, "match_exp" : "^003$", "match_len" : 0, "subst_exp" : "^003$", "repl_exp" : "11111", "attrs" : "abc" }但是该模块无法应用这一点。例如:
$kamcmd dialplan.dump 100
error: 500 - Dialplan ID not matched我做错了什么?
发布于 2017-02-17 18:29:16
问题是有些值应该是整数(在dialplan.json中指定),这是我在插入时没有指定的。当我这样做的时候:
db.dialplan.insert( { "dpid" : NumberInt(100), "pr": NumberInt(1), "match_op" : NumberInt(1), "match_exp" : "^003$", "match_len" : NumberInt(0), "subst_exp" : "^003$", "repl_exp" : "11111", "attrs" : "abc" } )一切都很正常:
$kamcmd dialplan.translate 100 s:003
{
Output: 11111
Attributes: abc
}https://stackoverflow.com/questions/42203071
复制相似问题