Asterisk - The Open Source Telephony Project GIT-master-0644429
|
Out-of-call refer support. More...
Go to the source code of this file.
Data Structures | |
struct | ast_refer_tech |
A refer technology. More... | |
Functions | |
struct ast_refer * | ast_refer_alloc (void) |
Allocate a refer. More... | |
struct ast_refer * | ast_refer_destroy (struct ast_refer *refer) |
Destroy an ast_refer. More... | |
const char * | ast_refer_get_endpoint (const struct ast_refer *refer) |
Retrieve the endpoint associated with this refer. More... | |
const char * | ast_refer_get_from (const struct ast_refer *refer) |
Retrieve the source of this refer. More... | |
const char * | ast_refer_get_refer_to (const struct ast_refer *refer) |
Get the "refer-to" value of a refer. More... | |
const char * | ast_refer_get_tech (const struct ast_refer *refer) |
Retrieve the technology associated with this refer. More... | |
const char * | ast_refer_get_to (const struct ast_refer *refer) |
Retrieve the destination of this refer. More... | |
int | ast_refer_get_to_self (const struct ast_refer *refer) |
Retrieve the "to_self" value of this refer. More... | |
const char * | ast_refer_get_var (struct ast_refer *refer, const char *name) |
Get the specified variable on the refer. More... | |
char * | ast_refer_get_var_and_unlink (struct ast_refer *refer, const char *name) |
Get the specified variable on the refer and unlink it from the container of variables. More... | |
struct ast_refer * | ast_refer_ref (struct ast_refer *refer) |
Bump a refer's ref count. More... | |
int | ast_refer_send (struct ast_refer *refer) |
Send a refer directly to an endpoint. More... | |
int | ast_refer_set_endpoint (struct ast_refer *refer, const char *fmt,...) |
Set the technology's endpoint associated with this refer. More... | |
int | ast_refer_set_from (struct ast_refer *refer, const char *fmt,...) |
Set the 'from' URI of a refer. More... | |
int | ast_refer_set_refer_to (struct ast_refer *refer, const char *fmt,...) |
Set the 'refer_to' URI of a refer. More... | |
int | ast_refer_set_tech (struct ast_refer *refer, const char *fmt,...) |
Set the technology associated with this refer. More... | |
int | ast_refer_set_to (struct ast_refer *refer, const char *fmt,...) |
Set the 'to' URI of a refer. More... | |
int | ast_refer_set_to_self (struct ast_refer *refer, int val) |
Set the 'to_self' value of a refer. More... | |
int | ast_refer_set_var_outbound (struct ast_refer *refer, const char *name, const char *value) |
Set a variable on the refer being sent to a refer tech directly. More... | |
int | ast_refer_tech_register (const struct ast_refer_tech *tech) |
Register a refer technology. More... | |
int | ast_refer_tech_unregister (const struct ast_refer_tech *tech) |
Unregister a refer technology. More... | |
void | ast_refer_var_iterator_destroy (struct ast_refer_var_iterator *iter) |
Destroy a refer variable iterator. More... | |
struct ast_refer_var_iterator * | ast_refer_var_iterator_init (const struct ast_refer *refer) |
Create a new refer variable iterator. More... | |
int | ast_refer_var_iterator_next (struct ast_refer_var_iterator *iter, const char **name, const char **value) |
Get the next variable name and value. More... | |
void | ast_refer_var_unref_current (struct ast_refer_var_iterator *iter) |
Unref a refer var from inside an iterator loop. More... | |
Out-of-call refer support.
The purpose of this API is to provide support for refers that are not session based. The refers are passed into the Asterisk core to be routed through the dialplan or another interface and potentially sent back out through a refer technology that has been registered through this API.
Definition in file refer.h.
struct ast_refer * ast_refer_alloc | ( | void | ) |
Allocate a refer.
Allocate a refer for the purposes of passing it into the Asterisk core to be routed through the dialplan. This refer must be destroyed using ast_refer_destroy().
Definition at line 122 of file refer.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_container_alloc_list, ao2_ref, ast_string_field_init, NULL, refer_data_cmp_fn(), refer_destructor(), ast_refer::to_self, and ast_refer::vars.
Referenced by send_refer().
Destroy an ast_refer.
NULL | always. |
Definition at line 152 of file refer.c.
Referenced by refer_data_destroy(), and send_refer().
const char * ast_refer_get_endpoint | ( | const struct ast_refer * | refer | ) |
Retrieve the endpoint associated with this refer.
refer | The refer to get the endpoint from |
NULL | or empty string if the refer has no associated endpoint |
Definition at line 244 of file refer.c.
References ast_refer::endpoint.
const char * ast_refer_get_from | ( | const struct ast_refer * | refer | ) |
Retrieve the source of this refer.
refer | The refer to get the soure from |
NULL | or empty string if the refer has no source |
Definition at line 224 of file refer.c.
References ast_refer::from.
Referenced by refer_data_create().
const char * ast_refer_get_refer_to | ( | const struct ast_refer * | refer | ) |
Get the "refer-to" value of a refer.
refer | The refer to get the "refer-to" value from |
Definition at line 219 of file refer.c.
References ast_refer::refer_to.
Referenced by refer_data_create().
const char * ast_refer_get_tech | ( | const struct ast_refer * | refer | ) |
Retrieve the technology associated with this refer.
refer | The refer to get the technology from |
NULL | or empty string if the refer has no associated technology |
Definition at line 239 of file refer.c.
References ast_refer::tech.
const char * ast_refer_get_to | ( | const struct ast_refer * | refer | ) |
Retrieve the destination of this refer.
refer | The refer to get the destination from |
NULL | or empty string if the refer has no destination |
Definition at line 229 of file refer.c.
References ast_refer::to.
Referenced by refer_data_create(), and sip_refer_send().
int ast_refer_get_to_self | ( | const struct ast_refer * | refer | ) |
Retrieve the "to_self" value of this refer.
refer | The refer to get the destination from |
Definition at line 234 of file refer.c.
References ast_refer::to_self.
Referenced by refer_data_create().
const char * ast_refer_get_var | ( | struct ast_refer * | refer, |
const char * | name | ||
) |
Get the specified variable on the refer.
refer | |
name | Name of variable to get |
Definition at line 315 of file refer.c.
References ao2_ref, name, NULL, refer_data::refer, refer_data_find(), refer_data::value, and ast_refer::vars.
char * ast_refer_get_var_and_unlink | ( | struct ast_refer * | refer, |
const char * | name | ||
) |
Get the specified variable on the refer and unlink it from the container of variables.
refer | |
name | Name of variable to get |
Definition at line 267 of file refer.c.
References ao2_find, ao2_ref, ast_strdup, name, NULL, OBJ_SEARCH_KEY, OBJ_UNLINK, refer_data::refer, refer_data::value, and ast_refer::vars.
Referenced by refer_send().
Bump a refer's ref count.
Definition at line 146 of file refer.c.
References ao2_ref.
Referenced by refer_data_create().
int ast_refer_send | ( | struct ast_refer * | refer | ) |
Send a refer directly to an endpoint.
Regardless of the return value of this function, this function will take care of ensuring that the refer object is properly destroyed when needed.
0 | refer successfully queued to be sent out |
non-zero | failure, refer not get sent out. |
Definition at line 411 of file refer.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_log, ast_rwlock_rdlock, ast_rwlock_unlock, ast_strdupa, ast_strlen_zero(), LOG_ERROR, NULL, refer_find_by_tech_name(), ast_refer_tech::refer_send, refer_tech, refer_techs_lock, strsep(), and ast_refer::to.
Referenced by send_refer().
int ast_refer_set_endpoint | ( | struct ast_refer * | refer, |
const char * | fmt, | ||
... | |||
) |
Set the technology's endpoint associated with this refer.
0 | success |
-1 | failure |
Definition at line 208 of file refer.c.
References ast_string_field_build_va, and ast_refer::endpoint.
int ast_refer_set_from | ( | struct ast_refer * | refer, |
const char * | fmt, | ||
... | |||
) |
Set the 'from' URI of a refer.
0 | success |
-1 | failure |
Definition at line 169 of file refer.c.
References ast_string_field_build_va, and ast_refer::from.
Referenced by send_refer().
int ast_refer_set_refer_to | ( | struct ast_refer * | refer, |
const char * | fmt, | ||
... | |||
) |
Set the 'refer_to' URI of a refer.
0 | success |
-1 | failure |
Definition at line 180 of file refer.c.
References ast_string_field_build_va, and ast_refer::refer_to.
Referenced by send_refer().
int ast_refer_set_tech | ( | struct ast_refer * | refer, |
const char * | fmt, | ||
... | |||
) |
Set the technology associated with this refer.
0 | success |
-1 | failure |
Definition at line 197 of file refer.c.
References ast_string_field_build_va, and ast_refer::tech.
int ast_refer_set_to | ( | struct ast_refer * | refer, |
const char * | fmt, | ||
... | |||
) |
Set the 'to' URI of a refer.
0 | success |
-1 | failure |
Definition at line 158 of file refer.c.
References ast_string_field_build_va, and ast_refer::to.
Referenced by send_refer().
int ast_refer_set_to_self | ( | struct ast_refer * | refer, |
int | val | ||
) |
Set the 'to_self' value of a refer.
0 | success |
-1 | failure |
Definition at line 191 of file refer.c.
References ast_refer::to_self.
Referenced by send_refer().
int ast_refer_set_var_outbound | ( | struct ast_refer * | refer, |
const char * | name, | ||
const char * | value | ||
) |
Set a variable on the refer being sent to a refer tech directly.
refer | |
name | Name of variable to set |
value | Value of variable to set |
0 | success |
-1 | failure |
Definition at line 310 of file refer.c.
References name, refer_data::refer, refer_set_var_full(), and value.
Referenced by send_refer().
int ast_refer_tech_register | ( | const struct ast_refer_tech * | tech | ) |
Register a refer technology.
0 | success |
non-zero | failure |
Definition at line 446 of file refer.c.
References ast_log, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_APPEND, ast_verb, LOG_ERROR, match(), ast_refer_tech::name, refer_find_by_tech_name(), refer_techs, and refer_techs_lock.
Referenced by load_module().
int ast_refer_tech_unregister | ( | const struct ast_refer_tech * | tech | ) |
Unregister a refer technology.
0 | success |
non-zero | failure |
Definition at line 490 of file refer.c.
References ast_log, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_ELEM_CLEANUP_NOOP, AST_VECTOR_REMOVE_CMP_UNORDERED, ast_verb, LOG_ERROR, match(), ast_refer_tech::name, refer_tech_cmp(), refer_techs, and refer_techs_lock.
Referenced by load_module().
void ast_refer_var_iterator_destroy | ( | struct ast_refer_var_iterator * | iter | ) |
Destroy a refer variable iterator.
iter | Iterator to be destroyed |
Definition at line 376 of file refer.c.
References ao2_iterator_destroy(), ast_free, ast_refer_var_unref_current(), and ast_refer_var_iterator::iter.
Referenced by vars_to_headers().
struct ast_refer_var_iterator * ast_refer_var_iterator_init | ( | const struct ast_refer * | refer | ) |
Create a new refer variable iterator.
refer | A refer whose variables are to be iterated over |
Definition at line 335 of file refer.c.
References ao2_iterator_init(), ast_calloc, ast_refer_var_iterator::iter, NULL, and ast_refer::vars.
Referenced by vars_to_headers().
int ast_refer_var_iterator_next | ( | struct ast_refer_var_iterator * | iter, |
const char ** | name, | ||
const char ** | value | ||
) |
Get the next variable name and value.
iter | An iterator created with ast_refer_var_iterator_init |
name | A pointer to the name result pointer |
value | A pointer to the value result pointer |
0 | No more entries |
1 | Valid entry |
Definition at line 349 of file refer.c.
References ao2_iterator_next, ast_refer_var_iterator::current_used, ast_refer_var_iterator::iter, name, refer_data::name, refer_data::value, and value.
Referenced by vars_to_headers().
void ast_refer_var_unref_current | ( | struct ast_refer_var_iterator * | iter | ) |
Unref a refer var from inside an iterator loop.
Definition at line 370 of file refer.c.
References ao2_cleanup, ast_refer_var_iterator::current_used, and NULL.
Referenced by ast_refer_var_iterator_destroy(), and vars_to_headers().