19#ifndef _ASTERISK_STASIS_APP_H
20#define _ASTERISK_STASIS_APP_H
276 const char *event_name,
277 const char **source_uris,
int sources_count,
304 const char **event_source_uris,
int event_sources_count,
319 const char **event_source_uris,
int event_sources_count,
416 const char *channel_id);
715 const char *bridge_id);
932 const char *dialstring,
unsigned int timeout);
General Asterisk PBX channel definitions.
static int filter(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
ast_frame_type
Frame types.
ast_control_frame_type
Internal control frame subtype field values.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
const char * app_name(struct ast_app *app)
static int debug
Global debug status.
void stasis_app_control_mute_in_bridge(struct stasis_app_control *control, int mute)
Set whether audio from the channel is muted instead of passing through to the bridge.
void stasis_app_bridge_playback_channel_remove(char *bridge_id, struct stasis_app_control *control)
remove channel from list of ARI playback channels for bridges.
struct ast_json * stasis_app_object_to_json(struct stasis_app *app)
Return the JSON representation of a Stasis application.
void stasis_app_set_debug(struct stasis_app *app, int debug)
Enable/disable request/response and event logging on an application.
struct stasis_message_sanitizer * stasis_app_get_sanitizer(void)
Get the Stasis message sanitizer for app_stasis applications.
void stasis_app_control_register_remove_rule(struct stasis_app_control *control, struct stasis_app_control_rule *rule)
Registers a remove channel from bridge rule.
void stasis_app_control_moh_start(struct stasis_app_control *control, const char *moh_class)
Play music on hold to a channel (does not affect hold status)
const char * stasis_app_control_get_channel_id(const struct stasis_app_control *control)
Returns the uniqueid of the channel associated with this control.
struct stasis_topic * ast_app_get_topic(struct stasis_app *app)
Returns the stasis topic for an app.
struct ast_bridge * stasis_app_bridge_create_invisible(const char *type, const char *name, const char *id)
Create an invisible bridge of the specified type.
int stasis_app_control_queue_control(struct stasis_app_control *control, enum ast_control_frame_type frame_type)
Queue a control frame without payload.
int stasis_app_channel_is_internal(struct ast_channel *chan)
Is this channel internal to Stasis?
void stasis_app_control_unregister_remove_rule(struct stasis_app_control *control, struct stasis_app_control_rule *rule)
Unregisters a remove channel from bridge rule.
int stasis_app_event_allowed(const char *app_name, struct ast_json *event)
Check if the given event should be filtered.
int stasis_app_control_unmute(struct stasis_app_control *control, unsigned int direction, enum ast_frame_type frametype)
Unmute the channel associated with this control.
void stasis_app_control_unhold(struct stasis_app_control *control)
Remove the channel associated with the control from hold.
int stasis_app_send(const char *app_name, struct ast_json *message)
Send a message to the given Stasis application.
int stasis_app_control_add_channel_to_bridge(struct stasis_app_control *control, struct ast_bridge *bridge)
Add a channel to the bridge.
void stasis_app_unregister_event_sources(void)
Unregister core event sources.
enum stasis_app_subscribe_res stasis_app_subscribe(const char *app_name, const char **event_source_uris, int event_sources_count, struct ast_json **json)
Subscribes an application to a list of event sources.
void stasis_app_control_silence_start(struct stasis_app_control *control)
Start playing silence to a channel.
void stasis_app_control_silence_stop(struct stasis_app_control *control)
Stop playing silence to a channel.
void stasis_app_channel_set_stasis_end_published(struct ast_channel *chan)
Indicate that this channel has had a StasisEnd published for it.
void stasis_app_control_clear_roles(struct stasis_app_control *control)
Clear bridge roles currently applied to a channel controlled by a stasis app control.
void stasis_app_bridge_destroy(const char *bridge_id)
Destroy the bridge.
int stasis_app_control_continue(struct stasis_app_control *control, const char *context, const char *extension, int priority)
Exit res_stasis and continue execution in the dialplan.
stasis_app_user_event_res
Return code for stasis_app_user_event.
@ STASIS_APP_USER_APP_NOT_FOUND
@ STASIS_APP_USER_EVENT_SOURCE_NOT_FOUND
@ STASIS_APP_USER_EVENT_SOURCE_BAD_SCHEME
@ STASIS_APP_USER_USEREVENT_INVALID
@ STASIS_APP_USER_INTERNAL_ERROR
struct ast_json * stasis_app_to_json(const char *app_name)
Return the JSON representation of a Stasis application.
void stasis_app_set_debug_by_name(const char *app_name, int debug)
Enable/disable request/response and event logging on an application.
int stasis_app_register(const char *app_name, stasis_app_cb handler, void *data)
Register a new Stasis application.
void stasis_app_control_publish(struct stasis_app_control *control, struct stasis_message *message)
Publish a message to the control's channel's topic.
int stasis_app_control_redirect(struct stasis_app_control *control, const char *endpoint)
Redirect a channel in res_stasis to a particular endpoint.
void stasis_app_control_moh_stop(struct stasis_app_control *control)
Stop playing music on hold to a channel (does not affect hold status)
int stasis_app_control_move(struct stasis_app_control *control, const char *app_name, const char *app_args)
Exit res_stasis and move to another Stasis application.
int stasis_app_channel_set_internal(struct ast_channel *chan)
Mark this channel as being internal to Stasis.
struct ast_json * stasis_app_event_filter_to_json(struct stasis_app *app, struct ast_json *json)
Convert and add the app's event type filter(s) to the given json object.
struct ast_bridge * stasis_app_bridge_find_by_id(const char *bridge_id)
Returns the bridge with the given id.
void stasis_app_register_event_sources(void)
Register core event sources.
struct ast_bridge * stasis_app_bridge_create(const char *type, const char *name, const char *id)
Create a bridge of the specified type.
int stasis_app_control_mute(struct stasis_app_control *control, unsigned int direction, enum ast_frame_type frametype)
Mute the channel associated with this control.
void stasis_app_unregister_event_source(struct stasis_app_event_source *obj)
Unregister an application event source.
void stasis_app_control_absorb_dtmf_in_bridge(struct stasis_app_control *control, int absorb)
Set whether DTMF from the channel is absorbed instead of passing through to the bridge.
int stasis_app_event_filter_set(struct stasis_app *app, struct ast_json *filter)
Set the application's event type filter.
enum stasis_app_subscribe_res stasis_app_subscribe_channel(const char *app_name, struct ast_channel *chan)
Directly subscribe an application to a channel.
void(* stasis_app_cb)(void *data, const char *app_name, struct ast_json *message)
Callback for Stasis application handler.
void stasis_app_control_execute_until_exhausted(struct ast_channel *chan, struct stasis_app_control *control)
Act on a stasis app control queue until it is empty.
struct ast_channel * stasis_app_bridge_moh_channel(struct ast_bridge *bridge)
Finds or creates an announcer channel in a bridge that can play music on hold.
enum stasis_app_user_event_res stasis_app_user_event(const char *app_name, const char *event_name, const char **source_uris, int sources_count, struct ast_json *json_variables)
Generate a Userevent for stasis app (echo to AMI)
void stasis_app_set_global_debug(int debug)
Enable/disable request/response and event logging on all applications.
int stasis_app_control_dtmf(struct stasis_app_control *control, const char *dtmf, int before, int between, unsigned int duration, int after)
Send DTMF to the channel associated with this control.
int stasis_app_get_debug(struct stasis_app *app)
Get debug status of an application.
void stasis_app_control_flush_queue(struct stasis_app_control *control)
Flush the control command queue.
void stasis_app_to_cli(const struct stasis_app *app, struct ast_cli_args *a)
Dump properties of a stasis_app to the CLI.
int stasis_app_control_add_role(struct stasis_app_control *control, const char *role)
Apply a bridge role to a channel controlled by a stasis app control.
int stasis_app_channel_unreal_set_internal(struct ast_channel *chan)
Mark this unreal channel and it's other half as being internal to Stasis.
void stasis_app_control_inhibit_colp_in_bridge(struct stasis_app_control *control, int inhibit_colp)
Set whether COLP frames should be generated when joining the bridge.
int stasis_app_control_remove_channel_from_bridge(struct stasis_app_control *control, struct ast_bridge *bridge)
Remove a channel from the bridge.
struct ast_bridge * stasis_app_get_bridge(struct stasis_app_control *control)
Gets the bridge currently associated with a control object.
int stasis_app_control_bridge_features_init(struct stasis_app_control *control)
Initialize bridge features into a channel control.
int stasis_app_bridge_playback_channel_add(struct ast_bridge *bridge, struct ast_channel *chan, struct stasis_app_control *control)
Adds a channel to the list of ARI playback channels for bridges.
void stasis_app_unregister(const char *app_name)
Unregister a Stasis application.
enum stasis_app_subscribe_res stasis_app_unsubscribe(const char *app_name, const char **event_source_uris, int event_sources_count, struct ast_json **json)
Unsubscribes an application from a list of event sources.
void stasis_app_control_hold(struct stasis_app_control *control)
Place the channel associated with the control on hold.
struct stasis_app * stasis_app_get_by_name(const char *name)
Retrieve a handle to a Stasis application by its name.
void stasis_app_control_unregister_add_rule(struct stasis_app_control *control, struct stasis_app_control_rule *rule)
UnRegister an add channel to bridge rule.
struct stasis_app_control * stasis_app_control_find_by_channel_id(const char *channel_id)
Returns the handler for the channel with the given id.
void stasis_app_register_event_source(struct stasis_app_event_source *obj)
Register an application event source.
struct ast_channel * stasis_app_bridge_playback_channel_find(struct ast_bridge *bridge)
Finds an existing ARI playback channel in a bridge.
struct ao2_container * stasis_app_get_all(void)
Gets the names of all registered Stasis applications.
int stasis_app_control_is_done(struct stasis_app_control *control)
Check if a control is marked as done.
int stasis_app_control_ring_stop(struct stasis_app_control *control)
Stop locally generated ringing on the channel associated with this control.
int stasis_app_control_dial(struct stasis_app_control *control, const char *dialstring, unsigned int timeout)
Dial a channel.
struct ast_channel_snapshot * stasis_app_control_get_snapshot(const struct stasis_app_control *control)
Returns the most recent snapshot for the associated channel.
const char * stasis_app_name(const struct stasis_app *app)
Retrieve an application's name.
void stasis_app_control_register_add_rule(struct stasis_app_control *control, struct stasis_app_control_rule *rule)
Registers an add channel to bridge rule.
stasis_app_control_channel_result
Result codes used when adding/removing channels to/from bridges.
@ STASIS_APP_CHANNEL_RECORDING
@ STASIS_APP_CHANNEL_OKAY
stasis_app_subscribe_res
Return code for stasis_app_[un]subscribe.
@ STASIS_ASR_EVENT_SOURCE_BAD_SCHEME
@ STASIS_ASR_INTERNAL_ERROR
@ STASIS_ASR_EVENT_SOURCE_NOT_FOUND
@ STASIS_ASR_APP_NOT_FOUND
int stasis_app_channel_is_stasis_end_published(struct ast_channel *chan)
Has this channel had a StasisEnd published on it?
struct stasis_app_control * stasis_app_control_find_by_channel(const struct ast_channel *chan)
Returns the handler for the given channel.
int stasis_app_control_set_channel_var(struct stasis_app_control *control, const char *variable, const char *value)
Set a variable on the channel associated with this control to value.
int stasis_app_register_all(const char *app_name, stasis_app_cb handler, void *data)
Register a new Stasis application that receives all Asterisk events.
struct stasis_app_control * stasis_app_control_create(struct ast_channel *chan)
Creates a control handler for a channel that isn't in a stasis app.
int stasis_app_get_debug_by_name(const char *app_name)
Get debug status of an application.
int stasis_app_control_ring(struct stasis_app_control *control)
Indicate ringing to the channel associated with this control.
void stasis_app_control_shutdown(void)
Let Stasis app internals shut down.
int stasis_app_bridge_moh_stop(struct ast_bridge *bridge)
Breaks down MOH channels playing on the bridge created by stasis_app_bridge_moh_channel.
int stasis_app_control_answer(struct stasis_app_control *control)
Answer the channel associated with this control.
Structure that contains information about a bridge.
Structure representing a snapshot of channel state.
Main Channel structure associated with a channel.
struct ast_bridge * bridge
Abstract JSON element (object, array, string, int, ...).
structure to hold extensions
Rule to check to see if an operation is allowed.
enum stasis_app_control_channel_result(* check_rule)(const struct stasis_app_control *control)
Checks to see if an operation is allowed on the control.
struct stasis_app_control_rule * next
Event source information and callbacks.
const char * scheme
The scheme to match against on [un]subscribes.
int(* unsubscribe)(struct stasis_app *app, const char *id)
Cancel the subscription an app has to an event source.
void(* to_json)(const struct stasis_app *app, struct ast_json *json)
Convert event source data to json.
struct stasis_app_event_source * next
int(* is_subscribed)(struct stasis_app *app, const char *id)
Find an event source by the given id/name.
int(* subscribe)(struct stasis_app *app, void *obj)
Subscribe an application to an event source.
Structure containing callbacks for Stasis message sanitization.
static void handler(const char *name, int response_code, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)