2005-07-12 22:50:45 +00:00
|
|
|
/*
|
2005-09-14 20:46:50 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
2005-07-12 22:50:45 +00:00
|
|
|
*
|
2006-02-12 04:28:58 +00:00
|
|
|
* Copyright (C) 1999 - 2006, Digium, Inc.
|
2005-07-12 22:50:45 +00:00
|
|
|
*
|
|
|
|
* Russell Bryant <russelb@clemson.edu>
|
|
|
|
*
|
2005-09-14 20:46:50 +00:00
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
|
|
|
*
|
2005-07-12 22:50:45 +00:00
|
|
|
* This program is free software, distributed under the terms of
|
2005-09-14 20:46:50 +00:00
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \file
|
2005-09-14 20:46:50 +00:00
|
|
|
*
|
2005-10-24 20:12:06 +00:00
|
|
|
* \brief Functions for reading or setting the MusicOnHold class
|
2005-12-30 21:18:06 +00:00
|
|
|
*
|
|
|
|
* \author Russell Bryant <russelb@clemson.edu>
|
2005-07-12 22:50:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "asterisk.h"
|
|
|
|
|
2006-02-11 03:14:05 +00:00
|
|
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|
|
|
|
|
|
|
#include "asterisk/module.h"
|
2005-07-12 22:50:45 +00:00
|
|
|
#include "asterisk/channel.h"
|
|
|
|
#include "asterisk/pbx.h"
|
|
|
|
#include "asterisk/utils.h"
|
2006-02-01 23:05:28 +00:00
|
|
|
#include "asterisk/stringfields.h"
|
2005-07-12 22:50:45 +00:00
|
|
|
|
2006-02-12 04:28:58 +00:00
|
|
|
static int depwarning = 0;
|
|
|
|
|
|
|
|
static int moh_read(struct ast_channel *chan, char *cmd, char *data,
|
|
|
|
char *buf, size_t len)
|
2005-07-12 22:50:45 +00:00
|
|
|
{
|
2006-02-12 04:28:58 +00:00
|
|
|
if (!depwarning) {
|
|
|
|
depwarning = 1;
|
|
|
|
ast_log(LOG_WARNING, "MUSICCLASS() is deprecated; use CHANNEL(musicclass) instead.\n");
|
|
|
|
}
|
|
|
|
|
2005-07-12 22:50:45 +00:00
|
|
|
ast_copy_string(buf, chan->musicclass, len);
|
|
|
|
|
2006-02-12 04:28:58 +00:00
|
|
|
return 0;
|
2005-07-12 22:50:45 +00:00
|
|
|
}
|
|
|
|
|
2006-02-12 04:28:58 +00:00
|
|
|
static int moh_write(struct ast_channel *chan, char *cmd, char *data,
|
|
|
|
const char *value)
|
2005-07-12 22:50:45 +00:00
|
|
|
{
|
2006-02-12 04:28:58 +00:00
|
|
|
if (!depwarning) {
|
|
|
|
depwarning = 1;
|
|
|
|
ast_log(LOG_WARNING, "MUSICCLASS() is deprecated; use CHANNEL(musicclass) instead.\n");
|
|
|
|
}
|
|
|
|
|
2006-02-01 23:05:28 +00:00
|
|
|
ast_string_field_set(chan, musicclass, value);
|
2006-02-12 04:28:58 +00:00
|
|
|
|
|
|
|
return 0;
|
2005-07-12 22:50:45 +00:00
|
|
|
}
|
|
|
|
|
2006-02-11 03:14:05 +00:00
|
|
|
static struct ast_custom_function moh_function = {
|
2005-07-12 22:50:45 +00:00
|
|
|
.name = "MUSICCLASS",
|
|
|
|
.synopsis = "Read or Set the MusicOnHold class",
|
|
|
|
.syntax = "MUSICCLASS()",
|
2006-02-12 04:28:58 +00:00
|
|
|
.desc = "Deprecated. Use CHANNEL(musicclass) instead.\n",
|
2006-02-11 03:14:05 +00:00
|
|
|
.read = moh_read,
|
|
|
|
.write = moh_write,
|
2005-07-12 22:50:45 +00:00
|
|
|
};
|
|
|
|
|
2006-02-11 03:14:05 +00:00
|
|
|
static char *tdesc = "Music-on-hold dialplan function";
|
|
|
|
|
2006-04-14 14:08:19 +00:00
|
|
|
static int unload_module(void *mod)
|
2006-02-11 03:14:05 +00:00
|
|
|
{
|
2006-02-12 04:28:58 +00:00
|
|
|
return ast_custom_function_unregister(&moh_function);
|
2006-02-11 03:14:05 +00:00
|
|
|
}
|
|
|
|
|
2006-04-14 14:08:19 +00:00
|
|
|
static int load_module(void *mod)
|
2006-02-11 03:14:05 +00:00
|
|
|
{
|
2006-02-12 04:28:58 +00:00
|
|
|
return ast_custom_function_register(&moh_function);
|
2006-02-11 03:14:05 +00:00
|
|
|
}
|
|
|
|
|
2006-04-14 14:08:19 +00:00
|
|
|
static const char *description(void)
|
2006-02-11 03:14:05 +00:00
|
|
|
{
|
|
|
|
return tdesc;
|
|
|
|
}
|
|
|
|
|
2006-04-14 14:08:19 +00:00
|
|
|
static const char *key(void)
|
2006-02-11 03:14:05 +00:00
|
|
|
{
|
|
|
|
return ASTERISK_GPL_KEY;
|
|
|
|
}
|
2006-04-14 14:08:19 +00:00
|
|
|
|
|
|
|
STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
|