Let's also include aclocal.m4
[asterisk-bristuff.git] / funcs / func_moh.c
blob86701b161f35e4e51f5debe5c2694907613d3ad2
1 /*
2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2006, Digium, Inc.
6 * Russell Bryant <russelb@clemson.edu>
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
19 /*! \file
21 * \brief Functions for reading or setting the MusicOnHold class
23 * \author Russell Bryant <russelb@clemson.edu>
26 #include "asterisk.h"
28 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
30 #include <stdio.h>
31 #include <stdlib.h>
33 #include "asterisk/module.h"
34 #include "asterisk/channel.h"
35 #include "asterisk/pbx.h"
36 #include "asterisk/utils.h"
37 #include "asterisk/stringfields.h"
39 static int depwarning = 0;
41 static int moh_read(struct ast_channel *chan, char *cmd, char *data,
42 char *buf, size_t len)
44 if (!depwarning) {
45 depwarning = 1;
46 ast_log(LOG_WARNING, "MUSICCLASS() is deprecated; use CHANNEL(musicclass) instead.\n");
49 ast_copy_string(buf, chan ? chan->musicclass : "", len);
51 return 0;
54 static int moh_write(struct ast_channel *chan, char *cmd, char *data,
55 const char *value)
57 if (!depwarning) {
58 depwarning = 1;
59 ast_log(LOG_WARNING, "MUSICCLASS() is deprecated; use CHANNEL(musicclass) instead.\n");
62 if (chan)
63 ast_string_field_set(chan, musicclass, value);
65 return 0;
68 static struct ast_custom_function moh_function = {
69 .name = "MUSICCLASS",
70 .synopsis = "Read or Set the MusicOnHold class",
71 .syntax = "MUSICCLASS()",
72 .desc = "Deprecated. Use CHANNEL(musicclass) instead.\n",
73 .read = moh_read,
74 .write = moh_write,
77 static int unload_module(void)
79 return ast_custom_function_unregister(&moh_function);
82 static int load_module(void)
84 return ast_custom_function_register(&moh_function);
87 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Music-on-hold dialplan function");