74 #define AST_ICONV_CAST void *
76 static int iconv_read(
struct ast_channel *chan,
const char *cmd,
char *
arguments,
char *buf,
size_t len)
84 size_t incount, outcount = len - 1;
87 if (ast_strlen_zero(arguments)) {
88 ast_log(LOG_WARNING,
"Syntax: ICONV(<in-charset>,<out-charset>,<text>) - missing arguments!\n");
96 ast_log(LOG_WARNING,
"Syntax: ICONV(<in-charset>,<out-charset>,<text>) %u\n", args.argc);
100 incount = strlen(args.text);
102 ast_debug(1,
"Iconv: \"%s\" %s -> %s\n", args.text, args.in_charset, args.out_charset);
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);
111 if (iconv(cd, (
AST_ICONV_CAST) &args.text, &incount, &buf, &outcount) == (
size_t) -1) {
113 ast_log(LOG_WARNING,
"Iconv: output buffer too small.\n");
114 else if (errno == EILSEQ)
115 ast_log(LOG_WARNING,
"Iconv: illegal character.\n");
116 else if (errno == EINVAL)
117 ast_log(LOG_WARNING,
"Iconv: incomplete character sequence.\n");
119 ast_log(LOG_WARNING,
"Iconv: error %d: %s.\n", errno, strerror(errno));
133 static int unload_module(
void)
138 static int load_module(
void)
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
const ast_string_field arguments
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
General Asterisk PBX channel definitions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
Data structure associated with a custom dialplan function.
#define ast_debug(level,...)
Log a DEBUG message.
Core PBX routines and definitions.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define ast_custom_function_register(acf)
Register a custom function.
#define AST_APP_ARG(name)
Define an application argument.