00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <stdlib.h>
00027 #include <stdio.h>
00028 #include <unistd.h>
00029 #include <string.h>
00030
00031 #include "asterisk.h"
00032
00033 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 7221 $")
00034
00035 #include "asterisk/lock.h"
00036 #include "asterisk/file.h"
00037 #include "asterisk/logger.h"
00038 #include "asterisk/channel.h"
00039 #include "asterisk/pbx.h"
00040 #include "asterisk/module.h"
00041 #include "asterisk/adsi.h"
00042 #include "asterisk/options.h"
00043
00044 static char *tdesc = "Get ADSI CPE ID";
00045
00046 static char *app = "GetCPEID";
00047
00048 static char *synopsis = "Get ADSI CPE ID";
00049
00050 static char *descrip =
00051 " GetCPEID: Obtains and displays ADSI CPE ID and other information in order\n"
00052 "to properly setup zapata.conf for on-hook operations.\n";
00053
00054 STANDARD_LOCAL_USER;
00055
00056 LOCAL_USER_DECL;
00057
00058 static int cpeid_setstatus(struct ast_channel *chan, char *stuff[], int voice)
00059 {
00060 int justify[5] = { ADSI_JUST_CENT, ADSI_JUST_LEFT, ADSI_JUST_LEFT, ADSI_JUST_LEFT };
00061 char *tmp[5];
00062 int x;
00063 for (x=0;x<4;x++)
00064 tmp[x] = stuff[x];
00065 tmp[4] = NULL;
00066 return adsi_print(chan, tmp, justify, voice);
00067 }
00068
00069 static int cpeid_exec(struct ast_channel *chan, void *idata)
00070 {
00071 int res=0;
00072 struct localuser *u;
0007a class="code" href="cdr_8h.html#a3">AST_CDR_FLAG_CHILD | AST_CDR_FLAG_LOCKED);
00077 }
00078
00079 static int forkcdr_exec(struct ast_channel *chan, void *data)
00080 {
00081 int res = 0;
00082 struct localuser *u;
00083
00084 if (!chan->cdr) {
00085 ast_log(LOG_WARNING, "Channel does not have a CDR\n");
00086 return 0;
00087 }
00088
00089 LOCAL_USER_ADD(u);
00090
00091 if (!ast_strlen_zero(data))
00092 ast_set2_flag(chan->cdr, strchr(data, 'v'), AST_CDR_FLAG_KEEP_VARS);
00093
00094 ast_cdr_fork(chan);
00095
00096 LOCAL_USER_REMOVE(u);
00097 return res;
00098 }
00099
00100 int unload_module(void)
00101 {
00102 int res;
00103
00104 res = ast_unregister_application(app);
00105
00106 STANDARD_HANGUP_LOCALUSERS;
00107
00108 return res;
00109 }
00110
00111 int load_module(void)
00112 {
00113 return ast_register_application(app, forkcdr_exec, synopsis, descrip);
00114 }
00115
00116 char *description(void)
00117 {
00118 return tdesc;
00119 }
00120
00121 int usecount(void)
00122 {
00123 int res;
00124 STANDARD_USECOUNT(res);
00125 return res;
00126 }
00127
00128 char *key()
00129 {
00130 return ASTERISK_GPL_KEY;
00131 }