Environment:Centos6.2 + asterisk 1.8.7.1
1. Add source files
CopyApp_verbose.cIsApp_testapp.c
CopyApp_verbose.exportsIsApp_testapp.exports
It mainly modifies some identifiers and does not cause compilation errors. The main modifications I made are listed here.
1Add header files
# Include"Asterisk/CLI. H"
2Modify Variables
Static Char* App_testapp ="Testapp";Static Char* App_testapplog ="Testapplog";
3InLoad_module.
Res | = ast_register_application_xml (app_testapp, testapp_exec );
4Add function
Static IntTestapp_exec (StructAst_channel * Chan,Const Char* Data) { Ast_verb (2,"Testapp_exec:% S \ r \ n", Data ); Return0; }
5, AddCLICall Interface
RegisterCommand:E-> command ="Testapp {print }";
CallCommand:
If (! Strcasecmp (a-> argv [ 1 ], " print " ) {
Testapp_exec (Chan, a-> argv [2]);}
6InUnload_moduleFor anti-registration
Res = ast_unregister_application (app_testapp );
2. Compile and install
Asterisk-Rx "core stop now" & make install & asterisk-rvvvvvvvvvvvvv
Iii. Test
Run asterisk-rvvvvvvvv to enter CLI Mode
Input:Core show help testapp
Will output help document
Input:Core show help testapp "Something To test! "
Will output: Something to test!
Okay, that's all. I hope it will help you.