00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <stdlib.h>
00026
00027 #include "asterisk.h"
00028
00029 #include "asterisk/channel.h"
00030 #include "asterisk/pbx.h"
00031 #include "asterisk/utils.h"
00032
00033 static char *function_moh_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
00034 {
00035 ast_copy_string(buf, chan->musicclass, len);
00036
00037 return buf;
00038 }
00039
00040 static void function_moh_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
00041 {
00042 ast_copy_string(chan->musicclass, value, sizeof(chan->musicclass));
00043 }
00044
00045 #ifndef BUILTIN_FUNC
00046 static
00047 #endif
00048 struct ast_custom_function moh_function = {
00049 .name = "MUSICCLASS",
00050 .synopsis = "Read or Set the MusicOnHold class",
00051 .syntax = "MUSICCLASS()",
00052 .desc = "This function will read or set the music on hold class for a channel.\n",
00053 .read = function_moh_read,
00054 .write = function_moh_write,
00055 };
00056