Vous êtes sur la page 1sur 72

Table of Contents

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

No code examples required.

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

Note: a new ast_aji_send function is in 1.6.0

1.4.0 example:

static int manager_jabber_send( struct mansession *s, struct message


*m )
{
struct aji_client *client = NULL;
char *id = astman_get_header(m,"ActionID");
char *jabber = astman_get_header(m,"Jabber");
char *screenname = astman_get_header(m,"ScreenName");
char *message = astman_get_header(m,"Message");
...
if (strchr(screenname, '@') && message){
--> ast_aji_send(client, screenname, message);
if (!ast_strlen_zero(id))
astman_append(s, "ActionID: %s\r\n",id);
astman_append(s, "Response: Success\r\n");
return 0;
}
...

1.6.0 example:

Exactly the same as above, except using the new function name:

--> ast_aji_send_chat(client, screenname, message);

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

No code examples required.

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:

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")) {
int ha_error = 0;
--> peer->ha = ast_append_ha(v->name, v->value, peer->ha,
&ha_error);
if (ha_error)
ast_log(LOG_ERROR, "Bad ACL entry in configuration line
%d : %s\n", v->lineno, v->value);

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:

static struct ast_config *realtime_directory(char *context)


{
struct ast_config *cfg;
struct ast_config *rtdata;
struct ast_category *cat;
struct ast_variable *var;
char *mailbox;
const char *fullname;
const char *hidefromdir;
char tmp[100];

/* Load flat file config. */


cfg = ast_config_load(VOICEMAIL_CONFIG);

/* Get realtime entries, categorized by their mailbox number


and present in the requested context */
rtdata = ast_load_realtime_multientry("voicemail", "mailbox
LIKE", "%", "context", context, NULL);

/* Context exist within the config file? If not, make one */


cat = ast_category_get(cfg, context);
if (!cat) {
--> cat = ast_category_new(context);
...

8
(continued)
1.6.0 example:

static struct ast_config *realtime_directory(char *context)


{
struct ast_config *cfg;
struct ast_config *rtdata;
struct ast_category *cat;
struct ast_variable *var;
char *mailbox;
struct ast_flags config_flags = { 0 };

/* Load flat file config. */


cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags);

/* Get realtime entries, categorized by their mailbox number


and present in the requested context */
rtdata = ast_load_realtime_multientry("voicemail", "mailbox
LIKE", "%", "context", context, NULL);

/* Context exist within the config file? If not, make one */


cat = ast_category_get(cfg, context);
if (!cat) {
--> cat = ast_category_new(context, "", 99999);
...

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

/* both code examples assume 1 is a valid channel */

1.4.0 example:
char buf[2048];
struct ast_channel *c = ast_get_channel_by_name_locked(1);

--> if(c->cdr && ast_cdr_serialize_variables(c->cdr,buf, sizeof(buf),


'=', '\n', 1))
ast_cli(fd," CDR Variables:\n%s\n",buf);

1.6.0 example:

struct ast_str *out = ast_str_create(100);


struct ast_channel *c = ast_get_channel_by_name_locked(1);

--> if (c->cdr && ast_cdr_serialize_variables(c->cdr, &out, '=',


'\n', 1))
ast_cli(a->fd," CDR Variables:\n%s\n", out->str);

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;

/* Make a new, fake channel that we'll use to masquerade in the


real one */
--> if (!(chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0,
"Parked/%s",rchan->name))) {
...

1.6.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;
char *orig_chan_name = NULL;

/* Make a new, fake channel that we'll use to masquerade in the


real one */
--> if (!(chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, rchan-
>accountcode, rchan->exten, rchan->context, rchan->amaflags, "Parked/
%s",rchan->name))) {
...

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:

if ((beepstream = ast_openstream_full(chan, "beep", chan->language,


1))) {
struct ast_frame *f;

while ((f = ast_readframe(beepstream))) {


--> ast_channel_whisper_feed(csth.spy.chan, f);
ast_frfree(f);
}

ast_closestream(beepstream);
chan->stream = NULL;
}

1.6.0 example:

if (ast_test_flag(flags, OPTION_WHISPER) && f->frametype ==


AST_FRAME_VOICE) {
ast_audiohook_lock(&csth.whisper_audiohook);
--> ast_audiohook_write_frame(&csth.whisper_audiohook,
AST_AUDIOHOOK_DIRECTION_WRITE, f);
ast_audiohook_unlock(&csth.whisper_audiohook);
ast_frfree(f);
continue;
}

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:

if (ast_test_flag(flags, OPTION_WHISPER) && csth.spy.chan)


--> ast_channel_whisper_stop(csth.spy.chan);

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:

static int __ast_rtp_reload(int reload)


{
struct ast_config *cfg;
const char *s;
struct ast_flags config_flags = { reload ?
CONFIG_FLAG_FILEUNCHANGED : 0 };

--> if ((cfg = ast_config_load("rtp.conf", config_flags)) ==


CONFIG_STATUS_FILEUNCHANGED)
return 0;
...

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:

static int handle_logger_mute(int fd, int argc, char *argv[])


{
if (argc != 2)
return RESULT_SHOWUSAGE;
--> ast_console_toggle_mute(fd);
return RESULT_SUCCESS;
}

1.6.0 example:

static char *handle_logger_mute(struct ast_cli_entry *e, int cmd,


struct ast_cli_args *a)
{
switch (cmd) {
case CLI_INIT:
e->command = "logger mute";
e->usage =
"Usage: logger mute\n"
" Disables logging output to the current console,
making it possible to\n"
" gather information without being disturbed by
scrolling lines.\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
...
if (a->argc == 3 && !strcasecmp(a->argv[2], "silent"))
--> ast_console_toggle_mute(a->fd, 1);
else
--> ast_console_toggle_mute(a->fd, 0);

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:

static int controlplayback_exec(struct ast_channel *chan, void *data)


{
int res = 0;
int skipms = 0;
long offsetms = 0;
char offsetbuf[20];
char stopkeybuf[2];
char *tmp;
struct ast_flags opts = { 0, };
char *opt_args[OPT_ARG_ARRAY_LEN];
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(filename);
AST_APP_ARG(skip);
AST_APP_ARG(fwd);
AST_APP_ARG(rev);
AST_APP_ARG(stop);
AST_APP_ARG(pause);
AST_APP_ARG(restart);
AST_APP_ARG(options);
);
skipms = args.skip ? (atoi(args.skip) ? atoi(args.skip) : 3000) :
3000;
...
if (args.options) {
ast_app_parse_options(cpb_opts, &opts, opt_args,
args.options);
if (ast_test_flag(&opts, OPT_OFFSET))
offsetms = atol(opt_args[OPT_ARG_OFFSET]);
}

--> res = ast_control_streamfile(chan, args.filename, args.fwd,


args.rev, args.stop, args.pause, args.restart, skipms, &offsetms);
...

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:

static int senddtmf_exec(struct ast_channel *chan, void *data)


{
int res = 0;
struct ast_module_user *u;
char *digits = NULL, *to = NULL;
int timeout = 250;

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;

--> res = ast_dtmf_stream(chan,NULL,digits,timeout);


ast_module_user_remove(u);
return res;
}

21
(continued)
1.6.0 example:

static int senddtmf_exec(struct ast_channel *chan, void *vdata)


{
int res = 0;
char *data;
int timeout = 0, duration = 0;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(digits);
AST_APP_ARG(timeout);
AST_APP_ARG(duration);
);

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, ...);

ast_dynamic_str_thread_set( struct ast_dynamic_str


**buf, size_t max_len, struct ast_threadstorage *ts,
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_append(struct ast_dynamic_str


**buf, size_t max_len, const char *fmt, ...);

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);

1.6.0 prototype struct ast_str *ast_str_alloca(size_t init_len);


(attributes
removed) struct ast_str *ast_str_create(size_t init_len);

struct ast_str *ast_str_thread_get(struct


ast_threadstorage *ts, size_t init_len);

23
int ast_str_set(struct ast_str **buf, size_t
max_len, const char *fmt, ...);

int ast_str_set_va(struct ast_str **buf, size_t


max_len, const char *fmt, va_list ap);

int ast_str_append(struct ast_str **buf, size_t


max_len, const char *fmt, ...);

int ast_str_append_va(struct ast_str **buf, size_t


max_len, const char *fmt, va_list ap);
Changed There were multiple string APIs in Asterisk 1.4,
explanation some with overlapping functionality. A new API
(ast_str) was written that centralizes all of the
string API code and was put in strings.h. This was
done so that complex string handling in Asterisk is
more consistent.
New types or ast_str – see page 71
variables

Generally, each function is called in the exact same way, except


using the new ast_str buffer. ast_dynamic_str_thread_append was
replaced with ast_str_append, ast_dyaamic_str_thread_set was replaced
with ast_str_set, and ast_dynamic_str_thread_build_va was replaced
with ast_build_string_va.

1.4.0 example:

AST_THREADSTORAGE(ast_cli_buf, ast_cli_buf_init);

/*! \brief Initial buffer size for resulting strings in ast_cli() */


#define AST_CLI_INITLEN 256

void ast_cli(int fd, char *fmt, ...)


{
int res;
struct ast_dynamic_str *buf;
va_list ap;

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);

/*! \brief Initial buffer size for resulting strings in ast_cli() */


#define AST_CLI_INITLEN 256

void ast_cli(int fd, const char *fmt, ...)


{
int res;
struct ast_str *buf;
va_list ap;

--> if (!(buf = ast_str_thread_get(&ast_cli_buf, AST_CLI_INITLEN)))


return;

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]);

aes_rval aes_encrypt_key192(const void *in_key,


aes_encrypt_ctx cx[1]);
aes_rval aes_encrypt_key256(const void *in_key,
aes_encrypt_ctx cx[1]);

aes_rval aes_encrypt_key(const void *in_key, int


key_len, aes_encrypt_ctx cx[1]);

aes_rval aes_encrypt(const void *in_blk, void


*out_blk, const aes_encrypt_ctx cx[1]);

aes_rval aes_decrypt_key128(const void *in_key,


aes_decrypt_ctx cx[1]);

aes_rval aes_decrypt_key192(const void *in_key,


aes_decrypt_ctx cx[1]);

aes_rval aes_decrypt_key256(const void *in_key,


aes_decrypt_ctx cx[1]);

aes_rval aes_decrypt_key(const void *in_key, int


key_len, aes_decrypt_ctx cx[1]);

aes_rval aes_decrypt(const void *in_blk, void


*out_blk, const aes_decrypt_ctx cx[1]);
1.6.0 prototype Types differ based on available libraries.
int ast_aes_encrypt_key(key, context) ;
int ast_aes_decrypt_key(key, context);
int ast_aes_encrypt(in, out, context);
int ast_aes_decrypt(in, out, context);
Changed Functions were unified without reguard to keysize.
explanation AES is implemented from the OpenSSL library if
available.
New types or none
variables

26
1.4.0 example:

static void build_enc_keys(const unsigned char *digest,


aes_encrypt_ctx *ecx, aes_decrypt_ctx *dcx)
{
--> aes_encrypt_key128(digest, ecx);
--> aes_decrypt_key128(digest, dcx);
}

static void memcpy_decrypt(unsigned char *dst, const unsigned char


*src, int len, aes_decrypt_ctx *dcx)
{
unsigned char lastblock[16] = { 0 };
int x;
while(len > 0) {
--> aes_decrypt(src, dst, dcx);
for (x=0;x<16;x++)
dst[x] ^= lastblock[x];
memcpy(lastblock, src, sizeof(lastblock));
dst += 16;
src += 16;
len -= 16;
}
}

27
(continued)
1.6.0 example:

static void build_enc_keys(const unsigned char *digest,


ast_aes_encrypt_key *ecx, ast_aes_decrypt_key *dcx)
{
--> ast_aes_encrypt_key(digest, ecx);
--> ast_aes_decrypt_key(digest, dcx);
}

static void memcpy_decrypt(unsigned char *dst, const unsigned char


*src, int len, ast_aes_decrypt_key *dcx)
{
unsigned char lastblock[16] = { 0 };
int x;
while(len > 0) {
--> ast_aes_decrypt(src, dst, dcx);
for (x=0;x<16;x++)
dst[x] ^= lastblock[x];
memcpy(lastblock, src, sizeof(lastblock));
dst += 16;
src += 16;
len -= 16;
}
}

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:

static void pbx_substitute_variables_helper_full(struct ast_channel


*c, struct varshead *headp, const char *cp1, char *cp2, int count)
{
const char *tmp, *whereweare;
int length, offset, offset2, isfunction;
char *ltmp = NULL, *var = NULL, *workspace = NULL;
char *nextvar, *nextexp, *nextthing, *vars, *vare, *cp4;
int pos, brackets, needsub, len;

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;

/* Copy that many bytes */


memcpy(cp2, whereweare, pos);

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;

/* Find the end of it */


while (brackets && *vare) {
if ((vare[0] == '$') && (vare[1] == '{')) {
needsub++;
} else if (vare[0] == '{') {
brackets++;
} else if (vare[0] == '}') {
brackets--;
} else if ((vare[0] == '$') && (vare[1] == '['))
needsub++;
vare++;
}
if (brackets)
ast_log(LOG_NOTICE, "Error in extension logic
(missing '}')\n");
len = vare - vars - 1;

/* Skip totally over variable string */


whereweare += (len + 3);

if (!var)
var = alloca(VAR_BUF_SIZE);

/* Store variable name (and truncate) */


ast_copy_string(var, vars, len + 1);

/* 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;

ast_log(LOG_DEBUG, "Function result is '%s'\n", cp4 ?


cp4 : "(null)");
} else {
/* Retrieve variable value */
pbx_retrieve_variable(c, vars, &cp4, workspace,
VAR_BUF_SIZE, headp);
}
if (cp4) {
cp4 = substring(cp4, offset, offset2, workspace,
VAR_BUF_SIZE);

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;

/* Find the end of it */


while(brackets && *vare) {
if ((vare[0] == '$') && (vare[1] == '[')) {
needsub++;
brackets++;
vare++;
} else if (vare[0] == '[') {
brackets++;
} else if (vare[0] == ']') {
brackets--;
} else if ((vare[0] == '$') && (vare[1] == '{')) {
needsub++;
vare++;
}
vare++;
}
if (brackets)
ast_log(LOG_NOTICE, "Error in extension logic
(missing ']')\n");
len = vare - vars - 1;

31
/* Skip totally over expression */
whereweare += (len + 3);

if (!var)
var = alloca(VAR_BUF_SIZE);

/* Store variable name (and truncate) */


ast_copy_string(var, vars, len + 1);

/* 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;
}

--> length = ast_expr(vars, cp2, count);

1.6.0 example:

Exactly the same as above, except using the additional chan


parameter.
--> length = ast_expr(vars, cp2, count, chan);

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:

static int function_enum(struct ast_channel *chan, char *cmd, char


*data, char *buf, size_t len)
{
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(number);
AST_APP_ARG(tech);
AST_APP_ARG(options);
AST_APP_ARG(record);
AST_APP_ARG(zone);
);
int res = 0;
char tech[80];
char dest[256] = "", tmp[2] = "";
struct ast_module_user *u;
char *s, *p;
unsigned int record = 1;
buf[0] = '\0';

AST_STANDARD_APP_ARGS(args, data);
ast_copy_string(tech, args.tech ? args.tech : "sip",
sizeof(tech));
...
record = atoi(args.record);

/* assume any '-' signs are stripped from args.number */


--> res = ast_get_enum(chan, args.number, dest, sizeof(dest), tech,
sizeof(tech), args.zone, args.options, record);

1.6.0 example:

static int enum_query_read(struct ast_channel *chan, const char *cmd,

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";

ast_copy_string(tech, args.tech ? args.tech : "sip",


sizeof(tech));

if (!(erds = ast_calloc(1, sizeof(*erds))))


goto finish;

if (!(erds->context = ast_calloc(1, sizeof(*erds->context)))) {


ast_free(erds);
goto finish;
}

erds->id = ast_atomic_fetchadd_int((int *) &enum_datastore_id,


1);
snprintf(buf, len, "%u", erds->id);

if (!(datastore =
ast_channel_datastore_alloc(&enum_result_datastore_info, buf))) {
ast_free(erds->context);
ast_free(erds);
goto finish;
}

--> ast_get_enum(chan, args.number, dest, sizeof(dest), tech,


sizeof(tech), args.zone, "", 1, &erds->context);

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

No code examples required.

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

No code examples required.

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:

struct ast_str *out = NULL;


out = ast_http_error(404, "Not Found", NULL,
"The requested URL was not found on this server.");

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:

ast_str out = ast_str_create(1024);


ast_str_append(&out, 0,
"Content-type: text/html\r\n"
"Cache-Control: no-cache;\r\n"
--> "Set-Cookie: mansession_id=\"0\"; Version=\"1\"; Max-
Age=%60\r\n\r\n");

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:

static void reschedule_precache(const char *number, const char


*context, int expiration)
{
int len;
struct dundi_precache_queue *qe, *prev;

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:

static void reschedule_precache(const char *number, const char


*context, int expiration)
{
int len;
struct dundi_precache_queue *qe, *prev;

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:

int ast_say_date_en(struct ast_channel *chan, time_t t, const char


*ints, const char *lang)
{
struct tm tm;
char fn[256];
int res = 0;
--> ast_localtime(&t,&tm,NULL);
if (!res) {
snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
res = ast_streamfile(chan, fn, lang);
...

1.6.0 example:

int ast_say_date_en(struct ast_channel *chan, time_t t, const char


*ints, const char *lang)
{
struct ast_tm tm;
struct timeval tv = { t, 0 };
char fn[256];
int res = 0;
--> ast_localtime(&tv, &tm, NULL);
if (!res) {
snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
res = ast_streamfile(chan, fn, lang);
...

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:

static int acf_strptime(struct ast_channel *chan, char *cmd, char


*data,
char *buf, size_t len)
{
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(timestring);
AST_APP_ARG(timezone);
AST_APP_ARG(format);
);
struct tm time;
memset(&time, 0, sizeof(struct tm));
...
if (!strptime(args.timestring, args.format, &time)) {
ast_log(LOG_WARNING, "C function strptime() output
nothing?!!\n");
} else {
--> snprintf(buf, len, "%d", (int) ast_mktime(&time,
args.timezone));
}
...

41
(continued)
1.6.0 example:

static int acf_strptime(struct ast_channel *chan, const char *cmd,


char *data,
char *buf, size_t len)
{
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(timestring);
AST_APP_ARG(timezone);
AST_APP_ARG(format);
union {
struct ast_tm atm;
struct tm time;
} t = { { 0, }, };
...
struct timeval tv;
/* Since strptime(3) does not check DST, force ast_mktime()
to calculate it. */
t.atm.tm_isdst = -1;
--> tv = ast_mktime(&t.atm, args.timezone);
snprintf(buf, len, "%d", (int) tv.tv_sec);
...

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;

/* assuming netsock and io have already been properly allocated */


--> ns = ast_netsock_bind(netsock, io, "0.0.0.0", 4569, tos,
socket_read, NULL)

1.6.0 example:

static unsigned int tos = 0;


static unsigned int cos = 0;
static struct ast_netsock_list *netsock;
static struct io_context *io;
struct ast_netsock *ns;

/* assuming netsock and io have already been properly allocated */


--> ns = ast_netsock_bind(netsock, io, "0.0.0.0", 4569, tos, cos,
socket_read, NULL)

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);

host = strsep(&tmp, ":");


port = tmp;

if (port && ((portno = atoi(port)) > 0))


sin.sin_port = htons(portno);

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:

static int start_monitor_action(struct mansession *s, struct message


*m)
{
struct ast_channel *c = NULL;
char *name = astman_get_header(m, "Channel");
char *fname = astman_get_header(m, "File");
char *format = astman_get_header(m, "Format");
char *mix = astman_get_header(m, "Mix");
...
--> if (ast_monitor_start(c, format, fname, 1))
...

1.6.0 example:
/* Streams recording control */
#define X_REC_IN 1
#define X_REC_OUT 2

static int start_monitor_action(struct mansession *s, const struct


message *m)
{
struct ast_channel *c = NULL;
const char *name = astman_get_header(m, "Channel");
const char *fname = astman_get_header(m, "File");
const char *format = astman_get_header(m, "Format");
const char *mix = astman_get_header(m, "Mix");
...
c = ast_get_channel_by_name_locked(name);
...
--> if (ast_monitor_start(c, format, fname, 1, X_REC_IN | X_REC_OUT))
...

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:

static int handle_request_bye(struct sip_pvt *p, struct sip_request


*req)
{
struct ast_channel *c=NULL;
int res;
struct ast_channel *bridged_to;

/* If we have an INCOMING invite that we haven't answered,


terminate that transaction */
if (p->pendinginvite && !ast_test_flag(&p->flags[0],
SIP_OUTGOING) && !ast_test_flag(req, SIP_PKT_IGNORE) && !p->owner)
transmit_response_reliable(p, "487 Request Terminated", &p-
>initreq);

p->invitestate = INV_TERMINATED;

copy_request(&p->initreq, req);
check_via(p, req);
sip_alreadygone(p);

/* Get RTCP quality before end of call */


if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY) || p->owner) {
char *audioqos, *videoqos;
if (p->rtp) {
--> audioqos = ast_rtp_get_quality(p->rtp);
...

46
(continued)
1.6.0 example:

static int acf_channel_read(struct ast_channel *chan, const char


*funcname, char *preparse, char *buf, size_t buflen)
{
struct sip_pvt *p = chan->tech_pvt;
char *all = "", *parse = ast_strdupa(preparse);
int res = 0;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(param);
AST_APP_ARG(type);
AST_APP_ARG(field);
);
AST_STANDARD_APP_ARGS(args, parse);

/* 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:

static int manager_play_dtmf(struct mansession *s, struct message *m)


{
char *channel = astman_get_header(m, "Channel");
char *digit = astman_get_header(m, "Digit");
struct ast_channel *chan =
ast_get_channel_by_name_locked(channel);

--> ast_senddigit(chan, *digit);

ast_mutex_unlock(&chan->lock);
astman_send_ack(s, m, "DTMF successfully queued");
...

1.6.0 example:

static int manager_play_dtmf(struct mansession *s, const struct


message *m)
{
const char *channel = astman_get_header(m, "Channel");
const char *digit = astman_get_header(m, "Digit");
struct ast_channel *chan =
ast_get_channel_by_name_locked(channel);

--> ast_senddigit(chan, *digit, 0);

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:

static int agent_digit_end(struct ast_channel *ast, char digit)


{
struct agent_pvt *p = ast->tech_pvt;
int res = -1;
ast_mutex_lock(&p->lock);
--> ast_senddigit_end(p->chan, digit);
ast_mutex_unlock(&p->lock);
return res;
}

1.6.0 example:

static int agent_digit_end(struct ast_channel *ast, char digit,


unsigned int duration)
{
struct agent_pvt *p = ast->tech_pvt;
ast_mutex_lock(&p->lock);
if (p->chan) {
--> ast_senddigit_end(p->chan, digit, duration);
}
ast_mutex_unlock(&p->lock);
return 0;
}

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:

static int builtin_blindtransfer(struct ast_channel *chan, struct


ast_channel *peer, struct ast_bridge_config *config, char *code, int
sense)
{
struct ast_channel *transferer;
struct ast_channel *transferee;
const char *transferer_real_context;
char xferto[256];
int res;

set_peers(&transferer, &transferee, peer, chan, sense);


transferer_real_context = real_ctx(transferer, transferee);
/* Start autoservice on chan while we talk to the originator */
ast_autoservice_start(transferee);
ast_indicate(transferee, AST_CONTROL_HOLD);

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:

static int builtin_blindtransfer(struct ast_channel *chan, struct


ast_channel *peer, struct ast_bridge_config *config, char *code, int
sense, void *data)
{
struct ast_channel *transferer;
struct ast_channel *transferee;
const char *transferer_real_context;
char xferto[256];
int res;

set_peers(&transferer, &transferee, peer, chan, sense);


transferer_real_context = real_ctx(transferer, transferee);
/* Start autoservice on chan while we talk to the originator */
ast_autoservice_start(transferee);
ast_indicate(transferee, AST_CONTROL_HOLD);

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:

static void sip_registry_destroy(struct sip_registry *reg)


{
...
--> ast_string_field_free_pools(reg);
regobjs--;
free(reg);
}

1.6.0 example:

static void sip_registry_destroy(struct sip_registry *reg)


{
...
--> ast_string_field_free_memory(reg);
regobjs--;
ast_free(reg);

Note: Previously, where string_field_free() was used to NULL out a


single string field, you now simply do string_field_set(obj, field,
NULL), instead.

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

No code examples required.

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:

static void handle_updates(struct mansession *s, struct message *m,


struct ast_config *cfg)
{
int x;
char hdr[40];
char *action, *cat, *var, *value, *match;
struct ast_category *category;
struct ast_variable *v;

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:

static enum error_type handle_updates(struct mansession *s, const


struct message *m, struct ast_config *cfg, const char *dfn)
{
int x;
char hdr[40];
const char *action, *cat, *var, *value, *match, *line;
struct ast_category *category;
struct ast_variable *v;

for (x = 0; x < 100000; x++) {


unsigned int object = 0;

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);
if (!ast_strlen_zero(value) && *value == '>') {
object = 1;
value++;
}
snprintf(hdr, sizeof(hdr), "Match-%06d", x);
match = astman_get_header(m, hdr);
snprintf(hdr, sizeof(hdr), "Line-%06d", x);
line = astman_get_header(m, hdr);
if (!strcasecmp(action, "delete")) {
if (ast_strlen_zero(cat) || (ast_strlen_zero(var) &&
ast_strlen_zero(line)))
return UNSPECIFIED_ARGUMENT;
if (!(category = ast_category_get(cfg, cat)))
return UNKNOWN_CATEGORY;
--> if (ast_variable_delete(category, var, match, line))
return FAILURE_DELETE;
}

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:

static struct ast_variable *variable_clone(const struct ast_variable


*old)
{
--> struct ast_variable *new = ast_variable_new(old->name, old-
>value);

if (new) {
new->lineno = old->lineno;
new->object = old->object;
new->blanklines = old->blanklines;
}

return new;
}

1.6.0 example:

static struct ast_variable *variable_clone(const struct ast_variable


*old)
{
--> struct ast_variable *new = ast_variable_new(old->name, old-
>value, old->file);

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:

static void handle_updates(struct mansession *s, struct message *m,


struct ast_config *cfg)
{
int x;
char hdr[40];
char *action, *cat, *var, *value, *match;
struct ast_category *category;
struct ast_variable *v;

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:

static enum error_type handle_updates(struct mansession *s, const


struct message *m, struct ast_config *cfg, const char *dfn)
{
int x;
char hdr[40];
const char *action, *cat, *var, *value, *match, *line;
struct ast_category *category;
struct ast_variable *v;

for (x = 0; x < 100000; x++) {


unsigned int object = 0;

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);
if (!ast_strlen_zero(value) && *value == '>') {
object = 1;
value++;
}
snprintf(hdr, sizeof(hdr), "Match-%06d", x);
match = astman_get_header(m, hdr);
snprintf(hdr, sizeof(hdr), "Line-%06d", x);
line = astman_get_header(m, hdr);
if (!strcasecmp(action, "update")) {
if (ast_strlen_zero(cat) || ast_strlen_zero(var))
return UNSPECIFIED_ARGUMENT;
if (!(category = ast_category_get(cfg,cat)))
return UNKNOWN_CATEGORY;
--> if (ast_variable_update(category, var, value, match,
object))
return FAILURE_UPDATE;

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

No code examples required.

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

No code examples required.

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

/* both code examples assume 1 is a valid channel */

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:

struct ast_str *out = ast_str_alloca(2048);


struct ast_channel *c = ast_get_channel_by_name_locked(1);

--> if (pbx_builtin_serialize_variables(c, &out))


ast_cli(a->fd," Variables:\n%s\n", out->str);

63
Modified data structures

Data structure struct agi_command


Location /include/asterisk/agi.h
Changed Removed: *next
Added: int dead, ast_module *mod, AST_LIST_ENTRY
list

Data structure struct aji_buddy


Location /include/asterisk/jabber.h
Changed Removed: AST_OBJCOMPONENTS
Added: AST_OBJCOMPONENTS_FULL, btype

Data structure struct aji_client


Location /include/asterisk/jabber.h
Changed Removed: context
Added: name_space

Data structure struct ast_call_feature


Location /include/asterisk/features.h
Changed Added void *data parameter to operation function
pointer.

Data structure struct ast_channel


Location /include/asterisk/channel.h
Changed ast_mutex_t lock changed to lock_dont_use

Data structure struct ast_channel_tech


Location /include/asterisk/channel.h
Changed duration parameter added to send_digit_end function
pointer

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

Data structure struct ast_custom_function


Location /include/asterisk/pbx.h
Changed Modified read and write function pointers to have
second argument const.
acflist member changed to a AST_RW_LIST entry for
convenience.

Data structure struct ast_datastore


Location /include/asterisk/channel.h
Changed Changed char *uid to const char *uid
Added: unsigned int inheritance

Data structure struct ast_dynamic_str


Location /include/asterisk/threadstorage.h
Changed Removed completely because of new string handling in
strings.h

Data structure struct ast_filestream


Location /include/asterisk/file.h
Changed Made opaque type

Data structure struct ast_format


Location /include/asterisk/file.h
Changed Made opaque type

65
Data structure struct ast_format_list
Location /include/asterisk/frame.h
Changed Removed: visible
Added: samplespersecond

Data structure struct ast_frame


Location /include/asterisk/frame.h
Changed Removed: has_timing_info
Added: flags

Data structure struct ast_ha


Location /include/asterisk/acl.h
Changed Added all members to make public:
netaddr, netmask, sense, and *next

Data structure struct ast_http_uri


Location /include/asterisk/http.h
Changed Changed next entry to use AST_LIST_ENTRY macro and
renamed entry.
Added: static_content bitfield

Data structure struct ast_lastreloadtime


Location /include/asterisk/options.h
Changed changed type to struct timeval

Data structure struct manager_action


Location /include/asterisk/manager.h
Changed manager_action pointer renamed to list and changed
explanation to use linkedlist macro.

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.

Data structure struct ast_option_flags


Location /include/asterisk/options.h
Changed Removed: AST_OPT_FLAG_PRIORITY_JUMPING

Data structure struct ast_rtp_protocol


Location /include/asterisk/rtp.h
Changed modified set_rtp_peer function pointer to also
contain parameters tpeer, codecs, and nat_active

Data structure struct ast_smdi_interface


Location /include/asterisk/smdi.h
Changed Made an opaque type.

Data structure struct ast_speech_engine


Location /include/asterisk/speech.h
Changed “new” function pointer renamed to create and added
parameter format

Data structure struct ast_speech_result


Location /include/asterisk/speech.h
Changed replaced next with list declared using
AST_LIST_ENTRY macro
Added: int nbest_num

67
Data structure struct ast_startuptime
Location /include/asterisk/options.h
Changed changed type to struct timeval

Data structure struct ast_string_field_mgr


Location /include/asterisk/stringfields.h
Changed Removed: *pool, space

Data structure struct ast_udptl_protocol


Location /include/asterisk/udptl.h
Changed renamed next to list and declared using
AST_RWLIST_ENTRY macro

Data structure struct ast_variable


Location /include/asterisk/config.h
Changed Added: char *file
struct ast_comment *trailing

Data structure char debug_filename


Location /include/asterisk/options.h
Changed removed completely

Data structure struct fsk_data


Location /include/asterisk/fskmodem.h
Changed Removed: spb
Added: parity
changed nstop to instop and made an int
changed floats x0-x2 to xi0-xi2 and made ints
removed float cont
removed: fmxv,fmyv, fmp,fsxy,fsyv,fsp,flxv,flyv,flp
removed: pcola, cola_in, cola_filtro, cola_demod
added: ints pllispbd, pllids, pllispbd2
added: mark_filter,space_filter,demod_filter
filter_struct structs

Data structure struct tone_zone


Location /include/asterisk/indications.h

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;
};

Data structure struct ast_flags


Location /include/asterisk/utils.h

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 */
};

Data structure struct ast_str


Location /include/asterisk/strings.h

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;
};

Data structure struct ast_tm


Location /include/asterisk/utils.h

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

Vous aimerez peut-être aussi