401 {
CC_CALLER_BUSY,
"Callee was ready, but caller is now unavailable"},
461 "Calling provided agent callback function"))) {
463 cc_unref(core_instance,
"agent callback done with the core_instance");
495 const char *
name = arg;
496 unsigned long match_flags = *(
unsigned long *)data;
497 int possible_match = 0;
507 if (!possible_match) {
533 const char *
name = arg;
549#define CC_AVAILABLE_DEVSTATE_DEFAULT AST_DEVICE_NOT_INUSE
550#define CC_CALLER_OFFERED_DEVSTATE_DEFAULT AST_DEVICE_NOT_INUSE
551#define CC_CALLER_REQUESTED_DEVSTATE_DEFAULT AST_DEVICE_NOT_INUSE
552#define CC_ACTIVE_DEVSTATE_DEFAULT AST_DEVICE_INUSE
553#define CC_CALLEE_READY_DEVSTATE_DEFAULT AST_DEVICE_RINGING
554#define CC_CALLER_BUSY_DEVSTATE_DEFAULT AST_DEVICE_ONHOLD
555#define CC_RECALLING_DEVSTATE_DEFAULT AST_DEVICE_RINGING
556#define CC_COMPLETE_DEVSTATE_DEFAULT AST_DEVICE_NOT_INUSE
557#define CC_FAILED_DEVSTATE_DEFAULT AST_DEVICE_NOT_INUSE
609 "Find Core Instance for ccss_device_state reqeust.");
610 if (!core_instance) {
612 "Couldn't find a core instance for caller %s\n", device_name);
617 "Core %d: Found core_instance for caller %s in state %s\n",
622 "Core %d: Device State is only for generic agent types.\n",
624 cc_unref(core_instance,
"Unref core_instance since ccss_device_state was called with native agent");
628 cc_unref(core_instance,
"Unref core_instance done with ccss_device_state");
629 return cc_current_state;
648 "Notification of CCSS state change to '%s', device state '%s' for device '%s'\n",
654#define CC_OFFER_TIMER_DEFAULT 20
655#define CCNR_AVAILABLE_TIMER_DEFAULT 7200
656#define CCBS_AVAILABLE_TIMER_DEFAULT 4800
657#define CC_RECALL_TIMER_DEFAULT 20
658#define CC_MAX_AGENTS_DEFAULT 5
659#define CC_MAX_MONITORS_DEFAULT 5
660#define GLOBAL_CC_MAX_REQUESTS_DEFAULT 20
671 .cc_callback_sub =
"",
672 .cc_agent_dialstring =
"",
699 if (!strcasecmp(
value,
"never")) {
701 }
else if (!strcasecmp(
value,
"native")) {
703 }
else if (!strcasecmp(
value,
"generic")) {
713 if (!strcasecmp(
value,
"never")) {
715 }
else if (!strcasecmp(
value,
"native")) {
717 }
else if (!strcasecmp(
value,
"generic")) {
719 }
else if (!strcasecmp(
value,
"always")) {
759 char *
buf,
size_t buf_len)
763 if (!strcasecmp(
name,
"cc_callback_sub")) {
765 }
else if (!strcasecmp(
name,
"cc_agent_policy")) {
767 }
else if (!strcasecmp(
name,
"cc_monitor_policy")) {
769 }
else if (!strcasecmp(
name,
"cc_agent_dialstring")) {
781 if (!strcasecmp(
name,
"cc_offer_timer")) {
783 }
else if (!strcasecmp(
name,
"ccnr_available_timer")) {
785 }
else if (!strcasecmp(
name,
"ccbs_available_timer")) {
787 }
else if (!strcasecmp(
name,
"cc_max_agents")) {
789 }
else if (!strcasecmp(
name,
"cc_max_monitors")) {
791 }
else if (!strcasecmp(
name,
"cc_recall_timer")) {
802 const char *
const value)
804 unsigned int value_as_uint;
805 if (!strcasecmp(
name,
"cc_agent_policy")) {
807 }
else if (!strcasecmp(
name,
"cc_monitor_policy")) {
809 }
else if (!strcasecmp(
name,
"cc_agent_dialstring")) {
811 }
else if (!strcasecmp(
name,
"cc_callback_sub")) {
816 if (sscanf(
value,
"%30u", &value_as_uint) != 1) {
820 if (!strcasecmp(
name,
"cc_offer_timer")) {
822 }
else if (!strcasecmp(
name,
"ccnr_available_timer")) {
824 }
else if (!strcasecmp(
name,
"ccbs_available_timer")) {
826 }
else if (!strcasecmp(
name,
"cc_max_agents")) {
828 }
else if (!strcasecmp(
name,
"cc_max_monitors")) {
830 }
else if (!strcasecmp(
name,
"cc_recall_timer")) {
842 return (!strcasecmp(
name,
"cc_agent_policy") ||
843 !strcasecmp(
name,
"cc_monitor_policy") ||
844 !strcasecmp(
name,
"cc_offer_timer") ||
845 !strcasecmp(
name,
"ccnr_available_timer") ||
846 !strcasecmp(
name,
"ccbs_available_timer") ||
847 !strcasecmp(
name,
"cc_max_agents") ||
848 !strcasecmp(
name,
"cc_max_monitors") ||
849 !strcasecmp(
name,
"cc_callback_sub") ||
850 !strcasecmp(
name,
"cc_agent_dialstring") ||
851 !strcasecmp(
name,
"cc_recall_timer"));
861 return config->cc_agent_policy;
878 return config->cc_monitor_policy;
895 return config->cc_offer_timer;
910 return config->ccnr_available_timer;
917 ast_log(
LOG_WARNING,
"0 is an invalid value for ccnr_available_timer. Retaining value as %u\n",
config->ccnr_available_timer);
925 return config->cc_recall_timer;
932 ast_log(
LOG_WARNING,
"0 is an invalid value for ccnr_available_timer. Retaining value as %u\n",
config->cc_recall_timer);
940 return config->ccbs_available_timer;
947 ast_log(
LOG_WARNING,
"0 is an invalid value for ccbs_available_timer. Retaining value as %u\n",
config->ccbs_available_timer);
955 return config->cc_agent_dialstring;
961 config->cc_agent_dialstring[0] =
'\0';
969 return config->cc_max_agents;
979 return config->cc_max_monitors;
989 return config->cc_callback_sub;
995 config->cc_callback_sub[0] =
'\0';
1007 if (!message_type) {
1012 "core_id", core_id);
1394 if (!generic_list) {
1399 cc_unref(generic_list,
"Failed to strdup the monitor's device name");
1406 if (!device_specific_topic) {
1411 cc_unref(generic_list,
"Failed to subscribe to device state");
1418 return generic_list;
1439 cc_unref(generic_list,
"Kill reference of generic list in devstate taskprocessor callback");
1458 cc_unref(generic_list,
"Kill reference of generic list in devstate taskprocessor callback");
1475 if (dev_state->
eid) {
1480 ao2_t_ref(dev_state, +1,
"Bumping dev_state ref for cc_core_taskprocessor");
1493 cc_unref(monitor,
"Unref reference from scheduler\n");
1509 if (!(gen_mon_pvt =
ast_calloc(1,
sizeof(*gen_mon_pvt)))) {
1528 if (!(generic_instance =
ast_calloc(1,
sizeof(*generic_instance)))) {
1532 cc_unref(generic_list,
"Generic monitor instance failed to allocate");
1543 if (*available_timer_id == -1) {
1544 cc_unref(monitor,
"Failed to schedule available timer. (monitor)");
1545 cc_unref(generic_list,
"Failed to schedule available timer. (generic_list)");
1556 cc_unref(generic_list,
"Finished with monitor instance reference in request cc callback");
1582 cc_unref(generic_list,
"Device is in use. Nothing to do. Unref generic list.");
1597 cc_unref(generic_list,
"Done with generic list in suspend callback");
1607 if (!generic_list) {
1625 cc_unref(generic_list,
"Done with generic list in cc_generic_monitor_unsuspend");
1640 cc_unref(monitor,
"Remove scheduler's reference to the monitor");
1652 if (!private_data) {
1704 "availability due to other instance's failure.");
1710 cc_unref(generic_list,
"Done with generic list in generic monitor destructor");
1805 if (!extension_pvt) {
1844 cc_unref(monitor,
"Destroying all monitors");
1946 if (!new_cc_interfaces) {
1955 return new_cc_interfaces;
1968 .
type =
"Dial CC Interfaces",
1999 cc_interfaces = cc_datastore->
data;
2006 if (monitor->
id ==
id) {
2017 if (!(child_dialstring =
ast_calloc(1,
sizeof(*child_dialstring)))) {
2035 if (monitor_iter->
id == parent_id) {
2040 if (!monitor_iter) {
2076 "Allocating new ast_cc_interface"))) {
2081 cc_unref(cc_interface,
"failed to allocate the monitor, so unref the interface");
2086 cc_unref(monitor,
"Failed to initialize extension monitor private data. uref monitor");
2087 cc_unref(cc_interface,
"Failed to initialize extension monitor private data. unref cc_interface");
2142 cc_unref(monitor,
"Could not allocate the dialed interfaces datastore. Unreffing monitor");
2148 "Allocate monitor tree"))) {
2150 cc_unref(monitor,
"Could not allocate monitor tree on dialed interfaces datastore. Unreffing monitor");
2158 cc_ref(monitor,
"List's reference to extension monitor");
2167 cc_unref(monitor,
"Unreffing allocation's reference");
2196 if (!monitor_callbacks) {
2231 size_t device_name_len = strlen(device_name);
2235 "Allocating new ast_cc_interface"))) {
2240 cc_unref(cc_interface,
"Failed to allocate config params, unref interface");
2245 cc_unref(cc_interface,
"Failed to allocate monitor, unref interface");
2250 cc_unref(monitor,
"Failed to copy dialable name. Unref monitor");
2251 cc_unref(cc_interface,
"Failed to copy dialable name");
2256 cc_unref(monitor,
"Failed to find monitor callbacks. Unref monitor");
2257 cc_unref(cc_interface,
"Failed to find monitor callbacks");
2308 ast_log(
LOG_WARNING,
"Unable to retrieve CC datastore while processing CC frame from '%s'. CC services will be unavailable.\n", device_name);
2314 cc_interfaces = cc_datastore->
data;
2316 if (cc_interfaces->
ignore) {
2334 if (!core_instance) {
2336 cc_interfaces->
core_id, cc_data);
2337 if (!core_instance) {
2338 cc_interfaces->
ignore = 1;
2357 core_instance->
core_id, device_name);
2359 cc_unref(core_instance,
"Returning early from ast_handle_cc_control_frame. Unref core_instance");
2367 ast_log(
LOG_WARNING,
"Unable to create CC device interface for '%s'. CC services will be unavailable on this interface.\n", device_name);
2368 cc_unref(core_instance,
"Returning early from ast_handle_cc_control_frame. Unref core_instance");
2374 cc_ref(monitor,
"monitor tree's reference to the monitor");
2382 cc_unref(core_instance,
"Done with core_instance after handling CC control frame");
2383 cc_unref(monitor,
"Unref reference from allocating monitor");
2452 cc_ref(monitor,
"monitor tree's reference to the monitor");
2456 cc_unref(monitor,
"Unref monitor's allocation reference");
2477 cc_interfaces = datastore->
data;
2478 core_id_return = cc_interfaces->
ignore ? -1 : cc_interfaces->
core_id;
2480 return core_id_return;
2484static long count_agents(
const char *
const caller,
const int core_id_exception)
2533 const char *
const caller_name,
const int core_id,
2540 "Allocating new ast_cc_agent"))) {
2549 cc_unref(agent,
"Could not get channel config params.");
2553 cc_unref(agent,
"Could not init agent config params.");
2559 cc_unref(agent,
"Could not find agent callbacks.");
2565 cc_unref(agent,
"Agent init callback failed.");
2677 cc_unref(agent,
"Remove scheduler's reference to the agent");
2706 cc_unref(agent,
"Remove scheduler's reference to the agent");
2747 cc_unref(agent,
"Done holding ref for subscription");
2754 if (dev_state->
eid) {
2759 new_state = dev_state->
state;
2776 ast_str_set(&
str, 0,
"Agent monitoring %s device state since it is busy\n",
2780 if (!device_specific_topic) {
2790 cc_ref(agent,
"Ref agent for subscription");
2812 if ((target = strchr(interface,
'/'))) {
2899 if (core_instance->
agent) {
2900 cc_unref(core_instance->
agent,
"Core instance is done with the agent now");
2948 core_instance->
core_id = core_id;
2950 cc_unref(core_instance,
"Couldn't allocate agent, unref core_instance");
2954 core_instance->
monitors =
cc_ref(called_tree,
"Core instance getting ref to monitor tree");
2958 return core_instance;
2971 switch (new_state) {
3085 cc_unref(monitor_iter,
"request_cc failed. Unref list's reference to monitor");
3102 ast_log(
LOG_WARNING,
"Cannot request CC since there is no more room for requests\n");
3123 cc_unref(monitor_iter,
"unsuspend failed. Unref list's reference to monitor");
3170 cc_unref(monitor_iter,
"suspend failed. Unref list's reference to monitor");
3203 cc_unref(monitor_iter,
"cancel_available_timer failed. Unref list's reference to monitor");
3210 ast_cc_failed(core_instance->
core_id,
"All device monitors failed to cancel their available timers");
3262 core_instance =
args->core_instance;
3276 cc_unref(core_instance,
"Unref core instance from when it was found earlier");
3291 cc_unref(core_instance,
"Unref since state change has completed");
3328 vsnprintf(
args->debug, debuglen,
debug, ap);
3367 .
type =
"cc_recall",
3378 if (!recall_datastore) {
3382 if (!(recall_data =
ast_calloc(1,
sizeof(*recall_data)))) {
3394 "Bump refcount for monitor tree for recall datastore");
3396 recall_datastore->
data = recall_data;
3401 cc_unref(core_instance,
"Recall datastore set up. No need for core_instance ref");
3412 int core_id_candidate;
3425 recall_data = recall_datastore->
data;
3427 if (recall_data->
ignore) {
3436 if (!recall_data->
nested) {
3465 core_id_candidate = recall_data->
core_id;
3491 if (!core_instance) {
3499 cc_ref(monitor_iter,
"Hand the requester of the monitor a reference");
3504 cc_unref(core_instance,
"Done with core instance ref in ast_cc_get_monitor_by_recall_core_id");
3505 return monitor_iter;
3532 snprintf(dialstring_search,
sizeof(dialstring_search),
"%s%c",
dialstring,
'&');
3558 int top_level_id = starting_point->
id;
3577 if (monitor_iter->
parent_id == top_level_id) {
3615 recall_data = recall_datastore->
data;
3617 core_id = recall_data->
core_id;
3652 recall_data = recall_datastore->
data;
3654 core_id = recall_data->
core_id;
3664 if (!monitor_iter) {
3694 cc_interfaces = cc_datastore->
data;
3695 cc_interfaces->
ignore = 1;
3699 recall_cc_data = cc_recall_datastore->
data;
3700 recall_cc_data->
ignore = 1;
3710 va_start(ap,
debug);
3722 char cc_is_offerable;
3730 cc_interfaces = datastore->
data;
3735 if (cc_is_offerable) {
3746 va_start(ap,
debug);
3757 va_start(ap,
debug);
3768 va_start(ap,
debug);
3779 va_start(ap,
debug);
3790 va_start(ap,
debug);
3801 va_start(ap,
debug);
3821 recall_data = recall_datastore->
data;
3838 va_start(ap,
debug);
3849 va_start(ap,
debug);
3868 if (!core_instance) {
3871 "Core %d: Could not find core instance for device %s '%s'\n",
3888 cc_unref(monitor_iter,
"Monitor reported failure. Unref list's reference.");
3898 cc_unref(core_instance,
"Finished with core_instance in cc_monitor_failed\n");
3912 if (!(failure_data =
ast_calloc(1,
sizeof(*failure_data)))) {
3921 va_start(ap,
debug);
3947 cc_unref(core_instance,
"Status request finished. Unref core instance");
3956 if (!core_instance) {
3962 cc_unref(core_instance,
"Unref core instance. ast_taskprocessor_push failed");
3984 cc_unref(core_instance,
"Stop ringing finished. Unref core_instance");
3993 if (!core_instance) {
3999 cc_unref(core_instance,
"Unref core instance. ast_taskprocessor_push failed");
4012 cc_unref(core_instance,
"Party B free finished. Unref core_instance");
4021 if (!core_instance) {
4027 cc_unref(core_instance,
"Unref core instance. ast_taskprocessor_push failed");
4054 cc_unref(core_instance,
"Status response finished. Unref core instance");
4070 if (!core_instance) {
4075 args->core_instance = core_instance;
4076 args->devstate = devstate;
4080 cc_unref(core_instance,
"Unref core instance. ast_taskprocessor_push failed");
4087 const char *monitor_type,
const char *
const device_name,
const char * dialstring,
4100 cc_interfaces = datastore->
data;
4128 ast_log(
LOG_NOTICE,
"Not queuing a CC frame for device %s since it already has its maximum monitors allocated\n", device_name);
4142 const char *monitor_type,
const char *
const device_name,
4159 frame->
datalen =
sizeof(*payload);
4198 const char *monitor_type,
const char *
const device_name,
const char *
const dialstring,
void *private_data)
4240 core_instance->
core_id, device_name);
4247 cc_unref(core_instance,
"Unref core_instance since CallCompletionRequest was called with native agent");
4257 cc_unref(core_instance,
"Unref core_instance since too many CC requests");
4267 cc_unref(core_instance,
"Done with CallCompletionRequest");
4291 ast_log(
LOG_WARNING,
"CallCompletionCancel may only be used for calles with a generic agent\n");
4292 cc_unref(core_instance,
"Unref core instance found during CallCompletionCancel");
4297 res =
ast_cc_failed(core_instance->
core_id,
"Call completion request Cancelled for core ID %d by caller %s",
4298 core_instance->
core_id, device_name);
4299 cc_unref(core_instance,
"Unref core instance found during CallCompletionCancel");
4345 const char *cc_max_requests_str;
4351 ast_log(
LOG_WARNING,
"Could not find valid ccss.conf file. Using cc_max_requests default\n");
4379 const char *cc_devstate_str;
4409 "Could not find valid ccss.conf file. Using cc_[state]_devstate defaults\n");
4440 if (child_monitor_iter->
parent_id == monitor->
id) {
4465 ast_cli(*cli_fd,
"There are currently no active call completion transactions\n");
4467 ast_cli(*cli_fd,
"%d Call completion transactions\n", count);
4468 ast_cli(*cli_fd,
"Core ID\t\tCaller\t\t\t\tStatus\n");
4469 ast_cli(*cli_fd,
"----------------------------------------------------------------------------\n");
4482 e->
command =
"cc report status";
4484 "Usage: cc report status\n"
4485 " Report the current status of any ongoing CC transactions\n";
4522 int wordlen = strlen(
word);
4527 cc_unref(core_instance,
"CLI tab completion iteration")) {
4528 char core_id_str[20];
4529 snprintf(core_id_str,
sizeof(core_id_str),
"%d", core_instance->
core_id);
4530 if (!strncmp(
word, core_id_str, wordlen)) {
4532 cc_unref(core_instance,
"Found a matching core ID for CLI tab-completion");
4546 e->
command =
"cc cancel [core|all]";
4548 "Usage: cc cancel can be used in two ways.\n"
4549 " 1. 'cc cancel core [core ID]' will cancel the CC transaction with\n"
4550 " core ID equal to the specified core ID.\n"
4551 " 2. 'cc cancel all' will cancel all active CC transactions.\n";
4554 if (
a->pos == 3 && !strcasecmp(
a->argv[2],
"core")) {
4563 if (strcasecmp(
a->argv[2],
"core")) {
4566 core_id = strtol(
a->argv[3], &endptr, 10);
4567 if ((
errno != 0 &&
core_id == 0) || (endptr ==
a->argv[3])) {
4571 }
else if (
a->argc == 3) {
4572 if (strcasecmp(
a->argv[2],
"all")) {
4625 "Create core instance container");
4632 generic_monitor_instance_list_hash_fn,
NULL, generic_monitor_instance_list_cmp_fn,
4633 "Create generic monitor container");
Asterisk main include file. File version handling, generic pbx functions.
void * __ast_malloc(size_t size, const char *file, int lineno, const char *func) attribute_malloc
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_vasprintf(ret, fmt, ap)
A wrapper for vasprintf()
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_t_ref(o, delta, tag)
@ AO2_ALLOC_OPT_LOCK_MUTEX
#define ao2_t_iterator_next(iter, tag)
#define ao2_t_find(container, arg, flags, tag)
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define AO2_STRING_FIELD_CMP_FN(stype, field)
Creates a compare function for a structure string field.
#define ao2_t_link(container, obj, tag)
int() ao2_callback_fn(void *obj, void *arg, int flags)
Type of a generic callback function.
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_t_callback_data(container, flags, cb_fn, arg, data, tag)
ao2_callback_data() is a generic function that applies cb_fn() to all objects in a container....
#define ao2_t_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn, tag)
#define ao2_t_unlink(container, obj, tag)
#define AO2_STRING_FIELD_HASH_FN(stype, field)
Creates a hash function for a structure string field.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_t_alloc(data_size, destructor_fn, debug_msg)
#define ao2_t_callback(c, flags, cb_fn, arg, tag)
Internal Asterisk hangup causes.
#define AST_CAUSE_CONGESTION
static int dialed_cc_interface_counter
static const struct ast_datastore_info recall_ds_info
static void cc_generic_agent_respond(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason)
unsigned int ast_get_cc_recall_timer(struct ast_cc_config_params *config)
Get the cc_recall_timer.
int ast_cc_available_timer_expire(const void *data)
Scheduler callback for available timer expiration.
static int cc_complete(struct cc_core_instance *core_instance, struct cc_state_change_args *args, enum cc_state previous_state)
int ast_cc_agent_caller_busy(int core_id, const char *debug,...)
Indicate that the caller is busy.
int ast_cc_agent_accept_request(int core_id, const char *const debug,...)
Accept inbound CC request.
static int cc_recalling(struct cc_core_instance *core_instance, struct cc_state_change_args *args, enum cc_state previous_state)
int ast_set_cc_agent_policy(struct ast_cc_config_params *config, enum ast_cc_agent_policies value)
Set the cc_agent_policy.
static void cc_publish_requestacknowledged(int core_id, const char *caller)
#define CC_CALLER_REQUESTED_DEVSTATE_DEFAULT
static void initialize_cc_devstate_map(void)
static struct ast_sched_context * cc_sched_context
static int cc_caller_offered(struct cc_core_instance *core_instance, struct cc_state_change_args *args, enum cc_state previous_state)
static int cc_generic_agent_recall(struct ast_cc_agent *agent)
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.
static struct extension_monitor_pvt * extension_monitor_pvt_init(void)
void ast_set_cc_max_monitors(struct ast_cc_config_params *config, unsigned int value)
Set the cc_max_monitors.
static int generic_monitor_devstate_tp_cb(void *data)
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 bac...
static int cc_caller_requested(struct cc_core_instance *core_instance, struct cc_state_change_args *args, enum cc_state previous_state)
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.
static void generic_monitor_instance_list_destructor(void *obj)
static void cc_interface_destroy(void *data)
static int cc_status_request(void *data)
static enum ast_device_state ccss_device_state(const char *device_name)
int ast_cc_monitor_register(const struct ast_cc_monitor_callbacks *callbacks)
Register a set of monitor callbacks with the core.
void ast_cc_config_params_destroy(struct ast_cc_config_params *params)
Free memory from CCSS configuration params.
static void unsuspend(struct cc_core_instance *core_instance)
static void cc_publish_callerstopmonitoring(int core_id, const char *caller)
void ast_set_ccbs_available_timer(struct ast_cc_config_params *config, unsigned int value)
Set the ccbs_available_timer.
static void cc_publish_available(int core_id, const char *callee, const char *service)
void ast_ignore_cc(struct ast_channel *chan)
Mark the channel to ignore further CC activity.
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.
void ast_handle_cc_control_frame(struct ast_channel *inbound, struct ast_channel *outbound, void *frame_data)
Properly react to a CC control frame.
static const char * agent_policy_to_str(enum ast_cc_agent_policies policy)
static int cc_callee_ready(struct cc_core_instance *core_instance, struct cc_state_change_args *args, enum cc_state previous_state)
static const struct ast_cc_config_params cc_default_params
unsigned int ast_get_cc_offer_timer(struct ast_cc_config_params *config)
Get the cc_offer_timer.
static const int CC_CORE_INSTANCES_BUCKETS
static void cancel_available_timer(struct cc_core_instance *core_instance)
static void cc_extension_monitor_destructor(void *private_data)
int ast_cc_monitor_stop_ringing(int core_id)
Alert a caller to stop ringing.
static const char * ccreq_app
int ast_setup_cc_recall_datastore(struct ast_channel *chan, const int core_id)
Set up a CC recall datastore on a channel.
static void * cc_unref(void *obj, const char *debug)
#define CC_FAILED_DEVSTATE_DEFAULT
static int cc_offer(const int core_id, const char *const debug,...)
static int cccancel_exec(struct ast_channel *chan, const char *data)
static void cc_recall_ds_destroy(void *data)
static void * cc_ref(void *obj, const char *debug)
enum ast_cc_service_type service
static struct ao2_container * cc_core_instances
#define CC_COMPLETE_DEVSTATE_DEFAULT
static unsigned int global_cc_max_requests
static const char * cccancel_app
#define CC_AVAILABLE_DEVSTATE_DEFAULT
static int(*const state_change_funcs[])(struct cc_core_instance *, struct cc_state_change_args *, enum cc_state previous_state)
int ast_cc_offer(struct ast_channel *caller_chan)
Offer CC to a caller.
void ast_set_cc_callback_sub(struct ast_cc_config_params *config, const char *const value)
Set the callback subroutine name.
#define CC_CALLER_BUSY_DEVSTATE_DEFAULT
static int cc_generic_agent_stop_ringing(struct ast_cc_agent *agent)
static int cc_failed(struct cc_core_instance *core_instance, struct cc_state_change_args *args, enum cc_state previous_state)
static void ccss_notify_device_state_change(const char *device, enum cc_state state)
void ast_cc_default_config_params(struct ast_cc_config_params *params)
Set the specified CC config params to default values.
static void agent_destroy(void *data)
static void build_cc_interfaces_chanvar(struct ast_cc_monitor *starting_point, struct ast_str **str)
static int cc_generic_monitor_unsuspend(struct ast_cc_monitor *monitor)
static void initialize_cc_devstate_map_helper(struct ast_config *cc_config, enum cc_state state, const char *cc_setting)
static void cc_publish_monitorfailed(int core_id, const char *callee)
static int cc_core_instance_cmp_fn(void *obj, void *arg, int flags)
cc_state
The states used in the CCSS core state machine.
static void kill_duplicate_offers(char *caller)
int ast_cc_monitor_request_acked(int core_id, const char *const debug,...)
Indicate that an outbound entity has accepted our CC request.
#define GLOBAL_CC_MAX_REQUESTS_DEFAULT
static void cc_publish_callerstartmonitoring(int core_id, const char *caller)
static int cc_caller_busy(struct cc_core_instance *core_instance, struct cc_state_change_args *args, enum cc_state previous_state)
int ast_cc_agent_register(const struct ast_cc_agent_callbacks *callbacks)
Register a set of agent callbacks with the core.
static char * handle_cc_kill(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void cc_publish_callerrecalling(int core_id, const char *caller)
void ast_set_cc_agent_dialstring(struct ast_cc_config_params *config, const char *const value)
Set the cc_agent_dialstring.
static int cc_do_state_change(void *datap)
static void cc_publish_recallcomplete(int core_id, const char *caller)
#define CC_OFFER_TIMER_DEFAULT
static const char * CC_LOGGER_LEVEL_NAME
static struct ast_cc_monitor_callbacks generic_monitor_cbs
static void cc_publish_offertimerstart(int core_id, const char *caller, unsigned int expires)
static int cc_generic_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan)
static int cc_cli_output_status(void *data)
static int ccreq_exec(struct ast_channel *chan, const char *data)
int ast_cc_agent_recalling(int core_id, const char *const debug,...)
Tell the CC core that a caller is currently recalling.
void ast_set_cc_offer_timer(struct ast_cc_config_params *config, unsigned int value)
Set the cc_offer_timer.
static int offer_timer_expire(const void *data)
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
void ast_set_cc_max_agents(struct ast_cc_config_params *config, unsigned int value)
Set the cc_max_agents.
static void cc_core_instance_destructor(void *data)
static int cc_build_payload(struct ast_channel *chan, struct ast_cc_config_params *cc_params, const char *monitor_type, const char *const device_name, const char *dialstring, enum ast_cc_service_type service, void *private_data, struct cc_control_payload *payload)
static int cc_generic_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, int *sched_id)
#define CCNR_AVAILABLE_TIMER_DEFAULT
int ast_cc_completed(struct ast_channel *chan, const char *const debug,...)
Indicate recall has been acknowledged.
unsigned int ast_get_ccbs_available_timer(struct ast_cc_config_params *config)
Get the ccbs_available_timer.
static struct ast_taskprocessor * cc_core_taskprocessor
static int cc_publish(struct stasis_message_type *message_type, int core_id, struct ast_json *extras)
static enum ast_device_state cc_state_to_devstate(enum cc_state state)
static void request_cc(struct cc_core_instance *core_instance)
static const char * cc_state_to_string(enum cc_state state)
static const struct ast_datastore_info dialed_cc_interfaces_info
struct ast_cc_agent * ast_cc_agent_callback(int flags, ao2_callback_fn *function, void *args, const char *const type)
Call a callback on all agents of a specific type.
int ast_cc_set_param(struct ast_cc_config_params *params, const char *const name, const char *const value)
set a CCSS configuration parameter, given its name
static void cc_generic_agent_destructor(struct ast_cc_agent *agent)
static int cc_generic_agent_start_monitoring(struct ast_cc_agent *agent)
static void cc_publish_requested(int core_id, const char *caller, const char *callee)
static int count_agents_cb(void *obj, void *arg, void *data, int flags)
static struct cc_core_instance * cc_core_init_instance(struct ast_channel *caller_chan, struct cc_monitor_tree *called_tree, const int core_id, struct cc_control_payload *cc_data)
static struct ast_cc_agent * cc_agent_init(struct ast_channel *caller_chan, const char *const caller_name, const int core_id, struct cc_monitor_tree *interface_tree)
static enum ast_cc_monitor_policies str_to_monitor_policy(const char *const value)
static const struct ast_cc_monitor_callbacks * find_monitor_callbacks(const char *const type)
int ast_cc_monitor_count(const char *const name, const char *const type)
Return the number of outstanding CC requests to a specific device.
static void suspend(struct cc_core_instance *core_instance)
unsigned int ast_get_ccnr_available_timer(struct ast_cc_config_params *config)
Get the ccnr_available_timer.
void ast_set_ccnr_available_timer(struct ast_cc_config_params *config, unsigned int value)
Set the ccnr_available_timer.
const char * service_string
static void cc_cli_print_monitor_stats(struct ast_cc_monitor *monitor, int fd, int parent_id)
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.
unsigned int ast_get_cc_max_agents(struct ast_cc_config_params *config)
Get the cc_max_agents.
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.
static enum ast_cc_agent_policies str_to_agent_policy(const char *const value)
static void cc_monitor_destroy(void *data)
int ast_set_cc_monitor_policy(struct ast_cc_config_params *config, enum ast_cc_monitor_policies value)
Set the cc_monitor_policy.
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.
void ast_set_cc_recall_timer(struct ast_cc_config_params *config, unsigned int value)
Set the cc_recall_timer.
static int cc_generic_is_device_available(enum ast_device_state state)
static const struct @319 cc_service_to_string_map[]
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.
static struct ast_cc_monitor * cc_device_monitor_init(const char *const device_name, const char *const dialstring, const struct cc_control_payload *cc_data, int core_id)
static int cc_party_b_free(void *data)
static int cc_generic_monitor_suspend(struct ast_cc_monitor *monitor)
int ast_cc_monitor_status_request(int core_id)
Request the status of a caller or callers.
enum ast_cc_agent_policies ast_get_cc_agent_policy(struct ast_cc_config_params *config)
Get the cc_agent_policy.
static int cc_request_count
static int cc_generic_agent_status_request(struct ast_cc_agent *agent)
static int cc_active(struct cc_core_instance *core_instance, struct cc_state_change_args *args, enum cc_state previous_state)
static int cc_generic_agent_start_offer_timer(struct ast_cc_agent *agent)
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.
static void * generic_recall(void *data)
static void generic_monitor_devstate_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
const char * ast_get_cc_callback_sub(struct ast_cc_config_params *config)
Get the name of the callback subroutine.
static struct ast_cc_monitor * cc_extension_monitor_init(const char *const exten, const char *const context, const unsigned int parent_id)
static struct cc_core_instance * find_cc_core_instance(const int core_id)
static void initialize_cc_max_requests(void)
static int has_device_monitors(struct cc_core_instance *core_instance)
check if the core instance has any device monitors
static int is_state_change_valid(enum cc_state current_state, const enum cc_state new_state, struct ast_cc_agent *agent)
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.
struct ao2_container * generic_monitors
static int cc_logger_level
void ast_cc_monitor_unregister(const struct ast_cc_monitor_callbacks *callbacks)
Unregister a set of monitor callbacks with the core.
static void cc_extension_monitor_change_is_valid(struct cc_core_instance *core_instance, unsigned int parent_id, const char *const device_name, int is_valid)
#define CC_MAX_AGENTS_DEFAULT
enum ast_cc_monitor_policies ast_get_cc_monitor_policy(struct ast_cc_config_params *config)
Get the cc_monitor_policy.
const char * state_string
static void check_callback_sanity(const struct ast_cc_agent_callbacks *callbacks)
unsigned int ast_get_cc_max_monitors(struct ast_cc_config_params *config)
Get the cc_max_monitors.
int ast_queue_cc_frame(struct ast_channel *chan, const char *monitor_type, const char *const dialstring, enum ast_cc_service_type service, void *private_data)
Queue an AST_CONTROL_CC frame.
static int cc_available(struct cc_core_instance *core_instance, struct cc_state_change_args *args, enum cc_state previous_state)
static int cc_generic_monitor_request_cc(struct ast_cc_monitor *monitor, int *available_timer_id)
static int cc_stop_ringing(void *data)
static int cc_interfaces_datastore_init(struct ast_channel *chan)
static int match_agent(void *obj, void *arg, void *data, int flags)
static const struct ast_cc_agent_callbacks * find_agent_callbacks(struct ast_channel *chan)
static int count_monitors_cb(void *obj, void *arg, int flags)
static struct generic_monitor_instance_list * create_new_generic_list(struct ast_cc_monitor *monitor)
int ast_cc_agent_caller_available(int core_id, const char *const debug,...)
Indicate that a previously unavailable caller has become available.
static int load_module(void)
static struct ast_cli_entry cc_cli[]
#define CCBS_AVAILABLE_TIMER_DEFAULT
#define CC_CALLEE_READY_DEVSTATE_DEFAULT
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
static void generic_agent_devstate_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
static void cc_unique_append(struct ast_str **str, const char *dialstring)
int ast_cc_agent_set_interfaces_chanvar(struct ast_channel *chan)
Set the first level CC_INTERFACES channel variable for a channel.
static const char * monitor_policy_to_str(enum ast_cc_monitor_policies policy)
static char * handle_cc_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
int ast_cc_call_init(struct ast_channel *chan, int *ignore_cc)
Start the CC process on a call.
int ast_cc_agent_status_response(int core_id, enum ast_device_state devstate)
Response with a caller's current status.
static enum ast_device_state cc_state_to_devstate_map[]
static int unload_module(void)
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.
int ast_cc_failed(int core_id, const char *const debug,...)
Indicate failure has occurred.
static void call_destructor_with_no_monitor(const char *const monitor_type, void *private_data)
static int cc_generic_agent_stop_offer_timer(struct ast_cc_agent *agent)
void ast_cc_agent_unregister(const struct ast_cc_agent_callbacks *callbacks)
Unregister a set of agent callbacks with the core.
static int print_stats_cb(void *obj, void *arg, int flags)
static void dialed_cc_interfaces_destroy(void *data)
static const struct @320 cc_state_to_string_map[]
static int cc_agent_callback_helper(void *obj, void *args, int flags)
static void cc_publish_failure(int core_id, const char *caller, const char *reason)
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...
#define CC_RECALL_TIMER_DEFAULT
static void cc_interface_tree_destroy(void *data)
static long count_agents(const char *const caller, const int core_id_exception)
#define CC_CALLER_OFFERED_DEVSTATE_DEFAULT
#define CC_RECALLING_DEVSTATE_DEFAULT
static void * dialed_cc_interfaces_duplicate(void *data)
static int kill_cores(void *obj, void *arg, int flags)
static void * cc_recall_ds_duplicate(void *data)
static struct generic_monitor_instance_list * find_generic_monitor_instance_list(const char *const device_name)
static char * complete_core_id(const char *word)
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.
static int cc_core_instance_hash_fn(const void *obj, const int flags)
static int cc_status_response(void *data)
int ast_cc_get_current_core_id(struct ast_channel *chan)
Get the core id for the current call.
static int cc_monitor_failed(void *data)
int ast_cc_is_config_param(const char *const name)
Is this a CCSS configuration parameter?
static int core_id_counter
#define CC_MAX_MONITORS_DEFAULT
static int cc_request_state_change(enum cc_state state, const int core_id, const char *debug, va_list ap)
#define CC_ACTIVE_DEVSTATE_DEFAULT
const char * ast_get_cc_agent_dialstring(struct ast_cc_config_params *config)
Get the cc_agent_dialstring.
static void cc_generic_monitor_destructor(void *private_data)
static const char * cc_service_to_string(enum ast_cc_service_type service)
static struct ast_cc_agent_callbacks generic_agent_callbacks
Call Completion Supplementary Services API.
#define ast_cc_config_params_init()
Allocate and initialize an ast_cc_config_params structure.
#define AST_CC_GENERIC_MONITOR_TYPE
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.
ast_cc_agent_response_reason
@ AST_CC_AGENT_RESPONSE_FAILURE_INVALID
@ AST_CC_AGENT_RESPONSE_SUCCESS
@ AST_CC_AGENT_RESPONSE_FAILURE_TOO_MANY
ast_cc_monitor_policies
The various possibilities for cc_monitor_policy values.
ast_cc_agent_policies
The various possibilities for cc_agent_policy values.
@ AST_CC_AGENT_SKIP_OFFER
@ AST_CC_EXTENSION_MONITOR
static const char config[]
static void dummy(char *unused,...)
General Asterisk PBX channel definitions.
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
const char * ast_channel_name(const struct ast_channel *chan)
int ast_channel_get_device_name(struct ast_channel *chan, char *device_name, size_t name_buffer_length)
Get a device name given its channel structure.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
#define DATASTORE_INHERIT_FOREVER
#define ast_channel_lock(chan)
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
const char * ast_channel_context(const struct ast_channel *chan)
struct ast_channel * ast_channel_get_by_name_prefix(const char *name, size_t name_len)
Find a channel by a name prefix.
int ast_channel_hangupcause(const struct ast_channel *chan)
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
int ast_softhangup(struct ast_channel *chan, int cause)
Softly hangup up a channel.
struct ast_channel * ast_request_and_dial(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int timeout, int *reason, const char *cid_num, const char *cid_name)
Request a channel of a given type, with data as optional information used by the low level module and...
@ AST_SOFTHANGUP_EXPLICIT
void ast_channel_context_set(struct ast_channel *chan, const char *value)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_priority_set(struct ast_channel *chan, int value)
const struct ast_channel_tech * ast_get_channel_tech(const char *name)
Get a channel technology structure by name.
const char * ast_channel_exten(const struct ast_channel *chan)
struct ast_cc_config_params * ast_channel_get_cc_config_params(struct ast_channel *chan)
Get the CCSS parameters from a channel.
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
int ast_channel_get_cc_agent_type(struct ast_channel *chan, char *agent_type, size_t size)
Find the appropriate CC agent type to use given a channel.
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.
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
int ast_cli_completion_add(char *value)
Add a result to a request for completion options.
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
#define ast_datastore_alloc(info, uid)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
struct stasis_message_type * ast_device_state_message_type(void)
Get the Stasis message type for device state messages.
int ast_devstate_prov_del(const char *label)
Remove device state provider.
int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
const char * ast_devstate2str(enum ast_device_state devstate) attribute_pure
Convert device state to text string for output.
enum ast_device_state ast_devstate_val(const char *val)
Convert device state from text to integer value.
struct stasis_topic * ast_device_state_topic(const char *device)
Get the Stasis topic for device state messages for a specific device.
int ast_devstate_prov_add(const char *label, ast_devstate_prov_cb_type callback)
Add device state provider.
ast_device_state
Device States.
struct stasis_message_type * stasis_subscription_change_type(void)
Gets the message type for subscription change notices.
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
int ast_app_exec_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const char *sub_args, int ignore_hangup)
Run a subroutine on a channel, placing an optional second channel into autoservice.
struct ast_config * ast_config_load2(const char *filename, const char *who_asked, struct ast_flags flags)
Load a config file.
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
#define ast_log_dynamic_level(level,...)
Send a log message to a dynamically registered log level.
int ast_logger_register_level(const char *name)
Register a new logger level.
void ast_logger_unregister_level(const char *name)
Unregister a previously registered logger level.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_json_payload * ast_json_payload_create(struct ast_json *json)
Create an ao2 object to pass json blobs as data payloads for stasis.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
AST_JSON_INT_T ast_json_int_t
Primarily used to cast when packing to an "I" type.
int ast_json_object_update(struct ast_json *object, struct ast_json *other)
Update object with all of the fields of other.
#define AST_RWLIST_REMOVE_CURRENT
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized.
#define AST_LIST_HEAD_DESTROY(head)
Destroys a list head structure.
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_RWLIST_TRAVERSE_SAFE_END
#define AST_LIST_HEAD_INIT(head)
Initializes a list head structure.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_RWLIST_TRAVERSE
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define AST_RWLIST_INSERT_TAIL
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
Asterisk module definitions.
@ AST_MODFLAG_GLOBAL_SYMBOLS
int ast_register_application2(const char *app, int(*execute)(struct ast_channel *, const char *), const char *synopsis, const char *description, void *mod)
Register an application.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
@ AST_MODULE_LOAD_FAILURE
Module could not be loaded properly.
@ AST_MODULE_LOAD_SUCCESS
Core PBX routines and definitions.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
struct stasis_forward * sub
static int debug
Global debug status.
int ast_sched_del(struct ast_sched_context *con, int id) attribute_warn_unused_result
Deletes a scheduled event.
int ast_sched_add(struct ast_sched_context *con, int when, ast_sched_cb callback, const void *data) attribute_warn_unused_result
Adds a scheduled event.
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
int ast_sched_start_thread(struct ast_sched_context *con)
Start a thread for processing scheduler entries.
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
@ STASIS_SUBSCRIPTION_FILTER_SELECTIVE
int stasis_subscription_accept_message_type(struct stasis_subscription *subscription, const struct stasis_message_type *type)
Indicate to a subscription that we are interested in a message type.
int stasis_subscription_set_filter(struct stasis_subscription *subscription, enum stasis_subscription_message_filter filter)
Set the message type filtering level on a subscription.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
int stasis_subscription_final_message(struct stasis_subscription *sub, struct stasis_message *msg)
Determine whether a message is the final message to be received on a subscription.
struct stasis_message * stasis_message_create(struct stasis_message_type *type, void *data)
Create a new message.
struct stasis_subscription * stasis_unsubscribe(struct stasis_subscription *subscription)
Cancel a subscription.
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic's subscribers.
#define stasis_subscribe(topic, callback, data)
struct stasis_message_type * ast_cc_monitorfailed_type(void)
A stasis_message_type for CCSS Monitor Failed messages.
struct stasis_message_type * ast_cc_recallcomplete_type(void)
A stasis_message_type for CCSS Recall Complete messages.
struct stasis_message_type * ast_cc_callerrecalling_type(void)
A stasis_message_type for CCSS Caller Recalling messages.
struct stasis_topic * ast_system_topic(void)
A Stasis Message Bus API topic which publishes messages regarding system changes.
struct stasis_message_type * ast_cc_failure_type(void)
A stasis_message_type for CCSS Failure messages.
struct stasis_message_type * ast_cc_callerstopmonitoring_type(void)
A stasis_message_type for CCSS Caller Stop Monitoring messages.
struct stasis_message_type * ast_cc_available_type(void)
A stasis_message_type for CCSS Available messages.
struct stasis_message_type * ast_cc_requestacknowledged_type(void)
A stasis_message_type for CCSS Request Acknowledged messages.
struct stasis_message_type * ast_cc_callerstartmonitoring_type(void)
A stasis_message_type for CCSS Caller Start Monitoring messages.
struct stasis_message_type * ast_cc_offertimerstart_type(void)
A stasis_message_type for CCSS Offer Timer Start messages.
struct stasis_message_type * ast_cc_requested_type(void)
A stasis_message_type for CCSS Requested messages.
String manipulation functions.
char * ast_str_truncate(struct ast_str *buf, ssize_t len)
Truncates the enclosed string to the given length.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
char * ast_tech_to_upper(char *dev_str)
Convert the tech portion of a device string to upper case.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_alloca(init_len)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Structure representing an agent.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
int(* party_b_free)(struct ast_cc_agent *agent)
Let the caller know that the callee has become free but that the caller cannot attempt to call back b...
int(* status_request)(struct ast_cc_agent *agent)
Request the status of the agent's device.
int(* stop_ringing)(struct ast_cc_agent *agent)
Request for an agent's phone to stop ringing.
const char * type
Type of agent the callbacks belong to.
int(* start_offer_timer)(struct ast_cc_agent *agent)
Start the offer timer.
int(* start_monitoring)(struct ast_cc_agent *agent)
Begin monitoring a busy device.
void(* respond)(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason)
Respond to a CC request.
void(* destructor)(struct ast_cc_agent *agent)
Destroy private data on the agent.
int(* stop_offer_timer)(struct ast_cc_agent *agent)
Stop the offer timer.
int(* callee_available)(struct ast_cc_agent *agent)
Alert the caller that it is time to try recalling.
int(* init)(struct ast_cc_agent *agent, struct ast_channel *chan)
CC agent initialization.
const struct ast_cc_agent_callbacks * callbacks
unsigned int flags
Flags for agent operation.
struct ast_cc_config_params * cc_params
enum ast_cc_monitor_policies cc_monitor_policy
unsigned int cc_recall_timer
unsigned int ccnr_available_timer
unsigned int cc_max_monitors
char cc_callback_sub[AST_MAX_EXTENSION]
char cc_agent_dialstring[AST_MAX_EXTENSION]
enum ast_cc_agent_policies cc_agent_policy
unsigned int cc_offer_timer
unsigned int ccbs_available_timer
unsigned int cc_max_agents
Structure with information about an outbound interface.
const char * monitor_type
The type of monitor that should be used for this interface.
enum ast_cc_monitor_class monitor_class
struct ast_cc_config_params * config_params
Callbacks defined by CC monitors.
int(* status_response)(struct ast_cc_monitor *monitor, enum ast_device_state devstate)
Status response to an ast_cc_monitor_status_request().
int(* request_cc)(struct ast_cc_monitor *monitor, int *available_timer_id)
Request CCSS.
int(* cancel_available_timer)(struct ast_cc_monitor *monitor, int *sched_id)
Cancel the running available timer.
void(* destructor)(void *private_data)
Destroy private data on the monitor.
const char * type
Type of monitor the callbacks belong to.
int(* unsuspend)(struct ast_cc_monitor *monitor)
Unsuspend monitoring.
int(* suspend)(struct ast_cc_monitor *monitor)
Suspend monitoring.
const struct ast_cc_monitor_callbacks * callbacks
struct ast_cc_interface * interface
struct ast_cc_monitor * next
void * private_data
Data that is private to a monitor technology.
enum ast_cc_service_type service_offered
char * dialstring
Name that should be used to recall specified interface.
Structure to describe a channel "technology", ie a channel driver See for examples:
int(* cc_callback)(struct ast_channel *inbound, const char *dest, ast_cc_callback_fn callback)
Call a function with cc parameters as a function parameter.
Main Channel structure associated with a channel.
descriptor for a cli entry.
Structure for a data store type.
Structure for a data store object.
struct ast_datastore * next
The structure that contains device state.
enum ast_device_state state
const struct ast_eid * eid
The EID of the server where this message originated.
Structure used to handle boolean flags.
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@226 data
enum ast_frame_type frametype
Abstract JSON element (object, array, string, int, ...).
Support for dynamic strings.
A ast_taskprocessor structure is a singleton by name.
const struct ast_cc_agent_callbacks * callbacks
struct cc_agent_backend * next
ao2_callback_fn * function
The payload for an AST_CONTROL_CC frame.
const char * monitor_type
The type of monitor to allocate.
int parent_interface_id
ID of parent extension.
char device_name[AST_CHANNEL_NAME]
Name of device to be monitored.
enum ast_cc_service_type service
Service offered by the endpoint.
char dialstring[AST_CHANNEL_NAME]
Recall dialstring.
void * private_data
Private data allocated by the callee.
struct ast_cc_config_params config_params
Configuration parameters used by this endpoint.
enum cc_state current_state
struct ast_cc_agent * agent
struct cc_monitor_tree * monitors
struct stasis_subscription * sub
char context[AST_CHANNEL_NAME]
char cid_num[AST_CHANNEL_NAME]
char cid_name[AST_CHANNEL_NAME]
char exten[AST_CHANNEL_NAME]
const struct ast_cc_monitor_callbacks * callbacks
struct cc_monitor_backend * next
The "tree" of interfaces that is dialed.
struct cc_monitor_tree * interface_tree
struct cc_core_instance * core_instance
enum ast_device_state devstate
struct cc_core_instance * core_instance
const char * monitor_type
struct cc_monitor_tree * interface_tree
unsigned int dial_parent_id
Data regarding an extension monitor's child's dialstrings.
char device_name[AST_CHANNEL_NAME]
The name of the device being dialed.
int is_valid
Is this structure valid for use in CC_INTERFACES?
struct extension_child_dialstring * next
char original_dialstring[AST_CHANNEL_NAME]
the original dialstring used to call a particular device
Private data for an extension monitor.
struct extension_monitor_pvt::@326 child_dialstrings
structure to hold extensions
struct stasis_subscription * sub
enum ast_device_state current_state
struct generic_monitor_instance_list::@324 list
struct generic_monitor_instance * next
private data for generic device monitor
An API for managing task processing threads that can be shared across modules.
struct ast_taskprocessor * ast_taskprocessor_get(const char *name, enum ast_tps_options create)
Get a reference to a taskprocessor with the specified name and create the taskprocessor if necessary.
void * ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
Unreference the specified taskprocessor and its reference count will decrement.
@ TPS_REF_DEFAULT
return a reference to a taskprocessor, create one if it does not exist
int ast_taskprocessor_push(struct ast_taskprocessor *tps, int(*task_exe)(void *datap), void *datap) attribute_warn_unused_result
Push a task into the specified taskprocessor queue and signal the taskprocessor thread.
#define ast_test_flag(p, flag)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_pthread_create_detached_background(a, b, c, d)
#define ast_set_flag(p, flag)