21 #include "asterisk/max_forwards.h"
24 #define DEFAULT_MAX_FORWARDS 20
51 static void *max_forwards_duplicate(
void *data)
58 static void max_forwards_destroy(
void *data)
64 .
type =
"mfaled-interface",
65 .duplicate = max_forwards_duplicate,
66 .destroy = max_forwards_destroy,
75 mf_datastore = ast_datastore_alloc(&max_forwards_info, NULL);
79 mf_datastore->
inheritance = DATASTORE_INHERIT_FOREVER;
81 mf = max_forwards_alloc(starting_count, starting_count);
86 mf_datastore->
data = mf;
99 mf_datastore = max_forwards_datastore_alloc(chan, DEFAULT_MAX_FORWARDS);
105 int ast_max_forwards_set(
struct ast_channel *chan,
int starting_count)
110 mf_datastore = max_forwards_datastore_find_or_alloc(chan);
115 mf = mf_datastore->
data;
126 mf_datastore = max_forwards_datastore_find_or_alloc(chan);
131 mf = mf_datastore->
data;
135 int ast_max_forwards_decrement(
struct ast_channel *chan)
140 mf_datastore = max_forwards_datastore_find_or_alloc(chan);
145 mf = mf_datastore->
data;
151 int ast_max_forwards_reset(
struct ast_channel *chan)
156 mf_datastore = max_forwards_datastore_find_or_alloc(chan);
161 mf = mf_datastore->
data;
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
Structure for a data store type.
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
General Asterisk PBX channel definitions.
#define ast_malloc(len)
A wrapper for malloc()
Channel datastore data for max forwards.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.