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
|
|
|
*
|
2005-09-14 20:46:50 +00:00
|
|
|
* Copyright (C) 1999 - 2005, 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"
|
|
|
|
|
|
|
|
#include "asterisk/channel.h"
|
|
|
|
#include "asterisk/pbx.h"
|
|
|
|
#include "asterisk/utils.h"
|
|
|
|
|
|
|
|
static char *function_moh_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
|
|
|
{
|
|
|
|
ast_copy_string(buf, chan->musicclass, len);
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void function_moh_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
|
|
|
|
{
|
|
|
|
ast_copy_string(chan->musicclass, value, MAX_MUSICCLASS);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef BUILTIN_FUNC
|
|
|
|
static
|
|
|
|
#endif
|
|
|
|
struct ast_custom_function moh_function = {
|
|
|
|
.name = "MUSICCLASS",
|
|
|
|
.synopsis = "Read or Set the MusicOnHold class",
|
|
|
|
.syntax = "MUSICCLASS()",
|
|
|
|
.desc = "This function will read or set the music on hold class for a channel.\n",
|
|
|
|
.read = function_moh_read,
|
|
|
|
.write = function_moh_write,
|
|
|
|
};
|
|
|
|
|