| 1 | /* |
| 2 | * Asterisk -- An open source telephony toolkit. |
| 3 | * |
| 4 | * Copyright (C) 2013, Digium, Inc. |
| 5 | * |
| 6 | * Jonathan Rose <[email protected]> |
| 7 | * |
| 8 | * See http://www.asterisk.org for more information about |
| 9 | * the Asterisk project. Please do not directly contact |
| 10 | * any of the maintainers of this project for assistance; |
| 11 | * the project provides a web site, mailing lists and IRC |
| 12 | * channels for your use. |
| 13 | * |
| 14 | * This program is free software, distributed under the terms of |
| 15 | * the GNU General Public License Version 2. See the LICENSE file |
| 16 | * at the top of the source tree. |
| 17 | */ |
| 18 | |
| 19 | /*! \file |
| 20 | * |
| 21 | * \brief Call Parking Resource Internal API |
| 22 | * |
| 23 | * \author Jonathan Rose <[email protected]> |
| 24 | */ |
| 25 | |
| 26 | #ifndef ASTERISK_RES_PARKING_H |
| 27 | #define ASTERISK_RES_PARKING_H |
| 28 | |
| 29 | #include "asterisk/pbx.h" |
| 30 | #include "asterisk/bridge.h" |
| 31 | #include "asterisk/parking.h" |
| 32 | #include "asterisk/stasis_channels.h" |
| 33 | |
| 34 | #define DEFAULT_PARKING_LOT "default" |
| 35 | #define DEFAULT_PARKING_EXTEN "700" |
| 36 | #define BASE_REGISTRAR "res_parking" |
| 37 | #define PARK_DIAL_CONTEXT "park-dial" |
| 38 | #define PARKED_CALL_APPLICATION "ParkedCall" |
| 39 | |
| 40 | enum park_call_resolution { |
| 41 | PARK_UNSET = 0, /*! Nothing set a resolution. This should never be observed in practice. */ |
| 42 | PARK_ABANDON, /*! The channel for the parked call hung up */ |
| 43 | PARK_TIMEOUT, /*! The parked call stayed parked until the parking lot timeout was reached and was removed */ |
| 44 | PARK_FORCED, /*! The parked call was forcibly terminated by an unusual means in Asterisk */ |
| 45 | PARK_ANSWERED, /*! The parked call was retrieved successfully */ |
| 46 | }; |
| 47 | |
| 48 | enum parked_call_feature_options { |
| 49 | OPT_PARKEDPLAY = 0, |
| 50 | OPT_PARKEDTRANSFERS, |
| 51 | OPT_PARKEDREPARKING, |
| 52 | OPT_PARKEDHANGUP, |
| 53 | OPT_PARKEDRECORDING, |
| 54 | }; |
| 55 | |
| 56 | enum parking_lot_modes { |
| 57 | PARKINGLOT_NORMAL = 0, /*! The parking lot is configured normally and can accept new calls. Disable on reload if the config isn't replaced. |
| 58 | * valid transitions: PARKINGLOT_DISABLED */ |
| 59 | PARKINGLOT_DYNAMIC, /*! The parking lot is a dynamically created parking lot. It can be parked to at any time. Disabled on last parked call leaving. |
| 60 | * valid transitions: PARKINGLOT_DISABLED */ |
| 61 | PARKINGLOT_DISABLED, /*! The parking lot is no longer linked to a parking lot in configuration. It can no longer be parked to. |
| 62 | * and it can not be parked to. This mode has no transitions. */ |
| 63 | }; |
| 64 | |
| 65 | struct parking_lot_cfg { |
| 66 | int parking_start; /*!< First space in the parking lot */ |
| 67 | int parking_stop; /*!< Last space in the parking lot */ |
| 68 | |
| 69 | unsigned int parkingtime; /*!< Analogous to parkingtime config option */ |
| 70 | unsigned int comebackdialtime; /*!< Analogous to comebackdialtime config option */ |
| 71 | unsigned int parkfindnext; /*!< Analogous to parkfindnext config option */ |
| 72 | unsigned int parkext_exclusive; /*!< Analogous to parkext_exclusive config option */ |
| 73 | unsigned int parkaddhints; /*!< Analogous to parkaddhints config option */ |
| 74 | unsigned int comebacktoorigin; /*!< Analogous to comebacktoorigin config option */ |
| 75 | int parkedplay; /*!< Analogous to parkedplay config option */ |
| 76 | int parkedcalltransfers; /*!< Analogous to parkedcalltransfers config option */ |
| 77 | int parkedcallreparking; /*!< Analogous to parkedcallreparking config option */ |
| 78 | int parkedcallhangup; /*!< Analogous to parkedcallhangup config option */ |
| 79 | int parkedcallrecording; /*!< Analogous to parkedcallrecording config option */ |
| 80 | |
| 81 | AST_DECLARE_STRING_FIELDS( |
| 82 | AST_STRING_FIELD(name); /*!< Name of the parking lot configuration object */ |
| 83 | AST_STRING_FIELD(registrar); /*!< Which registrar the lot uses if it isn't the default registrar */ |
| 84 | AST_STRING_FIELD(mohclass); /*!< Analogous to mohclass config option */ |
| 85 | AST_STRING_FIELD(parkext); /*!< Analogous to parkext config option */ |
| 86 | AST_STRING_FIELD(parking_con); /*!< Analogous to context config option */ |
| 87 | AST_STRING_FIELD(comebackcontext); /*!< Analogous to comebackcontext config option */ |
| 88 | AST_STRING_FIELD(courtesytone); /*!< Analogous to courtesytone config option */ |
| 89 | ); |
| 90 | }; |
| 91 | |
| 92 | struct parking_lot { |
| 93 | int next_space; /*!< When using parkfindnext, which space we should start searching from next time we park */ |
| 94 | struct ast_bridge *parking_bridge; /*!< Bridged where parked calls will rest until they are answered or otherwise leave */ |
| 95 | struct ao2_container *parked_users; /*!< List of parked users rigidly ordered by their parking space */ |
| 96 | struct parking_lot_cfg *cfg; /*!< Reference to configuration object for the parking lot */ |
| 97 | enum parking_lot_modes mode; /*!< Whether a parking lot is operational, being reconfigured, primed for deletion, or dynamically created. */ |
| 98 | int disable_mark; /*!< On reload, disable this parking lot if it doesn't receive a new configuration. */ |
| 99 | |
| 100 | AST_DECLARE_STRING_FIELDS( |
| 101 | AST_STRING_FIELD(name); /*!< Name of the parking lot object */ |
| 102 | ); |
| 103 | }; |
| 104 | |
| 105 | struct parked_user { |
| 106 | struct ast_channel *chan; /*!< Parked channel */ |
| 107 | struct ast_channel_snapshot *retriever; /*!< Snapshot of the channel that retrieves a parked call */ |
| 108 | struct timeval start; /*!< When the call was parked */ |
| 109 | int parking_space; /*!< Which parking space is used */ |
| 110 | char comeback[AST_MAX_CONTEXT]; /*!< Where to go on parking timeout */ |
| 111 | char *parker_dial_string; /*!< dialstring to call back with comebacktoorigin. Used timeout extension generation and call control */ |
| 112 | unsigned int time_limit; /*!< How long this specific channel may remain in the parking lot before timing out */ |
| 113 | struct parking_lot *lot; /*!< Which parking lot the user is parked to */ |
| 114 | enum park_call_resolution resolution; /*!< How did the parking session end? If the call is in a bridge, lock parked_user before checking/setting */ |
| 115 | }; |
| 116 | |
| 117 | #if defined(TEST_FRAMEWORK) |
| 118 | /*! |
| 119 | * \since 12.0.0 |
| 120 | * \brief Create an empty parking lot configuration structure |
| 121 | * useful for unit tests. |
| 122 | * |
| 123 | * \param cat name given to the parking lot |
| 124 | * |
| 125 | * \retval NULL failure |
| 126 | * \retval non-NULL successfully allocated parking lot |
| 127 | */ |
| 128 | struct parking_lot_cfg *parking_lot_cfg_create(const char *cat); |
| 129 | #endif |
| 130 | |
| 131 | /*! |
| 132 | * \since 12.0.0 |
| 133 | * \brief If a parking lot exists in the parking lot list already, update its status to match the provided |
| 134 | * configuration and return a reference return a reference to it. Otherwise, create a parking lot |
| 135 | * struct based on a parking lot configuration and return a reference to the new one. |
| 136 | * |
| 137 | * \param cfg The configuration being used as a reference to build the parking lot from. |
| 138 | * \param dynamic non-zero if creating a dynamic parking lot with this. Don't replace existing parking lots. Ever. |
| 139 | * |
| 140 | * \return A reference to the new parking lot |
| 141 | * \retval NULL if it was not found and could not be allocated |
| 142 | * |
| 143 | * \note The parking lot will need to be unreffed if it ever falls out of scope |
| 144 | * \note The parking lot will automatically be added to the parking lot container if needed as part of this process |
| 145 | */ |
| 146 | struct parking_lot *parking_lot_build_or_update(struct parking_lot_cfg *cfg, int dynamic); |
| 147 | |
| 148 | /*! |
| 149 | * \since 12.0.0 |
| 150 | * \brief Remove a parking lot from the usable lists if it is no longer involved in any calls and no configuration currently claims it |
| 151 | * |
| 152 | * \param lot Which parking lot is being checked for elimination |
| 153 | * |
| 154 | * \retval 0 if the parking lot was removed |
| 155 | * \retval -1 if the parking lot wasn't removed. |
| 156 | * |
| 157 | * \note This should generally be called when something is happening that could cause a parking lot to die such as a call being unparked or |
| 158 | * a parking lot no longer existing in configurations. |
| 159 | */ |
| 160 | int parking_lot_remove_if_unused(struct parking_lot *lot); |
| 161 | |
| 162 | /*! |
| 163 | * \since 12.0.0 |
| 164 | * \brief Create a new parking bridge |
| 165 | * |
| 166 | * \param bridge_lot Parking lot which the new bridge should be based on |
| 167 | * |
| 168 | * \retval NULL if the bridge can not be created |
| 169 | * \return Newly created parking bridge |
| 170 | */ |
| 171 | struct ast_bridge *bridge_parking_new(struct parking_lot *bridge_lot); |
| 172 | |
| 173 | /*! |
| 174 | * \since 12.0.0 |
| 175 | * \brief Get a reference to a parking lot's bridge. If it doesn't exist, create it and get a reference. |
| 176 | * |
| 177 | * \param lot Which parking lot we need the bridge from. This parking lot must be locked before calling this function. |
| 178 | * |
| 179 | * \return A reference to the ast_bridge associated with the parking lot |
| 180 | * \retval NULL if it didn't already have a bridge and one couldn't be created |
| 181 | * |
| 182 | * \note This bridge will need to be unreffed if it ever falls out of scope. |
| 183 | */ |
| 184 | struct ast_bridge *parking_lot_get_bridge(struct parking_lot *lot); |
| 185 | |
| 186 | /*! |
| 187 | * \since 12.0.0 |
| 188 | * \brief Get an available parking space within a parking lot. |
| 189 | * |
| 190 | * \param lot Which parking lot we are getting a space from |
| 191 | * \param target_override If there is a specific slot we want, provide it here and we'll start from that position |
| 192 | * |
| 193 | * \retval -1 if No slot can be found |
| 194 | * \return integer value of parking space selected |
| 195 | * |
| 196 | * \note lot should be locked before this is called and unlocked only after a parked_user with the space |
| 197 | * returned has been added to the parking lot. |
| 198 | */ |
| 199 | int parking_lot_get_space(struct parking_lot *lot, int target_override); |
| 200 | |
| 201 | /*! |
| 202 | * \brief Determine if there is a parked user in a parking space and return it if there is. |
| 203 | * |
| 204 | * \param lot Parking lot being pulled from |
| 205 | * \param target If < 0 search for the first occupied space in the parking lot |
| 206 | * If >= 0 Only pull from the indicated target |
| 207 | * |
| 208 | * \retval NULL if no parked user could be pulled from the requested parking lot at the requested parking space |
| 209 | * \return reference to the requested parked user |
| 210 | * |
| 211 | */ |
| 212 | struct parked_user *parking_lot_inspect_parked_user(struct parking_lot *lot, int target); |
| 213 | |
| 214 | /*! |
| 215 | * \since 12.0.0 |
| 216 | * \brief Determine if there is a parked user in a parking space and pull it from the parking lot if there is. |
| 217 | * |
| 218 | * \param lot Parking lot being pulled from |
| 219 | * \param target If < 0 search for the first occupied space in the parking lot |
| 220 | * If >= 0 Only pull from the indicated target |
| 221 | * |
| 222 | * \retval NULL if no parked user could be pulled from the requested parking lot at the requested parking space |
| 223 | * \return reference to the requested parked user |
| 224 | * |
| 225 | * \note The parked user will be removed from parking lot as part of this process |
| 226 | * \note Remove this reference with ao2_cleanup once it falls out of scope. |
| 227 | */ |
| 228 | struct parked_user *parking_lot_retrieve_parked_user(struct parking_lot *lot, int target); |
| 229 | |
| 230 | /*! |
| 231 | * \since 12.0.0 |
| 232 | * \brief Apply features based on the parking lot feature options |
| 233 | * |
| 234 | * \param chan Which channel's feature set is being modified |
| 235 | * \param lot parking lot which establishes the features used |
| 236 | * \param recipient_mode AST_FEATURE_FLAG_BYCALLER if the user is the retriever |
| 237 | * AST_FEATURE_FLAG_BYCALLEE if the user is the parkee |
| 238 | */ |
| 239 | void parked_call_retrieve_enable_features(struct ast_channel *chan, struct parking_lot *lot, int recipient_mode); |
| 240 | |
| 241 | /*! |
| 242 | * \since 12.0.0 |
| 243 | * \brief Set necessary bridge roles on a channel that is about to enter a parking lot |
| 244 | * |
| 245 | * \param chan Entering channel |
| 246 | * \param lot The parking lot the channel will be entering |
| 247 | * \param force_ringing Use ringing instead of music on hold |
| 248 | * |
| 249 | * \retval 0 on success |
| 250 | * \retval non-zero on failure |
| 251 | */ |
| 252 | int parking_channel_set_roles(struct ast_channel *chan, struct parking_lot *lot, int force_ringing); |
| 253 | |
| 254 | /*! |
| 255 | * \since 12.0.0 |
| 256 | * \brief custom callback function for ast_bridge_channel_queue_playfile which plays a parking space |
| 257 | * and optionally hangs up the call afterwards based on the payload in playfile. |
| 258 | */ |
| 259 | void say_parking_space(struct ast_bridge_channel *bridge_channel, const char *payload); |
| 260 | |
| 261 | /*! |
| 262 | * \since 12.0.0 |
| 263 | * \brief Setup timeout interval feature on an ast_bridge_features for parking |
| 264 | * |
| 265 | * \param features The ast_bridge_features we are establishing the interval hook on |
| 266 | * \param user The parked_user receiving the timeout duration limits |
| 267 | */ |
| 268 | void parking_set_duration(struct ast_bridge_features *features, struct parked_user *user); |
| 269 | |
| 270 | /*! |
| 271 | * \since 12.0.0 |
| 272 | * \brief Get a pointer to the parking lot container for purposes such as iteration |
| 273 | * |
| 274 | * \return pointer to the parking lot container. |
| 275 | */ |
| 276 | struct ao2_container *get_parking_lot_container(void); |
| 277 | |
| 278 | /*! |
| 279 | * \since 12.0.0 |
| 280 | * \brief Find a parking lot based on its name |
| 281 | * |
| 282 | * \param lot_name Name of the parking lot sought |
| 283 | * |
| 284 | * \return The parking lot if found |
| 285 | * \retval NULL if no parking lot with the name specified exists |
| 286 | * |
| 287 | * \note ao2_cleanup this reference when you are done using it or you'll cause leaks. |
| 288 | */ |
| 289 | struct parking_lot *parking_lot_find_by_name(const char *lot_name); |
| 290 | |
| 291 | /*! |
| 292 | * \since 12.0.0 |
| 293 | * \brief Create a dynamic parking lot |
| 294 | * |
| 295 | * \param name Dynamic parking lot name to create |
| 296 | * \param chan Channel parkee to get dynamic parking lot parameters from |
| 297 | * |
| 298 | * \return dynamically created parking lot on success |
| 299 | * \retval NULL on error |
| 300 | * |
| 301 | * \note This should be called only after verifying that the named parking lot doesn't already exist in a non-dynamic way. |
| 302 | */ |
| 303 | struct parking_lot *parking_create_dynamic_lot(const char *name, struct ast_channel *chan); |
| 304 | |
| 305 | #if defined(TEST_FRAMEWORK) |
| 306 | /*! |
| 307 | * \since 12.0.0 |
| 308 | * \brief Create a dynamic parking lot without respect to whether they are enabled by configuration |
| 309 | * |
| 310 | * \param name Dynamic parking lot name to create |
| 311 | * \param chan Channel parkee to get the dynamic parking lot parameters from |
| 312 | * |
| 313 | * \return dynamically created parking lot on success |
| 314 | * \retval NULL on error |
| 315 | * |
| 316 | * \note This should be called only after verifying that the named parking lot doesn't already exist in a non-dynamic way. |
| 317 | */ |
| 318 | struct parking_lot *parking_create_dynamic_lot_forced(const char *name, struct ast_channel *chan); |
| 319 | #endif |
| 320 | |
| 321 | /*! |
| 322 | * \since 12.0.0 |
| 323 | * \brief Find parking lot name from channel |
| 324 | * |
| 325 | * \param chan The channel we want the parking lot name for |
| 326 | * |
| 327 | * \return name of the parking lot to use for the channel. |
| 328 | * |
| 329 | * \note Always returns a parking lot name. |
| 330 | * |
| 331 | * \note Channel needs to be locked while the returned string is in use. |
| 332 | */ |
| 333 | const char *find_channel_parking_lot_name(struct ast_channel *chan); |
| 334 | |
| 335 | /*! |
| 336 | * \since 12.0.0 |
| 337 | * \brief Flattens a dial string so that it can be written to/found from PBX extensions |
| 338 | * |
| 339 | * \param dialstring unflattened dial string. This will be flattened in place. |
| 340 | */ |
| 341 | void flatten_dial_string(char *dialstring); |
| 342 | |
| 343 | /*! |
| 344 | * \since 12.0.0 |
| 345 | * \brief Set a channel's position in the PBX after timeout using the parking lot settings |
| 346 | * |
| 347 | * \param pu Parked user who is entering/reentering the PBX |
| 348 | * \param lot Parking lot the user was removed from. |
| 349 | * |
| 350 | * \retval 0 Position set successfully |
| 351 | * \retval -1 Failed to set the position |
| 352 | */ |
| 353 | int comeback_goto(struct parked_user *pu, struct parking_lot *lot); |
| 354 | |
| 355 | /*! |
| 356 | * \since 12.0.0 |
| 357 | * \brief Add extensions for a parking lot configuration |
| 358 | * |
| 359 | * \param lot_cfg parking lot configuration to generate extensions for |
| 360 | * |
| 361 | * \retval 0 on success |
| 362 | * \retval non-zero on failure |
| 363 | */ |
| 364 | int parking_lot_cfg_create_extensions(struct parking_lot_cfg *lot_cfg); |
| 365 | |
| 366 | /*! |
| 367 | * \since 12.0.0 |
| 368 | * \brief Remove extensions belonging to a parking lot configuration |
| 369 | * |
| 370 | * \param lot_cfg parking lot configuratin to remove extensions from |
| 371 | * |
| 372 | * \note This will not remove extensions registered non-exclusively even |
| 373 | * if those extensions were registered by lot_cfg. Those are only |
| 374 | * purged on a res_parking module reload. |
| 375 | */ |
| 376 | void parking_lot_cfg_remove_extensions(struct parking_lot_cfg *lot_cfg); |
| 377 | |
| 378 | /*! |
| 379 | * \since 12.0.0 |
| 380 | * \brief Pull a parked user out of its parking lot. Use this when you don't want to use the parked user afterwards. |
| 381 | * \param user The parked user being pulled. |
| 382 | * |
| 383 | * \retval 0 on success |
| 384 | * \retval -1 if the user didn't have its parking lot set |
| 385 | */ |
| 386 | int unpark_parked_user(struct parked_user *user); |
| 387 | |
| 388 | /*! |
| 389 | * \since 12.0.0 |
| 390 | * \brief Publish a stasis parked call message for the channel indicating failure to park. |
| 391 | * |
| 392 | * \param parkee channel belonging to the failed parkee |
| 393 | */ |
| 394 | void publish_parked_call_failure(struct ast_channel *parkee); |
| 395 | |
| 396 | /*! |
| 397 | * \since 12.0.0 |
| 398 | * \brief Publish a stasis parked call message for a given parked user |
| 399 | * |
| 400 | * \param pu pointer to a parked_user that we are generating the message for |
| 401 | * \param event_type What parked call event type is provoking this message |
| 402 | */ |
| 403 | void publish_parked_call(struct parked_user *pu, enum ast_parked_call_event_type event_type); |
| 404 | |
| 405 | /*! |
| 406 | * \since 12.3.0 |
| 407 | * \brief Create a parking announcement subscription |
| 408 | * |
| 409 | * \param chan Channel that will receive the announcement |
| 410 | * \param parkee_uuid Unique ID of the channel being parked |
| 411 | * \param hangup_after if non-zero, have the channel hangup after hearing the announcement |
| 412 | * |
| 413 | * \retval 0 on success |
| 414 | * \retval -1 on failure |
| 415 | */ |
| 416 | int create_parked_subscription(struct ast_channel *chan, const char *parkee_uuid, int hangup_after); |
| 417 | |
| 418 | /*! |
| 419 | * \since 12.0.0 |
| 420 | * \brief Setup a parked call on a parking bridge without needing to parse appdata |
| 421 | * |
| 422 | */ |
| 423 | struct ast_bridge *park_common_setup(struct ast_channel *parkee, struct ast_channel *parker, |
| 424 | const char *lot_name, const char *comeback_override, |
| 425 | int use_ringing, int randomize, int time_limit, int silence_announcements); |
| 426 | |
| 427 | /*! |
| 428 | * \since 12.0.0 |
| 429 | * \brief Function to prepare a channel for parking by determining which parking bridge should |
| 430 | * be used, setting up a park common datastore so that the parking bridge will have access |
| 431 | * to necessary parking information when joining, and applying various bridge roles to the |
| 432 | * channel. |
| 433 | * |
| 434 | * \param parkee The channel being prepared for parking |
| 435 | * \param parker The channel initiating the park; may be the parkee as well. May be NULL. |
| 436 | * \param app_data arguments supplied to the Park application. May be NULL. |
| 437 | * \param silence_announcements optional pointer to an integer where we want to store the silence option flag |
| 438 | * this value should be initialized to 0 prior to calling park_common_setup. |
| 439 | * |
| 440 | * \return reference to a parking bridge if successful |
| 441 | * \retval NULL on failure |
| 442 | * |
| 443 | * \note ao2_cleanup this reference when you are done using it or you'll cause leaks. |
| 444 | */ |
| 445 | struct ast_bridge *park_application_setup(struct ast_channel *parkee, struct ast_channel *parker, |
| 446 | const char *app_data, int *silence_announcements); |
| 447 | |
| 448 | struct park_common_datastore { |
| 449 | char *parker_uuid; /*!< Unique ID of the channel parking the call. */ |
| 450 | char *parker_dial_string; /*!< Dial string that we would attempt to call when timing out when comebacktoorigin=yes */ |
| 451 | char *comeback_override; /*!< Optional goto string for where to send the call after we are done */ |
| 452 | int randomize; /*!< Pick a parking space to enter on at random */ |
| 453 | int time_limit; /*!< time limit override. -1 values don't override, 0 for unlimited time, >0 for custom time limit in seconds */ |
| 454 | int silence_announce; /*!< Used when a call parks itself to keep it from hearing the parked call announcement */ |
| 455 | }; |
| 456 | |
| 457 | /*! |
| 458 | * \since 12.0.0 |
| 459 | * \brief Get a copy of the park_common_datastore from a channel that is being parked |
| 460 | * |
| 461 | * \param parkee The channel entering parking with the datastore we are checking |
| 462 | * |
| 463 | * \return Pointer to a copy of the park common datastore for parkee if it could be cloned. This needs to be free'd with park_common_datastore free. |
| 464 | * \retval NULL if the park_common_datastore could not be copied off of the channel. |
| 465 | */ |
| 466 | struct park_common_datastore *get_park_common_datastore_copy(struct ast_channel *parkee); |
| 467 | |
| 468 | /*! |
| 469 | * \since 12.0.0 |
| 470 | * \brief Free a park common datastore struct |
| 471 | * |
| 472 | * \param datastore The park_common_datastore being free'd. (NULL tolerant) |
| 473 | */ |
| 474 | void park_common_datastore_free(struct park_common_datastore *datastore); |
| 475 | |
| 476 | /*! |
| 477 | * \since 12.0.0 |
| 478 | * \brief Notify metermaids that we've changed an extension |
| 479 | * |
| 480 | * \param exten Extension of the call parked/unparked |
| 481 | * \param context Context of the call parked/unparked |
| 482 | * \param state new device state |
| 483 | */ |
| 484 | void parking_notify_metermaids(int exten, const char *context, enum ast_device_state state); |
| 485 | |
| 486 | /*! |
| 487 | * \since 12.0.0 |
| 488 | * \brief Check global configuration to see if dynamic parking is enabled |
| 489 | * |
| 490 | * \retval 1 if dynamic parking is enabled |
| 491 | * \retval 0 if dynamic parking is disabled |
| 492 | */ |
| 493 | int parking_dynamic_lots_enabled(void); |
| 494 | |
| 495 | /*! |
| 496 | * \since 12.0.0 |
| 497 | * \brief Register parking applications |
| 498 | * |
| 499 | * \retval 0 if successful |
| 500 | * \retval -1 on failure |
| 501 | */ |
| 502 | int load_parking_applications(void); |
| 503 | |
| 504 | /*! |
| 505 | * \since 12.0.0 |
| 506 | * \brief Unregister parking applications |
| 507 | */ |
| 508 | void unload_parking_applications(void); |
| 509 | |
| 510 | /*! |
| 511 | * \since 12.0.0 |
| 512 | * \brief Register CLI commands |
| 513 | * |
| 514 | * \retval 0 if successful |
| 515 | * \retval -1 on failure |
| 516 | */ |
| 517 | int load_parking_ui(void); |
| 518 | |
| 519 | /*! |
| 520 | * \since 12.0.0 |
| 521 | * \brief Unregister CLI commands |
| 522 | */ |
| 523 | void unload_parking_ui(void); |
| 524 | |
| 525 | /*! |
| 526 | * \since 12.0.0 |
| 527 | * \brief Register manager actions and setup subscriptions for stasis events |
| 528 | */ |
| 529 | int load_parking_manager(void); |
| 530 | |
| 531 | /*! |
| 532 | * \since 12.0.0 |
| 533 | * \brief Unregister manager actions and remove subscriptions for stasis events |
| 534 | */ |
| 535 | void unload_parking_manager(void); |
| 536 | |
| 537 | /*! |
| 538 | * \since 12.0.0 |
| 539 | * \brief Register bridge features for parking |
| 540 | * |
| 541 | * \retval 0 on success |
| 542 | * \retval -1 on failure |
| 543 | */ |
| 544 | int load_parking_bridge_features(void); |
| 545 | |
| 546 | /*! |
| 547 | * \since 12.0.0 |
| 548 | * \brief Unregister features registered by load_parking_bridge_features |
| 549 | */ |
| 550 | void unload_parking_bridge_features(void); |
| 551 | |
| 552 | /*! |
| 553 | * \since 12.0.0 |
| 554 | * \brief Register Parking devstate handler |
| 555 | */ |
| 556 | int load_parking_devstate(void); |
| 557 | |
| 558 | /*! |
| 559 | * \since 12.0.0 |
| 560 | * \brief Unregister Parking devstate handler |
| 561 | */ |
| 562 | void unload_parking_devstate(void); |
| 563 | |
| 564 | /*! |
| 565 | * \since 12.0.0 |
| 566 | * \brief Register parking unit tests |
| 567 | * |
| 568 | * \retval 0 on success |
| 569 | * \retval nonzero on failure |
| 570 | */ |
| 571 | int load_parking_tests(void); |
| 572 | |
| 573 | /*! |
| 574 | * \since 12.0.0 |
| 575 | * \brief Unregister parking unit tests |
| 576 | */ |
| 577 | void unload_parking_tests(void); |
| 578 | |
| 579 | #endif /* ASTERISK_RES_PARKING_H */ |