Asterisk - The Open Source Telephony Project
18.5.0
|
Parking Entry, Exit, and other assorted controls. More...
#include "asterisk.h"
#include "asterisk/logger.h"
#include "res_parking.h"
#include "asterisk/astobj2.h"
#include "asterisk/utils.h"
#include "asterisk/manager.h"
#include "asterisk/test.h"
#include "asterisk/features.h"
#include "asterisk/bridge_basic.h"
Go to the source code of this file.
Data Structures | |
struct | parking_limits_pvt |
Functions | |
int | comeback_goto (struct parked_user *pu, struct parking_lot *lot) |
Set a channel's position in the PBX after timeout using the parking lot settings. More... | |
void | flatten_dial_string (char *dialstring) |
Flattens a dial string so that it can be written to/found from PBX extensions. More... | |
void | parked_call_retrieve_enable_features (struct ast_channel *chan, struct parking_lot *lot, int recipient_mode) |
Apply features based on the parking lot feature options. More... | |
int | parking_channel_set_roles (struct ast_channel *chan, struct parking_lot *lot, int force_ringing) |
Set necessary bridge roles on a channel that is about to enter a parking lot. More... | |
struct ast_bridge * | parking_lot_get_bridge (struct parking_lot *lot) |
Get a reference to a parking lot's bridge. If it doesn't exist, create it and get a reference. More... | |
int | parking_lot_get_space (struct parking_lot *lot, int target_override) |
Get an available parking space within a parking lot. More... | |
struct parked_user * | parking_lot_inspect_parked_user (struct parking_lot *lot, int target) |
Determine if there is a parked user in a parking space and return it if there is. More... | |
struct parked_user * | parking_lot_retrieve_parked_user (struct parking_lot *lot, int target) |
Determine if there is a parked user in a parking space and pull it from the parking lot if there is. More... | |
static int | retrieve_parked_user_targeted (void *obj, void *arg, int flags) |
int | unpark_parked_user (struct parked_user *pu) |
Pull a parked user out of its parking lot. Use this when you don't want to use the parked user afterwards. More... | |
Parking Entry, Exit, and other assorted controls.
Definition in file parking_controller.c.
int comeback_goto | ( | struct parked_user * | pu, |
struct parking_lot * | lot | ||
) |
Set a channel's position in the PBX after timeout using the parking lot settings.
pu | Parked user who is entering/reentering the PBX |
lot | Parking lot the user was removed from. |
0 | Position set successfully |
-1 | Failed to set the position |
Definition at line 261 of file parking_controller.c.
References ast_async_goto(), ast_channel_name(), ast_exists_extension(), ast_log, ast_strdupa, ast_verb, parking_lot::cfg, parked_user::chan, parking_lot_cfg::comebackcontext, parking_lot_cfg::comebacktoorigin, flatten_dial_string(), LOG_ERROR, NULL, PARK_DIAL_CONTEXT, and parked_user::parker_dial_string.
Referenced by parking_duration_callback().
void flatten_dial_string | ( | char * | dialstring | ) |
Flattens a dial string so that it can be written to/found from PBX extensions.
peername | unflattened dial string. This will be flattened in place. |
Definition at line 249 of file parking_controller.c.
Referenced by comeback_goto(), and parking_duration_callback().
void parked_call_retrieve_enable_features | ( | struct ast_channel * | chan, |
struct parking_lot * | lot, | ||
int | recipient_mode | ||
) |
Apply features based on the parking lot feature options.
chan | Which channel's feature set is being modified |
lot | parking lot which establishes the features used |
recipient_mode | AST_FEATURE_FLAG_BYCALLER if the user is the retriever AST_FEATURE_FLAG_BYCALLEE if the user is the parkee |
Definition at line 215 of file parking_controller.c.
References ast_bridge_features_ds_get(), ast_bridge_features_ds_set(), ast_channel_lock, ast_channel_unlock, AST_FEATURE_AUTOMIXMON, AST_FEATURE_DISCONNECT, AST_FEATURE_PARKCALL, AST_FEATURE_REDIRECT, ast_set_flag, parking_lot::cfg, parking_lot_cfg::parkedcallhangup, parking_lot_cfg::parkedcallrecording, parking_lot_cfg::parkedcallreparking, and parking_lot_cfg::parkedcalltransfers.
Referenced by bridge_parking_pull(), and parked_call_app_exec().
int parking_channel_set_roles | ( | struct ast_channel * | chan, |
struct parking_lot * | lot, | ||
int | force_ringing | ||
) |
Set necessary bridge roles on a channel that is about to enter a parking lot.
chan | Entering channel |
lot | The parking lot the channel will be entering |
force_ringing | Use ringing instead of music on hold |
0 | on success |
non-zero | on failure |
Definition at line 57 of file parking_controller.c.
References ast_channel_add_bridge_role(), ast_channel_set_bridge_role_option(), ast_strlen_zero, parking_lot::cfg, and parking_lot_cfg::mohclass.
Referenced by bridge_parking_push(), and park_common_setup().
struct ast_bridge* parking_lot_get_bridge | ( | struct parking_lot * | lot | ) |
Get a reference to a parking lot's bridge. If it doesn't exist, create it and get a reference.
lot | Which parking lot we need the bridge from. This parking lot must be locked before calling this function. |
A | reference to the ast_bridge associated with the parking lot |
NULL | if it didn't already have a bridge and one couldn't be created |
Definition at line 36 of file parking_controller.c.
References ao2_ref, bridge_parking_new(), NULL, and parking_lot::parking_bridge.
Referenced by park_common_setup().
int parking_lot_get_space | ( | struct parking_lot * | lot, |
int | target_override | ||
) |
Get an available parking space within a parking lot.
lot | Which parking lot we are getting a space from |
target_override | If there is a specific slot we want, provide it here and we'll start from that position |
-1 | if No slot can be found |
integer | value of parking space selected |
Definition at line 96 of file parking_controller.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, parking_lot::cfg, parking_lot::next_space, parking_lot::parked_users, parking_lot_cfg::parkfindnext, parked_user::parking_space, parking_lot_cfg::parking_start, and parking_limits_pvt::user.
Referenced by generate_parked_user().
struct parked_user* parking_lot_inspect_parked_user | ( | struct parking_lot * | lot, |
int | target | ||
) |
Determine if there is a parked user in a parking space and return it if there is.
lot | Parking lot being pulled from |
target | If < 0 search for the first occupied space in the parking lot If >= 0 Only pull from the indicated target |
NULL | if no parked user could be pulled from the requested parking lot at the requested parking space |
reference | to the requested parked user |
Definition at line 166 of file parking_controller.c.
References ao2_callback, NULL, parking_lot::parked_users, retrieve_parked_user_targeted(), and parking_limits_pvt::user.
Referenced by func_get_parkingslot_channel().
struct parked_user* parking_lot_retrieve_parked_user | ( | struct parking_lot * | lot, |
int | target | ||
) |
Determine if there is a parked user in a parking space and pull it from the parking lot if there is.
lot | Parking lot being pulled from |
target | If < 0 search for the first occupied space in the parking lot If >= 0 Only pull from the indicated target |
NULL | if no parked user could be pulled from the requested parking lot at the requested parking space |
reference | to the requested parked user |
Definition at line 183 of file parking_controller.c.
References ao2_callback, ao2_cleanup, ao2_lock, ao2_ref, ao2_unlink, ao2_unlock, NULL, PARK_ANSWERED, PARK_UNSET, parking_lot::parked_users, parking_lot_remove_if_unused(), RAII_VAR, retrieve_parked_user_targeted(), and parking_limits_pvt::user.
Referenced by AST_TEST_DEFINE(), and parked_call_app_exec().
|
static |
Definition at line 155 of file parking_controller.c.
References CMP_MATCH, and parked_user::parking_space.
Referenced by parking_lot_inspect_parked_user(), and parking_lot_retrieve_parked_user().
int unpark_parked_user | ( | struct parked_user * | user | ) |
Pull a parked user out of its parking lot. Use this when you don't want to use the parked user afterwards.
user | The parked user being pulled. |
0 | on success |
-1 | if the user didn't have its parking lot set |
Definition at line 85 of file parking_controller.c.
References ao2_unlink, parked_user::lot, parking_lot::parked_users, and parking_lot_remove_if_unused().
Referenced by bridge_parking_pull().