Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Call Completion Supplementary Services API. More...
Go to the source code of this file.
Data Structures | |
struct | ast_cc_agent |
struct | ast_cc_agent_callbacks |
struct | ast_cc_interface |
Structure with information about an outbound interface. More... | |
struct | ast_cc_monitor |
struct | ast_cc_monitor_callbacks |
Callbacks defined by CC monitors. More... | |
Macros | |
#define | ast_cc_config_params_init() __ast_cc_config_params_init(__FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate and initialize an ast_cc_config_params structure. More... | |
#define | AST_CC_GENERIC_MONITOR_TYPE "generic" |
Typedefs | |
typedef void(* | ast_cc_callback_fn) (struct ast_channel *chan, struct ast_cc_config_params *cc_params, const char *monitor_type, const char *const device_name, const char *const dialstring, void *private_data) |
Callback made from ast_cc_callback for certain channel types. More... | |
Enumerations | |
enum | ast_cc_agent_flags { AST_CC_AGENT_SKIP_OFFER = (1 << 0) } |
agent flags that can alter core behavior More... | |
enum | ast_cc_agent_policies { AST_CC_AGENT_NEVER , AST_CC_AGENT_NATIVE , AST_CC_AGENT_GENERIC } |
The various possibilities for cc_agent_policy values. More... | |
enum | ast_cc_agent_response_reason { AST_CC_AGENT_RESPONSE_SUCCESS , AST_CC_AGENT_RESPONSE_FAILURE_INVALID , AST_CC_AGENT_RESPONSE_FAILURE_TOO_MANY } |
enum | ast_cc_monitor_class { AST_CC_DEVICE_MONITOR , AST_CC_EXTENSION_MONITOR } |
enum | ast_cc_monitor_policies { AST_CC_MONITOR_NEVER , AST_CC_MONITOR_NATIVE , AST_CC_MONITOR_GENERIC , AST_CC_MONITOR_ALWAYS } |
The various possibilities for cc_monitor_policy values. More... | |
enum | ast_cc_service_type { AST_CC_NONE , AST_CC_CCBS , AST_CC_CCNR , AST_CC_CCNL } |
Functions | |
struct ast_cc_config_params * | __ast_cc_config_params_init (const char *file, int line, const char *function) |
Allocate and initialize an ast_cc_config_params structure. More... | |
int | ast_cc_agent_accept_request (int core_id, const char *const debug,...) |
Accept inbound CC request. More... | |
struct ast_cc_agent * | ast_cc_agent_callback (int flags, ao2_callback_fn *function, void *arg, const char *const type) |
Call a callback on all agents of a specific type. More... | |
int | ast_cc_agent_caller_available (int core_id, const char *const debug,...) |
Indicate that a previously unavailable caller has become available. More... | |
int | ast_cc_agent_caller_busy (int core_id, const char *const debug,...) |
Indicate that the caller is busy. More... | |
int | ast_cc_agent_recalling (int core_id, const char *const debug,...) |
Tell the CC core that a caller is currently recalling. More... | |
int | ast_cc_agent_register (const struct ast_cc_agent_callbacks *callbacks) |
Register a set of agent callbacks with the core. More... | |
int | ast_cc_agent_set_interfaces_chanvar (struct ast_channel *chan) |
Set the first level CC_INTERFACES channel variable for a channel. More... | |
int | ast_cc_agent_status_response (int core_id, enum ast_device_state devstate) |
Response with a caller's current status. More... | |
void | ast_cc_agent_unregister (const struct ast_cc_agent_callbacks *callbacks) |
Unregister a set of agent callbacks with the core. More... | |
int | ast_cc_available_timer_expire (const void *data) |
Scheduler callback for available timer expiration. More... | |
int | ast_cc_build_frame (struct ast_channel *chan, struct ast_cc_config_params *cc_params, const char *monitor_type, const char *const device_name, const char *const dialstring, enum ast_cc_service_type service, void *private_data, struct ast_frame *frame) |
Create a CC Control frame. More... | |
void | ast_cc_busy_interface (struct ast_channel *inbound, struct ast_cc_config_params *cc_params, const char *monitor_type, const char *const device_name, const char *const dialstring, void *private_data) |
Callback made from ast_cc_callback for certain channel types. More... | |
void | ast_cc_call_failed (struct ast_channel *incoming, struct ast_channel *outgoing, const char *const dialstring) |
Make CCBS available in the case that ast_call fails. More... | |
int | ast_cc_call_init (struct ast_channel *chan, int *ignore_cc) |
Start the CC process on a call. More... | |
int | ast_cc_callback (struct ast_channel *inbound, const char *const tech, const char *const dest, ast_cc_callback_fn callback) |
Run a callback for potential matching destinations. More... | |
int | ast_cc_completed (struct ast_channel *chan, const char *const debug,...) |
Indicate recall has been acknowledged. More... | |
void | ast_cc_config_params_destroy (struct ast_cc_config_params *params) |
Free memory from CCSS configuration params. More... | |
void | ast_cc_copy_config_params (struct ast_cc_config_params *dest, const struct ast_cc_config_params *src) |
copy CCSS configuration parameters from one structure to another More... | |
void | ast_cc_default_config_params (struct ast_cc_config_params *params) |
Set the specified CC config params to default values. More... | |
void | ast_cc_extension_monitor_add_dialstring (struct ast_channel *incoming, const char *const dialstring, const char *const device_name) |
Add a child dialstring to an extension monitor. More... | |
int | ast_cc_failed (int core_id, const char *const debug,...) |
Indicate failure has occurred. More... | |
int | ast_cc_get_current_core_id (struct ast_channel *chan) |
Get the core id for the current call. More... | |
struct ast_cc_monitor * | ast_cc_get_monitor_by_recall_core_id (const int core_id, const char *const device_name) |
Get the associated monitor given the device name and core_id. More... | |
int | ast_cc_get_param (struct ast_cc_config_params *params, const char *const name, char *buf, size_t buf_len) |
get a CCSS configuration parameter, given its name More... | |
int | ast_cc_is_config_param (const char *const name) |
Is this a CCSS configuration parameter? More... | |
int | ast_cc_is_recall (struct ast_channel *chan, int *core_id, const char *const monitor_type) |
Decide if a call to a particular channel is a CC recall. More... | |
int | ast_cc_monitor_callee_available (const int core_id, const char *const debug,...) |
Alert the core that a device being monitored has become available. More... | |
int | ast_cc_monitor_count (const char *const name, const char *const type) |
Return the number of outstanding CC requests to a specific device. More... | |
int | ast_cc_monitor_failed (int core_id, const char *const monitor_name, const char *const debug,...) |
Indicate that a failure has occurred on a specific monitor. More... | |
int | ast_cc_monitor_party_b_free (int core_id) |
Alert a caller that though the callee has become free, the caller himself is not and may not call back. More... | |
int | ast_cc_monitor_register (const struct ast_cc_monitor_callbacks *callbacks) |
Register a set of monitor callbacks with the core. More... | |
int | ast_cc_monitor_request_acked (int core_id, const char *const debug,...) |
Indicate that an outbound entity has accepted our CC request. More... | |
int | ast_cc_monitor_status_request (int core_id) |
Request the status of a caller or callers. More... | |
int | ast_cc_monitor_stop_ringing (int core_id) |
Alert a caller to stop ringing. More... | |
void | ast_cc_monitor_unregister (const struct ast_cc_monitor_callbacks *callbacks) |
Unregister a set of monitor callbacks with the core. More... | |
int | ast_cc_offer (struct ast_channel *caller_chan) |
Offer CC to a caller. More... | |
int | ast_cc_request_is_within_limits (void) |
Check if the incoming CC request is within the bounds set by the cc_max_requests configuration option. More... | |
int | ast_cc_set_param (struct ast_cc_config_params *params, const char *const name, const char *value) |
set a CCSS configuration parameter, given its name More... | |
const char * | ast_get_cc_agent_dialstring (struct ast_cc_config_params *config) |
Get the cc_agent_dialstring. More... | |
enum ast_cc_agent_policies | ast_get_cc_agent_policy (struct ast_cc_config_params *config) |
Get the cc_agent_policy. More... | |
const char * | ast_get_cc_callback_sub (struct ast_cc_config_params *config) |
Get the name of the callback subroutine. More... | |
unsigned int | ast_get_cc_max_agents (struct ast_cc_config_params *config) |
Get the cc_max_agents. More... | |
unsigned int | ast_get_cc_max_monitors (struct ast_cc_config_params *config) |
Get the cc_max_monitors. More... | |
enum ast_cc_monitor_policies | ast_get_cc_monitor_policy (struct ast_cc_config_params *config) |
Get the cc_monitor_policy. More... | |
unsigned int | ast_get_cc_offer_timer (struct ast_cc_config_params *config) |
Get the cc_offer_timer. More... | |
unsigned int | ast_get_cc_recall_timer (struct ast_cc_config_params *config) |
Get the cc_recall_timer. More... | |
unsigned int | ast_get_ccbs_available_timer (struct ast_cc_config_params *config) |
Get the ccbs_available_timer. More... | |
unsigned int | ast_get_ccnr_available_timer (struct ast_cc_config_params *config) |
Get the ccnr_available_timer. More... | |
void | ast_handle_cc_control_frame (struct ast_channel *inbound, struct ast_channel *outbound, void *frame_data) |
Properly react to a CC control frame. More... | |
void | ast_ignore_cc (struct ast_channel *chan) |
Mark the channel to ignore further CC activity. More... | |
int | ast_queue_cc_frame (struct ast_channel *chan, const char *const monitor_type, const char *const dialstring, enum ast_cc_service_type service, void *private_data) |
Queue an AST_CONTROL_CC frame. More... | |
void | ast_set_cc_agent_dialstring (struct ast_cc_config_params *config, const char *const value) |
Set the cc_agent_dialstring. More... | |
int | ast_set_cc_agent_policy (struct ast_cc_config_params *config, enum ast_cc_agent_policies value) |
Set the cc_agent_policy. More... | |
void | ast_set_cc_callback_sub (struct ast_cc_config_params *config, const char *const value) |
Set the callback subroutine name. More... | |
int | ast_set_cc_interfaces_chanvar (struct ast_channel *chan, const char *const extension) |
Set the CC_INTERFACES channel variable for a channel using an. More... | |
void | ast_set_cc_max_agents (struct ast_cc_config_params *config, unsigned int value) |
Set the cc_max_agents. More... | |
void | ast_set_cc_max_monitors (struct ast_cc_config_params *config, unsigned int value) |
Set the cc_max_monitors. More... | |
int | ast_set_cc_monitor_policy (struct ast_cc_config_params *config, enum ast_cc_monitor_policies value) |
Set the cc_monitor_policy. More... | |
void | ast_set_cc_offer_timer (struct ast_cc_config_params *config, unsigned int value) |
Set the cc_offer_timer. More... | |
void | ast_set_cc_recall_timer (struct ast_cc_config_params *config, unsigned int value) |
Set the cc_recall_timer. More... | |
void | ast_set_ccbs_available_timer (struct ast_cc_config_params *config, unsigned int value) |
Set the ccbs_available_timer. More... | |
void | ast_set_ccnr_available_timer (struct ast_cc_config_params *config, unsigned int value) |
Set the ccnr_available_timer. More... | |
int | ast_setup_cc_recall_datastore (struct ast_channel *chan, const int core_id) |
Set up a CC recall datastore on a channel. More... | |
Call Completion Supplementary Services API.
Definition in file ccss.h.
#define ast_cc_config_params_init | ( | ) | __ast_cc_config_params_init(__FILE__, __LINE__, __PRETTY_FUNCTION__) |
Allocate and initialize an ast_cc_config_params structure.
NULL | Unable to allocate the structure |
non-NULL | A pointer to the newly allocated and initialized structure |
#define AST_CC_GENERIC_MONITOR_TYPE "generic" |
It is recommended that monitors use a pointer to an ast_cc_monitor_callbacks::type when creating an AST_CONTROL_CC frame. Since the generic monitor callbacks are opaque and channel drivers will wish to use that, this string is made globally available for all to use
typedef void(* ast_cc_callback_fn) (struct ast_channel *chan, struct ast_cc_config_params *cc_params, const char *monitor_type, const char *const device_name, const char *const dialstring, void *private_data) |
Callback made from ast_cc_callback for certain channel types.
chan | A channel involved in the call. What we want is on a datastore on both incoming and outgoing so either may be provided |
cc_params | The CC configuration parameters for the outbound target |
monitor_type | The type of monitor to use when CC is requested |
device_name | The name of the outbound target device. |
dialstring | The dial string used when calling this specific interface |
private_data | If a native monitor is being used, and some channel-driver-specific private data has been allocated, then this parameter should contain a pointer to that data. If using a generic monitor, this parameter should remain NULL. Note that if this function should fail at some point, it is the responsibility of the caller to free the private data upon return. |
For channel types that fail ast_request when the device is busy, we call into the channel driver with ast_cc_callback. This is the callback that is called in that case for each device found which could have been returned by ast_request.
enum ast_cc_agent_flags |
agent flags that can alter core behavior
Enumerator | |
---|---|
AST_CC_AGENT_SKIP_OFFER |
Definition at line 59 of file ccss.h.
The various possibilities for cc_agent_policy values.
Enumerator | |
---|---|
AST_CC_AGENT_NEVER | Never offer CCSS to the caller |
AST_CC_AGENT_NATIVE | Offer CCSS using native signaling |
AST_CC_AGENT_GENERIC | Use generic agent for caller |
Definition at line 47 of file ccss.h.
Definition at line 841 of file ccss.h.
enum ast_cc_monitor_class |
The various possibilities for cc_monitor_policy values.
Definition at line 74 of file ccss.h.
enum ast_cc_service_type |
Enumerator | |
---|---|
AST_CC_NONE | |
AST_CC_CCBS | |
AST_CC_CCNR | |
AST_CC_CCNL |
Definition at line 32 of file ccss.h.
struct ast_cc_config_params * __ast_cc_config_params_init | ( | const char * | file, |
int | line, | ||
const char * | function | ||
) |
Allocate and initialize an ast_cc_config_params structure.
NULL | Unable to allocate the structure |
non-NULL | A pointer to the newly allocated and initialized structure |
Definition at line 680 of file ccss.c.
References __ast_malloc(), ast_cc_default_config_params(), make_ari_stubs::file, and NULL.
int ast_cc_agent_accept_request | ( | int | core_id, |
const char *const | debug, | ||
... | |||
) |
Accept inbound CC request.
When a caller requests CC, this function should be called to let the core know that the request has been accepted.
core_id | core_id of the CC transaction |
debug | optional string to print for debugging purposes |
0 | Success |
-1 | Failure |
Definition at line 3741 of file ccss.c.
References CC_CALLER_REQUESTED, cc_request_state_change(), dialed_cc_interfaces::core_id, and debug.
Referenced by ccreq_exec().
struct ast_cc_agent * ast_cc_agent_callback | ( | int | flags, |
ao2_callback_fn * | function, | ||
void * | arg, | ||
const char *const | type | ||
) |
Call a callback on all agents of a specific type.
Since the container of CC core instances is private, and so are the items which the container contains, we have to provide an ao2_callback-like method so that a specific agent may be found or so that an operation can be made on all agents of a particular type. The first three arguments should be familiar to anyone who has used ao2_callback. The final argument is the type of agent you wish to have the callback called on.
flags | astobj2 search flags |
function | an ao2 callback function to call |
arg | the argument to the callback function |
type | The type of agents to call the callback on |
Definition at line 456 of file ccss.c.
References cc_core_instance::agent, ao2_t_callback, args, cc_agent_callback_helper(), cc_core_instances, cc_ref(), cc_unref(), cc_callback_helper::function, NULL, and type.
int ast_cc_agent_caller_available | ( | int | core_id, |
const char *const | debug, | ||
... | |||
) |
Indicate that a previously unavailable caller has become available.
If a monitor is suspended due to a caller becoming unavailable, then this function should be called to indicate that the caller has become available.
core_id | core_id of the CC transaction |
debug | optional string to print for debugging purposes |
0 | Success |
-1 | Failure |
Definition at line 3785 of file ccss.c.
References CC_ACTIVE, cc_request_state_change(), dialed_cc_interfaces::core_id, and debug.
Referenced by generic_agent_devstate_cb().
int ast_cc_agent_caller_busy | ( | int | core_id, |
const char *const | debug, | ||
... | |||
) |
Indicate that the caller is busy.
When the callee makes it known that he is available, the core will let the caller's channel driver know that it may attempt to let the caller know to attempt a recall. If the channel driver can detect, though, that the caller is busy, then the channel driver should call this function to let the CC core know.
core_id | core_id of the CC transaction |
debug | optional string to print for debugging purposes |
0 | Success |
-1 | Failure |
Definition at line 3774 of file ccss.c.
References CC_CALLER_BUSY, cc_request_state_change(), dialed_cc_interfaces::core_id, and debug.
Referenced by cc_generic_agent_recall().
int ast_cc_agent_recalling | ( | int | core_id, |
const char *const | debug, | ||
... | |||
) |
Tell the CC core that a caller is currently recalling.
The main purpose of this is so that the core can alert the monitor to stop its available timer since the caller has begun its recall phase.
core_id | core_id of the CC transaction |
debug | optional string to print for debugging purposes |
0 | Success |
-1 | Failure |
Definition at line 3796 of file ccss.c.
References CC_RECALLING, cc_request_state_change(), dialed_cc_interfaces::core_id, and debug.
Referenced by generic_recall().
int ast_cc_agent_register | ( | const struct ast_cc_agent_callbacks * | callbacks | ) |
Register a set of agent callbacks with the core.
This is made so that at agent creation time, the proper callbacks may be installed and the proper .init callback may be called for the monitor to establish private data.
callbacks | The callbacks used by the agent implementation |
0 | Successfully registered |
-1 | Failure to register |
Definition at line 1217 of file ccss.c.
References ast_calloc, AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, cc_agent_backend::callbacks, callbacks, and cc_agent_backend::next.
Referenced by load_module().
int ast_cc_agent_set_interfaces_chanvar | ( | struct ast_channel * | chan | ) |
Set the first level CC_INTERFACES channel variable for a channel.
The CC_INTERFACES channel variable will have the interfaces that should be called back for a specific PBX instance.
chan | The channel to set the CC_INTERFACES variable on |
Definition at line 3596 of file ccss.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_free, AST_LIST_FIRST, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_log_dynamic_level, ast_str_buffer(), ast_str_create, build_cc_interfaces_chanvar(), cc_logger_level, cc_recall_ds_data::core_id, ast_datastore::data, cc_recall_ds_data::interface_tree, NULL, pbx_builtin_setvar_helper(), recall_ds_info, and str.
Referenced by generic_recall().
int ast_cc_agent_status_response | ( | int | core_id, |
enum ast_device_state | devstate | ||
) |
Response with a caller's current status.
When an ISDN PTMP monitor requests the caller's status, the agent must respond to the request using this function. For simplicity it is recommended that the devstate parameter be one of AST_DEVICE_INUSE or AST_DEVICE_NOT_INUSE.
core_id | The core ID of the CC transaction |
devstate | The current state of the caller to which the agent pertains |
0 | Successfully responded with our status |
-1 | Failed to respond with our status |
Definition at line 4058 of file ccss.c.
References args, ast_calloc, ast_free, ast_taskprocessor_push(), cc_core_taskprocessor, cc_status_response(), cc_unref(), cc_core_instance::core_id, and find_cc_core_instance().
Referenced by cc_generic_agent_status_request().
void ast_cc_agent_unregister | ( | const struct ast_cc_agent_callbacks * | callbacks | ) |
Unregister a set of agent callbacks with the core.
If a module which makes use of a CC agent is unloaded, then it may unregister its agent callbacks with the core.
callbacks | The callbacks used by the agent implementation |
Definition at line 1232 of file ccss.c.
References ast_free, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, cc_agent_backend::callbacks, callbacks, and cc_agent_backend::next.
Referenced by __unload_module(), and unload_module().
int ast_cc_available_timer_expire | ( | const void * | data | ) |
Scheduler callback for available timer expiration.
data | A reference to the CC monitor on which the timer was running. |
Definition at line 1487 of file ccss.c.
References ast_cc_monitor_failed(), ast_cc_monitor::available_timer_id, cc_unref(), ast_cc_monitor::core_id, ast_cc_interface::device_name, and ast_cc_monitor::interface.
Referenced by cc_generic_monitor_request_cc().
int ast_cc_build_frame | ( | struct ast_channel * | chan, |
struct ast_cc_config_params * | cc_params, | ||
const char * | monitor_type, | ||
const char *const | device_name, | ||
const char *const | dialstring, | ||
enum ast_cc_service_type | service, | ||
void * | private_data, | ||
struct ast_frame * | frame | ||
) |
Create a CC Control frame.
chan_dahdi is weird. It doesn't seem to actually queue frames when it needs to tell an application something. Instead it wakes up, tells the application that it has data ready, and then based on set flags, creates the proper frame type. For chan_dahdi, we provide this function. It provides us the data we need, and we'll make its frame for it.
chan | A channel involved in the call. What we want is on a datastore on both incoming and outgoing so either may be provided | |
cc_params | The CC configuration parameters for the outbound target | |
monitor_type | The type of monitor to use when CC is requested | |
device_name | The name of the outbound target device. | |
dialstring | The dial string used when calling this specific interface | |
service | What kind of CC service is being offered. (CCBS/CCNR/etc...) | |
private_data | If a native monitor is being used, and some channel-driver-specific private data has been allocated, then this parameter should contain a pointer to that data. If using a generic monitor, this parameter should remain NULL. Note that if this function should fail at some point, it is the responsibility of the caller to free the private data upon return. | |
[out] | frame | The frame we will be returning to the caller. It is vital that ast_frame_free be called on this frame since the payload will be allocated on the heap. |
-1 | Failure. At some point there was a failure. Do not attempt to use the frame in this case. |
0 | Success |
Definition at line 4141 of file ccss.c.
References ast_calloc, AST_CONTROL_CC, AST_FRAME_CONTROL, ast_free, AST_MALLOCD_DATA, cc_build_payload(), ast_frame::data, ast_frame::datalen, cc_control_payload::device_name, cc_control_payload::dialstring, ast_frame::frametype, ast_frame_subclass::integer, ast_frame::mallocd, cc_control_payload::monitor_type, cc_control_payload::private_data, ast_frame::ptr, service, and ast_frame::subclass.
Referenced by ast_queue_cc_frame().
void ast_cc_busy_interface | ( | struct ast_channel * | inbound, |
struct ast_cc_config_params * | cc_params, | ||
const char * | monitor_type, | ||
const char *const | device_name, | ||
const char *const | dialstring, | ||
void * | private_data | ||
) |
Callback made from ast_cc_callback for certain channel types.
inbound | Incoming asterisk channel. |
cc_params | The CC configuration parameters for the outbound target |
monitor_type | The type of monitor to use when CC is requested |
device_name | The name of the outbound target device. |
dialstring | The dial string used when calling this specific interface |
private_data | If a native monitor is being used, and some channel-driver-specific private data has been allocated, then this parameter should contain a pointer to that data. If using a generic monitor, this parameter should remain NULL. Note that if this function should fail at some point, it is the responsibility of the caller to free the private data upon return. |
For channel types that fail ast_request when the device is busy, we call into the channel driver with ast_cc_callback. This is the callback that is called in that case for each device found which could have been returned by ast_request.
This function creates a CC control frame payload, simulating the act of reading it from the nonexistent outgoing channel's frame queue. We then handle this simulated frame just as we would a normal CC frame which had actually been queued by the channel driver.
Definition at line 4197 of file ccss.c.
References AST_CC_CCBS, ast_handle_cc_control_frame(), call_destructor_with_no_monitor(), cc_build_payload(), cc_control_payload::device_name, cc_control_payload::dialstring, cc_control_payload::monitor_type, NULL, and cc_control_payload::private_data.
Referenced by dial_exec_full().
void ast_cc_call_failed | ( | struct ast_channel * | incoming, |
struct ast_channel * | outgoing, | ||
const char *const | dialstring | ||
) |
Make CCBS available in the case that ast_call fails.
In some situations, notably if a call-limit is reached in SIP, ast_call will fail due to Asterisk's knowing that the desired device is currently busy. In such a situation, CCBS should be made available to the caller.
One caveat is that this may only be used if generic monitoring is being used. The reason is that since Asterisk determined that the device was busy without actually placing a call to it, the far end will have no idea what call we are requesting call completion for if we were to send a call completion request.
Definition at line 4164 of file ccss.c.
References AST_CAUSE_BUSY, AST_CAUSE_CONGESTION, AST_CC_CCBS, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_MONITOR_GENERIC, ast_channel_get_cc_config_params(), ast_channel_get_device_name(), ast_channel_hangupcause(), AST_CHANNEL_NAME, ast_get_cc_monitor_policy(), ast_handle_cc_control_frame(), cc_build_payload(), cc_control_payload::device_name, and NULL.
Referenced by dial_exec_full().
int ast_cc_call_init | ( | struct ast_channel * | chan, |
int * | ignore_cc | ||
) |
Start the CC process on a call.
Whenever a CC-capable application, such as Dial, wishes to engage in CC activity, it initiates the process by calling this function. If the CC core should discover that a previous application has called ast_ignore_cc on this channel or a "parent" channel, then the value of the ignore_cc integer passed in will be set nonzero.
The ignore_cc parameter is a convenience parameter. It can save an application the trouble of trying to call CC APIs when it knows that it should just ignore further attempts at CC actions.
chan | The inbound channel calling the CC-capable application. | |
[out] | ignore_cc | Will be set non-zero if no further CC actions need to be taken |
0 | Success |
-1 | Failure |
Definition at line 2386 of file ccss.c.
References AST_CC_AGENT_NEVER, ast_channel_context(), ast_channel_datastore_find(), ast_channel_exten(), ast_channel_get_cc_config_params(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_get_cc_agent_policy(), AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_log_dynamic_level, cc_extension_monitor_init(), cc_interfaces_datastore_init(), cc_logger_level, cc_ref(), cc_unref(), ast_cc_monitor::core_id, ast_datastore::data, dialed_cc_interfaces_info, ast_cc_monitor::id, interfaces, and NULL.
Referenced by dial_exec_full().
int ast_cc_callback | ( | struct ast_channel * | inbound, |
const char *const | tech, | ||
const char *const | dest, | ||
ast_cc_callback_fn | callback | ||
) |
Run a callback for potential matching destinations.
inbound | |
tech | Channel technology to use |
dest | Channel/group/peer or whatever the specific technology uses |
callback | Function to call when a target is reached |
0 | Always, I guess. |
Definition at line 4209 of file ccss.c.
References ast_get_channel_tech(), and ast_channel_tech::cc_callback.
Referenced by dial_exec_full().
int ast_cc_completed | ( | struct ast_channel * | chan, |
const char *const | debug, | ||
... | |||
) |
Indicate recall has been acknowledged.
When we receive confirmation that an endpoint has responded to our CC recall, we call this function.
chan | The inbound channel making the CC recall |
debug | optional string to print for debugging purposes |
0 | Success |
-1 | Failure |
Definition at line 3807 of file ccss.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, CC_COMPLETE, cc_request_state_change(), cc_recall_ds_data::core_id, ast_datastore::data, debug, cc_recall_ds_data::ignore, cc_recall_ds_data::nested, NULL, and recall_ds_info.
Referenced by wait_for_answer().
void ast_cc_config_params_destroy | ( | struct ast_cc_config_params * | params | ) |
Free memory from CCSS configuration params.
params | Pointer to structure whose memory we need to free |
Definition at line 692 of file ccss.c.
References ast_free.
Referenced by agent_destroy(), ast_channel_cc_params_init(), cc_interface_destroy(), channel_cc_params_destroy(), dahdi_create_channel_range(), destroy_dahdi_pvt(), process_dahdi(), and setup_dahdi().
void ast_cc_copy_config_params | ( | struct ast_cc_config_params * | dest, |
const struct ast_cc_config_params * | src | ||
) |
copy CCSS configuration parameters from one structure to another
For now, this is a simple memcpy, but this function is necessary since the size of an ast_cc_config_params structure is unknown outside of main/ccss.c. Also, this allows for easier expansion of the function in case it becomes more complex than just a memcpy.
src | The structure from which data is copied |
dest | The structure to which data is copied |
Definition at line 854 of file ccss.c.
Referenced by ast_channel_cc_params_init(), cc_agent_init(), cc_build_payload(), cc_device_monitor_init(), channel_cc_params_copy(), dahdi_new(), deep_copy_dahdi_chan_conf(), duplicate_pseudo(), and mkintf().
void ast_cc_default_config_params | ( | struct ast_cc_config_params * | params | ) |
Set the specified CC config params to default values.
This is just like ast_cc_copy_config_params() and could be used in place of it if you need to set the config params to defaults instead. You are simply "copying" defaults into the destination.
params | CC config params to set to default values. |
Definition at line 675 of file ccss.c.
References cc_default_params.
Referenced by __ast_cc_config_params_init().
void ast_cc_extension_monitor_add_dialstring | ( | struct ast_channel * | incoming, |
const char *const | dialstring, | ||
const char *const | device_name | ||
) |
Add a child dialstring to an extension monitor.
Whenever we request a channel, the parent extension monitor needs to store the dialstring of the device requested. The reason is so that we can call the device back during the recall even if we are not monitoring the device.
incoming | The caller's channel |
dialstring | The dialstring used when requesting the outbound channel |
device_name | The device name associated with the requested outbound channel |
Definition at line 1983 of file ccss.c.
References ast_calloc, ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_copy_string(), AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, extension_monitor_pvt::child_dialstrings, ast_datastore::data, extension_child_dialstring::device_name, dialed_cc_interfaces::dial_parent_id, dialed_cc_interfaces_info, id, ast_cc_monitor::id, dialed_cc_interfaces::interface_tree, extension_child_dialstring::is_valid, NULL, extension_child_dialstring::original_dialstring, and ast_cc_monitor::private_data.
Referenced by dial_exec_full().
int ast_cc_failed | ( | int | core_id, |
const char *const | debug, | ||
... | |||
) |
Indicate failure has occurred.
If at any point a failure occurs, this is the function to call so that the core can initiate cleanup procedures.
core_id | core_id of the CC transaction |
debug | optional string to print for debugging purposes |
0 | Success |
-1 | Failure |
Definition at line 3844 of file ccss.c.
References CC_FAILED, cc_request_state_change(), cc_recall_ds_data::core_id, and debug.
Referenced by cancel_available_timer(), cc_caller_offered(), cc_caller_requested(), cc_monitor_failed(), cccancel_exec(), ccreq_exec(), generic_recall(), kill_cores(), offer_timer_expire(), request_cc(), suspend(), unsuspend(), and wait_for_answer().
int ast_cc_get_current_core_id | ( | struct ast_channel * | chan | ) |
Get the core id for the current call.
The main use of this function is for channel drivers who queue an AST_CONTROL_CC frame. A channel driver may call this function in order to get the core_id for what may become a CC request. This way, when monitor functions are called which use a core_id as a means of identification, the channel driver will have saved this information.
The channel given to this function may be an inbound or outbound channel. Both will have the necessary info on it.
chan | The channel from which to get the core_id. |
core_id | on success |
-1 | Failure |
Definition at line 2465 of file ccss.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, dialed_cc_interfaces::core_id, ast_datastore::data, dialed_cc_interfaces_info, dialed_cc_interfaces::ignore, and NULL.
struct ast_cc_monitor * ast_cc_get_monitor_by_recall_core_id | ( | const int | core_id, |
const char *const | device_name | ||
) |
Get the associated monitor given the device name and core_id.
The function ast_cc_is_recall is helpful for determining if a call to a specific channel is a recall. However, once you have determined that this is a recall, you will most likely need access to the private data within the associated monitor. This function is what one uses to get that monitor.
core_id | The core ID to which this recall corresponds. This likely will have been obtained using the ast_cc_is_recall function |
device_name | Which device to find the monitor for. |
NULL | Appropriate monitor does not exist |
non-NULL | The monitor to use for this recall |
Definition at line 3486 of file ccss.c.
References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, cc_ref(), cc_unref(), cc_core_instance::core_id, ast_cc_interface::device_name, find_cc_core_instance(), ast_cc_monitor::interface, cc_core_instance::monitors, ast_cc_monitor::next, and NULL.
int ast_cc_get_param | ( | struct ast_cc_config_params * | params, |
const char *const | name, | ||
char * | buf, | ||
size_t | buf_len | ||
) |
get a CCSS configuration parameter, given its name
params | The CCSS configuration from which to get the value |
name | The name of the CCSS parameter we want |
buf | A preallocated buffer to hold the value |
buf_len | The size of buf |
0 | Success |
-1 | Failure |
Definition at line 758 of file ccss.c.
References agent_policy_to_str(), ast_copy_string(), ast_get_cc_agent_dialstring(), ast_get_cc_agent_policy(), ast_get_cc_callback_sub(), ast_get_cc_max_agents(), ast_get_cc_max_monitors(), ast_get_cc_monitor_policy(), ast_get_cc_offer_timer(), ast_get_cc_recall_timer(), ast_get_ccbs_available_timer(), ast_get_ccnr_available_timer(), ast_log, buf, LOG_WARNING, monitor_policy_to_str(), name, NULL, and value.
Referenced by acf_cc_read().
int ast_cc_is_config_param | ( | const char *const | name | ) |
Is this a CCSS configuration parameter?
name | Name of configuration option being parsed. |
1 | Yes, this is a CCSS configuration parameter. |
0 | No, this is not a CCSS configuration parameter. |
Definition at line 840 of file ccss.c.
References name.
Referenced by process_dahdi().
int ast_cc_is_recall | ( | struct ast_channel * | chan, |
int * | core_id, | ||
const char *const | monitor_type | ||
) |
Decide if a call to a particular channel is a CC recall.
When a CC recall happens, it is important on the called side to know that the call is a CC recall and not a normal call. This function will determine first if the call in question is a CC recall. Then it will determine based on the chan parameter if the channel is being called is being recalled.
As a quick example, let's say a call is placed to SIP/1000 and SIP/1000 is currently on the phone. The caller requests CCBS. SIP/1000 finishes his call, and so the caller attempts to recall. Now, the dialplan administrator has set up this second call so that not only is SIP/1000 called, but also SIP/2000 is called. If SIP/1000's channel were passed to this function, the return value would be non-zero, but if SIP/2000's channel were passed into this function, then the return would be 0 since SIP/2000 was not one of the original devices dialed.
chan | The channel to check | |
[out] | core_id | If this is a valid CC recall, the core_id of the failed call will be placed in this output parameter |
monitor_type | Clarify which type of monitor type we are looking for if this is happening on a called channel. For incoming channels, this parameter is not used. |
0 | Either this is not a recall or it is but this channel is not part of the recall |
non-zero | This is a recall and the channel in question is directly involved. |
Definition at line 3405 of file ccss.c.
References ast_assert, ast_channel_datastore_find(), ast_channel_get_device_name(), ast_channel_lock, AST_CHANNEL_NAME, ast_channel_unlock, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strlen_zero(), ast_cc_monitor::core_id, cc_recall_ds_data::core_id, ast_datastore::data, ast_cc_interface::device_name, cc_recall_ds_data::ignore, ast_cc_monitor::interface, cc_recall_ds_data::interface_tree, ast_cc_interface::monitor_type, cc_recall_ds_data::nested, ast_cc_monitor::next, NULL, and recall_ds_info.
Referenced by cc_core_init_instance(), and wait_for_answer().
int ast_cc_monitor_callee_available | ( | const int | core_id, |
const char *const | debug, | ||
... | |||
) |
Alert the core that a device being monitored has become available.
0 | Request successfully queued |
-1 | Request could not be queued |
Definition at line 3763 of file ccss.c.
References CC_CALLEE_READY, cc_request_state_change(), dialed_cc_interfaces::core_id, and debug.
Referenced by cc_generic_monitor_destructor(), cc_generic_monitor_suspend(), cc_generic_monitor_unsuspend(), and generic_monitor_devstate_tp_cb().
int ast_cc_monitor_count | ( | const char *const | name, |
const char *const | type | ||
) |
Return the number of outstanding CC requests to a specific device.
name | The name of the monitored device |
type | The type of the monitored device (e.g. "generic") |
Definition at line 4333 of file ccss.c.
References ao2_t_callback, ast_log_dynamic_level, cc_core_instances, cc_logger_level, count_monitors_cb_data::count, count_monitors_cb(), count_monitors_cb_data::device_name, name, OBJ_NODATA, and type.
Referenced by ast_queue_cc_frame().
int ast_cc_monitor_failed | ( | int | core_id, |
const char *const | monitor_name, | ||
const char *const | debug, | ||
... | |||
) |
Indicate that a failure has occurred on a specific monitor.
If a monitor should detect that a failure has occurred when communicating with its endpoint, then ast_cc_monitor_failed should be called. The big difference between ast_cc_monitor_failed and ast_cc_failed is that ast_cc_failed indicates a global failure for a CC transaction, where as ast_cc_monitor_failed is localized to a particular monitor. When ast_cc_failed is called, the entire CC transaction is torn down. When ast_cc_monitor_failed is called, only the monitor on which the failure occurred is pruned from the tree of monitors.
If there are no more devices left to monitor when this function is called, then the core will fail the CC transaction globally.
core_id | The core ID for the CC transaction |
monitor_name | The name of the monitor on which the failure occurred |
debug | A debug message to print to the CC log |
Definition at line 3906 of file ccss.c.
References ast_calloc, ast_free, ast_strdup, ast_taskprocessor_push(), ast_vasprintf, cc_core_taskprocessor, cc_monitor_failed(), ast_cc_monitor_failure_data::core_id, ast_cc_monitor_failure_data::debug, debug, and ast_cc_monitor_failure_data::device_name.
Referenced by ast_cc_available_timer_expire().
int ast_cc_monitor_party_b_free | ( | int | core_id | ) |
Alert a caller that though the callee has become free, the caller himself is not and may not call back.
When an ISDN PTMP monitor senses that his monitored party has become available, he will request the status of the called party. If he determines that the caller is currently not available, then he will call this function so that an appropriate message is sent to the caller.
Yes, you just read that correctly. The callee asks the caller what his current status is, and if the caller is currently unavailable, the monitor must send him a message anyway. WTF?
This function results in the agent's party_b_free callback being called. It is most likely that you will not need to actually implement the party_b_free callback in an agent because it is not likely that you will need to or even want to send a caller a message indicating the callee's status if the caller himself is not also free.
core_id | The core ID of the CC transaction |
0 | Successfully alerted the core that party B is free |
-1 | Could not alert the core that party B is free |
Definition at line 4016 of file ccss.c.
References ast_taskprocessor_push(), cc_core_taskprocessor, cc_party_b_free(), cc_unref(), cc_core_instance::core_id, and find_cc_core_instance().
int ast_cc_monitor_register | ( | const struct ast_cc_monitor_callbacks * | callbacks | ) |
Register a set of monitor callbacks with the core.
This is made so that at monitor creation time, the proper callbacks may be installed and the proper .init callback may be called for the monitor to establish private data.
callbacks | The callbacks used by the monitor implementation |
0 | Successfully registered |
-1 | Failure to register |
Definition at line 1162 of file ccss.c.
References ast_calloc, AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, cc_monitor_backend::callbacks, callbacks, and cc_monitor_backend::next.
Referenced by load_module().
int ast_cc_monitor_request_acked | ( | int | core_id, |
const char *const | debug, | ||
... | |||
) |
Indicate that an outbound entity has accepted our CC request.
When we receive confirmation that an outbound device has accepted the CC request we sent it, this function must be called.
core_id | core_id of the CC transaction |
debug | optional string to print for debugging purposes |
0 | Success |
-1 | Failure |
Definition at line 3752 of file ccss.c.
References CC_ACTIVE, cc_request_state_change(), dialed_cc_interfaces::core_id, and debug.
Referenced by cc_generic_monitor_request_cc(), and cc_stop_ringing().
int ast_cc_monitor_status_request | ( | int | core_id | ) |
Request the status of a caller or callers.
The following are all functions which are required due to the unique case where Asterisk is acting as the NT side of an ISDN PTMP connection to the caller and as the TE side of an ISDN PTMP connection to the callee. In such a case, there are several times where the PTMP monitor needs information from the agent in order to formulate the appropriate messages to send.
When an ISDN PTMP monitor senses that the callee has become available, it needs to know the current status of the caller in order to determine the appropriate response to send to the caller. In order to do this, the monitor calls this function. Responses will arrive asynchronously.
core_id | The core ID of the CC transaction |
0 | Successfully requested status |
-1 | Failed to request status |
Definition at line 3951 of file ccss.c.
References ast_taskprocessor_push(), cc_core_taskprocessor, cc_status_request(), cc_unref(), cc_core_instance::core_id, and find_cc_core_instance().
int ast_cc_monitor_stop_ringing | ( | int | core_id | ) |
Alert a caller to stop ringing.
When an ISDN PTMP monitor becomes available, it is assumed that the agent will then cause the caller's phone to ring. In some cases, this is literally what happens. In other cases, it may be that the caller gets a visible indication on his phone that he may attempt to recall the callee. If multiple callers are recalled (since it may be possible to have a group of callers configured as a single party A), and one of those callers picks up his phone, then the ISDN PTMP monitor will alert the other callers to stop ringing. The agent's stop_ringing callback will be called, and it is up to the agent's driver to send an appropriate message to make his caller stop ringing.
core_id | The core ID of the CC transaction |
0 | Successfully requested for the phone to stop ringing |
-1 | Could not request for the phone to stop ringing |
Definition at line 3988 of file ccss.c.
References ast_taskprocessor_push(), cc_core_taskprocessor, cc_stop_ringing(), cc_unref(), cc_core_instance::core_id, and find_cc_core_instance().
void ast_cc_monitor_unregister | ( | const struct ast_cc_monitor_callbacks * | callbacks | ) |
Unregister a set of monitor callbacks with the core.
If a module which makes use of a CC monitor is unloaded, then it may unregister its monitor callbacks with the core.
callbacks | The callbacks used by the monitor implementation |
Definition at line 1195 of file ccss.c.
References ast_free, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, cc_monitor_backend::callbacks, callbacks, and cc_monitor_backend::next.
Referenced by __unload_module(), and unload_module().
int ast_cc_offer | ( | struct ast_channel * | caller_chan | ) |
Offer CC to a caller.
This function is called from ast_hangup if the caller is eligible to be offered call completion service.
caller_chan | The calling channel |
-1 | Error |
0 | Success |
Definition at line 3716 of file ccss.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, cc_offer(), dialed_cc_interfaces::core_id, cc_recall_ds_data::core_id, ast_datastore::data, dialed_cc_interfaces_info, dialed_cc_interfaces::is_original_caller, and NULL.
Referenced by ast_hangup().
int ast_cc_request_is_within_limits | ( | void | ) |
Check if the incoming CC request is within the bounds set by the cc_max_requests configuration option.
It is recommended that an entity which receives an incoming CC request calls this function before calling ast_cc_agent_accept_request. This way, immediate feedback can be given to the caller about why his request was rejected.
If this is not called and a state change to CC_CALLER_REQUESTED is made, then the core will still not allow for the request to succeed. However, if done this way, it may not be obvious to the requestor why the request failed.
0 | Not within the limits. Fail. |
non-zero | Within the limits. Success. |
Definition at line 2460 of file ccss.c.
References cc_request_count, and global_cc_max_requests.
Referenced by cc_caller_requested(), cc_interfaces_datastore_init(), and ccreq_exec().
int ast_cc_set_param | ( | struct ast_cc_config_params * | params, |
const char *const | name, | ||
const char * | value | ||
) |
set a CCSS configuration parameter, given its name
params | The parameter structure to set the value on |
name | The name of the cc parameter |
value | The value of the parameter |
0 | Success |
-1 | Failure |
Definition at line 801 of file ccss.c.
References ast_log, ast_set_cc_agent_dialstring(), ast_set_cc_agent_policy(), ast_set_cc_callback_sub(), ast_set_cc_max_agents(), ast_set_cc_max_monitors(), ast_set_cc_monitor_policy(), ast_set_cc_offer_timer(), ast_set_cc_recall_timer(), ast_set_ccbs_available_timer(), ast_set_ccnr_available_timer(), LOG_WARNING, name, str_to_agent_policy(), str_to_monitor_policy(), and value.
Referenced by acf_cc_write(), and process_dahdi().
const char * ast_get_cc_agent_dialstring | ( | struct ast_cc_config_params * | config | ) |
Get the cc_agent_dialstring.
config | The configuration to retrieve the cc_agent_dialstring from |
Definition at line 953 of file ccss.c.
References config.
Referenced by ast_cc_get_param(), and generic_recall().
enum ast_cc_agent_policies ast_get_cc_agent_policy | ( | struct ast_cc_config_params * | config | ) |
Get the cc_agent_policy.
config | The configuration to retrieve the policy from |
Definition at line 859 of file ccss.c.
References config.
Referenced by ast_cc_call_init(), ast_cc_get_param(), cc_core_init_instance(), and find_agent_callbacks().
const char * ast_get_cc_callback_sub | ( | struct ast_cc_config_params * | config | ) |
Get the name of the callback subroutine.
config | The configuration to retrieve the callback_sub from |
Definition at line 987 of file ccss.c.
References config.
Referenced by ast_cc_get_param(), and generic_recall().
unsigned int ast_get_cc_max_agents | ( | struct ast_cc_config_params * | config | ) |
Get the cc_max_agents.
config | The configuration to retrieve the cc_max_agents from |
Definition at line 967 of file ccss.c.
References config.
Referenced by ast_cc_get_param(), and cc_core_init_instance().
unsigned int ast_get_cc_max_monitors | ( | struct ast_cc_config_params * | config | ) |
Get the cc_max_monitors.
config | The configuration to retrieve the cc_max_monitors from |
Definition at line 977 of file ccss.c.
References config.
Referenced by ast_cc_get_param(), and ast_queue_cc_frame().
enum ast_cc_monitor_policies ast_get_cc_monitor_policy | ( | struct ast_cc_config_params * | config | ) |
Get the cc_monitor_policy.
config | The configuration to retrieve the cc_monitor_policy from |
Definition at line 876 of file ccss.c.
References config.
Referenced by analog_call(), ast_cc_call_failed(), ast_cc_get_param(), and dahdi_cc_callback().
unsigned int ast_get_cc_offer_timer | ( | struct ast_cc_config_params * | config | ) |
Get the cc_offer_timer.
config | The configuration to retrieve the cc_offer_timer from |
Definition at line 893 of file ccss.c.
References config.
Referenced by ast_cc_get_param(), and cc_generic_agent_start_offer_timer().
unsigned int ast_get_cc_recall_timer | ( | struct ast_cc_config_params * | config | ) |
Get the cc_recall_timer.
config | The configuration to retrieve the cc_recall_timer from |
Definition at line 923 of file ccss.c.
References config.
Referenced by ast_cc_get_param(), and generic_recall().
unsigned int ast_get_ccbs_available_timer | ( | struct ast_cc_config_params * | config | ) |
Get the ccbs_available_timer.
config | The configuration to retrieve the ccbs_available_timer from |
Definition at line 938 of file ccss.c.
References config.
Referenced by ast_cc_get_param(), and cc_generic_monitor_request_cc().
unsigned int ast_get_ccnr_available_timer | ( | struct ast_cc_config_params * | config | ) |
Get the ccnr_available_timer.
config | The configuration to retrieve the ccnr_available_timer from |
Definition at line 908 of file ccss.c.
References config.
Referenced by ast_cc_get_param(), and cc_generic_monitor_request_cc().
void ast_handle_cc_control_frame | ( | struct ast_channel * | inbound, |
struct ast_channel * | outbound, | ||
void * | frame_data | ||
) |
Properly react to a CC control frame.
When a CC-capable application, such as Dial, receives a frame of type AST_CONTROL_CC, then it may call this function in order to have the device which sent the frame added to the tree of interfaces which is kept on the inbound channel.
inbound | The inbound channel |
outbound | The outbound channel (The one from which the CC frame was read) |
frame_data | The ast_frame's data.ptr field. |
Unless we are ignoring CC for some reason, we will always call this function when we read an AST_CONTROL_CC frame from an outbound channel.
This function will call cc_device_monitor_init to create the new cc_monitor for the device from which we read the frame. In addition, the new device will be added to the monitor tree on the dialed_cc_interfaces datastore on the inbound channel.
If this is the first AST_CONTROL_CC frame that we have handled for this call, then we will also initialize the CC core for this call.
Definition at line 2293 of file ccss.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, AST_CONTROL_CC, ast_indicate_data(), AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, ast_log_dynamic_level, call_destructor_with_no_monitor(), cc_core_init_instance(), cc_device_monitor_init(), cc_extension_monitor_change_is_valid(), cc_logger_level, cc_publish_available(), cc_ref(), cc_service_to_string(), cc_unref(), cc_core_instance::core_id, dialed_cc_interfaces::core_id, ast_datastore::data, ast_cc_interface::device_name, cc_control_payload::device_name, dialed_cc_interfaces_info, ast_cc_monitor::dialstring, cc_control_payload::dialstring, find_cc_core_instance(), dialed_cc_interfaces::ignore, ast_cc_monitor::interface, dialed_cc_interfaces::interface_tree, dialed_cc_interfaces::is_original_caller, LOG_WARNING, cc_control_payload::monitor_type, NULL, ast_cc_monitor::parent_id, cc_control_payload::private_data, and cc_control_payload::service.
Referenced by ast_cc_busy_interface(), ast_cc_call_failed(), and wait_for_answer().
void ast_ignore_cc | ( | struct ast_channel * | chan | ) |
Mark the channel to ignore further CC activity.
When a CC-capable application, such as Dial, has finished with all CC processing for a channel and knows that any further CC processing should be ignored, this function should be called.
chan | The channel for which further CC processing should be ignored. |
Definition at line 3685 of file ccss.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_datastore::data, dialed_cc_interfaces_info, dialed_cc_interfaces::ignore, cc_recall_ds_data::ignore, NULL, and recall_ds_info.
Referenced by dial_exec_full(), and do_forward().
int ast_queue_cc_frame | ( | struct ast_channel * | chan, |
const char *const | monitor_type, | ||
const char *const | dialstring, | ||
enum ast_cc_service_type | service, | ||
void * | private_data | ||
) |
Queue an AST_CONTROL_CC frame.
chan | The channel onto which to queue the frame |
monitor_type | The type of monitor to use when CC is requested |
dialstring | The dial string used to call the device |
service | The type of CC service the device is willing to offer |
private_data | If a native monitor is being used, and some channel-driver-specific private data has been allocated, then this parameter should contain a pointer to that data. If using a generic monitor, this parameter should remain NULL. Note that if this function should fail at some point, it is the responsibility of the caller to free the private data upon return. |
0 | Success |
-1 | Error |
Definition at line 4114 of file ccss.c.
References ast_cc_build_frame(), ast_cc_monitor_count(), ast_channel_get_cc_config_params(), ast_channel_get_device_name(), AST_CHANNEL_NAME, ast_frfree, ast_get_cc_max_monitors(), ast_log, ast_queue_frame(), LOG_NOTICE, retval, and service.
Referenced by analog_call().
void ast_set_cc_agent_dialstring | ( | struct ast_cc_config_params * | config, |
const char *const | value | ||
) |
Set the cc_agent_dialstring.
config | The configuration to set the cc_agent_dialstring on |
value | The new cc_agent_dialstring we want to change to |
Definition at line 958 of file ccss.c.
References ast_copy_string(), ast_strlen_zero(), config, and value.
Referenced by ast_cc_set_param().
int ast_set_cc_agent_policy | ( | struct ast_cc_config_params * | config, |
enum ast_cc_agent_policies | value | ||
) |
Set the cc_agent_policy.
config | The configuration to set the cc_agent_policy on |
value | The new cc_agent_policy we want to change to |
0 | Success |
-1 | Failure (likely due to bad input) |
Definition at line 864 of file ccss.c.
References AST_CC_AGENT_GENERIC, config, and value.
Referenced by ast_cc_set_param().
void ast_set_cc_callback_sub | ( | struct ast_cc_config_params * | config, |
const char *const | value | ||
) |
Set the callback subroutine name.
config | The configuration to set the callback_sub on |
value | The new callback subroutine we want to change to |
Definition at line 992 of file ccss.c.
References ast_copy_string(), ast_strlen_zero(), config, and value.
Referenced by ast_cc_set_param().
int ast_set_cc_interfaces_chanvar | ( | struct ast_channel * | chan, |
const char *const | extension | ||
) |
Set the CC_INTERFACES channel variable for a channel using an.
extension@contextas a starting point
The CC_INTERFACES channel variable will have the interfaces that should be called back for a specific PBX instance. This version of the function is used mainly by local channels, wherein we need to set CC_INTERFACES based on an extension and context that appear in the middle of the tree of dialed interfaces.
chan | The channel to set the CC_INTERFACES variable on |
extension | The name of the extension for which we're setting the variable. This should be in the form of exten@context |
Definition at line 3633 of file ccss.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_free, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log_dynamic_level, ast_str_buffer(), ast_str_create, build_cc_interfaces_chanvar(), cc_logger_level, cc_recall_ds_data::core_id, ast_datastore::data, ast_cc_interface::device_name, ast_cc_monitor::interface, cc_recall_ds_data::interface_tree, NULL, pbx_builtin_setvar_helper(), recall_ds_info, and str.
Referenced by local_call().
void ast_set_cc_max_agents | ( | struct ast_cc_config_params * | config, |
unsigned int | value | ||
) |
void ast_set_cc_max_monitors | ( | struct ast_cc_config_params * | config, |
unsigned int | value | ||
) |
int ast_set_cc_monitor_policy | ( | struct ast_cc_config_params * | config, |
enum ast_cc_monitor_policies | value | ||
) |
Set the cc_monitor_policy.
config | The configuration to set the cc_monitor_policy on |
value | The new cc_monitor_policy we want to change to |
0 | Success |
-1 | Failure (likely due to bad input) |
Definition at line 881 of file ccss.c.
References AST_CC_MONITOR_ALWAYS, config, and value.
Referenced by ast_cc_set_param().
void ast_set_cc_offer_timer | ( | struct ast_cc_config_params * | config, |
unsigned int | value | ||
) |
Set the cc_offer_timer.
config | The configuration to set the cc_offer_timer on |
value | The new cc_offer_timer we want to change to |
Definition at line 898 of file ccss.c.
References ast_log, config, LOG_WARNING, and value.
Referenced by ast_cc_set_param().
void ast_set_cc_recall_timer | ( | struct ast_cc_config_params * | config, |
unsigned int | value | ||
) |
Set the cc_recall_timer.
config | The configuration to set the cc_recall_timer on |
value | The new cc_recall_timer we want to change to |
Definition at line 928 of file ccss.c.
References ast_log, config, LOG_WARNING, and value.
Referenced by ast_cc_set_param().
void ast_set_ccbs_available_timer | ( | struct ast_cc_config_params * | config, |
unsigned int | value | ||
) |
Set the ccbs_available_timer.
config | The configuration to set the ccbs_available_timer on |
value | The new ccbs_available_timer we want to change to |
Definition at line 943 of file ccss.c.
References ast_log, config, LOG_WARNING, and value.
Referenced by ast_cc_set_param().
void ast_set_ccnr_available_timer | ( | struct ast_cc_config_params * | config, |
unsigned int | value | ||
) |
Set the ccnr_available_timer.
config | The configuration to set the ccnr_available_timer on |
value | The new ccnr_available_timer we want to change to |
Definition at line 913 of file ccss.c.
References ast_log, config, LOG_WARNING, and value.
Referenced by ast_cc_set_param().
int ast_setup_cc_recall_datastore | ( | struct ast_channel * | chan, |
const int | core_id | ||
) |
Set up a CC recall datastore on a channel.
Implementers of protocol-specific CC agents will need to call this function in order for the channel to have the necessary interfaces to recall.
This function must be called by the implementer once it has been detected that an inbound call is a cc_recall. After allocating the channel, call this function, followed by ast_cc_set_cc_interfaces_chanvar. While it would be nice to be able to have the core do this automatically, it just cannot be done given the current architecture.
Definition at line 3372 of file ccss.c.
References ast_calloc, ast_channel_datastore_add(), ast_channel_lock, ast_channel_unlock, ast_datastore_alloc, ast_datastore_free(), ast_free, cc_ref(), cc_unref(), cc_core_instance::core_id, cc_recall_ds_data::core_id, ast_datastore::data, DATASTORE_INHERIT_FOREVER, find_cc_core_instance(), ast_datastore::inheritance, cc_recall_ds_data::interface_tree, cc_core_instance::monitors, NULL, and recall_ds_info.
Referenced by generic_recall().