Académique Documents
Professionnel Documents
Culture Documents
ast_agi_register..........................................................................................................................................4
ast_aji_send................................................................................................................................................5
ast_agi_unregister......................................................................................................................................6
ast_append_ha............................................................................................................................................7
ast_category_new.......................................................................................................................................8
ast_cdr_serialize_variables......................................................................................................................10
ast_channel_alloc.....................................................................................................................................11
ast_channel_whisper_feed.......................................................................................................................12
ast_channel_whisper_start.......................................................................................................................13
ast_channel_whisper_stop.......................................................................................................................14
ast_config_internal_load..........................................................................................................................15
ast_config_load........................................................................................................................................16
ast_console_toggle_mute.........................................................................................................................17
ast_control_streamfile..............................................................................................................................18
ast_ctime..................................................................................................................................................20
ast_ctime_r...............................................................................................................................................20
ast_dtmf_stream.......................................................................................................................................21
ast_dynamic_str_create............................................................................................................................23
ast_dynamic_str_thread_get.....................................................................................................................23
ast_dynamic_str_set.................................................................................................................................23
ast_dynamic_str_thread_set.....................................................................................................................23
ast_dynamic_str_thread_set_va...............................................................................................................23
ast_dynamic_str_append..........................................................................................................................23
ast_dynamic_str_thread_append..............................................................................................................23
ast_dynamic_str_thread_append_va........................................................................................................23
ast_dynamic_str_thread_build_va............................................................................................................23
aes_encrypt_key128 ................................................................................................................................26
aes_encrypt_key192 ................................................................................................................................26
aes_encrypt_key256 ................................................................................................................................26
aes_encrypt_key ......................................................................................................................................26
aes_encrypt ..............................................................................................................................................26
aes_decrypt_key128 ................................................................................................................................26
aes_decrypt_key192 ................................................................................................................................26
aes_decrypt_key256 ................................................................................................................................26
aes_decrypt_key ......................................................................................................................................26
aes_decrypt ..............................................................................................................................................26
ast_expr....................................................................................................................................................29
ast_get_enum...........................................................................................................................................33
ast_hint_state_changed............................................................................................................................35
ast_http_callback......................................................................................................................................36
ast_http_error...........................................................................................................................................37
ast_http_setcookie....................................................................................................................................38
AST_LIST_INSERT_BEFORE_CURRENT..........................................................................................39
AST_LIST_REMOVE_CURRENT........................................................................................................39
1
ast_localtime............................................................................................................................................40
ast_mktime...............................................................................................................................................41
ast_netsock_bind......................................................................................................................................43
ast_netsock_bindaddr...............................................................................................................................44
ast_monitor_start......................................................................................................................................45
ast_rtp_get_quality...................................................................................................................................46
ast_rtp_settos............................................................................................................................................48
ast_senddigit.............................................................................................................................................49
ast_senddigit_end.....................................................................................................................................50
ast_stream_and_wait................................................................................................................................51
ast_string_field_count..............................................................................................................................53
ast_string_field_free.................................................................................................................................53
ast_string_field_free_pools......................................................................................................................53
ast_string_field_free_all...........................................................................................................................53
ast_string_field_index..............................................................................................................................53
ast_string_field_index_free......................................................................................................................53
AST_THREADSTORAGE......................................................................................................................54
ast_tzsetwall.............................................................................................................................................55
ast_variable_delete...................................................................................................................................56
ast_variable_new......................................................................................................................................58
ast_variable_update..................................................................................................................................59
config_load_func.....................................................................................................................................61
fsk_serie...................................................................................................................................................62
pbx_builtin_serialize_variables................................................................................................................63
struct agi_command.................................................................................................................................64
struct aji_buddy........................................................................................................................................64
struct aji_client.........................................................................................................................................64
struct ast_call_feature...............................................................................................................................64
struct ast_channel.....................................................................................................................................64
struct ast_channel_tech............................................................................................................................64
struct ast_cli_entry...................................................................................................................................65
struct ast_custom_function......................................................................................................................65
struct ast_datastore...................................................................................................................................65
struct ast_dynamic_str..............................................................................................................................65
struct ast_filestream.................................................................................................................................65
struct ast_format.......................................................................................................................................65
struct ast_format_list................................................................................................................................66
struct ast_frame........................................................................................................................................66
struct ast_ha..............................................................................................................................................66
struct ast_http_uri.....................................................................................................................................66
struct ast_lastreloadtime...........................................................................................................................66
struct manager_action..............................................................................................................................66
struct message..........................................................................................................................................67
struct ast_option_flags.............................................................................................................................67
struct ast_rtp_protocol..............................................................................................................................67
struct ast_smdi_interface..........................................................................................................................67
struct ast_speech_engine..........................................................................................................................67
2
struct ast_speech_result............................................................................................................................67
struct ast_startuptime...............................................................................................................................68
struct ast_string_field_mgr......................................................................................................................68
struct ast_udptl_protocol..........................................................................................................................68
struct ast_variable....................................................................................................................................68
char debug_filename................................................................................................................................68
struct fsk_data..........................................................................................................................................68
struct tone_zone.......................................................................................................................................69
struct ast_audiohook................................................................................................................................70
struct ast_flags..........................................................................................................................................70
struct ast_rtp_quality................................................................................................................................71
struct ast_str.............................................................................................................................................71
struct ast_tcptls_session_instance ...........................................................................................................72
struct ast_tm.............................................................................................................................................72
3
Function ast_agi_register
Location /include/asterisk/agi.h
1.4.0 prototype int ast_agi_register(agi_command *cmd);
1.6.0 prototype int ast_agi_register(struct ast_module *mod,
agi_command *cmd);
Changed module parameter added to keep track which module
explanation registered the AGI command as well as the reference
count
New types or none
variables
4
Function ast_aji_send
Location /include/asterisk/jabber.h
1.4.0 prototype int ast_aji_send(struct aji_client *client, char
*address, char *message);
1.6.0 prototype int ast_aji_send_chat(struct aji_client *client,
char *address, char *message);
Changed function renamed for clarity
explanation
New types or none
variables
1.4.0 example:
1.6.0 example:
Exactly the same as above, except using the new function name:
5
Function ast_agi_unregister
Location /include/asterisk/agi.h
1.4.0 prototype void ast_agi_unregister(agi_command *cmd);
1.6.0 prototype int ast_agi_unregister(struct ast_module *mod,
agi_command *cmd);
Changed module checked to modify usecount only if mod is not
explanation the same as self
New types or none
variables
6
Function ast_append_ha
Location /include/asterisk/acl.h
1.4.0 prototype struct ast_ha *ast_append_ha(char *sense, char
*stuff, struct ast_ha *path);
1.6.0 prototype struct ast_ha *ast_append_ha(const char *sense,
const char *stuff, struct ast_ha *path, int *error);
Changed optionally can pass int pointer which will be set to
explanation 1 upon any error
New types or none
variables
1.4.0 example:
static struct sip_peer *build_peer(const char *name, struct
ast_variable *v, struct ast_variable *alt, int realtime)
{
...
if (!strcasecmp(v->name, "permit") || !strcasecmp(v->name,
"deny")) {
--> peer->ha = ast_append_ha(v->name, v->value, peer->ha);
}
1.6.0 example:
7
Function ast_category_new
Location /include/asterisk/config.h
1.4.0 prototype struct ast_category *ast_category_new(const char
*name);
1.6.0 prototype struct ast_category *ast_category_new(const char
*name, const char *in_file, int lineno);
Changed file and line numbers are used to determine exactly
explanation where to save
New types or none
variables
1.4.0 example:
8
(continued)
1.6.0 example:
9
Function ast_cdr_serialize_variables
Location /include/asterisk/cli.h
1.4.0 prototype int ast_cdr_serialize_variables(struct ast_cdr *cdr,
char *buf, size_t size, char delim, char sep, int
recur);
1.6.0 prototype int ast_cdr_serialize_variables(struct ast_cdr *cdr,
struct ast_str **buf, char delim, char sep, int
recur);
Changed ast_str is a nicer string data structure allowing
explanation support for dynamic strings
New types or ast_str – see page 71
variables
1.4.0 example:
char buf[2048];
struct ast_channel *c = ast_get_channel_by_name_locked(1);
1.6.0 example:
10
Function ast_channel_alloc
Location /include/asterisk/channel.h
1.4.0 prototype struct ast_channel *ast_channel_alloc(int
needalertpipe, int state, const char *cid_num, const
char *cid_name, const char *name_fmt, ...);
1.6.0 prototype struct ast_channel *ast_channel_alloc(int needqueue,
int state, const char *cid_num, const char
*cid_name, const char *acctcode, const char *exten,
const char *context, const int amaflag, const char
*name_fmt, ...);
Changed these channel properties are used for ast_cdr_init
explanation
New types or none
variables
1.4.0 example:
int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel
*peer, int timeout, int *extout)
{
struct ast_channel *chan;
struct ast_frame *f;
1.6.0 example:
11
Function ast_channel_whisper_feed
Location /include/asterisk/channel.h
1.4.0 prototype int ast_channel_whisper_feed(struct ast_channel
*chan, struct ast_frame *f);
1.6.0 prototype int ast_audiohook_write_frame(struct ast_audiohook
*audiohook, enum ast_audiohook_direction direction,
struct ast_frame *frame);
Changed new audiohooks API redesigned to be better, more
explanation stable, and allow easy addition of features
New types or ast_audiohook – see page 70
variables
1.4.0 example:
ast_closestream(beepstream);
chan->stream = NULL;
}
1.6.0 example:
12
Function ast_channel_whisper_start
Location /include/asterisk/channel.h
1.4.0 prototype int ast_channel_whisper_start(struct ast_channel
*chan);
1.6.0 prototype int ast_audiohook_init(struct ast_audiohook
*audiohook, enum ast_audiohook_type type, const char
*source);
Changed new audiohooks API redesigned to be better, more
explanation stable, and allow easy addition of features
New types or ast_audiohook – see page 70
variables
1.4.0 example:
if (ast_test_flag(flags, OPTION_WHISPER)) {
struct ast_filestream *beepstream;
int old_write_format = 0;
--> ast_channel_whisper_start(csth.spy.chan);
old_write_format = chan->writeformat;
...
1.6.0 example:
if (ast_test_flag(flags, OPTION_WHISPER)) {
--> ast_audiohook_init(&csth.whisper_audiohook,
AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
start_spying(spyee, spyer_name, &csth.whisper_audiohook);
}
13
Function ast_channel_whisper_stop
Location /include/asterisk/channel.h
1.4.0 prototype void ast_channel_whisper_stop(struct ast_channel
*chan);
1.6.0 prototype int ast_audiohook_detach(struct ast_audiohook
*audiohook);
int ast_audiohook_destroy(struct ast_audiohook
*audiohook);
Changed new audiohooks API redesigned to be better, more
explanation stable, and allow easy addition of features
New types or ast_audiohook – see page 70
variables
1.4.0 example:
1.6.0 example:
if (ast_test_flag(flags, OPTION_WHISPER)) {
ast_audiohook_lock(&csth.whisper_audiohook);
--> ast_audiohook_detach(&csth.whisper_audiohook);
ast_audiohook_unlock(&csth.whisper_audiohook);
--> ast_audiohook_destroy(&csth.whisper_audiohook);
}
14
Function ast_config_internal_load
Location /include/asterisk/config.h
1.4.0 prototype struct ast_config *ast_config_internal_load(const
char *configfile, struct ast_config *cfg, int
withcomments);
1.6.0 prototype struct ast_config *ast_config_internal_load(const
char *configfile, struct ast_config *cfg, struct
ast_flags flags, const char *suggested_incl_file,
const char *who_asked);
Changed ast_flags parameter now handles comment flags,
explanation suggested_include_file is used for keeping track of
destination file, and who_asked is used for config
file caching in the event the same file is loaded
for different modules
New types or ast_flags – see page 70
variables
1.4.0 example:
int read_config_maps(void)
{
struct ast_config *config, *configtmp;
struct ast_variable *v;
char *driver, *table, *database, *stringp;
clear_config_maps();
configtmp = ast_config_new();
configtmp->max_include_level = 1;
--> config = ast_config_internal_load(extconfig_conf, configtmp, 0);
1.6.0 example:
int read_config_maps(void)
{
struct ast_config *config, *configtmp;
struct ast_variable *v;
char *driver, *table, *database, *stringp, *tmp;
struct ast_flags flags = { 0 };
clear_config_maps();
configtmp = ast_config_new();
configtmp->max_include_level = 1;
--> config = ast_config_internal_load(extconfig_conf, configtmp,
flags, "", "config.c");
15
Function ast_config_load
Location /include/asterisk/config.h
1.4.0 prototype struct ast_config *ast_config_load(const char
*filename);
1.6.0 prototype #define ast_config_load(filename, flags)
ast_config_load2(filename, __FILE__, flags)
Changed flags parameter allows more flexbility in loading
explanation the config file:
CONFIG_FLAG_WITHCOMMENTS - load the file with
comments intact
CONFIG_FLAG_FILEUNCHANGED – reload only if file
mtime has changed
CONFIG_FLAG_NOCACHE - don't cache file mtime
New types or none
variables
1.4.0 example:
int ast_rtp_reload(void)
{
struct ast_config *cfg;
const char *s;
rtpstart = 5000;
rtpend = 31000;
dtmftimeout = DEFAULT_DTMF_TIMEOUT;
--> cfg = ast_config_load("rtp.conf");
...
1.6.0 example:
16
Function ast_console_toggle_mute
Location /include/asterisk/logger.h
1.4.0 prototype void ast_console_toggle_mute(int fd);
1.6.0 prototype void ast_console_toggle_mute(int fd, int silent);
Changed silent flag determines if silence info is printed to
explanation console
New types or none
variables
1.4.0 example:
1.6.0 example:
return CLI_SUCCESS;
}
17
Function ast_control_streamfile
Location /include/asterisk/app.h
1.4.0 prototype int ast_control_streamfile(struct ast_channel *chan,
const char *file, const char *fwd, const char *rev,
const char *stop, const char *pause, const char
*restart, int skipms);
1.6.0 prototype int ast_control_streamfile(struct ast_channel *chan,
const char *file, const char *fwd, const char *rev,
const char *stop, const char *pause, const char
*restart, int skipms, long *offsetms);
Changed offsetms parameter determines how far to start
explanation playing from (assuming 8kHz)
New types or none
variables
1.4.0 example:
static int controlplayback_exec(struct ast_channel *chan, void *data)
{
int res = 0, priority_jump = 0;
int skipms = 0;
struct ast_module_user *u;
char *tmp;
int argc;
char *argv[8];
enum arg_ids {
arg_file = 0,
arg_skip = 1,
arg_fwd = 2,
arg_rev = 3,
arg_stop = 4,
arg_pause = 5,
arg_restart = 6,
options = 7,
};
skipms = argv[arg_skip] ? atoi(argv[arg_skip]) : 3000;
...
--> res = ast_control_streamfile(chan, argv[arg_file], argv[arg_fwd],
argv[arg_rev], argv[arg_stop], argv[arg_pause], argv[arg_restart],
skipms);
...
18
(continued)
1.6.0 example:
19
Function ast_ctime
ast_ctime_r
Location /include/asterisk/localtime.h
1.4.0 prototype char *ast_ctime(const time_t * const timep);
char *ast_ctime_r(const time_t * const timep, char
*buf);
1.6.0 prototype int ast_strftime(char *buf, size_t len, const char
*format, const struct ast_tm *tm);
Changed function consolidation for easier usage and finer
explanation time precision
New types or ast_tm – see page 72
variables
1.4.0 example:
char date[256];
time_t now;
time(&now);
--> ast_ctime_r(now, date);
1.6.0 example:
char date[256];
struct ast_tm tm;
/* Set date format for voicemail mail */
--> ast_strftime(date, sizeof(date), "%A, %B %d, %Y at %r", &tm);
20
Function ast_dtmf_stream
Location /include/asterisk/app.h
1.4.0 prototype int ast_dtmf_stream(struct ast_channel *chan, struct
ast_channel *peer, const char *digits, int between);
1.6.0 prototype int ast_dtmf_stream(struct ast_channel *chan, struct
ast_channel *peer, const char *digits, int between,
unsigned int duration);
Changed duration parameter specifies length digit is played
explanation given that duration is longer than
AST_DEFAULT_EMULATE_DTMF_DURATION (100ms)
New types or none
variables
1.4.0 example:
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "SendDTMF requires an argument (digits
or *#aAbBcCdD)\n");
return 0;
}
u = ast_module_user_add(chan);
digits = ast_strdupa(data);
if ((to = strchr(digits,'|'))) {
*to = '\0';
to++;
timeout = atoi(to);
}
if (timeout <= 0)
timeout = 250;
21
(continued)
1.6.0 example:
if (ast_strlen_zero(vdata)) {
ast_log(LOG_WARNING, "SendDTMF requires an argument (digits
or *#aAbBcCdD)\n");
return 0;
}
data = ast_strdupa(vdata);
AST_STANDARD_APP_ARGS(args, data);
if (!ast_strlen_zero(args.timeout))
timeout = atoi(args.timeout);
if (!ast_strlen_zero(args.duration))
duration = atoi(args.duration);
--> res = ast_dtmf_stream(chan, NULL, args.digits, timeout <= 0 ? 250
: timeout, duration);
return res;
}
22
Function ast_dynamic_str_create
ast_dynamic_str_thread_get
ast_dynamic_str_set
ast_dynamic_str_thread_set
ast_dynamic_str_thread_set_va
ast_dynamic_str_append
ast_dynamic_str_thread_append
ast_dynamic_str_thread_append_va
ast_dynamic_str_thread_build_va
Location /include/asterisk/threadstorage.h
1.4.0 prototype struct ast_dynamic_str
(attributes *ast_dynamic_str_create(size_t init_len);
removed)
struct ast_dynamic_str
*ast_dynamic_str_thread_get(struct ast_threadstorage
*ts, size_t init_len);
int ast_dynamic_str_set( struct ast_dynamic_str
**buf, size_t max_len, const char *fmt, ...);
int ast_dynamic_str_thread_set_va(struct
ast_dynamic_str **buf, size_t max_len, struct
ast_threadstorage *ts, const char *fmt, va_list ap);
int ast_dynamic_str_thread_append(struct
ast_dynamic_str **buf, size_t max_len, struct
ast_threadstorage *ts, const char *fmt, ...);
int ast_dynamic_str_thread_append_va(struct
ast_dynamic_str **buf, size_t max_len, struct
ast_threadstorage *ts, const char *fmt, va_list ap);
int ast_dynamic_str_thread_build_va(struct
ast_dynamic_str **buf, size_t max_len, struct
ast_threadstorage *ts, int append, const char *fmt,
va_list ap);
23
int ast_str_set(struct ast_str **buf, size_t
max_len, const char *fmt, ...);
1.4.0 example:
AST_THREADSTORAGE(ast_cli_buf, ast_cli_buf_init);
24
--> if (!(buf = ast_dynamic_str_thread_get(&ast_cli_buf,
AST_CLI_INITLEN)))
return;
va_start(ap, fmt);
--> res = ast_dynamic_str_thread_set_va(&buf, 0, &ast_cli_buf, fmt,
ap);
va_end(ap);
if (res != AST_DYNSTR_BUILD_FAILED)
ast_carefulwrite(fd, buf->str, strlen(buf->str), 100);
}
1.6.0 example:
AST_THREADSTORAGE(ast_cli_buf);
va_start(ap, fmt);
--> res = ast_str_set_va(&buf, 0, fmt, ap);
va_end(ap);
if (res != AST_DYNSTR_BUILD_FAILED)
ast_carefulwrite(fd, buf->str, strlen(buf->str), 100);
}
25
Function aes_encrypt_key128
aes_encrypt_key192
aes_encrypt_key256
aes_encrypt_key
aes_encrypt
aes_decrypt_key128
aes_decrypt_key192
aes_decrypt_key256
aes_decrypt_key
aes_decrypt
Location /include/asterisk/aes.h
1.4.0 prototype aes_rval aes_encrypt_key128(const void *in_key,
aes_encrypt_ctx cx[1]);
26
1.4.0 example:
27
(continued)
1.6.0 example:
28
Function ast_expr
Location /include/asterisk/pval.h
1.4.0 prototype int ast_expr(char *expr, char *buf, int length);
1.6.0 prototype int ast_expr(char *expr, char *buf, int length,
struct ast_channel *chan);
Changed chan parameter is used for retrieving the values of
explanation dialplan functions
New types or none
variables
1.4.0 example:
whereweare=tmp=cp1;
while (!ast_strlen_zero(whereweare) && count) {
/* Assume we're copying the whole remaining string */
pos = strlen(whereweare);
nextvar = NULL;
nextexp = NULL;
nextthing = strchr(whereweare, '$');
if (nextthing) {
switch(nextthing[1]) {
case '{':
nextvar = nextthing;
pos = nextvar - whereweare;
break;
case '[':
nextexp = nextthing;
pos = nextexp - whereweare;
break;
}
}
if (pos) {
/* Can't copy more than 'count' bytes */
if (pos > count)
pos = count;
count -= pos;
cp2 += pos;
29
whereweare += pos;
}
if (nextvar) {
/* We have a variable. Find the start and end, and
determine if we are going to have to recursively call ourselves on
the contents */
vars = vare = nextvar + 2;
brackets = 1;
needsub = 0;
if (!var)
var = alloca(VAR_BUF_SIZE);
/* Substitute if necessary */
if (needsub) {
if (!ltmp)
ltmp = alloca(VAR_BUF_SIZE);
memset(ltmp, 0, VAR_BUF_SIZE);
pbx_substitute_variables_helper_full(c, headp, var,
ltmp, VAR_BUF_SIZE - 1);
vars = ltmp;
} else {
vars = var;
}
if (!workspace)
workspace = alloca(VAR_BUF_SIZE);
workspace[0] = '\0';
30
parse_variable_name(vars, &offset, &offset2,
&isfunction);
if (isfunction) {
/* Evaluate function */
cp4 = ast_func_read(c, vars, workspace, VAR_BUF_SIZE)
? NULL : workspace;
length = strlen(cp4);
if (length > count)
length = count;
memcpy(cp2, cp4, length);
count -= length;
cp2 += length;
}
} else if (nextexp) {
/* We have an expression. Find the start and end, and
determine if we are going to have to recursively call ourselves on
the contents */
vars = vare = nextexp + 2;
brackets = 1;
needsub = 0;
31
/* Skip totally over expression */
whereweare += (len + 3);
if (!var)
var = alloca(VAR_BUF_SIZE);
/* Substitute if necessary */
if (needsub) {
if (!ltmp)
ltmp = alloca(VAR_BUF_SIZE);
memset(ltmp, 0, VAR_BUF_SIZE);
pbx_substitute_variables_helper_full(c, headp, var,
ltmp, VAR_BUF_SIZE - 1);
vars = ltmp;
} else {
vars = var;
}
1.6.0 example:
32
Function ast_get_enum
Location /include/asterisk/enum.h
1.4.0 prototype int ast_get_enum(struct ast_channel *chan, const
char *number, char *location, int maxloc, char
*technology, int maxtech, char* suffix, char*
options, unsigned int record);
1.6.0 prototype int ast_get_enum(struct ast_channel *chan, const
char *number, char *location, int maxloc, char
*technology, int maxtech, char* suffix, char*
options, unsigned int record, struct enum_context
**argcontext);
Changed Save pointer to enum_context which is later added to
explanation the channel datastores. The stored information is
used for ensuring that interating through query
results does not result in repeated queries.
New types or none
variables
1.4.0 example:
AST_STANDARD_APP_ARGS(args, data);
ast_copy_string(tech, args.tech ? args.tech : "sip",
sizeof(tech));
...
record = atoi(args.record);
1.6.0 example:
33
char *data, char *buf, size_t len)
{
struct enum_result_datastore *erds;
struct ast_datastore *datastore;
char *parse, tech[128], dest[128];
int res = -1;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(number);
AST_APP_ARG(tech);
AST_APP_ARG(zone);
);
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
if (!args.zone)
args.zone = "e164.zone";
if (!(datastore =
ast_channel_datastore_alloc(&enum_result_datastore_info, buf))) {
ast_free(erds->context);
ast_free(erds);
goto finish;
}
34
Function ast_hint_state_changed
Location /include/asterisk/pbx.h
1.4.0 prototype void ast_hint_state_changed(const char *device);
1.6.0 prototype Made private: void handle_statechange(const char
*device)
Changed Function made private because device state handling
explanation is now event based. The device state not longer
needs to be pushed to the hint handling.
New types or none
variables
35
Function ast_http_callback
Location /include/asterisk/http.h
1.4.0 prototype typedef char *(*ast_http_callback)(struct
sockaddr_in *requestor, const char *uri, struct
ast_variable *params, int *status, char **title, int
*contentlength);
1.6.0 prototype typedef struct ast_str *(*ast_http_callback)(struct
ast_tcptls_session_instance *ser, const char *uri,
struct ast_variable *params, int *status, char
**title, int *contentlength);
Changed parameter changed to support http services over TLS
explanation
New types or ast_tcptls_session_instance – see page 72
variables
36
Function ast_http_error
Location /include/asterisk/http.h
1.4.0 prototype char *ast_http_error(int status, const char *title,
const char *extra_header, const char *text);
1.6.0 prototype struct ast_str *ast_http_error(int status, const
char *title, const char *extra_header, const char
*text);
Changed ast_str is a better string data structure allowing
explanation support for dynamic strings which uses less memory
New types or ast_str – see page 71
variables
1.4.0 example:
char *c;
c = ast_http_error(404, "Not Found", NULL, "The requested URL was not
found on this serer.");
1.6.0 example:
37
Function ast_http_setcookie
Location /include/asterisk/http.h
1.4.0 prototype char *ast_http_setcookie(const char *var, const char
*val, int expires, char *buf, size_t buflen);
1.6.0 prototype none
Changed one only has to add Set-Cookie and its parameters to
explanation the header to be sent
New types or none
variables
1.4.0 example:
char workspace[512];
size_t len = sizeof(workspace);
char cookie[128];
char *c = workspace;
...
ast_build_string(&c, &len, "Content-type: text/html\r\n");
sprintf(tmp, "%08lx", 0);
ast_build_string(&c, &len, "%s\r\n",
--> ast_http_setcookie("mansession_id", tmp, httptimeout, cookie,
sizeof(cookie)));
1.6.0 example:
38
Function AST_LIST_INSERT_BEFORE_CURRENT
(both defines) AST_LIST_REMOVE_CURRENT
Location /include/asterisk/linkedlists.h
1.4.0 prototype AST_LIST_INSERT_BEFORE_CURRENT(head, elm, field),
AST_LIST_REMOVE_CURRENT(head, field)
1.6.0 prototype AST_LIST_INSERT_BEFORE_CURRENT(elm, field),
AST_LIST_REMOVE_CURRENT(field)
Changed code improved to no longer require specifying the
explanation head
New types or none
variables
1.4.0 example:
AST_LIST_LOCK(&pcq);
AST_LIST_TRAVERSE_SAFE_BEGIN(&pcq, qe, list) {
if (!strcmp(number, qe->number) && !strcasecmp(context, qe-
>context)) {
--> AST_LIST_REMOVE_CURRENT(&pcq, list);
break;
}
}
1.6.0 example:
AST_LIST_LOCK(&pcq);
AST_LIST_TRAVERSE_SAFE_BEGIN(&pcq, qe, list) {
if (!strcmp(number, qe->number) && !strcasecmp(context, qe-
>context)) {
--> AST_LIST_REMOVE_CURRENT(list);
break;
}
}
39
Function ast_localtime
Location /include/asterisk/localtime.h
1.4.0 prototype struct tm *ast_localtime(const time_t *timep, struct
tm *p_tm, const char *zone);
1.6.0 prototype struct ast_tm *ast_localtime(const struct timeval
*timep, struct ast_tm *p_tm, const char *zone);
Changed timeval includes further precision to the
explanation microsecond
New types or ast_tm – see page 72
variables
1.4.0 example:
1.6.0 example:
40
Function ast_mktime
Location /include/asterisk/localtime.h
1.4.0 prototype time_t ast_mktime(struct tm * const tmp, const char
*zone);
1.6.0 prototype struct timeval ast_mktime(struct ast_tm * const tmp,
const char *zone);
Changed timeval includes further precision to the
explanation microsecond
New types or ast_tm – see page 72
variables
1.4.0 example:
41
(continued)
1.6.0 example:
42
Function ast_netsock_bind
Location /include/asterisk/netsock.h
1.4.0 prototype struct ast_netsock *ast_netsock_bind(struct
ast_netsock_list *list, struct io_context *ioc,
const char *bindinfo, int defaultport, int tos,
ast_io_cb callback, void *data);
1.6.0 prototype struct ast_netsock *ast_netsock_bind(struct
ast_netsock_list *list, struct io_context *ioc,
const char *bindinfo, int defaultport, int tos, int
cos, ast_io_cb callback, void *data);
Changed Added quality of service parameter to denote
explanation queueing priority to Linux kernel
New types or none
variables
1.4.0 example:
static unsigned int tos = 0;
static struct ast_netsock_list *netsock;
static struct io_context *io;
struct ast_netsock *ns;
1.6.0 example:
43
Function ast_netsock_bindaddr
Location /include/asterisk/netsock.h
1.4.0 prototype struct ast_netsock *ast_netsock_bindaddr(struct
ast_netsock_list *list, struct io_context *ioc,
struct sockaddr_in *bindaddr, int tos, ast_io_cb
callback, void *data);
1.6.0 prototype struct ast_netsock *ast_netsock_bind(struct
ast_netsock_list *list, struct io_context *ioc,
const char *bindinfo, int defaultport, int tos, int
cos, ast_io_cb callback, void *data);
Changed Added quality of service parameter to denote
explanation queueing priority to Linux kernel
New types or none
variables
1.4.0 example:
struct ast_netsock *ast_netsock_bind(struct ast_netsock_list *list,
struct io_context *ioc, const char *bindinfo, int defaultport, int
tos, ast_io_cb callback, void *data)
{
struct sockaddr_in sin;
char *tmp, *host, *port;
int portno;
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(defaultport);
tmp = ast_strdupa(bindinfo);
inet_aton(host, &sin.sin_addr);
--> return ast_netsock_bindaddr(list, ioc, &sin, tos, callback,
data);
}
1.6.0 example:
Same as above, except adding the new cos parameter. In this case, the
function would need modifying to pass cos in as a parameter as well.
--> return ast_netsock_bindaddr(list, ioc, &sin, tos, cos, callback,
data);
44
Function ast_monitor_start
Location /include/asterisk/monitor.h
1.4.0 prototype int ast_monitor_start(struct ast_channel *chan,
const char *format_spec, const char *fname_base, int
need_lock );
1.6.0 prototype int ast_monitor_start(struct ast_channel *chan,
const char *format_spec, const char *fname_base, int
need_lock, int stream_action);
Changed stream_action flag determines whether to record the
explanation input and/or output streams
New types or none
variables
1.4.0 example:
1.6.0 example:
/* Streams recording control */
#define X_REC_IN 1
#define X_REC_OUT 2
45
Function ast_rtp_get_quality
Location /include/asterisk/rtp.h
1.4.0 prototype char *ast_rtp_get_quality(struct ast_rtp *rtp);
1.6.0 prototype char *ast_rtp_get_quality(struct ast_rtp *rtp,
struct ast_rtp_quality *qual);
Changed qual parameter was added because users needed
explanation individual RTP statistics, rather than having to
extract them from a string
New types or ast_rtp_quality – see page 71
variables
1.4.0 example:
p->invitestate = INV_TERMINATED;
copy_request(&p->initreq, req);
check_via(p, req);
sip_alreadygone(p);
46
(continued)
1.6.0 example:
/* Sanity check */
if (!IS_SIP_TECH(chan->tech)) {
ast_log(LOG_ERROR, "Cannot call %s on a non-SIP channel\n",
funcname);
return 0;
}
memset(buf, 0, buflen);
if (!strcasecmp(args.param, "rtpqos")) {
struct ast_rtp_quality qos;
memset(&qos, 0, sizeof(qos));
if (ast_strlen_zero(args.type))
args.type = "audio";
if (ast_strlen_zero(args.field))
args.field = "all";
if (strcasecmp(args.type, "AUDIO") == 0) {
--> all = ast_rtp_get_quality(p->rtp, &qos);
}
...
47
Function ast_rtp_settos
Location /include/asterisk/rtp.h
1.4.0 prototype int ast_rtp_settos(struct ast_rtp *rtp, int tos);
1.6.0 prototype int ast_rtp_setqos(struct ast_rtp *rtp, int tos, int
cos, char *desc);
Changed cos parameter sets priority level, description
explanation parameter describes what tos/cos settings apply to
New types or none
variables
1.4.0 example:
if (sip_methods[intended_method].need_rtp) {
p->rtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0,
bindaddr.sin_addr);
...
ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF)
!= SIP_DTMF_INFO);
ast_rtp_setdtmfcompensate(p->rtp, ast_test_flag(&p->flags[1],
SIP_PAGE2_RFC2833_COMPENSATE));
--> ast_rtp_settos(p->rtp, global_tos_audio);
...
1.6.0 example:
if (sip_methods[intended_method].need_rtp) {
p->rtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0,
bindaddr.sin_addr);
...
--> ast_rtp_setqos(p->rtp, global_tos_audio, global_cos_audio,
"SIP RTP");
ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) ==
SIP_DTMF_RFC2833);
ast_rtp_setdtmfcompensate(p->rtp, ast_test_flag(&p->flags[1],
SIP_PAGE2_RFC2833_COMPENSATE));
...
48
Function ast_senddigit
Location /include/asterisk/channel.h
1.4.0 prototype int ast_senddigit(struct ast_channel *chan, char
digit);
1.6.0 prototype int ast_senddigit(struct ast_channel *chan, char
digit, unsigned int duration);
Changed duration parameter specifies length digit is played
explanation as long as duration is longer than
AST_DEFAULT_EMULATE_DTMF_DURATION (100ms)
New types or none
variables
1.4.0 example:
ast_mutex_unlock(&chan->lock);
astman_send_ack(s, m, "DTMF successfully queued");
...
1.6.0 example:
ast_channel_unlock(chan);
astman_send_ack(s, m, "DTMF successfully queued");
...
49
Function ast_senddigit_end
Location /include/asterisk/channel.h
1.4.0 prototype int ast_senddigit_end(struct ast_channel *chan, char
digit);
1.6.0 prototype int ast_senddigit_end(struct ast_channel *chan, char
digit, unsigned int duration);
Changed duration parameter determ length sent if supported
explanation (send_digit_end function pointer called)
New types or none
variables
1.4.0 example:
1.6.0 example:
50
Function ast_stream_and_wait
Location /include/asterisk/file.h
1.4.0 prototype int ast_stream_and_wait(struct ast_channel *chan,
const char *file, const char *language, const char
*digits);
1.6.0 prototype int ast_stream_and_wait(struct ast_channel *chan,
const char *file, const char *digits);
Changed channel structure has the language in it, no reason
explanation to pass it in
New types or none
variables
1.4.0 example:
memset(xferto, 0, sizeof(xferto));
/* Transfer */
--> res = ast_stream_and_wait(transferer, "pbx-transfer", transferer-
>language, AST_DIGIT_ANY);
...
51
(continued)
1.6.0 example:
memset(xferto, 0, sizeof(xferto));
/* Transfer */
--> res = ast_stream_and_wait(transferer, "pbx-transfer",
AST_DIGIT_ANY);
...
52
Function ast_string_field_count
(all defines) ast_string_field_free
ast_string_field_free_pools
ast_string_field_free_all
ast_string_field_index
ast_string_field_index_free
Location /include/asterisk/stringfields.h
1.4.0 prototype ast_string_field_count(x)
ast_string_field_index(x, field)
ast_string_field_index_free(x, index)
ast_string_field_free(x, field)
ast_string_field_free_pools(x)
ast_string_field_free_all(x)
1.6.0 prototype ast_string_field_free_memory(x)
ast_string_field_set(x, field, data)
Changed All the old free functions were replaced by a new
explanation single ast_string_field_free_memory function.
New types or none
variables
1.4.0 example:
1.6.0 example:
53
Function AST_THREADSTORAGE
(define)
Location /include/asterisk/threadstorage.h
1.4.0 prototype AST_THREADSTORAGE(my_buf, my_buf_init);
1.6.0 prototype AST_THREADSTORAGE(my_buf);
Changed The new define handles the initialization based on
explanation the buffer name.
New types or none
variables
1.4.0 example:
AST_THREADSTORAGE(ast_cli_buf, ast_cli_buf_init);
1.6.0 example:
AST_THREADSTORAGE(ast_cli_buf);
54
Function ast_tzsetwall
Location was /include/asterisk/localtime.h
1.4.0 prototype int ast_tzsetwall(void)
1.6.0 prototype none
Changed deemed completely unnecessary
explanation
New types or none
variables
55
Function ast_variable_delete
Location /include/asterisk/config.h
1.4.0 prototype int ast_variable_delete(struct ast_category
*category, char *variable, char *match);
1.6.0 prototype int ast_variable_delete(struct ast_category
*category, const char *variable, const char *match,
const char *line);
Changed optional line number specified will specify exact
explanation location in file which could potentially save time
searching
New types or none
variables
1.4.0 example:
for (x=0;x<100000;x++) {
snprintf(hdr, sizeof(hdr), "Action-%06d", x);
action = astman_get_header(m, hdr);
if (ast_strlen_zero(action))
break;
snprintf(hdr, sizeof(hdr), "Cat-%06d", x);
cat = astman_get_header(m, hdr);
snprintf(hdr, sizeof(hdr), "Var-%06d", x);
var = astman_get_header(m, hdr);
snprintf(hdr, sizeof(hdr), "Value-%06d", x);
value = astman_get_header(m, hdr);
snprintf(hdr, sizeof(hdr), "Match-%06d", x);
match = astman_get_header(m, hdr);
}
if (!strcasecmp(action, "delete")) {
if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) &&
(category = ast_category_get(cfg, cat)))
--> ast_variable_delete(category, var, match);
56
(continued)
1.6.0 example:
57
Function ast_variable_new
Location /include/asterisk/config.h
1.4.0 prototype struct ast_variable *ast_variable_new(const char
*name, const char *value);
1.6.0 prototype struct ast_variable *ast_variable_new(const char
*name, const char *value, const char *filename);
Changed filename used for destination file during save
explanation operation
New types or none
variables
1.4.0 example:
if (new) {
new->lineno = old->lineno;
new->object = old->object;
new->blanklines = old->blanklines;
}
return new;
}
1.6.0 example:
if (new) {
new->lineno = old->lineno;
new->object = old->object;
new->blanklines = old->blanklines;
}
return new;
}
58
Function ast_variable_update
Location /include/asterisk/config.h
1.4.0 prototype int ast_variable_update(struct ast_category
*category, char *variable, char *value, char
*match);
1.6.0 prototype int ast_variable_update(struct ast_category
*category, const char *variable, const char *value,
const char *match, unsigned int object);
Changed object parameter added to differentiate both types
explanation of config file assignment operators ( = and => )
New types or none
variables
1.4.0 example:
for (x=0;x<100000;x++) {
snprintf(hdr, sizeof(hdr), "Action-%06d", x);
action = astman_get_header(m, hdr);
if (ast_strlen_zero(action))
break;
snprintf(hdr, sizeof(hdr), "Cat-%06d", x);
cat = astman_get_header(m, hdr);
snprintf(hdr, sizeof(hdr), "Var-%06d", x);
var = astman_get_header(m, hdr);
snprintf(hdr, sizeof(hdr), "Value-%06d", x);
value = astman_get_header(m, hdr);
snprintf(hdr, sizeof(hdr), "Match-%06d", x);
match = astman_get_header(m, hdr);
if (!strcasecmp(action, "update")) {
if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) &&
(category = ast_category_get(cfg, cat)))
--> ast_variable_update(category, var, value, match);
59
(continued)
1.6.0 example:
60
Function config_load_func
Location /include/asterisk/config.h
1.4.0 prototype typedef struct ast_config *config_load_func(const
char *database, const char *table, const char
*configfile, struct ast_config *config, int
withcomments);
1.6.0 prototype typedef struct ast_config *config_load_func(const
char *database, const char *table, const char
*configfile, struct ast_config *config, struct
ast_flags flags, const char *suggested_include_file,
const char *who_asked);
Changed ast_flags parameter now handles comment flags,
explanation suggested_include_file is used for keeping track of
destination file, and who_asked is used for config
file caching
New types or ast_flags – see 70
variables
61
Function fsk_serie
Location /include/asterisk/fskmodem.h
1.4.0 prototype int fsk_serie(fsk_data *fskd, short *buffer, int
*len, int *outbyte);
1.6.0 prototype int fsk_serial(fsk_data *fskd, short *buffer, int
*len, int *outbyte);
Changed translated to English
explanation
New types or none
variables
62
Function pbx_builtin_serialize_variables
Location /include/asterisk/pbx.h
1.4.0 prototype int pbx_builtin_serialize_variables(struct
ast_channel *chan, char *buf, size_t size);
1.6.0 prototype int pbx_builtin_serialize_variables(struct
ast_channel *chan, struct ast_str **buf);
Changed ast_str is a better string data structure allowing
explanation support for dynamic strings which uses less memory
New types or ast_str – see page 71
variables
1.4.0 example:
char buf[2048];
struct ast_channel *c = ast_get_channel_by_name_locked(1);
--> if (pbx_builtin_serialize_variables(c,buf,sizeof(buf)))
ast_cli(fd," Variables:\n%s\n",buf);
1.6.0 example:
63
Modified data structures
64
Data structure struct ast_cli_entry
Location /include/asterisk/cli.h
Changed handler and generator function pointers replaced by
a single new handler function pointer
65
Data structure struct ast_format_list
Location /include/asterisk/frame.h
Changed Removed: visible
Added: samplespersecond
66
Data structure struct message
Location /include/asterisk/manager.h
Changed headers member is now a pointer to const strings
instead of allocating the entire string list inside
the struct.
67
Data structure struct ast_startuptime
Location /include/asterisk/options.h
Changed changed type to struct timeval
68
Changed Renamed next to list and declared using
AST_RWLIST_ENTRY macro.
69
New data structures
Data structure struct ast_audiohook
Location /include/asterisk/audiohook.h
struct ast_audiohook {
ast_mutex_t lock;
ast_cond_t trigger;
enum ast_audiohook_type type;
enum ast_audiohook_status status;
const char *source;
unsigned int flags;
struct ast_slinfactory read_factory;
struct ast_slinfactory write_factory;
struct timeval read_time;
struct timeval write_time;
int format;
struct ast_trans_pvt *trans_pvt;
ast_audiohook_manipulate_callback manipulate_callback;
struct ast_audiohook_options options;
AST_LIST_ENTRY(ast_audiohook) list;
};
struct ast_flags {
unsigned int flags;
};
70
Data structure struct ast_rtp_quality
Location /include/asterisk/rtp.h
struct ast_rtp_quality {
unsigned int local_ssrc; /* Our SSRC */
unsigned int local_lostpackets; /* Our lost packets */
double local_jitter; /* Our calculated jitter */
unsigned int local_count; /* Number of received packets */
unsigned int remote_ssrc; /* Their SSRC */
unsigned int remote_lostpackets; /* Their lost packets */
double remote_jitter; /* Their reported jitter */
unsigned int remote_count; /* Number of sent packets */
double rtt; /* Round trip time */
};
struct ast_str {
size_t len; /*!< The current maximum length of the string */
size_t used; /*!< Amount of space used */
struct ast_threadstorage *ts; /*!< What kind of storage is this
? */
#define DS_MALLOC ((struct ast_threadstorage *)1)
#define DS_ALLOCA ((struct ast_threadstorage *)2)
#define DS_STATIC ((struct ast_threadstorage *)3) /* not supported
yet */
char str[0]; /*!< The string buffer */
};
71
Data structure struct ast_tcptls_session_instance
Location /include/asterisk/tcptls.h
struct ast_tcptls_session_instance {
FILE *f; /* fopen/funopen result */
int fd; /* the socket returned by accept() */
SSL *ssl; /* ssl state */
int client;
struct sockaddr_in requestor;
struct server_args *parent;
};
struct ast_tm {
int tm_sec; /*!< Seconds. [0-60] (1 leap second) */
int tm_min; /*!< Minutes. [0-59] */
int tm_hour; /*!< Hours. [0-23] */
int tm_mday; /*!< Day. [1-31] */
int tm_mon; /*!< Month. [0-11] */
int tm_year; /*!< Year - 1900. */
int tm_wday; /*!< Day of week. [0-6] */
int tm_yday; /*!< Days in year.[0-365] */
int tm_isdst; /*!< DST. [-1/0/1]*/
long int tm_gmtoff; /*!< Seconds east of UTC. */
char *tm_zone; /*!< Timezone abbreviation. */
/* NOTE: do NOT reorder this final item. The order needs to
remain compatible with struct tm */
int tm_usec; /*!< microseconds */
};
72