Wed Apr 6 11:29:45 2011

Asterisk developer's documentation


func_callcompletion.c

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2010, Digium, Inc.
00005  *
00006  * Mark Michelson <mmichelson@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  * \brief Call Completion Supplementary Services implementation
00021  * \author Mark Michelson <mmichelson@digium.com>
00022  */
00023 
00024 #include "asterisk.h"
00025 
00026 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 258345 $")
00027 
00028 #include "asterisk/module.h"
00029 #include "asterisk/channel.h"
00030 #include "asterisk/ccss.h"
00031 #include "asterisk/pbx.h"
00032 
00033 /*** DOCUMENTATION
00034    <function name="CALLCOMPLETION" language="en_US">
00035       <synopsis>
00036          Get or set a call completion configuration parameter for a channel.
00037       </synopsis>
00038       <syntax>
00039          <parameter name="option" required="true">
00040             <para>The allowable options are:</para>
00041             <enumlist>
00042                <enum name="cc_agent_policy" />
00043                <enum name="cc_monitor_policy" />
00044                <enum name="cc_offer_timer" />
00045                <enum name="ccnr_available_timer" />
00046                <enum name="ccbs_available_timer" />
00047                <enum name="cc_recall_timer" />
00048                <enum name="cc_max_agents" />
00049                <enum name="cc_max_monitors" />
00050                <enum name="cc_callback_macro" />
00051                <enum name="cc_agent_dialstring" />
00052             </enumlist>
00053          </parameter>
00054       </syntax>
00055       <description>
00056          <para>The CALLCOMPLETION function can be used to get or set a call
00057          completion configuration parameter for a channel. Note that setting
00058          a configuration parameter will only change the parameter for the
00059          duration of the call.
00060          
00061          For more information on call completion in Asterisk, see <filename>doc/tex/ccss.tex</filename>.
00062          For more information on call completion parameters, see <filename>configs/ccss.conf.sample</filename>.</para>
00063       </description>
00064    </function>
00065  ***/
00066 
00067 static int acf_cc_read(struct ast_channel *chan, const char *name, char *data,
00068       char *buf, size_t buf_len)
00069 {
00070    struct ast_cc_config_params *cc_params;
00071    int res;
00072 
00073    ast_channel_lock(chan);
00074    if (!(cc_params = ast_channel_get_cc_config_params(chan))) {
00075       ast_channel_unlock(chan);
00076       return -1;
00077    }
00078 
00079    res = ast_cc_get_param(cc_params, data, buf, buf_len);
00080    ast_channel_unlock(chan);
00081    return res;
00082 }
00083 
00084 static int acf_cc_write(struct ast_channel *chan, const char *cmd, char *data,
00085       const char *value)
00086 {
00087    struct ast_cc_config_params *cc_params;
00088    int res;
00089 
00090    ast_channel_lock(chan);
00091    if (!(cc_params = ast_channel_get_cc_config_params(chan))) {
00092       ast_channel_unlock(chan);
00093       return -1;
00094    }
00095 
00096    res = ast_cc_set_param(cc_params, data, value);
00097    ast_channel_unlock(chan);
00098    return res;
00099 }
00100 
00101 static struct ast_custom_function cc_function = {
00102    .name = "CALLCOMPLETION",
00103    .read = acf_cc_read,
00104    .write = acf_cc_write,
00105 };
00106 
00107 static int unload_module(void)
00108 {
00109    return ast_custom_function_unregister(&cc_function);
00110 }
00111 
00112 static int load_module(void)
00113 {
00114    return ast_custom_function_register(&cc_function) == 0 ? AST_MODULE_LOAD_SUCCESS : AST_MODULE_LOAD_DECLINE;
00115 }
00116 
00117 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Call Control Configuration Function");

Generated on Wed Apr 6 11:29:45 2011 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7