在freeswitch中,查询坐席的时候,当place_call_ringall_callback返回0 则继续下一条的回调,当返回1则停止回调
#include <iostream>
using namespace std;
#include <sqlite3.h>
int callback(void*,int,char**,char**);
int main()
{
sqlite3* db;
int nResult = sqlite3_open("/usr/local/freeswitch/db/fifo.db",&db);
if (nResult != SQLITE_OK)
{
cout<<"打开数据库失败:"<<sqlite3_errmsg(db)<<endl;
return 0;
}
else
{
cout<<"数据库打开成功"<<endl;
}
char* errmsg;
string strSql;
strSql = "select uuid, fifo_name, originate_string, simo_count, use_count, timeout, lag, next_avail, expires, static, outbound_call_count, outbound_fail_count, hostname from fifo_outbound";
nResult = sqlite3_exec(db,strSql.c_str(),callback,NULL,&errmsg);
if (nResult != SQLITE_OK)
{
sqlite3_close(db);
cout<<errmsg<<endl;
sqlite3_free(errmsg);
return 0;
}
sqlite3_close(db);
return 0;
}
int callback(void* ,int nCount,char** pValue,char** pName)
{
cout<<"call once!!!!!1"<<endl;
return 1;
}