Tue Aug 20 16:34:33 2013

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

Generated on 20 Aug 2013 for Asterisk - The Open Source Telephony Project by  doxygen 1.6.1