2017-02-13 1 views
0

mongodb를 백엔드로 사용하여 kamailio dialplan 모듈을 설정하려고합니다. 설정은 mysql을 백엔드로 사용했고, 내가 사용하는 다른 모듈 (subscriber, location)은 이제 mongodb와 잘 동작한다.mongodb와 kamailio dialplan 모듈 사용

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 

내가 뭘 잘못하고 있니?

답변

0

일부 값은 dialplan.json에 지정된대로 ints이어야하며 삽입시 지정하지 않았습니다. 내가 할 때 :

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 
}