建网站有什么要求,企业英文网站建设,临海做网站公司,哈尔滨网站建设可信赖环境#xff1a;CentOS6.2 Asterisk 1.8.7.1 一、添加源文件 复制app_verbose.c为app_testApp.c 复制app_verbose.exports为app_testApp.exports 主要是修改一些标识#xff0c;编译不会出错就行#xff0c;这里列出我进行的主要修改。 1、添加头文件 #include aster… 环境CentOS6.2 Asterisk 1.8.7.1 一、添加源文件 复制app_verbose.c为app_testApp.c 复制app_verbose.exports为app_testApp.exports 主要是修改一些标识编译不会出错就行这里列出我进行的主要修改。 1、添加头文件 #include asterisk/cli.h 2、修改变量 static char *app_testApp testApp;
static char *app_testApplog testAppLog; 3、在load_module中进行注册 res | ast_register_application_xml(app_testApp, testApp_exec); 4、添加功能函数 static int testApp_exec(struct ast_channel *chan, const char *data)
{ast_verb(2,testApp_exec : %s\r\n,data);return0;
} 5、添加cli调用接口 注册commande-command testApp {print}; 调用command if (!strcasecmp(a-argv[1], print)) { testApp_exec(chan, a-argv[2]);
}6、在unload_module中进行反注册 res ast_unregister_application(app_testApp); 二、编译并安装 asterisk -rx core stop now make make install asterisk asterisk -rvvvvvvvvvvvvv 三、测试 运行asterisk -rvvvvvvvv进入CLI模式 输入core show help testApp 会输出帮助文档 输入core show help testApp something to test! 会输出something to test! 好就这些了希望对你有帮助。 转载于:https://www.cnblogs.com/MikeZhang/archive/2012/04/14/asteriskCLIAppTest20120414.html