Sun Aug 6 15:02:24 2006

Asterisk developer's documentation


Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

app_getcpeid.c

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2005, Digium, Inc.
00005  *
00006  * Mark Spencer <markster@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 /*! \file
00020  *
00021  * \brief Get ADSI CPE ID
00022  * 
00023  * \ingroup applications
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 }

Generated on Sun Aug 6 15:02:24 2006 for Asterisk - the Open Source PBX by  doxygen 1.4.2
./usr/share/doc/asterisk-doc/api/html/app__getcpeid_8c-source.html0000644000000000000000000003506610465364140025314 0ustar rootroot00000000000000 Asterisk.org: Developer Documentation (6 Aug 2006)
Sun Aug 6 15:02:24 2006

Asterisk developer's documentation


Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

app_getcpeid.c

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2005, Digium, Inc.
00005  *
00006  * Mark Spencer <markster@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 /*! \file
00020  *
00021  * \brief Get ADSI CPE ID
00022  * 
00023  * \ingroup applications
00024  */
00025 
0