mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
major dialplan functions update
deprecate LANGUAGE() and MUSICCLASS(), in favor of CHANNEL() git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@9674 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Asterisk -- An open source telephony toolkit.
|
||||
*
|
||||
* Copyright (C) 1999 - 2005, Digium, Inc.
|
||||
* Copyright (C) 1999 - 2006, Digium, Inc.
|
||||
*
|
||||
* Russell Bryant <russelb@clemson.edu>
|
||||
*
|
||||
@@ -35,23 +35,39 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
static char *moh_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
||||
static int depwarning = 0;
|
||||
|
||||
static int moh_read(struct ast_channel *chan, char *cmd, char *data,
|
||||
char *buf, size_t len)
|
||||
{
|
||||
if (!depwarning) {
|
||||
depwarning = 1;
|
||||
ast_log(LOG_WARNING, "MUSICCLASS() is deprecated; use CHANNEL(musicclass) instead.\n");
|
||||
}
|
||||
|
||||
ast_copy_string(buf, chan->musicclass, len);
|
||||
|
||||
return buf;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void moh_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
|
||||
static int moh_write(struct ast_channel *chan, char *cmd, char *data,
|
||||
const char *value)
|
||||
{
|
||||
if (!depwarning) {
|
||||
depwarning = 1;
|
||||
ast_log(LOG_WARNING, "MUSICCLASS() is deprecated; use CHANNEL(musicclass) instead.\n");
|
||||
}
|
||||
|
||||
ast_string_field_set(chan, musicclass, value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static 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",
|
||||
.desc = "Deprecated. Use CHANNEL(musicclass) instead.\n",
|
||||
.read = moh_read,
|
||||
.write = moh_write,
|
||||
};
|
||||
@@ -60,12 +76,12 @@ static char *tdesc = "Music-on-hold dialplan function";
|
||||
|
||||
int unload_module(void)
|
||||
{
|
||||
return ast_custom_function_unregister(&moh_function);
|
||||
return ast_custom_function_unregister(&moh_function);
|
||||
}
|
||||
|
||||
int load_module(void)
|
||||
{
|
||||
return ast_custom_function_register(&moh_function);
|
||||
return ast_custom_function_register(&moh_function);
|
||||
}
|
||||
|
||||
char *description(void)
|
||||
|
Reference in New Issue
Block a user