Asterisk - The Open Source Telephony Project
21.4.1
|
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. | |
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. | |
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_container_alloc_list, ao2_ref, ast_string_field_init, and ast_refer::vars.
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.
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.
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.
int ast_refer_get_to_self | ( | const struct ast_refer * | refer | ) |
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, 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_ref, ast_strdup, OBJ_SEARCH_KEY, OBJ_UNLINK, and ast_refer::vars.
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_ref, ast_strdupa, ast_refer_tech::refer_send, and ast_refer::to.
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.
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.
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.
int ast_refer_set_to_self | ( | struct ast_refer * | refer, |
int | val | ||
) |
Set the 'to_self' value of a refer.
0 | success |
-1 | failure |
int ast_refer_set_var_outbound | ( | struct ast_refer * | refer, |
const char * | name, | ||
const char * | value | ||
) |
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_VECTOR_APPEND, ast_refer_tech::name, and refer_techs.
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_VECTOR_ELEM_CLEANUP_NOOP, AST_VECTOR_REMOVE_CMP_UNORDERED, ast_refer_tech::name, refer_tech_cmp(), and refer_techs.
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(), and ast_refer_var_unref_current().
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, and ast_refer::vars.
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.