bridge_features.h File Reference

Channel Bridging API. More...

#include "asterisk/channel.h"

Include dependency graph for bridge_features.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ast_bridge_features
 Structure that contains features information. More...
struct  ast_bridge_features_attended_transfer
 Structure that contains configuration information for the attended transfer built in feature. More...
struct  ast_bridge_features_automixmonitor
struct  ast_bridge_features_automonitor
struct  ast_bridge_features_blind_transfer
 Structure that contains configuration information for the blind transfer built in feature. More...
struct  ast_bridge_features_limits
 Structure that contains configuration information for the limits feature. More...
struct  ast_bridge_hook
 Structure that is the essence of a feature hook. More...
struct  ast_bridge_hook_dtmf
struct  ast_bridge_hook_dtmf_parms
struct  ast_bridge_hook_timer
struct  ast_bridge_hook_timer_parms

Defines

#define MAXIMUM_DTMF_FEATURE_STRING   (11 + 1)
 Maximum length of a DTMF feature string.

Typedefs

typedef int(* ast_bridge_builtin_set_limits_fn )(struct ast_bridge_features *features, struct ast_bridge_features_limits *limits, enum ast_bridge_hook_remove_flags remove_flags)
 Attach interval hooks to a bridge features structure.
typedef int(* ast_bridge_hook_callback )(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
 Hook callback type.
typedef void(* ast_bridge_hook_pvt_destructor )(void *hook_pvt)
 Hook pvt destructor callback.
typedef int(* ast_bridge_move_indicate_callback )(struct ast_bridge_channel *bridge_channel, void *hook_pvt, struct ast_bridge *src, struct ast_bridge *dst)
 Move indicator callback.
typedef int(* ast_bridge_talking_indicate_callback )(struct ast_bridge_channel *bridge_channel, void *hook_pvt, int talking)
 Talking indicator callback.

Enumerations

enum  ast_bridge_builtin_feature {
  AST_BRIDGE_BUILTIN_BLINDTRANSFER, AST_BRIDGE_BUILTIN_ATTENDEDTRANSFER, AST_BRIDGE_BUILTIN_HANGUP, AST_BRIDGE_BUILTIN_PARKCALL,
  AST_BRIDGE_BUILTIN_AUTOMON, AST_BRIDGE_BUILTIN_AUTOMIXMON, AST_BRIDGE_BUILTIN_END
}
 Built in DTMF features. More...
enum  ast_bridge_builtin_interval { AST_BRIDGE_BUILTIN_INTERVAL_LIMITS, AST_BRIDGE_BUILTIN_INTERVAL_END }
enum  ast_bridge_channel_feature_flags { AST_BRIDGE_CHANNEL_FLAG_DISSOLVE_HANGUP = (1 << 0), AST_BRIDGE_CHANNEL_FLAG_LONELY = (1 << 1), AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE = (1 << 2) }
 Flags used for per bridge channel features. More...
enum  ast_bridge_feature_flags {
  AST_BRIDGE_FLAG_DISSOLVE_HANGUP = (1 << 0), AST_BRIDGE_FLAG_DISSOLVE_EMPTY = (1 << 1), AST_BRIDGE_FLAG_SMART = (1 << 2), AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM = (1 << 3),
  AST_BRIDGE_FLAG_MERGE_INHIBIT_TO = (1 << 4), AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM = (1 << 5), AST_BRIDGE_FLAG_SWAP_INHIBIT_TO = (1 << 6), AST_BRIDGE_FLAG_MASQUERADE_ONLY = (1 << 7),
  AST_BRIDGE_FLAG_TRANSFER_PROHIBITED = (1 << 8), AST_BRIDGE_FLAG_TRANSFER_BRIDGE_ONLY = (1 << 9)
}
 Flags used for bridge features. More...
enum  ast_bridge_features_monitor { AUTO_MONITOR_TOGGLE, AUTO_MONITOR_START, AUTO_MONITOR_STOP }
enum  ast_bridge_hook_remove_flags { AST_BRIDGE_HOOK_REMOVE_ON_PULL = (1 << 0), AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE = (1 << 1) }
enum  ast_bridge_hook_timer_option { AST_BRIDGE_HOOK_TIMER_OPTION_MEDIA = (1 << 0) }
enum  ast_bridge_hook_type {
  AST_BRIDGE_HOOK_TYPE_NONE, AST_BRIDGE_HOOK_TYPE_DTMF, AST_BRIDGE_HOOK_TYPE_TIMER, AST_BRIDGE_HOOK_TYPE_HANGUP,
  AST_BRIDGE_HOOK_TYPE_JOIN, AST_BRIDGE_HOOK_TYPE_LEAVE, AST_BRIDGE_HOOK_TYPE_TALK, AST_BRIDGE_HOOK_TYPE_MOVE
}

Functions

int ast_bridge_dtmf_hook (struct ast_bridge_features *features, const char *dtmf, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
 Attach a DTMF hook to a bridge features structure.
void ast_bridge_features_cleanup (struct ast_bridge_features *features)
 Clean up the contents of a bridge features structure.
void ast_bridge_features_destroy (struct ast_bridge_features *features)
 Destroy an allocated bridge features struct.
int ast_bridge_features_do (enum ast_bridge_builtin_feature feature, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
 Invoke a built in feature hook now.
int ast_bridge_features_enable (struct ast_bridge_features *features, enum ast_bridge_builtin_feature feature, const char *dtmf, void *config, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
 Enable a built in feature on a bridge features structure.
int ast_bridge_features_init (struct ast_bridge_features *features)
 Initialize bridge features structure.
int ast_bridge_features_limits_construct (struct ast_bridge_features_limits *limits)
 Constructor function for ast_bridge_features_limits.
void ast_bridge_features_limits_destroy (struct ast_bridge_features_limits *limits)
 Destructor function for ast_bridge_features_limits.
void ast_bridge_features_merge (struct ast_bridge_features *into, const struct ast_bridge_features *from)
 Merge one ast_bridge_features into another.
struct ast_bridge_featuresast_bridge_features_new (void)
 Allocate a new bridge features struct.
int ast_bridge_features_register (enum ast_bridge_builtin_feature feature, ast_bridge_hook_callback callback, const char *dtmf)
 Register a handler for a built in feature.
void ast_bridge_features_set_flag (struct ast_bridge_features *features, unsigned int flag)
 Set a flag on a bridge channel features structure.
int ast_bridge_features_set_limits (struct ast_bridge_features *features, struct ast_bridge_features_limits *limits, enum ast_bridge_hook_remove_flags remove_flags)
 Limit the amount of time a channel may stay in the bridge and optionally play warning messages as time runs out.
int ast_bridge_features_unregister (enum ast_bridge_builtin_feature feature)
 Unregister a handler for a built in feature.
int ast_bridge_hangup_hook (struct ast_bridge_features *features, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
 Attach a hangup hook to a bridge features structure.
int ast_bridge_interval_hook (struct ast_bridge_features *features, enum ast_bridge_hook_timer_option flags, unsigned int interval, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
 Attach an interval hook to a bridge features structure.
int ast_bridge_interval_register (enum ast_bridge_builtin_interval interval, ast_bridge_builtin_set_limits_fn callback)
 Register a handler for a built in interval feature.
int ast_bridge_join_hook (struct ast_bridge_features *features, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
 Unregisters a handler for a built in interval feature.
int ast_bridge_leave_hook (struct ast_bridge_features *features, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
 Attach a bridge channel leave hook to a bridge features structure.
int ast_bridge_move_hook (struct ast_bridge_features *features, ast_bridge_move_indicate_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
 Attach a bridge channel move detection hook to a bridge features structure.
int ast_bridge_talk_detector_hook (struct ast_bridge_features *features, ast_bridge_talking_indicate_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
 Attach a bridge channel talk detection hook to a bridge features structure.


Detailed Description

Channel Bridging API.

Author:
Joshua Colp <jcolp@digium.com>

Definition in file bridge_features.h.


Define Documentation

#define MAXIMUM_DTMF_FEATURE_STRING   (11 + 1)

Maximum length of a DTMF feature string.

Definition at line 215 of file bridge_features.h.

Referenced by action_playback_and_continue().


Typedef Documentation

Attach interval hooks to a bridge features structure.

Parameters:
features Bridge features structure
limits Configured limits applicable to the channel
remove_flags Dictates what situations the hook should be removed.
Return values:
0 on success
-1 on failure

Definition at line 416 of file bridge_features.h.

typedef int(* ast_bridge_hook_callback)(struct ast_bridge_channel *bridge_channel, void *hook_pvt)

Hook callback type.

Parameters:
bridge_channel Channel executing the feature
hook_pvt Private data passed in when the hook was created
For interval hooks:
Return values:
0 Setup to fire again at the last interval.
positive Setup to fire again at the new interval returned.
-1 Remove the callback hook.
For other hooks:
Return values:
0 Keep the callback hook.
-1 Remove the callback hook.

Definition at line 134 of file bridge_features.h.

typedef void(* ast_bridge_hook_pvt_destructor)(void *hook_pvt)

Hook pvt destructor callback.

Parameters:
hook_pvt Private data passed in when the hook was created to destroy

Definition at line 141 of file bridge_features.h.

typedef int(* ast_bridge_move_indicate_callback)(struct ast_bridge_channel *bridge_channel, void *hook_pvt, struct ast_bridge *src, struct ast_bridge *dst)

Move indicator callback.

This callback can be registered with the bridge channel in order to be notified when the bridge channel is being moved from one bridge to another.

Parameters:
bridge_channel The channel executing the feature
hook_pvt Private data passed in when the hook was created
src The bridge from which the bridge channel is moving
dst The bridge into which the bridge channel is moving
Return values:
0 Keep the callback hook.
-1 Remove the callback hook.

Definition at line 176 of file bridge_features.h.

typedef int(* ast_bridge_talking_indicate_callback)(struct ast_bridge_channel *bridge_channel, void *hook_pvt, int talking)

Talking indicator callback.

This callback can be registered with the bridge channel in order to receive updates when the bridge_channel has started and stopped talking.

Parameters:
bridge_channel Channel executing the feature
hook_pvt Private data passed in when the hook was created
talking TRUE if the channel is now talking
Return values:
0 Keep the callback hook.
-1 Remove the callback hook.

Definition at line 158 of file bridge_features.h.


Enumeration Type Documentation

Built in DTMF features.

Enumerator:
AST_BRIDGE_BUILTIN_BLINDTRANSFER  DTMF based Blind Transfer
AST_BRIDGE_BUILTIN_ATTENDEDTRANSFER  DTMF based Attended Transfer
AST_BRIDGE_BUILTIN_HANGUP  DTMF based depart bridge feature

Note:
Imparted channels are optionally hangup depending upon how it was imparted.

Joined channels exit the bridge with BRIDGE_CHANNEL_STATE_END_WITH_DISSOLVE.

AST_BRIDGE_BUILTIN_PARKCALL  DTMF based Park

The bridge is parked and the channel hears the parking slot to which it was parked.

AST_BRIDGE_BUILTIN_AUTOMON  DTMF one-touch-record toggle using Monitor app.

Note:
Only valid on two party bridges.
AST_BRIDGE_BUILTIN_AUTOMIXMON  DTMF one-touch-record toggle using MixMonitor app.

Note:
Only valid on two party bridges.
AST_BRIDGE_BUILTIN_END  End terminator for list of built in features. Must remain last.

Definition at line 69 of file bridge_features.h.

00069                                 {
00070    /*! DTMF based Blind Transfer */
00071    AST_BRIDGE_BUILTIN_BLINDTRANSFER,
00072    /*! DTMF based Attended Transfer */
00073    AST_BRIDGE_BUILTIN_ATTENDEDTRANSFER,
00074    /*!
00075     * DTMF based depart bridge feature
00076     *
00077     * \note Imparted channels are optionally hangup depending upon
00078     * how it was imparted.
00079     *
00080     * \note Joined channels exit the bridge with
00081     * BRIDGE_CHANNEL_STATE_END_WITH_DISSOLVE.
00082     */
00083    AST_BRIDGE_BUILTIN_HANGUP,
00084    /*!
00085     * DTMF based Park
00086     *
00087     * \details The bridge is parked and the channel hears the
00088     * parking slot to which it was parked.
00089     */
00090    AST_BRIDGE_BUILTIN_PARKCALL,
00091    /*!
00092     * DTMF one-touch-record toggle using Monitor app.
00093     *
00094     * \note Only valid on two party bridges.
00095     */
00096    AST_BRIDGE_BUILTIN_AUTOMON,
00097    /*!
00098     * DTMF one-touch-record toggle using MixMonitor app.
00099     *
00100     * \note Only valid on two party bridges.
00101     */
00102    AST_BRIDGE_BUILTIN_AUTOMIXMON,
00103 
00104    /*! End terminator for list of built in features. Must remain last. */
00105    AST_BRIDGE_BUILTIN_END
00106 };

Enumerator:
AST_BRIDGE_BUILTIN_INTERVAL_LIMITS  Apply Call Duration Limits
AST_BRIDGE_BUILTIN_INTERVAL_END  End terminator for list of built in interval features. Must remain last.

Definition at line 108 of file bridge_features.h.

00108                                  {
00109    /*! Apply Call Duration Limits */
00110    AST_BRIDGE_BUILTIN_INTERVAL_LIMITS,
00111 
00112    /*! End terminator for list of built in interval features. Must remain last. */
00113    AST_BRIDGE_BUILTIN_INTERVAL_END
00114 };

Flags used for per bridge channel features.

Enumerator:
AST_BRIDGE_CHANNEL_FLAG_DISSOLVE_HANGUP  Upon channel hangup all bridge participants should be kicked out.
AST_BRIDGE_CHANNEL_FLAG_LONELY  This channel leaves the bridge if all participants have this flag set.
AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE  This channel cannot be moved to another bridge.

Definition at line 59 of file bridge_features.h.

00059                                       {
00060    /*! Upon channel hangup all bridge participants should be kicked out. */
00061    AST_BRIDGE_CHANNEL_FLAG_DISSOLVE_HANGUP = (1 << 0),
00062    /*! This channel leaves the bridge if all participants have this flag set. */
00063    AST_BRIDGE_CHANNEL_FLAG_LONELY = (1 << 1),
00064    /*! This channel cannot be moved to another bridge. */
00065    AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE = (1 << 2),
00066 };

Flags used for bridge features.

Enumerator:
AST_BRIDGE_FLAG_DISSOLVE_HANGUP  Upon channel hangup all bridge participants should be kicked out.
AST_BRIDGE_FLAG_DISSOLVE_EMPTY  The last channel to leave the bridge dissolves it.
AST_BRIDGE_FLAG_SMART  Move between bridging technologies as needed.
AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM  Bridge channels cannot be merged from this bridge.
AST_BRIDGE_FLAG_MERGE_INHIBIT_TO  Bridge channels cannot be merged to this bridge.
AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM  Bridge channels cannot be local channel swap optimized from this bridge.
AST_BRIDGE_FLAG_SWAP_INHIBIT_TO  Bridge channels cannot be local channel swap optimized to this bridge.
AST_BRIDGE_FLAG_MASQUERADE_ONLY  Bridge channels can be moved to another bridge only by masquerade (ConfBridge)
AST_BRIDGE_FLAG_TRANSFER_PROHIBITED  Bridge does not allow transfers of channels out
AST_BRIDGE_FLAG_TRANSFER_BRIDGE_ONLY  Bridge transfers require transfer of entire bridge rather than individual channels

Definition at line 35 of file bridge_features.h.

00035                               {
00036    /*! Upon channel hangup all bridge participants should be kicked out. */
00037    AST_BRIDGE_FLAG_DISSOLVE_HANGUP = (1 << 0),
00038    /*! The last channel to leave the bridge dissolves it. */
00039    AST_BRIDGE_FLAG_DISSOLVE_EMPTY = (1 << 1),
00040    /*! Move between bridging technologies as needed. */
00041    AST_BRIDGE_FLAG_SMART = (1 << 2),
00042    /*! Bridge channels cannot be merged from this bridge. */
00043    AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM = (1 << 3),
00044    /*! Bridge channels cannot be merged to this bridge. */
00045    AST_BRIDGE_FLAG_MERGE_INHIBIT_TO = (1 << 4),
00046    /*! Bridge channels cannot be local channel swap optimized from this bridge. */
00047    AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM = (1 << 5),
00048    /*! Bridge channels cannot be local channel swap optimized to this bridge. */
00049    AST_BRIDGE_FLAG_SWAP_INHIBIT_TO = (1 << 6),
00050    /*! Bridge channels can be moved to another bridge only by masquerade (ConfBridge) */
00051    AST_BRIDGE_FLAG_MASQUERADE_ONLY = (1 << 7),
00052    /*! Bridge does not allow transfers of channels out */
00053    AST_BRIDGE_FLAG_TRANSFER_PROHIBITED = (1 << 8),
00054    /*! Bridge transfers require transfer of entire bridge rather than individual channels */
00055    AST_BRIDGE_FLAG_TRANSFER_BRIDGE_ONLY = (1 << 9),
00056 };

Enumerator:
AUTO_MONITOR_TOGGLE  Toggle start/stop of Monitor/MixMonitor.
AUTO_MONITOR_START  Start Monitor/MixMonitor if not already started.
AUTO_MONITOR_STOP  Stop Monitor/MixMonitor if not already stopped.

Definition at line 304 of file bridge_features.h.

00304                                  {
00305    /*! Toggle start/stop of Monitor/MixMonitor. */
00306    AUTO_MONITOR_TOGGLE,
00307    /*! Start Monitor/MixMonitor if not already started. */
00308    AUTO_MONITOR_START,
00309    /*! Stop Monitor/MixMonitor if not already stopped. */
00310    AUTO_MONITOR_STOP,
00311 };

Enumerator:
AST_BRIDGE_HOOK_REMOVE_ON_PULL  The hook is removed when the channel is pulled from the bridge.
AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE  The hook is removed when the bridge's personality changes.

Definition at line 179 of file bridge_features.h.

00179                                   {
00180    /*! The hook is removed when the channel is pulled from the bridge. */
00181    AST_BRIDGE_HOOK_REMOVE_ON_PULL = (1 << 0),
00182    /*! The hook is removed when the bridge's personality changes. */
00183    AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE = (1 << 1),
00184 };

Enumerator:
AST_BRIDGE_HOOK_TIMER_OPTION_MEDIA  The timer temporarily affects media. (Like a custom playfile.)

Definition at line 231 of file bridge_features.h.

00231                                   {
00232    /*! The timer temporarily affects media. (Like a custom playfile.) */
00233    AST_BRIDGE_HOOK_TIMER_OPTION_MEDIA = (1 << 0),
00234 };

Enumerator:
AST_BRIDGE_HOOK_TYPE_NONE  The hook type has not been specified.
AST_BRIDGE_HOOK_TYPE_DTMF 
AST_BRIDGE_HOOK_TYPE_TIMER 
AST_BRIDGE_HOOK_TYPE_HANGUP 
AST_BRIDGE_HOOK_TYPE_JOIN 
AST_BRIDGE_HOOK_TYPE_LEAVE 
AST_BRIDGE_HOOK_TYPE_TALK 
AST_BRIDGE_HOOK_TYPE_MOVE 

Definition at line 186 of file bridge_features.h.


Function Documentation

int ast_bridge_dtmf_hook ( struct ast_bridge_features features,
const char *  dtmf,
ast_bridge_hook_callback  callback,
void *  hook_pvt,
ast_bridge_hook_pvt_destructor  destructor,
enum ast_bridge_hook_remove_flags  remove_flags 
)

Attach a DTMF hook to a bridge features structure.

Parameters:
features Bridge features structure
dtmf DTMF string to be activated upon
callback Function to execute upon activation
hook_pvt Unique data
destructor Optional destructor callback for hook_pvt data
remove_flags Dictates what situations the hook should be removed.
Return values:
0 on success
-1 on failure (The caller must cleanup any hook_pvt resources.)
Example usage:

 struct ast_bridge_features features;
 ast_bridge_features_init(&features);
 ast_bridge_dtmf_hook(&features, "#", pound_callback, NULL, NULL, 0);

This makes the bridging core call pound_callback if a channel that has this feature structure inputs the DTMF string '#'. A pointer to useful data may be provided to the hook_pvt parameter.

Definition at line 3014 of file bridge.c.

References ao2_link, ao2_ref, AST_BRIDGE_HOOK_TYPE_DTMF, ast_copy_string(), bridge_hook_generic(), ast_bridge_hook_dtmf_parms::code, ast_bridge_hook::destructor, ast_bridge_hook_dtmf::dtmf, ast_bridge_features::dtmf_hooks, ast_bridge_hook_dtmf::generic, NULL, and ast_bridge_hook::type.

Referenced by apply_menu_to_user(), ast_bridge_features_enable(), AST_TEST_DEFINE(), bridge_agent_hold_push(), bridge_personality_atxfer_push(), and dynamic_dtmf_hook_add().

03020 {
03021    struct ast_bridge_hook_dtmf *hook;
03022    int res;
03023 
03024    /* Allocate new hook and setup it's various variables */
03025    hook = (struct ast_bridge_hook_dtmf *) bridge_hook_generic(sizeof(*hook), callback,
03026       hook_pvt, destructor, remove_flags);
03027    if (!hook) {
03028       return -1;
03029    }
03030    hook->generic.type = AST_BRIDGE_HOOK_TYPE_DTMF;
03031    ast_copy_string(hook->dtmf.code, dtmf, sizeof(hook->dtmf.code));
03032 
03033    /* Once done we put it in the container. */
03034    res = ao2_link(features->dtmf_hooks, hook) ? 0 : -1;
03035    if (res) {
03036       /*
03037        * Could not link the hook into the container.
03038        *
03039        * Remove the hook_pvt destructor call from the hook since we
03040        * are returning failure to install the hook.
03041        */
03042       hook->generic.destructor = NULL;
03043    }
03044    ao2_ref(hook, -1);
03045 
03046    return res;
03047 }

void ast_bridge_features_cleanup ( struct ast_bridge_features features  ) 

Clean up the contents of a bridge features structure.

Parameters:
features Bridge features structure
Returns:
Nothing
Example usage:

This cleans up the feature structure 'features'.

Note:
This MUST be called after the features structure is done being used or a memory leak may occur.

Definition at line 3488 of file bridge.c.

References ao2_cleanup, ao2_ref, ast_heap_destroy(), ast_heap_pop(), ast_bridge_features::dtmf_hooks, ast_bridge_features::interval_hooks, NULL, and ast_bridge_features::other_hooks.

Referenced by agent_request_exec(), agent_run(), ast_bridge_call_with_flags(), ast_bridge_features_destroy(), AST_TEST_DEFINE(), bridge_exec(), bridgewait_exec(), channel_feature_hooks_set_full(), confbridge_exec(), park_and_announce_app_exec(), park_app_exec(), and parked_call_app_exec().

03489 {
03490    struct ast_bridge_hook_timer *hook;
03491 
03492    /* Destroy the interval hooks heap. */
03493    if (features->interval_hooks) {
03494       while ((hook = ast_heap_pop(features->interval_hooks))) {
03495          ao2_ref(hook, -1);
03496       }
03497       features->interval_hooks = ast_heap_destroy(features->interval_hooks);
03498    }
03499 
03500    /* Destroy the miscellaneous other hooks container. */
03501    ao2_cleanup(features->other_hooks);
03502    features->other_hooks = NULL;
03503 
03504    /* Destroy the DTMF hooks container. */
03505    ao2_cleanup(features->dtmf_hooks);
03506    features->dtmf_hooks = NULL;
03507 }

void ast_bridge_features_destroy ( struct ast_bridge_features features  ) 

Destroy an allocated bridge features struct.

Since:
12.0.0
Parameters:
features Bridge features structure
Example usage:

 struct ast_bridge_features *features;
 features = ast_bridge_features_new();
 ast_bridge_features_destroy(features);

Returns:
Nothing

Definition at line 3509 of file bridge.c.

References ast_bridge_features_cleanup(), and ast_free.

Referenced by ast_bridge_add_channel(), ast_bridge_call_with_flags(), ast_bridge_features_new(), ast_bridge_impart(), ast_local_setup_bridge(), ast_unreal_channel_push_to_bridge(), bridge_channel_depart_thread(), bridge_channel_ind_thread(), bridge_exec(), conf_announce_channel_push(), conf_start_record(), features_destroy(), and local_pvt_destructor().

03510 {
03511    if (!features) {
03512       return;
03513    }
03514    ast_bridge_features_cleanup(features);
03515    ast_free(features);
03516 }

int ast_bridge_features_do ( enum ast_bridge_builtin_feature  feature,
struct ast_bridge_channel bridge_channel,
void *  hook_pvt 
)

Invoke a built in feature hook now.

Parameters:
feature The feature to invoke
bridge_channel Channel executing the feature
hook_pvt Private data passed in when the hook was created
Note:
This API call is only meant to be used by bridge subclasses and hook callbacks to request a builtin feature hook to be executed.
Return values:
0 on success
-1 on failure
Example usage:

 ast_bridge_features_do(AST_BRIDGE_BUILTIN_ATTENDED_TRANSFER, bridge_channel, hook_pvt);

Definition at line 2920 of file bridge.c.

References ARRAY_LEN.

Referenced by agent_connect_caller().

02921 {
02922    ast_bridge_hook_callback callback;
02923 
02924    if (ARRAY_LEN(builtin_features_handlers) <= feature) {
02925       return -1;
02926    }
02927 
02928    callback = builtin_features_handlers[feature];
02929    if (!callback) {
02930       return -1;
02931    }
02932    callback(bridge_channel, hook_pvt);
02933 
02934    return 0;
02935 }

int ast_bridge_features_enable ( struct ast_bridge_features features,
enum ast_bridge_builtin_feature  feature,
const char *  dtmf,
void *  config,
ast_bridge_hook_pvt_destructor  destructor,
enum ast_bridge_hook_remove_flags  remove_flags 
)

Enable a built in feature on a bridge features structure.

Parameters:
features Bridge features structure
feature Feature to enable
dtmf Optionally the DTMF stream to trigger the feature, if not specified it will be the default
config Configuration structure unique to the built in type
destructor Optional destructor callback for config data
remove_flags Dictates what situations the hook should be removed.
Return values:
0 on success
-1 on failure
Example usage:

This enables the attended transfer DTMF option using the default DTMF string. An alternate string may be provided using the dtmf parameter. Internally this is simply setting up a hook to a built in feature callback function.

Definition at line 3197 of file bridge.c.

References ARRAY_LEN, ast_bridge_dtmf_hook(), ast_debug, and ast_strlen_zero.

Referenced by builtin_features_helper().

03203 {
03204    if (ARRAY_LEN(builtin_features_handlers) <= feature
03205       || !builtin_features_handlers[feature]) {
03206       return -1;
03207    }
03208 
03209    /* If no alternate DTMF stream was provided use the default one */
03210    if (ast_strlen_zero(dtmf)) {
03211       dtmf = builtin_features_dtmf[feature];
03212       /* If no DTMF is still available (ie: it has been disabled) then error out now */
03213       if (ast_strlen_zero(dtmf)) {
03214          ast_debug(1, "Failed to enable built in feature %u on %p, no DTMF string is available for it.\n",
03215             feature, features);
03216          return -1;
03217       }
03218    }
03219 
03220    /*
03221     * The rest is basically pretty easy.  We create another hook
03222     * using the built in feature's DTMF callback.  Easy as pie.
03223     */
03224    return ast_bridge_dtmf_hook(features, dtmf, builtin_features_handlers[feature],
03225       config, destructor, remove_flags);
03226 }

int ast_bridge_features_init ( struct ast_bridge_features features  ) 

Initialize bridge features structure.

Parameters:
features Bridge featues structure
Return values:
0 on success
-1 on failure
Example usage:

 struct ast_bridge_features features;
 ast_bridge_features_init(&features);

This initializes the feature structure 'features' to have nothing enabled.

Note:
This MUST be called before enabling features or flags. Failure to do so may result in a crash.

Definition at line 3456 of file bridge.c.

References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_list, AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE, ast_heap_create(), bridge_dtmf_hook_sort(), ast_bridge_features::dtmf_hooks, ast_bridge_features::dtmf_passthrough, interval_hook_time_cmp(), ast_bridge_features::interval_hooks, NULL, ast_bridge_features::other_hooks, and timer.

Referenced by agent_request_exec(), agent_run(), ast_bridge_call_with_flags(), ast_bridge_features_new(), AST_TEST_DEFINE(), bridge_exec(), bridgewait_exec(), channel_feature_hooks_set_full(), confbridge_exec(), park_and_announce_app_exec(), park_app_exec(), and parked_call_app_exec().

03457 {
03458    /* Zero out the structure */
03459    memset(features, 0, sizeof(*features));
03460 
03461    /* Initialize the DTMF hooks container */
03462    features->dtmf_hooks = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX,
03463       AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE, bridge_dtmf_hook_sort, NULL);
03464    if (!features->dtmf_hooks) {
03465       return -1;
03466    }
03467 
03468    /* Initialize the miscellaneous other hooks container */
03469    features->other_hooks = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL,
03470       NULL);
03471    if (!features->other_hooks) {
03472       return -1;
03473    }
03474 
03475    /* Initialize the interval hooks heap */
03476    features->interval_hooks = ast_heap_create(8, interval_hook_time_cmp,
03477       offsetof(struct ast_bridge_hook_timer, timer.heap_index));
03478    if (!features->interval_hooks) {
03479       return -1;
03480    }
03481 
03482    features->dtmf_passthrough = 1;
03483 
03484    return 0;
03485 }

int ast_bridge_features_limits_construct ( struct ast_bridge_features_limits limits  ) 

Constructor function for ast_bridge_features_limits.

Parameters:
limits pointer to a ast_bridge_features_limits struct that has been allocted, but not initialized
Return values:
0 on success
-1 on failure

Definition at line 3228 of file bridge.c.

References ast_string_field_init.

Referenced by bridge_builtin_set_limits(), and pre_bridge_setup().

03229 {
03230    memset(limits, 0, sizeof(*limits));
03231 
03232    if (ast_string_field_init(limits, 256)) {
03233       return -1;
03234    }
03235 
03236    return 0;
03237 }

void ast_bridge_features_limits_destroy ( struct ast_bridge_features_limits limits  ) 

Destructor function for ast_bridge_features_limits.

Parameters:
limits pointer to an ast_bridge_features_limits struct that needs to be destroyed
This function does not free memory allocated to the ast_bridge_features_limits struct, it only frees elements within the struct. You must still call ast_free on the the struct if you allocated it with malloc.

Definition at line 3239 of file bridge.c.

References ast_string_field_free_memory.

Referenced by bridge_features_limits_dtor(), and pre_bridge_setup().

03240 {
03241    ast_string_field_free_memory(limits);
03242 }

void ast_bridge_features_merge ( struct ast_bridge_features into,
const struct ast_bridge_features from 
)

Merge one ast_bridge_features into another.

Parameters:
into The ast_bridge_features that will be merged into
from The ast_bridge_features that will be merged from

Definition at line 3431 of file bridge.c.

References ao2_callback, ast_heap_peek(), ast_heap_unlock, ast_heap_wrlock, ast_bridge_features::dtmf_hooks, ast_bridge_features::dtmf_passthrough, ast_bridge_features::feature_flags, ast_flags::flags, ast_bridge_features::interval_hooks, merge_container_cb(), ast_bridge_features::mute, ast_bridge_features::other_hooks, ast_bridge_features::usable, and wrap_hook().

Referenced by bridge_channel_internal_join(), and channel_feature_hooks_set_full().

03432 {
03433    struct ast_bridge_hook_timer *hook;
03434    int idx;
03435 
03436    /* Merge hook containers */
03437    ao2_callback(from->dtmf_hooks, 0, merge_container_cb, into->dtmf_hooks);
03438    ao2_callback(from->other_hooks, 0, merge_container_cb, into->other_hooks);
03439 
03440    /* Merge hook heaps */
03441    ast_heap_wrlock(from->interval_hooks);
03442    for (idx = 1; (hook = ast_heap_peek(from->interval_hooks, idx)); idx++) {
03443       wrap_hook(into, hook);
03444    }
03445    ast_heap_unlock(from->interval_hooks);
03446 
03447    /* Merge feature flags */
03448    into->feature_flags.flags |= from->feature_flags.flags;
03449    into->usable |= from->usable;
03450 
03451    into->mute |= from->mute;
03452    into->dtmf_passthrough |= from->dtmf_passthrough;
03453 }

struct ast_bridge_features* ast_bridge_features_new ( void   )  [read]

Allocate a new bridge features struct.

Since:
12.0.0
Example usage:

 struct ast_bridge_features *features;
 features = ast_bridge_features_new();
 ast_bridge_features_destroy(features);

Return values:
features New allocated features struct.
NULL on error.

Definition at line 3518 of file bridge.c.

References ast_bridge_features_destroy(), ast_bridge_features_init(), ast_malloc, and NULL.

Referenced by ast_bridge_call_with_flags(), ast_bridge_impart(), ast_unreal_channel_push_to_bridge(), bridge_exec(), channel_feature_hooks_set_full(), conf_announce_channel_push(), and conf_start_record().

03519 {
03520    struct ast_bridge_features *features;
03521 
03522    features = ast_malloc(sizeof(*features));
03523    if (features) {
03524       if (ast_bridge_features_init(features)) {
03525          ast_bridge_features_destroy(features);
03526          features = NULL;
03527       }
03528    }
03529 
03530    return features;
03531 }

int ast_bridge_features_register ( enum ast_bridge_builtin_feature  feature,
ast_bridge_hook_callback  callback,
const char *  dtmf 
)

Register a handler for a built in feature.

Parameters:
feature The feature that the handler will be responsible for
callback The callback function that will handle it
dtmf Default DTMF string used to activate the feature
Return values:
0 on success
-1 on failure
Example usage:

 ast_bridge_features_register(AST_BRIDGE_BUILTIN_ATTENDED_TRANSFER, bridge_builtin_attended_transfer, "*1");

This registers the function bridge_builtin_attended_transfer as the function responsible for the built in attended transfer feature.

Definition at line 2892 of file bridge.c.

References ARRAY_LEN, ast_copy_string(), and ast_strlen_zero.

Referenced by ast_bridging_init_basic(), load_module(), and load_parking_bridge_features().

02893 {
02894    if (ARRAY_LEN(builtin_features_handlers) <= feature
02895       || builtin_features_handlers[feature]) {
02896       return -1;
02897    }
02898 
02899    if (!ast_strlen_zero(dtmf)) {
02900       ast_copy_string(builtin_features_dtmf[feature], dtmf, sizeof(builtin_features_dtmf[feature]));
02901    }
02902 
02903    builtin_features_handlers[feature] = callback;
02904 
02905    return 0;
02906 }

void ast_bridge_features_set_flag ( struct ast_bridge_features features,
unsigned int  flag 
)

Set a flag on a bridge channel features structure.

Parameters:
features Bridge channel features structure
flag Flag to enable
Returns:
Nothing
Example usage:

This sets the AST_BRIDGE_CHANNEL_FLAG_DISSOLVE_HANGUP feature to be enabled on the features structure 'features'.

Definition at line 3259 of file bridge.c.

References ast_set_flag, ast_bridge_features::feature_flags, and ast_bridge_features::usable.

03260 {
03261    ast_set_flag(&features->feature_flags, flag);
03262    features->usable = 1;
03263 }

int ast_bridge_features_set_limits ( struct ast_bridge_features features,
struct ast_bridge_features_limits limits,
enum ast_bridge_hook_remove_flags  remove_flags 
)

Limit the amount of time a channel may stay in the bridge and optionally play warning messages as time runs out.

Parameters:
features Bridge features structure
limits Configured limits applicable to the channel
remove_flags Dictates what situations the hook should be removed.
Return values:
0 on success
-1 on failure
Example usage:

This sets the maximum time the channel can be in the bridge to 10 seconds and does not play any warnings.

Note:
This API call can only be used on a features structure that will be used in association with a bridge channel.

The ast_bridge_features_limits structure must remain accessible for the lifetime of the features structure.

Definition at line 3244 of file bridge.c.

References AST_BRIDGE_BUILTIN_INTERVAL_LIMITS, ast_log, and LOG_ERROR.

Referenced by pre_bridge_setup().

03247 {
03248    if (builtin_interval_handlers[AST_BRIDGE_BUILTIN_INTERVAL_LIMITS]) {
03249       ast_bridge_builtin_set_limits_fn callback;
03250 
03251       callback = builtin_interval_handlers[AST_BRIDGE_BUILTIN_INTERVAL_LIMITS];
03252       return callback(features, limits, remove_flags);
03253    }
03254 
03255    ast_log(LOG_ERROR, "Attempted to set limits without an AST_BRIDGE_BUILTIN_INTERVAL_LIMITS callback registered.\n");
03256    return -1;
03257 }

int ast_bridge_features_unregister ( enum ast_bridge_builtin_feature  feature  ) 

Unregister a handler for a built in feature.

Parameters:
feature The feature to unregister
Return values:
0 on success
-1 on failure
Example usage:

 ast_bridge_features_unregister(AST_BRIDGE_BUILTIN_ATTENDED_TRANSFER);

This unregisters the function that is handling the built in attended transfer feature.

Definition at line 2908 of file bridge.c.

References ARRAY_LEN, and NULL.

Referenced by unload_module(), and unload_parking_bridge_features().

02909 {
02910    if (ARRAY_LEN(builtin_features_handlers) <= feature
02911       || !builtin_features_handlers[feature]) {
02912       return -1;
02913    }
02914 
02915    builtin_features_handlers[feature] = NULL;
02916 
02917    return 0;
02918 }

int ast_bridge_hangup_hook ( struct ast_bridge_features features,
ast_bridge_hook_callback  callback,
void *  hook_pvt,
ast_bridge_hook_pvt_destructor  destructor,
enum ast_bridge_hook_remove_flags  remove_flags 
)

Attach a hangup hook to a bridge features structure.

Parameters:
features Bridge features structure
callback Function to execute upon activation
hook_pvt Unique data
destructor Optional destructor callback for hook_pvt data
remove_flags Dictates what situations the hook should be removed.
Return values:
0 on success
-1 on failure (The caller must cleanup any hook_pvt resources.)
Example usage:

 struct ast_bridge_features features;
 ast_bridge_features_init(&features);
 ast_bridge_hangup_hook(&features, hangup_callback, NULL, NULL, 0);

This makes the bridging core call hangup_callback if a channel that has this hook hangs up. A pointer to useful data may be provided to the hook_pvt parameter.

Definition at line 3097 of file bridge.c.

References AST_BRIDGE_HOOK_TYPE_HANGUP, and bridge_other_hook().

Referenced by add_normal_hooks(), and bridge_personality_atxfer_push().

03102 {
03103    return bridge_other_hook(features, callback, hook_pvt, destructor, remove_flags,
03104       AST_BRIDGE_HOOK_TYPE_HANGUP);
03105 }

int ast_bridge_interval_hook ( struct ast_bridge_features features,
enum ast_bridge_hook_timer_option  flags,
unsigned int  interval,
ast_bridge_hook_callback  callback,
void *  hook_pvt,
ast_bridge_hook_pvt_destructor  destructor,
enum ast_bridge_hook_remove_flags  remove_flags 
)

Attach an interval hook to a bridge features structure.

Parameters:
features Bridge features structure
flags Interval timer callback option flags.
interval The interval that the hook should execute at in milliseconds
callback Function to execute upon activation
hook_pvt Unique data
destructor Optional destructor callback for hook_pvt data
remove_flags Dictates what situations the hook should be removed.
Return values:
0 on success
-1 on failure (The caller must cleanup any hook_pvt resources.)
 struct ast_bridge_features features;
 ast_bridge_features_init(&features);
 ast_bridge_interval_hook(&features, 1000, playback_callback, NULL, NULL, 0);

This makes the bridging core call playback_callback every second. A pointer to useful data may be provided to the hook_pvt parameter.

Definition at line 3151 of file bridge.c.

References ao2_ref, ast_atomic_fetchadd_int(), AST_BRIDGE_HOOK_TYPE_TIMER, ast_debug, ast_heap_push(), ast_heap_unlock, ast_heap_wrlock, ast_samp2tv(), ast_tvadd(), ast_tvnow(), bridge_hook_generic(), ast_bridge_hook::destructor, ast_bridge_hook_timer_parms::flags, ast_bridge_hook_timer::generic, ast_bridge_hook_timer_parms::interval, ast_bridge_features::interval_hooks, ast_bridge_features::interval_sequence, NULL, ast_bridge_hook_timer_parms::seqno, ast_bridge_hook_timer::timer, ast_bridge_hook_timer_parms::trip_time, and ast_bridge_hook::type.

Referenced by agent_request_exec(), apply_option_timeout(), AST_TEST_DEFINE(), bridge_agent_hold_push(), bridge_builtin_set_limits(), parking_set_duration(), and wrap_hook().

03158 {
03159    struct ast_bridge_hook_timer *hook;
03160    int res;
03161 
03162    if (!features ||!interval || !callback) {
03163       return -1;
03164    }
03165 
03166    /* Allocate new hook and setup it's various variables */
03167    hook = (struct ast_bridge_hook_timer *) bridge_hook_generic(sizeof(*hook), callback,
03168       hook_pvt, destructor, remove_flags);
03169    if (!hook) {
03170       return -1;
03171    }
03172    hook->generic.type = AST_BRIDGE_HOOK_TYPE_TIMER;
03173    hook->timer.interval = interval;
03174    hook->timer.trip_time = ast_tvadd(ast_tvnow(), ast_samp2tv(interval, 1000));
03175    hook->timer.seqno = ast_atomic_fetchadd_int((int *) &features->interval_sequence, +1);
03176    hook->timer.flags = flags;
03177 
03178    ast_debug(1, "Putting interval hook %p with interval %u in the heap on features %p\n",
03179       hook, hook->timer.interval, features);
03180    ast_heap_wrlock(features->interval_hooks);
03181    res = ast_heap_push(features->interval_hooks, hook);
03182    ast_heap_unlock(features->interval_hooks);
03183    if (res) {
03184       /*
03185        * Could not push the hook into the heap
03186        *
03187        * Remove the hook_pvt destructor call from the hook since we
03188        * are returning failure to install the hook.
03189        */
03190       hook->generic.destructor = NULL;
03191       ao2_ref(hook, -1);
03192    }
03193 
03194    return res ? -1 : 0;
03195 }

int ast_bridge_interval_register ( enum ast_bridge_builtin_interval  interval,
ast_bridge_builtin_set_limits_fn  callback 
)

Register a handler for a built in interval feature.

Parameters:
interval The interval feature that the handler will be responsible for
callback the Callback function that will handle it
Return values:
0 on success
-1 on failure
Example usage:

This registers the function bridge_builtin_set_limits as the function responsible for the built in duration limit feature.

Definition at line 2937 of file bridge.c.

References ARRAY_LEN.

Referenced by load_module().

02938 {
02939    if (ARRAY_LEN(builtin_interval_handlers) <= interval
02940       || builtin_interval_handlers[interval]) {
02941       return -1;
02942    }
02943 
02944    builtin_interval_handlers[interval] = callback;
02945 
02946    return 0;
02947 }

int ast_bridge_join_hook ( struct ast_bridge_features features,
ast_bridge_hook_callback  callback,
void *  hook_pvt,
ast_bridge_hook_pvt_destructor  destructor,
enum ast_bridge_hook_remove_flags  remove_flags 
)

Unregisters a handler for a built in interval feature.

Parameters:
interval the interval feature to unregister
Return values:
0 on success
-1 on failure
Example usage:

 ast_bridge_interval_unregister(AST_BRIDGE_BULTIN_INTERVAL_LIMITS)
 /endcode

 This unregisters the function that is handling the built in duration limit feature.
 */
int ast_bridge_interval_unregister(enum ast_bridge_builtin_interval interval);

/*!
 \brief Attach a bridge channel join hook to a bridge features structure

 \param features Bridge features structure
 \param callback Function to execute upon activation
 \param hook_pvt Unique data
 \param destructor Optional destructor callback for hook_pvt data
 \param remove_flags Dictates what situations the hook should be removed.

 \retval 0 on success
 \retval -1 on failure (The caller must cleanup any hook_pvt resources.)

 Example usage:

 \code
 struct ast_bridge_features features;
 ast_bridge_features_init(&features);
 ast_bridge_join_hook(&features, join_callback, NULL, NULL, 0);

This makes the bridging core call join_callback when a channel successfully joins the bridging system. A pointer to useful data may be provided to the hook_pvt parameter.

Definition at line 3107 of file bridge.c.

References AST_BRIDGE_HOOK_TYPE_JOIN, and bridge_other_hook().

Referenced by agent_request_exec().

03112 {
03113    return bridge_other_hook(features, callback, hook_pvt, destructor, remove_flags,
03114       AST_BRIDGE_HOOK_TYPE_JOIN);
03115 }

int ast_bridge_leave_hook ( struct ast_bridge_features features,
ast_bridge_hook_callback  callback,
void *  hook_pvt,
ast_bridge_hook_pvt_destructor  destructor,
enum ast_bridge_hook_remove_flags  remove_flags 
)

Attach a bridge channel leave hook to a bridge features structure.

Parameters:
features Bridge features structure
callback Function to execute upon activation
hook_pvt Unique data
destructor Optional destructor callback for hook_pvt data
remove_flags Dictates what situations the hook should be removed.
Return values:
0 on success
-1 on failure (The caller must cleanup any hook_pvt resources.)
Example usage:

 struct ast_bridge_features features;
 ast_bridge_features_init(&features);
 ast_bridge_leave_hook(&features, leave_callback, NULL, NULL, 0);

This makes the bridging core call leave_callback when a channel successfully leaves the bridging system. A pointer to useful data may be provided to the hook_pvt parameter.

Definition at line 3117 of file bridge.c.

References AST_BRIDGE_HOOK_TYPE_LEAVE, and bridge_other_hook().

03122 {
03123    return bridge_other_hook(features, callback, hook_pvt, destructor, remove_flags,
03124       AST_BRIDGE_HOOK_TYPE_LEAVE);
03125 }

int ast_bridge_move_hook ( struct ast_bridge_features features,
ast_bridge_move_indicate_callback  callback,
void *  hook_pvt,
ast_bridge_hook_pvt_destructor  destructor,
enum ast_bridge_hook_remove_flags  remove_flags 
)

Attach a bridge channel move detection hook to a bridge features structure.

Parameters:
features Bridge features structure
callback Function to execute upon activation
hook_pvt Unique data
destructor Optional destructor callback for hook_pvt data
remove_flags Dictates what situations the hook should be removed.
Return values:
0 on success
-1 on failure (The caller must cleanup any hook_pvt resources.)
Example usage:

 struct ast_bridge_features features;
 ast_bridge_features_init(&features);
 ast_bridge_move_hook(&features, move_callback, NULL, NULL, 0);

This makes the bridging core call callback when a channel is moved from one bridge to another. A pointer to useful data may be provided to the hook_pvt parameter.

Definition at line 3139 of file bridge.c.

References AST_BRIDGE_HOOK_TYPE_MOVE, bridge_other_hook(), and hook_cb().

Referenced by bridge_stasis_pull().

03144 {
03145    ast_bridge_hook_callback hook_cb = (ast_bridge_hook_callback) callback;
03146 
03147    return bridge_other_hook(features, hook_cb, hook_pvt, destructor, remove_flags,
03148       AST_BRIDGE_HOOK_TYPE_MOVE);
03149 }

int ast_bridge_talk_detector_hook ( struct ast_bridge_features features,
ast_bridge_talking_indicate_callback  callback,
void *  hook_pvt,
ast_bridge_hook_pvt_destructor  destructor,
enum ast_bridge_hook_remove_flags  remove_flags 
)

Attach a bridge channel talk detection hook to a bridge features structure.

Parameters:
features Bridge features structure
callback Function to execute upon activation
hook_pvt Unique data
destructor Optional destructor callback for hook_pvt data
remove_flags Dictates what situations the hook should be removed.
Return values:
0 on success
-1 on failure (The caller must cleanup any hook_pvt resources.)
Example usage:

 struct ast_bridge_features features;
 ast_bridge_features_init(&features);
 ast_bridge_talk_hook(&features, talk_callback, NULL, NULL, 0);

This makes the bridging technology call talk_callback when a channel is recognized as starting and stopping talking. A pointer to useful data may be provided to the hook_pvt parameter.

Note:
This hook is currently only supported by softmix.

Definition at line 3127 of file bridge.c.

References AST_BRIDGE_HOOK_TYPE_TALK, bridge_other_hook(), and hook_cb().

Referenced by confbridge_exec().

03132 {
03133    ast_bridge_hook_callback hook_cb = (ast_bridge_hook_callback) callback;
03134 
03135    return bridge_other_hook(features, hook_cb, hook_pvt, destructor, remove_flags,
03136       AST_BRIDGE_HOOK_TYPE_TALK);
03137 }


Generated on Thu Apr 16 06:29:11 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6