diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-07-12 22:50:45 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-07-12 22:50:45 +0000 |
commit | 20ef59e571304695c72b24c52383f699e00fe88f (patch) | |
tree | 13ba17f15e1199303bcf3aedae1c1aadc31d1e3e /funcs | |
parent | 7b08b9a445588227e3ee819a66834bb3c89eab88 (diff) |
add a dialplan function to get and set the music on hold class
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6115 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rwxr-xr-x | funcs/Makefile | 1 | ||||
-rwxr-xr-x | funcs/func_moh.c | 45 |
2 files changed, 46 insertions, 0 deletions
diff --git a/funcs/Makefile b/funcs/Makefile index 543f23a97..274a0df6a 100755 --- a/funcs/Makefile +++ b/funcs/Makefile @@ -23,6 +23,7 @@ BUILTINS=func_md5.o \ func_db.o \ func_timeout.o \ func_language.o \ + func_moh.o STANDALONE_FUNCS=$(filter-out $(BUILTINS),$(patsubst %.c,%.o,$(wildcard func*.c))) diff --git a/funcs/func_moh.c b/funcs/func_moh.c new file mode 100755 index 000000000..f3e720b9a --- /dev/null +++ b/funcs/func_moh.c @@ -0,0 +1,45 @@ +/* + * Asterisk -- A telephony toolkit for Linux. + * + * Functions for reading or setting the MusicOnHold class + * + * Copyright (C) 2005, Digium, Inc. + * + * Russell Bryant <russelb@clemson.edu> + * + * This program is free software, distributed under the terms of + * the GNU General Public License + */ + +#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, +}; + |