Charset conversions.
More...
#include "asterisk.h"
#include <ctype.h>
#include <iconv.h>
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
Go to the source code of this file.
|
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Charset conversions" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
|
static const struct ast_module_info * | ast_module_info = &__mod_info |
|
static struct ast_custom_function | iconv_function |
|
Charset conversions.
- Author
- Sven Slezak sunny.nosp@m.@mez.nosp@m.zo.ne.nosp@m.t
Definition in file func_iconv.c.
◆ AST_ICONV_CAST
#define AST_ICONV_CAST void * |
Some systems define the second arg to iconv() as (const char *), while others define it as (char *). Cast it to a (void *) to suppress compiler warnings about it.
Definition at line 74 of file func_iconv.c.
Referenced by iconv_read().
◆ __reg_module()
static void __reg_module |
( |
void |
| ) |
|
|
static |
◆ __unreg_module()
static void __unreg_module |
( |
void |
| ) |
|
|
static |
◆ AST_MODULE_SELF_SYM()
◆ iconv_read()
static int iconv_read |
( |
struct ast_channel * |
chan, |
|
|
const char * |
cmd, |
|
|
char * |
arguments, |
|
|
char * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
static |
Definition at line 76 of file func_iconv.c.
References args, AST_APP_ARG, ast_debug, AST_DECLARE_APP_ARGS, AST_ICONV_CAST, ast_log, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero, errno, LOG_ERROR, LOG_WARNING, parse(), and text.
84 size_t incount, outcount =
len - 1;
88 ast_log(
LOG_WARNING,
"Syntax: ICONV(<in-charset>,<out-charset>,<text>) - missing arguments!\n");
100 incount = strlen(
args.text);
104 cd = iconv_open(
args.out_charset,
args.in_charset);
106 if (cd == (iconv_t) -1) {
107 ast_log(
LOG_ERROR,
"conversion from '%s' to '%s' not available. type 'iconv -l' in a shell to list the supported charsets.\n",
args.in_charset,
args.out_charset);
114 else if (
errno == EILSEQ)
116 else if (
errno == EINVAL)
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ast_strlen_zero(foo)
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_strdupa(s)
duplicate a string in memory from the stack
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static void parse(struct mgcp_request *req)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_APP_ARG(name)
Define an application argument.
◆ load_module()
static int load_module |
( |
void |
| ) |
|
|
static |
◆ unload_module()
static int unload_module |
( |
void |
| ) |
|
|
static |
Definition at line 133 of file func_iconv.c.
References ast_custom_function_unregister().
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static struct ast_custom_function iconv_function
◆ __mod_info
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Charset conversions" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
|
static |
◆ ast_module_info
◆ iconv_function
Initial value:= {
.name = "ICONV",
}
static int iconv_read(struct ast_channel *chan, const char *cmd, char *arguments, char *buf, size_t len)
Definition at line 128 of file func_iconv.c.