382 static const struct {
392 static const struct {
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 586 return cc_state_to_devstate_map[
state];
608 (
char *) device_name, &match_flags,
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_macro =
"",
672 .cc_callback_sub =
"",
673 .cc_agent_dialstring =
"",
700 if (!strcasecmp(value,
"never")) {
702 }
else if (!strcasecmp(value,
"native")) {
704 }
else if (!strcasecmp(value,
"generic")) {
707 ast_log(
LOG_WARNING,
"%s is an invalid value for cc_agent_policy. Switching to 'never'\n", value);
714 if (!strcasecmp(value,
"never")) {
716 }
else if (!strcasecmp(value,
"native")) {
718 }
else if (!strcasecmp(value,
"generic")) {
720 }
else if (!strcasecmp(value,
"always")) {
723 ast_log(
LOG_WARNING,
"%s is an invalid value for cc_monitor_policy. Switching to 'never'\n", value);
760 char *
buf,
size_t buf_len)
764 if (!strcasecmp(name,
"cc_callback_macro")) {
766 }
else if (!strcasecmp(name,
"cc_callback_sub")) {
768 }
else if (!strcasecmp(name,
"cc_agent_policy")) {
770 }
else if (!strcasecmp(name,
"cc_monitor_policy")) {
772 }
else if (!strcasecmp(name,
"cc_agent_dialstring")) {
784 if (!strcasecmp(name,
"cc_offer_timer")) {
786 }
else if (!strcasecmp(name,
"ccnr_available_timer")) {
788 }
else if (!strcasecmp(name,
"ccbs_available_timer")) {
790 }
else if (!strcasecmp(name,
"cc_max_agents")) {
792 }
else if (!strcasecmp(name,
"cc_max_monitors")) {
794 }
else if (!strcasecmp(name,
"cc_recall_timer")) {
805 const char *
const value)
807 unsigned int value_as_uint;
808 if (!strcasecmp(name,
"cc_agent_policy")) {
810 }
else if (!strcasecmp(name,
"cc_monitor_policy")) {
812 }
else if (!strcasecmp(name,
"cc_agent_dialstring")) {
814 }
else if (!strcasecmp(name,
"cc_callback_macro")) {
817 }
else if (!strcasecmp(name,
"cc_callback_sub")) {
822 if (sscanf(value,
"%30u", &value_as_uint) != 1) {
826 if (!strcasecmp(name,
"cc_offer_timer")) {
828 }
else if (!strcasecmp(name,
"ccnr_available_timer")) {
830 }
else if (!strcasecmp(name,
"ccbs_available_timer")) {
832 }
else if (!strcasecmp(name,
"cc_max_agents")) {
834 }
else if (!strcasecmp(name,
"cc_max_monitors")) {
836 }
else if (!strcasecmp(name,
"cc_recall_timer")) {
848 return (!strcasecmp(name,
"cc_agent_policy") ||
849 !strcasecmp(name,
"cc_monitor_policy") ||
850 !strcasecmp(name,
"cc_offer_timer") ||
851 !strcasecmp(name,
"ccnr_available_timer") ||
852 !strcasecmp(name,
"ccbs_available_timer") ||
853 !strcasecmp(name,
"cc_max_agents") ||
854 !strcasecmp(name,
"cc_max_monitors") ||
855 !strcasecmp(name,
"cc_callback_macro") ||
856 !strcasecmp(name,
"cc_callback_sub") ||
857 !strcasecmp(name,
"cc_agent_dialstring") ||
858 !strcasecmp(name,
"cc_recall_timer"));
1006 ast_log(
LOG_WARNING,
"Usage of cc_callback_macro is deprecated. Please use cc_callback_sub instead.\n");
1029 if (!message_type) {
1034 "core_id", core_id);
1069 "service", service);
1416 if (!generic_list) {
1421 cc_unref(generic_list,
"Failed to strdup the monitor's device name");
1428 if (!device_specific_topic) {
1433 cc_unref(generic_list,
"Failed to subscribe to device state");
1439 ao2_t_link(generic_monitors, generic_list,
"linking new generic monitor instance list");
1440 return generic_list;
1461 cc_unref(generic_list,
"Kill reference of generic list in devstate taskprocessor callback");
1480 cc_unref(generic_list,
"Kill reference of generic list in devstate taskprocessor callback");
1497 if (dev_state->
eid) {
1502 ao2_t_ref(dev_state, +1,
"Bumping dev_state ref for cc_core_taskprocessor");
1515 cc_unref(monitor,
"Unref reference from scheduler\n");
1531 if (!(gen_mon_pvt =
ast_calloc(1,
sizeof(*gen_mon_pvt)))) {
1550 if (!(generic_instance =
ast_calloc(1,
sizeof(*generic_instance)))) {
1554 cc_unref(generic_list,
"Generic monitor instance failed to allocate");
1563 *available_timer_id =
ast_sched_add(cc_sched_context, when * 1000,
1565 if (*available_timer_id == -1) {
1566 cc_unref(monitor,
"Failed to schedule available timer. (monitor)");
1567 cc_unref(generic_list,
"Failed to schedule available timer. (generic_list)");
1578 cc_unref(generic_list,
"Finished with monitor instance reference in request cc callback");
1604 cc_unref(generic_list,
"Device is in use. Nothing to do. Unref generic list.");
1619 cc_unref(generic_list,
"Done with generic list in suspend callback");
1629 if (!generic_list) {
1647 cc_unref(generic_list,
"Done with generic list in cc_generic_monitor_unsuspend");
1655 if (*sched_id == -1) {
1662 cc_unref(monitor,
"Remove scheduler's reference to the monitor");
1674 if (!private_data) {
1709 ao2_t_unlink(generic_monitors, generic_list,
"Generic list is empty. Unlink it from the container");
1726 "availability due to other instance's failure.");
1732 cc_unref(generic_list,
"Done with generic list in generic monitor destructor");
1827 if (!extension_pvt) {
1866 cc_unref(monitor,
"Destroying all monitors");
1968 if (!new_cc_interfaces) {
1977 return new_cc_interfaces;
1990 .
type =
"Dial CC Interfaces",
2021 cc_interfaces = cc_datastore->
data;
2028 if (monitor->
id ==
id) {
2039 if (!(child_dialstring =
ast_calloc(1,
sizeof(*child_dialstring)))) {
2057 if (monitor_iter->
id == parent_id) {
2062 if (!monitor_iter) {
2068 if (!strcmp(child_dialstring->
device_name, device_name)) {
2098 "Allocating new ast_cc_interface"))) {
2103 cc_unref(cc_interface,
"failed to allocate the monitor, so unref the interface");
2108 cc_unref(monitor,
"Failed to initialize extension monitor private data. uref monitor");
2109 cc_unref(cc_interface,
"Failed to initialize extension monitor private data. unref cc_interface");
2154 if (!(interfaces =
ast_calloc(1,
sizeof(*interfaces)))) {
2164 cc_unref(monitor,
"Could not allocate the dialed interfaces datastore. Unreffing monitor");
2170 "Allocate monitor tree"))) {
2172 cc_unref(monitor,
"Could not allocate monitor tree on dialed interfaces datastore. Unreffing monitor");
2180 cc_ref(monitor,
"List's reference to extension monitor");
2189 cc_unref(monitor,
"Unreffing allocation's reference");
2220 if (!monitor_callbacks) {
2254 size_t device_name_len = strlen(device_name);
2258 "Allocating new ast_cc_interface"))) {
2263 cc_unref(cc_interface,
"Failed to allocate config params, unref interface");
2268 cc_unref(cc_interface,
"Failed to allocate monitor, unref interface");
2273 cc_unref(monitor,
"Failed to copy dialable name. Unref monitor");
2274 cc_unref(cc_interface,
"Failed to copy dialable name");
2279 cc_unref(monitor,
"Failed to find monitor callbacks. Unref monitor");
2280 cc_unref(cc_interface,
"Failed to find monitor callbacks");
2331 ast_log(
LOG_WARNING,
"Unable to retrieve CC datastore while processing CC frame from '%s'. CC services will be unavailable.\n", device_name);
2337 cc_interfaces = cc_datastore->
data;
2339 if (cc_interfaces->
ignore) {
2357 if (!core_instance) {
2359 cc_interfaces->
core_id, cc_data);
2360 if (!core_instance) {
2361 cc_interfaces->
ignore = 1;
2380 core_instance->
core_id, device_name);
2382 cc_unref(core_instance,
"Returning early from ast_handle_cc_control_frame. Unref core_instance");
2390 ast_log(
LOG_WARNING,
"Unable to create CC device interface for '%s'. CC services will be unavailable on this interface.\n", device_name);
2391 cc_unref(core_instance,
"Returning early from ast_handle_cc_control_frame. Unref core_instance");
2397 cc_ref(monitor,
"monitor tree's reference to the monitor");
2405 cc_unref(core_instance,
"Done with core_instance after handling CC control frame");
2406 cc_unref(monitor,
"Unref reference from allocating monitor");
2457 interfaces = cc_interfaces_datastore->
data;
2460 if (interfaces->
ignore) {
2474 cc_ref(monitor,
"monitor tree's reference to the monitor");
2478 cc_unref(monitor,
"Unref monitor's allocation reference");
2499 cc_interfaces = datastore->
data;
2500 core_id_return = cc_interfaces->
ignore ? -1 : cc_interfaces->
core_id;
2502 return core_id_return;
2506 static long count_agents(
const char *
const caller,
const int core_id_exception)
2525 match_agent, caller, &match_flags,
"Killing duplicate offers");
2555 const char *
const caller_name,
const int core_id,
2562 "Allocating new ast_cc_agent"))) {
2571 cc_unref(agent,
"Could not get channel config params.");
2575 cc_unref(agent,
"Could not init agent config params.");
2581 cc_unref(agent,
"Could not find agent callbacks.");
2587 cc_unref(agent,
"Agent init callback failed.");
2699 cc_unref(agent,
"Remove scheduler's reference to the agent");
2728 cc_unref(agent,
"Remove scheduler's reference to the agent");
2769 cc_unref(agent,
"Done holding ref for subscription");
2776 if (dev_state->
eid) {
2781 new_state = dev_state->
state;
2798 ast_str_set(&str, 0,
"Agent monitoring %s device state since it is busy\n",
2802 if (!device_specific_topic) {
2812 cc_ref(agent,
"Ref agent for subscription");
2820 const char *
interface =
S_OR(ast_get_cc_agent_dialstring(agent->cc_params), ast_strdupa(agent->device_name));
2835 if ((target = strchr(interface,
'/'))) {
2844 agent->core_id, agent->device_name, reason);
2845 ast_cc_failed(agent->core_id,
"Failed to call back device %s/%s", tech, target);
2868 agent->core_id, agent->device_name);
2870 ast_cc_failed(agent->core_id,
"Callback macro to %s failed. Maybe a hangup?", agent->device_name);
2878 agent->core_id, agent->device_name);
2880 ast_cc_failed(agent->core_id,
"Callback subroutine to %s failed. Maybe a hangup?", agent->device_name);
2886 ast_cc_failed(agent->core_id,
"PBX failed to start for %s.", agent->device_name);
2891 agent->device_name);
2921 if (agent_pvt->
sub) {
2932 if (core_instance->
agent) {
2933 cc_unref(core_instance->
agent,
"Core instance is done with the agent now");
2981 core_instance->
core_id = core_id;
2983 cc_unref(core_instance,
"Couldn't allocate agent, unref core_instance");
2987 core_instance->
monitors =
cc_ref(called_tree,
"Core instance getting ref to monitor tree");
2989 ao2_t_link(cc_core_instances, core_instance,
"Link core instance into container");
2991 return core_instance;
3004 switch (new_state) {
3118 cc_unref(monitor_iter,
"request_cc failed. Unref list's reference to monitor");
3135 ast_log(
LOG_WARNING,
"Cannot request CC since there is no more room for requests\n");
3156 cc_unref(monitor_iter,
"unsuspend failed. Unref list's reference to monitor");
3203 cc_unref(monitor_iter,
"suspend failed. Unref list's reference to monitor");
3236 cc_unref(monitor_iter,
"cancel_available_timer failed. Unref list's reference to monitor");
3243 ast_cc_failed(core_instance->
core_id,
"All device monitors failed to cancel their available timers");
3262 ao2_t_unlink(cc_core_instances, core_instance,
"Unlink core instance since CC recall has completed");
3269 ao2_t_unlink(cc_core_instances, core_instance,
"Unlink core instance since CC failed");
3309 cc_unref(core_instance,
"Unref core instance from when it was found earlier");
3319 if (!res && !strcmp(core_instance->agent->callbacks->type,
"generic")) {
3324 cc_unref(core_instance,
"Unref since state change has completed");
3343 debuglen = vsnprintf(dummy,
sizeof(dummy), debug, aq) + 1;
3346 if (!(args =
ast_calloc(1,
sizeof(*args) + debuglen))) {
3351 if (!core_instance) {
3361 vsnprintf(args->
debug, debuglen, debug, ap);
3365 cc_unref(core_instance,
"Unref core instance. ast_taskprocessor_push failed");
3400 .
type =
"cc_recall",
3411 if (!recall_datastore) {
3415 if (!(recall_data =
ast_calloc(1,
sizeof(*recall_data)))) {
3427 "Bump refcount for monitor tree for recall datastore");
3429 recall_datastore->
data = recall_data;
3434 cc_unref(core_instance,
"Recall datastore set up. No need for core_instance ref");
3445 int core_id_candidate;
3458 recall_data = recall_datastore->
data;
3460 if (recall_data->
ignore) {
3469 if (!recall_data->
nested) {
3476 *core_id = recall_data->
core_id;
3498 core_id_candidate = recall_data->
core_id;
3510 *core_id = core_id_candidate;
3524 if (!core_instance) {
3532 cc_ref(monitor_iter,
"Hand the requester of the monitor a reference");
3537 cc_unref(core_instance,
"Done with core instance ref in ast_cc_get_monitor_by_recall_core_id");
3538 return monitor_iter;
3566 snprintf(dialstring_search,
sizeof(dialstring_search),
"%s%c", dialstring,
'&');
3593 int top_level_id = starting_point->
id;
3612 if (monitor_iter->
parent_id == top_level_id) {
3650 recall_data = recall_datastore->
data;
3652 core_id = recall_data->
core_id;
3687 recall_data = recall_datastore->
data;
3689 core_id = recall_data->
core_id;
3699 if (!monitor_iter) {
3729 cc_interfaces = cc_datastore->
data;
3730 cc_interfaces->
ignore = 1;
3734 recall_cc_data = cc_recall_datastore->
data;
3735 recall_cc_data->
ignore = 1;
3745 va_start(ap, debug);
3757 char cc_is_offerable;
3765 cc_interfaces = datastore->
data;
3767 core_id = cc_interfaces->
core_id;
3770 if (cc_is_offerable) {
3781 va_start(ap, debug);
3792 va_start(ap, debug);
3803 va_start(ap, debug);
3814 va_start(ap, debug);
3825 va_start(ap, debug);
3836 va_start(ap, debug);
3856 recall_data = recall_datastore->
data;
3871 core_id = recall_data->
core_id;
3873 va_start(ap, debug);
3884 va_start(ap, debug);
3903 if (!core_instance) {
3906 "Core %d: Could not find core instance for device %s '%s'\n",
3923 cc_unref(monitor_iter,
"Monitor reported failure. Unref list's reference.");
3933 cc_unref(core_instance,
"Finished with core_instance in cc_monitor_failed\n");
3947 if (!(failure_data =
ast_calloc(1,
sizeof(*failure_data)))) {
3956 va_start(ap, debug);
3982 cc_unref(core_instance,
"Status request finished. Unref core instance");
3991 if (!core_instance) {
3997 cc_unref(core_instance,
"Unref core instance. ast_taskprocessor_push failed");
4019 cc_unref(core_instance,
"Stop ringing finished. Unref core_instance");
4028 if (!core_instance) {
4034 cc_unref(core_instance,
"Unref core instance. ast_taskprocessor_push failed");
4047 cc_unref(core_instance,
"Party B free finished. Unref core_instance");
4056 if (!core_instance) {
4062 cc_unref(core_instance,
"Unref core instance. ast_taskprocessor_push failed");
4089 cc_unref(core_instance,
"Status response finished. Unref core instance");
4105 if (!core_instance) {
4115 cc_unref(core_instance,
"Unref core instance. ast_taskprocessor_push failed");
4122 const char *monitor_type,
const char *
const device_name,
const char * dialstring,
4135 cc_interfaces = datastore->
data;
4163 ast_log(
LOG_NOTICE,
"Not queuing a CC frame for device %s since it already has its maximum monitors allocated\n", device_name);
4167 if (
ast_cc_build_frame(chan, cc_params, monitor_type, device_name, dialstring, service, private_data, &frame)) {
4177 const char *monitor_type,
const char *
const device_name,
4186 if (
cc_build_payload(chan, cc_params, monitor_type, device_name, dialstring, service, private_data, payload)) {
4194 frame->
datalen =
sizeof(*payload);
4233 const char *monitor_type,
const char *
const device_name,
const char *
const dialstring,
void *private_data)
4267 if (!(core_instance =
ao2_t_callback_data(cc_core_instances, 0,
match_agent, device_name, &match_flags,
"Find core instance for CallCompletionRequest"))) {
4275 core_instance->
core_id, device_name);
4282 cc_unref(core_instance,
"Unref core_instance since CallCompletionRequest was called with native agent");
4292 cc_unref(core_instance,
"Unref core_instance since too many CC requests");
4302 cc_unref(core_instance,
"Done with CallCompletionRequest");
4318 if (!(core_instance =
ao2_t_callback_data(cc_core_instances, 0,
match_agent, device_name, &match_flags,
"Find core instance for CallCompletionCancel"))) {
4326 ast_log(
LOG_WARNING,
"CallCompletionCancel may only be used for calles with a generic agent\n");
4327 cc_unref(core_instance,
"Unref core instance found during CallCompletionCancel");
4332 res =
ast_cc_failed(core_instance->
core_id,
"Call completion request Cancelled for core ID %d by caller %s",
4333 core_instance->
core_id, device_name);
4334 cc_unref(core_instance,
"Unref core instance found during CallCompletionCancel");
4380 const char *cc_max_requests_str;
4386 ast_log(
LOG_WARNING,
"Could not find valid ccss.conf file. Using cc_max_requests default\n");
4414 const char *cc_devstate_str;
4420 cc_state_to_devstate_map[
state] = this_devstate;
4444 "Could not find valid ccss.conf file. Using cc_[state]_devstate defaults\n");
4475 if (child_monitor_iter->
parent_id == monitor->
id) {
4500 ast_cli(*cli_fd,
"There are currently no active call completion transactions\n");
4502 ast_cli(*cli_fd,
"%d Call completion transactions\n", count);
4503 ast_cli(*cli_fd,
"Core ID\t\tCaller\t\t\t\tStatus\n");
4504 ast_cli(*cli_fd,
"----------------------------------------------------------------------------\n");
4517 e->
command =
"cc report status";
4519 "Usage: cc report status\n" 4520 " Report the current status of any ongoing CC transactions\n";
4549 if (!core_id || (core_instance->
core_id == *core_id)) {
4557 int wordlen = strlen(word);
4562 cc_unref(core_instance,
"CLI tab completion iteration")) {
4563 char core_id_str[20];
4564 snprintf(core_id_str,
sizeof(core_id_str),
"%d", core_instance->
core_id);
4565 if (!strncmp(word, core_id_str, wordlen)) {
4567 cc_unref(core_instance,
"Found a matching core ID for CLI tab-completion");
4581 e->
command =
"cc cancel [core|all]";
4583 "Usage: cc cancel can be used in two ways.\n" 4584 " 1. 'cc cancel core [core ID]' will cancel the CC transaction with\n" 4585 " core ID equal to the specified core ID.\n" 4586 " 2. 'cc cancel all' will cancel all active CC transactions.\n";
4589 if (a->
pos == 3 && !strcasecmp(a->
argv[2],
"core")) {
4598 if (strcasecmp(a->
argv[2],
"core")) {
4601 core_id = strtol(a->
argv[3], &endptr, 10);
4602 if ((
errno != 0 && core_id == 0) || (endptr == a->
argv[3])) {
4606 }
else if (a->
argc == 3) {
4607 if (strcasecmp(a->
argv[2],
"all")) {
4633 if (cc_sched_context) {
4635 cc_sched_context =
NULL;
4637 if (cc_core_taskprocessor) {
4641 if (cc_core_instances) {
4642 ao2_t_ref(cc_core_instances, -1,
"Unref cc_core_instances container in cc_shutdown");
4643 cc_core_instances =
NULL;
4645 if (generic_monitors) {
4646 ao2_t_ref(generic_monitors, -1,
"Unref generic_monitor container in cc_shutdown");
4647 generic_monitors =
NULL;
4660 "Create core instance container");
4661 if (!cc_core_instances) {
4667 generic_monitor_instance_list_hash_fn,
NULL, generic_monitor_instance_list_cmp_fn,
4668 "Create generic monitor container");
4669 if (!generic_monitors) {
4688 dialed_cc_interface_counter = 1;
static void cc_unique_append(struct ast_str **str, const char *dialstring)
struct stasis_topic * ast_device_state_topic(const char *device)
Get the Stasis topic for device state messages for a specific device.
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.
#define ao2_t_ref(o, delta, tag)
Reference/unreference an object and return the old refcount.
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.
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.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
#define CC_FAILED_DEVSTATE_DEFAULT
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.
int ast_sched_start_thread(struct ast_sched_context *con)
Start a thread for processing scheduler entries.
static const struct ast_cc_monitor_callbacks * find_monitor_callbacks(const char *const type)
static int load_module(void)
unsigned int ast_get_ccnr_available_timer(struct ast_cc_config_params *config)
Get the ccnr_available_timer.
struct cc_monitor_tree * monitors
struct stasis_message_type * ast_cc_callerstartmonitoring_type(void)
A stasis_message_type for CCSS Caller Start Monitoring messages.
static const char * cc_service_to_string(enum ast_cc_service_type service)
static int cc_generic_agent_status_request(struct ast_cc_agent *agent)
const char * ast_devstate2str(enum ast_device_state devstate) attribute_pure
Convert device state to text string for output.
#define ast_channel_lock(chan)
static int cc_generic_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, int *sched_id)
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
struct ast_cc_monitor * next
The payload for an AST_CONTROL_CC frame.
#define AST_CLI_DEFINE(fn, txt,...)
ast_device_state
Device States.
void ast_set_cc_callback_sub(struct ast_cc_config_params *config, const char *const value)
Set the callback subroutine name.
#define CC_OFFER_TIMER_DEFAULT
const char * type
Type of monitor the callbacks belong to.
static int cc_generic_agent_start_monitoring(struct ast_cc_agent *agent)
void ast_set_cc_agent_dialstring(struct ast_cc_config_params *config, const char *const value)
Set the cc_agent_dialstring.
static void cc_publish_recallcomplete(int core_id, const char *caller)
static void cc_recall_ds_destroy(void *data)
#define AST_LIST_LOCK(head)
Locks a list.
static char * handle_cc_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void * generic_recall(void *data)
Asterisk main include file. File version handling, generic pbx functions.
void * private_data
Private data allocated by the callee.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
static int cc_generic_monitor_suspend(struct ast_cc_monitor *monitor)
static unsigned int global_cc_max_requests
static enum ast_cc_monitor_policies str_to_monitor_policy(const char *const value)
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
static const struct @360 cc_state_to_string_map[]
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
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.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
String manipulation functions.
static struct extension_monitor_pvt * extension_monitor_pvt_init(void)
struct ast_datastore * next
char cid_num[AST_CHANNEL_NAME]
static void unsuspend(struct cc_core_instance *core_instance)
#define ao2_t_alloc(data_size, destructor_fn, debug_msg)
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.
#define AO2_STRING_FIELD_HASH_FN(stype, field)
Creates a hash function for a structure string field.
static int count_agents_cb(void *obj, void *arg, void *data, int flags)
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
const struct ast_channel_tech * ast_get_channel_tech(const char *name)
Get a channel technology structure by name.
int ast_cc_is_config_param(const char *const name)
Is this a CCSS configuration parameter?
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.
#define ast_test_flag(p, flag)
static void cc_generic_monitor_destructor(void *private_data)
static int cc_caller_requested(struct cc_core_instance *core_instance, struct cc_state_change_args *args, enum cc_state previous_state)
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...
unsigned int ast_get_cc_recall_timer(struct ast_cc_config_params *config)
Get the cc_recall_timer.
int is_valid
Is this structure valid for use in CC_INTERFACES?
static void generic_monitor_devstate_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
static void cc_publish_requestacknowledged(int core_id, const char *caller)
int ast_cc_failed(int core_id, const char *const debug,...)
Indicate failure has occurred.
static char * complete_core_id(const char *word)
static int dialed_cc_interface_counter
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
static const int CC_CORE_INSTANCES_BUCKETS
static void * cc_unref(void *obj, const char *debug)
static void cc_interface_destroy(void *data)
enum ast_cc_agent_policies cc_agent_policy
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
void ast_set_ccbs_available_timer(struct ast_cc_config_params *config, unsigned int value)
Set the ccbs_available_timer.
#define ast_set_flag(p, flag)
int ast_json_object_update(struct ast_json *object, struct ast_json *other)
Update object with all of the fields of other.
static struct cc_core_instance * find_cc_core_instance(const int core_id)
int ast_cc_monitor_request_acked(int core_id, const char *const debug,...)
Indicate that an outbound entity has accepted our CC request.
int ast_cc_agent_accept_request(int core_id, const char *const debug,...)
Accept inbound CC request.
descriptor for a cli entry.
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.
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...
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
struct ast_cc_config_params * cc_params
static void * cc_ref(void *obj, const char *debug)
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static const struct ast_datastore_info dialed_cc_interfaces_info
const char * service_string
static int debug
Global debug status.
AST_JSON_INT_T ast_json_int_t
Primarily used to cast when packing to an "I" type.
char context[AST_CHANNEL_NAME]
static void dummy(char *unused,...)