diff -ruN a/include/asterisk/parking.h b/include/asterisk/parking.h
--- a/include/asterisk/parking.h 2018-07-12 12:19:01.000000000 -0400
+++ b/include/asterisk/parking.h 2018-08-14 13:22:06.000000000 -0400
@@ -36,6 +36,9 @@
*/
#define DEFAULT_PARKINGLOT "default"
+typedef long long ast_parkingspace_int;
+#define AST_PARKINGSPACE_FORMAT "%lli"
+
/*!
* \brief Defines the type of parked call message being published
* \since 12
@@ -57,9 +60,9 @@
struct ast_channel_snapshot *parkee; /*!< Snapshot of the channel that is parked */
struct ast_channel_snapshot *retriever; /*!< Snapshot of the channel that retrieved the call (may be NULL) */
enum ast_parked_call_event_type event_type; /*!< Reason for issuing the parked call message */
- long unsigned int timeout; /*!< Time remaining before the call times out (seconds ) */
- long unsigned int duration; /*!< How long the parkee has been parked (seconds) */
- unsigned int parkingspace; /*!< Which Parking Space the parkee occupies */
+ long unsigned int timeout; /*!< Time remaining before the call times out (seconds) */
+ long unsigned int duration; /*!< Duration (in seconds) that the parkee has been parked */
+ ast_parkingspace_int parkingspace; /*!< Parking space of the parkee */
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(parkinglot); /*!< Name of the parking lot used to park the parkee */
AST_STRING_FIELD(parker_dial_string); /*!< The device string used for call control on parking timeout */
@@ -87,7 +90,7 @@
struct ast_parked_call_payload *ast_parked_call_payload_create(enum ast_parked_call_event_type event_type,
struct ast_channel_snapshot *parkee_snapshot, const char *parker_dial_string,
struct ast_channel_snapshot *retriever_snapshot, const char *parkinglot,
- unsigned int parkingspace, unsigned long int timeout, unsigned long int duration);
+ ast_parkingspace_int parkingspace, unsigned long int timeout, unsigned long int duration);
/*! \addtogroup StasisTopicsAndMessages
* @{
diff -ruN a/main/cdr.c b/main/cdr.c
--- a/main/cdr.c 2018-07-12 12:19:01.000000000 -0400
+++ b/main/cdr.c 2018-08-14 13:22:06.000000000 -0400
@@ -1612,7 +1612,7 @@
static int base_process_parked_channel(struct cdr_object *cdr, struct ast_parked_call_payload *parking_info)
{
- char park_info[128];
+ char park_info[AST_MAX_EXTENSION]; /* ideally: max. parking lot strlen + max. digits of ast_parkingspace_int */
ast_assert(!strcasecmp(parking_info->parkee->name, cdr->party_a.snapshot->name));
@@ -1621,7 +1621,7 @@
/* Fake out where we're parked */
ast_string_field_set(cdr, appl, "Park");
- snprintf(park_info, sizeof(park_info), "%s:%u", parking_info->parkinglot, parking_info->parkingspace);
+ snprintf(park_info, sizeof(park_info), "%s:"AST_PARKINGSPACE_FORMAT, parking_info->parkinglot, parking_info->parkingspace);
ast_string_field_set(cdr, data, park_info);
/* Prevent any further changes to the App/Data fields for this record */
diff -ruN a/main/parking.c b/main/parking.c
--- a/main/parking.c 2018-07-12 12:19:01.000000000 -0400
+++ b/main/parking.c 2018-08-14 13:22:06.000000000 -0400
@@ -84,7 +84,7 @@
struct ast_parked_call_payload *ast_parked_call_payload_create(enum ast_parked_call_event_type event_type,
struct ast_channel_snapshot *parkee_snapshot, const char *parker_dial_string,
struct ast_channel_snapshot *retriever_snapshot, const char *parkinglot,
- unsigned int parkingspace, unsigned long int timeout,
+ ast_parkingspace_int parkingspace, unsigned long int timeout,
unsigned long int duration)
{
RAII_VAR(struct ast_parked_call_payload *, payload, NULL, ao2_cleanup);
diff -ruN a/res/parking/parking_applications.c b/res/parking/parking_applications.c
--- a/res/parking/parking_applications.c 2018-07-12 12:19:01.000000000 -0400
+++ b/res/parking/parking_applications.c 2018-08-14 13:23:10.000000000 -0400
@@ -47,7 +47,7 @@
Specify in which parking lot to park a call.
- The parking lot used is selected in the following order:
+ The parking lot is selected in the following order:1) parking_lot_name option to this application2) PARKINGLOT variable3) CHANNEL(parkinglot) function
@@ -70,8 +70,8 @@
- If the parking times out, go to this place in the dialplan
- instead of where the parking lot defines the call should go.
+ If parking times out, continue at this dialplan extension,
+ instead of the destination defined for the parking lot.
- Park a call into the parkinglot and announce the call to another channel.
- The variable PARKEDAT will contain the parking extension
- into which the call was placed. Use with the Local channel to allow the dialplan to make
+ Park a call into the parking lot and announce the call to another channel.
+ The variable PARKEDAT is set to the parking extension
+ into which the call is placed. Use with channel 'Local' to allow the dialplan to make
use of this information.
@@ -608,7 +608,7 @@
RAII_VAR(struct parked_user *, pu, NULL, ao2_cleanup); /* Parked user being retrieved */
struct ast_bridge *retrieval_bridge;
int res;
- int target_space = -1;
+ ast_parkingspace_int target_space = -1;
struct ast_bridge_features chan_features;
char *parse;
const char *lot_name;
@@ -644,7 +644,7 @@
}
if (!ast_strlen_zero(args.parking_space)) {
- if (sscanf(args.parking_space, "%d", &target_space) != 1 || target_space < 0) {
+ if (sscanf(args.parking_space, AST_PARKINGSPACE_FORMAT, &target_space) != 1 || target_space < 0) {
ast_stream_and_wait(chan, "pbx-invalidpark", "");
ast_log(LOG_ERROR, "value '%s' for parking_space argument is invalid. Must be an integer greater than 0.\n", args.parking_space);
return -1;
@@ -799,15 +799,15 @@
ast_channel_cleanup(chan);
}
-static void announce_to_dial(char *dial_string, char *announce_string, int parkingspace, struct ast_channel_snapshot *parkee_snapshot)
+static void announce_to_dial(char *dial_string, char *announce_string, ast_parkingspace_int parkingspace, struct ast_channel_snapshot *parkee_snapshot)
{
struct ast_channel *dchan;
struct outgoing_helper oh = { 0, };
int outstate;
struct ast_format_cap *cap_slin = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
- char buf[13];
char *dial_tech;
char *cur_announce;
+ char buf[24]; /* A long long int has 20 characters with sign */
dial_tech = strsep(&dial_string, "/");
ast_verb(3, "Dial Tech,String: (%s,%s)\n", dial_tech, dial_string);
@@ -818,7 +818,7 @@
}
ast_format_cap_append(cap_slin, ast_format_slin, 0);
- snprintf(buf, sizeof(buf), "%d", parkingspace);
+ sprintf(buf, AST_PARKINGSPACE_FORMAT, parkingspace);
oh.vars = ast_variable_new("_PARKEDAT", buf, "");
inherit_channel_vars_from_id(&oh, parkee_snapshot->uniqueid);
@@ -840,7 +840,7 @@
for (cur_announce = strsep(&announce_string, ":"); cur_announce; cur_announce = strsep(&announce_string, ":")) {
ast_verb(4, "Announce:%s\n", cur_announce);
if (!strcmp(cur_announce, "PARKED")) {
- ast_say_digits(dchan, parkingspace, "", ast_channel_language(dchan));
+ parking_space_announce(dchan, parkingspace);
} else {
int dres = ast_streamfile(dchan, cur_announce, ast_channel_language(dchan));
if (!dres) {
diff -ruN a/res/parking/parking_bridge.c b/res/parking/parking_bridge.c
--- a/res/parking/parking_bridge.c 2018-07-12 12:19:01.000000000 -0400
+++ b/res/parking/parking_bridge.c 2018-08-14 13:22:06.000000000 -0400
@@ -109,8 +109,8 @@
static struct parked_user *generate_parked_user(struct parking_lot *lot, struct ast_channel *chan, struct ast_channel *parker, const char *parker_dial_string, int use_random_space, int time_limit)
{
struct parked_user *new_parked_user;
- int preferred_space = -1; /* Initialize to use parking lot defaults */
- int parking_space;
+ ast_parkingspace_int preferred_space = -1; /* Initialize to use parking lot defaults */
+ ast_parkingspace_int parking_space;
const char *parkingexten;
if (lot->mode == PARKINGLOT_DISABLED) {
@@ -124,7 +124,7 @@
}
if (use_random_space) {
- preferred_space = ast_random() % (lot->cfg->parking_stop - lot->cfg->parking_start + 1);
+ preferred_space = ((ast_parkingspace_int) ast_random() * (ast_parkingspace_int) ast_random()) % (lot->cfg->parking_stop - lot->cfg->parking_start + 1);
preferred_space += lot->cfg->parking_start;
} else {
ast_channel_lock(chan);
@@ -134,7 +134,7 @@
ast_channel_unlock(chan);
if (!ast_strlen_zero(parkingexten)) {
- if (sscanf(parkingexten, "%30d", &preferred_space) != 1 || preferred_space <= 0) {
+ if (sscanf(parkingexten, AST_PARKINGSPACE_FORMAT, &preferred_space) != 1 || preferred_space <= 0) {
ast_log(LOG_WARNING, "PARKINGEXTEN='%s' is not a valid parking space.\n", parkingexten);
ao2_ref(new_parked_user, -1);
return NULL;
@@ -301,7 +301,7 @@
if (ast_strlen_zero(blind_transfer) && !park_datastore->silence_announce) {
char saynum_buf[16];
- snprintf(saynum_buf, sizeof(saynum_buf), "%d %d", 0, pu->parking_space);
+ snprintf(saynum_buf, sizeof(saynum_buf), "%d "AST_PARKINGSPACE_FORMAT, 0, pu->parking_space);
ast_bridge_channel_queue_playfile(bridge_channel, say_parking_space, saynum_buf, NULL);
}
@@ -311,7 +311,7 @@
/* Set this to the bridge pvt so that we don't have to refind the parked user associated with this bridge channel again. */
bridge_channel->bridge_pvt = pu;
- ast_verb(3, "Parking '" COLORIZE_FMT "' in '" COLORIZE_FMT "' at space %d\n",
+ ast_verb(3, "Parking '" COLORIZE_FMT "' in '" COLORIZE_FMT "' at space "AST_PARKINGSPACE_FORMAT"\n",
COLORIZE(COLOR_BRMAGENTA, 0, ast_channel_name(bridge_channel->chan)),
COLORIZE(COLOR_BRMAGENTA, 0, self->lot->name),
pu->parking_space);
diff -ruN a/res/parking/parking_bridge_features.c b/res/parking/parking_bridge_features.c
--- a/res/parking/parking_bridge_features.c 2018-07-12 12:19:01.000000000 -0400
+++ b/res/parking/parking_bridge_features.c 2018-08-14 13:22:06.000000000 -0400
@@ -118,7 +118,7 @@
* parked_subscription_data is tracking a transfer_channel_data struct. */
if (message->event_type == PARKED_CALL) {
/* queue the saynum on the bridge channel and hangup */
- snprintf(saynum_buf, sizeof(saynum_buf), "%d %u", data->hangup_after, message->parkingspace);
+ snprintf(saynum_buf, sizeof(saynum_buf), "%d "AST_PARKINGSPACE_FORMAT, data->hangup_after, message->parkingspace);
if (!data->transfer_data) {
ast_bridge_channel_queue_playfile(bridge_channel, say_parking_space, saynum_buf, NULL);
} else {
@@ -275,7 +275,7 @@
struct pbx_find_info info = { .stacklen = 0 }; /* the rest is reset in pbx_find_extension */
const char *app_at_exten;
- ast_debug(4, "Checking if %s@%s is a parking exten\n", exten, context);
+ ast_debug(4, "Checking whether %s@%s is a parking extension.\n", exten, context);
exten_obj = pbx_find_extension(NULL, NULL, &info, context, exten, 1, NULL, NULL, E_MATCH);
if (!exten_obj) {
return 0;
@@ -581,7 +581,7 @@
flatten_dial_string(dial_string_flat);
/* Set parking timeout channel variables */
- snprintf(parking_space, sizeof(parking_space), "%d", user->parking_space);
+ snprintf(parking_space, sizeof(parking_space), AST_PARKINGSPACE_FORMAT, user->parking_space);
ast_channel_lock(chan);
ast_channel_stage_snapshot(chan);
pbx_builtin_setvar_helper(chan, "PARKING_SPACE", parking_space);
@@ -659,10 +659,11 @@
void say_parking_space(struct ast_bridge_channel *bridge_channel, const char *payload)
{
- unsigned int numeric_value;
+ ast_parkingspace_int numeric_value;
unsigned int hangup_after;
+ char buf[40];
- if (sscanf(payload, "%u %u", &hangup_after, &numeric_value) != 2) {
+ if (sscanf(payload, "%u "AST_PARKINGSPACE_FORMAT, &hangup_after, &numeric_value) != 2) {
/* If say_parking_space is called with a non-numeric string, we have a problem. */
ast_assert(0);
ast_bridge_channel_leave_bridge(bridge_channel,
@@ -670,8 +671,8 @@
return;
}
- ast_say_digits(bridge_channel->chan, numeric_value, "",
- ast_channel_language(bridge_channel->chan));
+ sprintf(buf, AST_PARKINGSPACE_FORMAT, numeric_value);
+ ast_say_digit_str(bridge_channel->chan, buf, "", ast_channel_language(bridge_channel->chan));
if (hangup_after) {
ast_bridge_channel_leave_bridge(bridge_channel,
diff -ruN a/res/parking/parking_controller.c b/res/parking/parking_controller.c
--- a/res/parking/parking_controller.c 2018-07-12 12:19:01.000000000 -0400
+++ b/res/parking/parking_controller.c 2018-08-14 13:22:06.000000000 -0400
@@ -93,13 +93,13 @@
return -1;
}
-int parking_lot_get_space(struct parking_lot *lot, int target_override)
+ast_parkingspace_int parking_lot_get_space(struct parking_lot *lot, ast_parkingspace_int target_override)
{
- int original_target;
- int current_target;
+ ast_parkingspace_int original_target;
+ ast_parkingspace_int current_target;
struct ao2_iterator i;
struct parked_user *user;
- int wrap;
+ ast_parkingspace_int wrap;
if (lot->cfg->parkfindnext) {
/* Use next_space if the lot already has next_space set; otherwise use lot start. */
@@ -154,7 +154,7 @@
static int retrieve_parked_user_targeted(void *obj, void *arg, int flags)
{
- int *target = arg;
+ ast_parkingspace_int *target = arg;
struct parked_user *user = obj;
if (user->parking_space == *target) {
return CMP_MATCH;
@@ -163,7 +163,7 @@
return 0;
}
-struct parked_user *parking_lot_retrieve_parked_user(struct parking_lot *lot, int target)
+struct parked_user *parking_lot_retrieve_parked_user(struct parking_lot *lot, ast_parkingspace_int target)
{
RAII_VAR(struct parked_user *, user, NULL, ao2_cleanup);
diff -ruN a/res/parking/parking_devicestate.c b/res/parking/parking_devicestate.c
--- a/res/parking/parking_devicestate.c 2018-07-12 12:19:01.000000000 -0400
+++ b/res/parking/parking_devicestate.c 2018-08-14 13:22:06.000000000 -0400
@@ -30,7 +30,7 @@
struct parking_lot_extension_inuse_search {
char *context;
- int exten;
+ ast_parkingspace_int exten;
};
static int retrieve_parked_user_targeted(void *obj, void *arg, int flags)
@@ -91,11 +91,11 @@
}
search.context = context;
- if (sscanf(exten, "%d", &search.exten) != 1) {
+ if (sscanf(exten, AST_PARKINGSPACE_FORMAT, &search.exten) != 1) {
return AST_DEVICE_INVALID;
}
- ast_debug(4, "Checking state of exten %d in context %s\n", search.exten, context);
+ ast_debug(4, "Checking state of extension "AST_PARKINGSPACE_FORMAT" in context %s\n", search.exten, context);
lot = ao2_callback(global_lots, 0, parking_lot_search_context_extension_inuse, &data);
if (!lot) {
@@ -105,12 +105,12 @@
return AST_DEVICE_INUSE;
}
-void parking_notify_metermaids(int exten, const char *context, enum ast_device_state state)
+void parking_notify_metermaids(ast_parkingspace_int exten, const char *context, enum ast_device_state state)
{
- ast_debug(4, "Notification of state change to metermaids %d@%s\n to state '%s'\n",
+ ast_debug(4, "Notification of state change to metermaids "AST_PARKINGSPACE_FORMAT"@%s\n to state '%s'\n",
exten, context, ast_devstate2str(state));
- ast_devstate_changed(state, AST_DEVSTATE_CACHABLE, "park:%d@%s", exten, context);
+ ast_devstate_changed(state, AST_DEVSTATE_CACHABLE, "park:"AST_PARKINGSPACE_FORMAT"@%s", exten, context);
}
void unload_parking_devstate(void)
diff -ruN a/res/parking/parking_manager.c b/res/parking/parking_manager.c
--- a/res/parking/parking_manager.c 2018-07-12 12:19:01.000000000 -0400
+++ b/res/parking/parking_manager.c 2018-08-14 13:22:06.000000000 -0400
@@ -243,7 +243,7 @@
"%s" /* retriever channel state (when available) */
"ParkerDialString: %s\r\n"
"Parkinglot: %s\r\n"
- "ParkingSpace: %u\r\n"
+ "ParkingSpace: "AST_PARKINGSPACE_FORMAT"\r\n"
"ParkingTimeout: %lu\r\n"
"ParkingDuration: %lu\r\n",
@@ -405,8 +405,8 @@
astman_append(s, "Event: Parkinglot\r\n"
"%s" /* The Action ID */
"Name: %s\r\n"
- "StartSpace: %d\r\n"
- "StopSpace: %d\r\n"
+ "StartSpace: "AST_PARKINGSPACE_FORMAT"\r\n"
+ "StopSpace: "AST_PARKINGSPACE_FORMAT"\r\n"
"Timeout: %u\r\n"
"\r\n",
list_data->id_text,
diff -ruN a/res/parking/parking_tests.c b/res/parking/parking_tests.c
--- a/res/parking/parking_tests.c 2018-07-12 12:19:01.000000000 -0400
+++ b/res/parking/parking_tests.c 2018-08-14 13:22:06.000000000 -0400
@@ -139,7 +139,7 @@
#define TEST_LOT_NAME "unit_tests_res_parking_test_lot"
-static struct parking_lot *generate_test_parking_lot(const char *name, int low_space, int high_space, const char *park_exten, const char *park_context, struct ast_test *test)
+static struct parking_lot *generate_test_parking_lot(const char *name, ast_parkingspace_int low_space, ast_parkingspace_int high_space, const char *park_exten, const char *park_context, struct ast_test *test)
{
RAII_VAR(struct parking_lot_cfg *, test_cfg, NULL, ao2_cleanup);
struct parking_lot *test_lot;
diff -ruN a/res/parking/parking_ui.c b/res/parking/parking_ui.c
--- a/res/parking/parking_ui.c 2018-07-12 12:19:01.000000000 -0400
+++ b/res/parking/parking_ui.c 2018-08-14 13:22:06.000000000 -0400
@@ -39,7 +39,7 @@
static void display_parked_call(struct parked_user *user, int fd)
{
- ast_cli(fd, " Space : %d\n", user->parking_space);
+ ast_cli(fd, " Space : "AST_PARKINGSPACE_FORMAT"\n", user->parking_space);
ast_cli(fd, " Channel : %s\n", ast_channel_name(user->chan));
ast_cli(fd, " Parker Dial String : %s\n", user->parker_dial_string);
ast_cli(fd, "\n");
@@ -58,7 +58,7 @@
ast_cli(fd, "Parking Lot: %s\n--------------------------------------------------------------------------\n", lot->name);
ast_cli(fd, "Parking Extension : %s\n", lot->cfg->parkext);
ast_cli(fd, "Parking Context : %s\n", lot->cfg->parking_con);
- ast_cli(fd, "Parking Spaces : %d-%d\n", lot->cfg->parking_start, lot->cfg->parking_stop);
+ ast_cli(fd, "Parking Spaces : "AST_PARKINGSPACE_FORMAT"-"AST_PARKINGSPACE_FORMAT"\n", lot->cfg->parking_start, lot->cfg->parking_stop);
ast_cli(fd, "Parking Time : %u sec\n", lot->cfg->parkingtime);
ast_cli(fd, "Comeback to Origin : %s\n", lot->cfg->comebacktoorigin ? "yes" : "no");
ast_cli(fd, "Comeback Context : %s%s\n", lot->cfg->comebackcontext, lot->cfg->comebacktoorigin ? " (comebacktoorigin=yes, not used)" : "");
@@ -126,8 +126,8 @@
}
struct parking_lot_complete {
- int seeking; /*! Nth match to return. */
- int which; /*! Which match currently on. */
+ ast_parkingspace_int seeking; /*! Nth match to return. */
+ ast_parkingspace_int which; /*! Which match currently on. */
};
static int complete_parking_lot_search(void *obj, void *arg, void *data, int flags)
@@ -139,7 +139,7 @@
return 0;
}
-static char *complete_parking_lot(const char *word, int seeking)
+static char *complete_parking_lot(const char *word, ast_parkingspace_int seeking)
{
char *ret = NULL;
struct parking_lot *lot;
diff -ruN a/res/parking/res_parking.h b/res/parking/res_parking.h
--- a/res/parking/res_parking.h 2018-07-12 12:19:01.000000000 -0400
+++ b/res/parking/res_parking.h 2018-08-14 13:22:06.000000000 -0400
@@ -60,8 +60,8 @@
};
struct parking_lot_cfg {
- int parking_start; /*!< First space in the parking lot */
- int parking_stop; /*!< Last space in the parking lot */
+ ast_parkingspace_int parking_start; /*!< First space in the parking lot */
+ ast_parkingspace_int parking_stop; /*!< Last space in the parking lot */
unsigned int parkingtime; /*!< Analogous to parkingtime config option */
unsigned int comebackdialtime; /*!< Analogous to comebackdialtime config option */
@@ -87,7 +87,7 @@
};
struct parking_lot {
- int next_space; /*!< When using parkfindnext, which space we should start searching from next time we park */
+ ast_parkingspace_int next_space; /*!< When using parkfindnext, which space we should start searching from next time we park */
struct ast_bridge *parking_bridge; /*!< Bridged where parked calls will rest until they are answered or otherwise leave */
struct ao2_container *parked_users; /*!< List of parked users rigidly ordered by their parking space */
struct parking_lot_cfg *cfg; /*!< Reference to configuration object for the parking lot */
@@ -103,7 +103,7 @@
struct ast_channel *chan; /*!< Parked channel */
struct ast_channel_snapshot *retriever; /*!< Snapshot of the channel that retrieves a parked call */
struct timeval start; /*!< When the call was parked */
- int parking_space; /*!< Which parking space is used */
+ ast_parkingspace_int parking_space; /*!< Which parking space is used */
char comeback[AST_MAX_CONTEXT]; /*!< Where to go on parking timeout */
char *parker_dial_string; /*!< dialstring to call back with comebacktoorigin. Used timeout extension generation and call control */
unsigned int time_limit; /*!< How long this specific channel may remain in the parking lot before timing out */
@@ -111,6 +111,14 @@
enum park_call_resolution resolution; /*!< How did the parking session end? If the call is in a bridge, lock parked_user before checking/setting */
};
+
+#define parking_space_announce(channel_, space_) do { \
+ char buf[24]; /* even a long long int has never more that 20 characters. */ \
+ sprintf(buf, AST_PARKINGSPACE_FORMAT, space_); \
+ ast_say_digit_str(channel_, buf, "", ast_channel_language(channel_)); \
+ } while (0)
+
+
#if defined(TEST_FRAMEWORK)
/*!
* \since 12.0.0
@@ -193,7 +201,7 @@
* \note lot should be locked before this is called and unlocked only after a parked_user with the space
* returned has been added to the parking lot.
*/
-int parking_lot_get_space(struct parking_lot *lot, int target_override);
+ast_parkingspace_int parking_lot_get_space(struct parking_lot *lot, ast_parkingspace_int target_override);
/*!
* \since 12.0.0
@@ -209,7 +217,7 @@
* \note The parked user will be removed from parking lot as part of this process
* \note Remove this reference with ao2_cleanup once it falls out of scope.
*/
-struct parked_user *parking_lot_retrieve_parked_user(struct parking_lot *lot, int target);
+struct parked_user *parking_lot_retrieve_parked_user(struct parking_lot *lot, ast_parkingspace_int target);
/*!
* \since 12.0.0
@@ -465,7 +473,7 @@
* \param context Context of the call parked/unparked
* \param state new device state
*/
-void parking_notify_metermaids(int exten, const char *context, enum ast_device_state state);
+void parking_notify_metermaids(ast_parkingspace_int exten, const char *context, enum ast_device_state state);
/*!
* \since 12.0.0
diff -ruN a/res/res_parking.c b/res/res_parking.c
--- a/res/res_parking.c 2018-07-12 12:19:01.000000000 -0400
+++ b/res/res_parking.c 2018-08-14 13:22:06.000000000 -0400
@@ -437,9 +437,9 @@
/* The arg just needs to have the parking space with it */
static int parked_user_cmp_fn(void *obj, void *arg, int flags)
{
- int *search_space = arg;
struct parked_user *user = obj;
- int object_space = user->parking_space;
+ ast_parkingspace_int *search_space = arg;
+ ast_parkingspace_int object_space = user->parking_space;
if (*search_space == object_space) {
return CMP_MATCH;
@@ -507,10 +507,10 @@
static int option_handler_parkpos(const struct aco_option *opt, struct ast_variable *var, void *obj)
{
struct parking_lot_cfg *lot_cfg = obj;
- int low;
- int high;
+ ast_parkingspace_int low;
+ ast_parkingspace_int high;
- if (sscanf(var->value, "%30d-%30d", &low, &high) != 2) {
+ if (sscanf(var->value, AST_PARKINGSPACE_FORMAT"-"AST_PARKINGSPACE_FORMAT, &low, &high) != 2) {
ast_log(LOG_WARNING, "Format for parking positions is a-b, where a and b are numbers\n");
} else if (high < low || low <= 0 || high <= 0) {
ast_log(LOG_WARNING, "Format for parking positions is a-b, where a <= b\n");
@@ -761,7 +761,7 @@
int parking_lot_cfg_create_extensions(struct parking_lot_cfg *lot_cfg)
{
- int parkingspace;
+ ast_parkingspace_int parkingspace;
struct ast_exten *existing_exten;
struct ast_context *lot_context;
struct pbx_find_info find_info = { .stacklen = 0 }; /* the rest is reset in pbx_find_extension */
@@ -814,11 +814,11 @@
/* Handle generation/confirmation for the ParkedCall extensions and hints */
for (parkingspace = lot_cfg->parking_start; parkingspace <= lot_cfg->parking_stop; parkingspace++) {
- char space[AST_MAX_EXTENSION];
+ char space[24]; /* even a long long int is only 20 characters long */
RAII_VAR(struct ast_str *, arguments_string, NULL, ast_free);
find_info.stacklen = 0; /* reset for pbx_find_exten */
- snprintf(space, sizeof(space), "%d", parkingspace);
+ snprintf(space, sizeof space, AST_PARKINGSPACE_FORMAT, parkingspace);
/* Unlike the Park extensions, ParkedCall extensions and their hints may never be shared for any reason. */
if ((existing_exten = pbx_find_extension(NULL, NULL, &find_info, lot_cfg->parking_con, space, 1, NULL, NULL, E_MATCH))) {
@@ -826,15 +826,15 @@
return -1;
}
- arguments_string = ast_str_create(32);
+ arguments_string = ast_str_create(strlen(lot_cfg->name) + 1 + sizeof space);
if (!arguments_string) {
ast_unlock_context(lot_context);
return -1;
}
ast_str_set(&arguments_string, 0, "%s,%s", lot_cfg->name, space);
- if (parking_add_extension(lot_context, 0, space, 1, PARKED_CALL_APPLICATION,
- ast_str_buffer(arguments_string), parkedcall_registrar_pointer)) {
+ if (parking_add_extension(lot_context, 0, space, 1, PARKED_CALL_APPLICATION, ast_str_buffer(arguments_string), parkedcall_registrar_pointer)
+ ) {
ast_log(LOG_ERROR, "Parking lot '%s' -- Failed to add %s extension '%s@%s' to the PBX.\n",
lot_cfg->name, PARKED_CALL_APPLICATION, space, lot_cfg->parking_con);
ast_unlock_context(lot_context);
@@ -849,7 +849,7 @@
snprintf(hint_device, sizeof(hint_device), "park:%s@%s", space, lot_cfg->parking_con);
if ((existing_exten = pbx_find_extension(NULL, NULL, &find_info, lot_cfg->parking_con, space, PRIORITY_HINT, NULL, NULL, E_MATCH))) {
- ast_log(LOG_ERROR, "Parking lot '%s' -- Needs to add a hint '%s' at '%s@%s' but one already exists owned by %s\n",
+ ast_log(LOG_ERROR, "Parking lot '%s' -- Failed to add hint '%s' at '%s@%s' because it already exists, owned by %s.\n",
lot_cfg->name, hint_device, space, lot_cfg->parking_con, ast_get_extension_registrar(existing_exten));
ast_unlock_context(lot_context);
return -1;
@@ -1301,4 +1301,5 @@
.unload = unload_module,
.reload = reload_module,
.load_pri = 0,
+ .buildopt_sum = {0},
);