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
00026 #include "asterisk.h"
00027
00028 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 61681 $")
00029
00030 #include <stdio.h>
00031 #include <stdlib.h>
00032
00033 #include "asterisk/module.h"
00034 #include "asterisk/channel.h"
00035 #include "asterisk/pbx.h"
00036 #include "asterisk/utils.h"
00037 #include "asterisk/stringfields.h"
00038
00039 static int depwarning = 0;
00040
00041 static int moh_read(struct ast_channel *chan, char *cmd, char *data,
00042 char *buf, size_t len)
00043 {
00044 if (!depwarning) {
00045 depwarning = 1;
00046 ast_log(LOG_WARNING, "MUSICCLASS() is deprecated; use CHANNEL(musicclass) instead.\n");
00047 }
00048
00049 ast_copy_string(buf, chan ? chan->musicclass : "", len);
00050
00051 return 0;
00052 }
00053
00054 static int moh_write(struct ast_channel *chan, char *cmd, char *data,
00055 const char *value)
00056 {
00057 if (!depwarning) {
00058 depwarning = 1;
00059 ast_log(LOG_WARNING, "MUSICCLASS() is deprecated; use CHANNEL(musicclass) instead.\n");
00060 }
00061
00062 if (chan)
00063 ast_string_field_set(chan, musicclass, value);
00064
00065 return 0;
00066 }
00067
00068 static struct ast_custom_function moh_function = {
00069 .name = "MUSICCLASS",
00070 .synopsis = "Read or Set the MusicOnHold class",
00071 .syntax = "MUSICCLASS()",
00072 .desc = "Deprecated. Use CHANNEL(musicclass) instead.\n",
00073 .read = moh_read,
00074 .write = moh_write,
00075 };
00076
00077 static int unload_module(void)
00078 {
00079 return ast_custom_function_unregister(&moh_function);
00080 }
00081
00082 static int load_module(void)
00083 {
00084 return ast_custom_function_register(&moh_function);
00085 }
00086
00087 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Music-on-hold dialplan function");