Beispiel #1
0
static void forwards_unsubscribe(struct app_forwards *forwards)
{
	stasis_forward_cancel(forwards->topic_forward);
	forwards->topic_forward = NULL;
	stasis_forward_cancel(forwards->topic_cached_forward);
	forwards->topic_cached_forward = NULL;
}
void stasis_cp_single_unsubscribe(struct stasis_cp_single *one)
{
	if (!one) {
		return;
	}

	stasis_forward_cancel(one->forward_topic_to_all);
	one->forward_topic_to_all = NULL;
	stasis_forward_cancel(one->forward_cached_to_all);
	one->forward_cached_to_all = NULL;
	stasis_caching_unsubscribe(one->topic_cached);
	one->topic_cached = NULL;

	ao2_cleanup(one);
}
Beispiel #3
0
/*! Forward a endpoint's topics to an app */
static struct app_forwards *forwards_create_endpoint(struct stasis_app *app,
	struct ast_endpoint *endpoint)
{
	RAII_VAR(struct app_forwards *, forwards, NULL, ao2_cleanup);

	if (!app || !endpoint) {
		return NULL;
	}

	forwards = forwards_create(app, ast_endpoint_get_id(endpoint));
	if (!forwards) {
		return NULL;
	}

	forwards->forward_type = FORWARD_ENDPOINT;
	forwards->topic_forward = stasis_forward_all(ast_endpoint_topic(endpoint),
		app->topic);
	if (!forwards->topic_forward) {
		return NULL;
	}

	forwards->topic_cached_forward = stasis_forward_all(
		ast_endpoint_topic_cached(endpoint), app->topic);
	if (!forwards->topic_cached_forward) {
		/* Half-subscribed is a bad thing */
		stasis_forward_cancel(forwards->topic_forward);
		forwards->topic_forward = NULL;
		return NULL;
	}

	ao2_ref(forwards, +1);
	return forwards;
}
Beispiel #4
0
/*! Forward a bridge's topics to an app */
static struct app_forwards *forwards_create_bridge(struct stasis_app *app,
	struct ast_bridge *bridge)
{
	RAII_VAR(struct app_forwards *, forwards, NULL, ao2_cleanup);

	if (!app || !bridge) {
		return NULL;
	}

	forwards = forwards_create(app, bridge->uniqueid);
	if (!forwards) {
		return NULL;
	}

	forwards->forward_type = FORWARD_BRIDGE;
	forwards->topic_forward = stasis_forward_all(ast_bridge_topic(bridge),
		app->topic);
	if (!forwards->topic_forward) {
		return NULL;
	}

	forwards->topic_cached_forward = stasis_forward_all(
		ast_bridge_topic_cached(bridge), app->topic);
	if (!forwards->topic_cached_forward) {
		/* Half-subscribed is a bad thing */
		stasis_forward_cancel(forwards->topic_forward);
		forwards->topic_forward = NULL;
		return NULL;
	}

	ao2_ref(forwards, +1);
	return forwards;
}
Beispiel #5
0
/*! Forward a channel's topics to an app */
static struct app_forwards *forwards_create_channel(struct stasis_app *app,
	struct ast_channel *chan)
{
	RAII_VAR(struct app_forwards *, forwards, NULL, ao2_cleanup);

	if (!app || !chan) {
		return NULL;
	}

	forwards = forwards_create(app, ast_channel_uniqueid(chan));
	if (!forwards) {
		return NULL;
	}

	forwards->forward_type = FORWARD_CHANNEL;
	forwards->topic_forward = stasis_forward_all(ast_channel_topic(chan),
		app->topic);
	if (!forwards->topic_forward) {
		return NULL;
	}

	forwards->topic_cached_forward = stasis_forward_all(
		ast_channel_topic_cached(chan), app->topic);
	if (!forwards->topic_cached_forward) {
		/* Half-subscribed is a bad thing */
		stasis_forward_cancel(forwards->topic_forward);
		forwards->topic_forward = NULL;
		return NULL;
	}

	ao2_ref(forwards, +1);
	return forwards;
}
Beispiel #6
0
static void *bridge_channel_control_thread(void *data)
{
	struct bridge_channel_control_thread_data *thread_data = data;
	struct ast_channel *bridge_channel = thread_data->bridge_channel;
	struct stasis_app_control *control = thread_data->control;
	struct stasis_forward *forward = thread_data->forward;
	ast_callid callid = ast_channel_callid(bridge_channel);
	char *bridge_id = ast_strdupa(thread_data->bridge_id);

	if (callid) {
		ast_callid_threadassoc_add(callid);
	}

	ast_free(thread_data);
	thread_data = NULL;

	stasis_app_control_execute_until_exhausted(bridge_channel, control);
	stasis_app_control_flush_queue(control);

	stasis_app_bridge_playback_channel_remove(bridge_id, control);
	stasis_forward_cancel(forward);
	ao2_cleanup(control);
	ast_hangup(bridge_channel);
	return NULL;
}
Beispiel #7
0
static void topic_pool_entry_dtor(void *obj)
{
	struct topic_pool_entry *entry = obj;

	entry->forward = stasis_forward_cancel(entry->forward);
	ao2_cleanup(entry->topic);
	entry->topic = NULL;
}
static void manager_bridging_cleanup(void)
{
	stasis_forward_cancel(topic_forwarder);
	topic_forwarder = NULL;

	ast_manager_unregister("BridgeList");
	ast_manager_unregister("BridgeInfo");
	ast_manager_unregister("BridgeDestroy");
	ast_manager_unregister("BridgeKick");
}
static void all_dtor(void *obj)
{
	struct stasis_cp_all *all = obj;

	ao2_cleanup(all->topic);
	all->topic = NULL;
	ao2_cleanup(all->topic_cached);
	all->topic_cached = NULL;
	ao2_cleanup(all->cache);
	all->cache = NULL;
	stasis_forward_cancel(all->forward_all_to_cached);
	all->forward_all_to_cached = NULL;
}
Beispiel #10
0
void ast_channel_internal_cleanup(struct ast_channel *chan)
{
	if (chan->dialed_causes) {
		ao2_t_ref(chan->dialed_causes, -1,
			"done with dialed causes since the channel is going away");
		chan->dialed_causes = NULL;
	}

	ast_string_field_free_memory(chan);

	chan->endpoint_forward = stasis_forward_cancel(chan->endpoint_forward);

	stasis_cp_single_unsubscribe(chan->topics);
	chan->topics = NULL;
}
static void manager_bridging_cleanup(void)
{
	stasis_forward_cancel(topic_forwarder);
	topic_forwarder = NULL;
}
Beispiel #12
0
static void manager_mwi_shutdown(void)
{
	stasis_forward_cancel(topic_forwarder);
	topic_forwarder = NULL;
}