<p>Karl Brose has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9931">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_parking: Increase size of parking space numbers<br><br>The parking feature processes parking space extensions<br>as 32-bit integers. It uses some 'unsigned int' and some<br>'int' (signed) types. Negative values are used in some<br>code sections to indicate specific conditions.<br>This modification expands the possible range of parking<br>space extensions to ca. 20 digits by using 64-bit<br>(long long) signed integers consistently by defining<br>the typedef 'ast_parkingspace_int'.<br><br>Issue ID: ASTERISK-26108<br>Reporter: David Sovereen (2016)<br>Author: Karl Brose<br><br>Change-Id: I6059f5469d4eb039245e30f31bca95d069f30c2e<br>---<br>M include/asterisk/parking.h<br>M main/cdr.c<br>M main/parking.c<br>M res/parking/parking_applications.c<br>M res/parking/parking_bridge.c<br>M res/parking/parking_bridge_features.c<br>M res/parking/parking_controller.c<br>M res/parking/parking_devicestate.c<br>M res/parking/parking_manager.c<br>M res/parking/parking_tests.c<br>M res/parking/parking_ui.c<br>M res/parking/res_parking.h<br>M res/res_parking.c<br>13 files changed, 106 insertions(+), 94 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/31/9931/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/asterisk/parking.h b/include/asterisk/parking.h</span><br><span>index 554c8d5..2f617a6 100644</span><br><span>--- a/include/asterisk/parking.h</span><br><span>+++ b/include/asterisk/parking.h</span><br><span>@@ -36,6 +36,9 @@</span><br><span> */</span><br><span> #define DEFAULT_PARKINGLOT "default"</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+typedef long long ast_parkingspace_int;</span><br><span style="color: hsl(120, 100%, 40%);">+#define AST_PARKINGSPACE_FORMAT "%lli"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*!</span><br><span> * \brief Defines the type of parked call message being published</span><br><span> * \since 12</span><br><span>@@ -57,9 +60,9 @@</span><br><span> struct ast_channel_snapshot *parkee; /*!< Snapshot of the channel that is parked */</span><br><span> struct ast_channel_snapshot *retriever; /*!< Snapshot of the channel that retrieved the call (may be NULL) */</span><br><span> enum ast_parked_call_event_type event_type; /*!< Reason for issuing the parked call message */</span><br><span style="color: hsl(0, 100%, 40%);">- long unsigned int timeout; /*!< Time remaining before the call times out (seconds ) */</span><br><span style="color: hsl(0, 100%, 40%);">- long unsigned int duration; /*!< How long the parkee has been parked (seconds) */</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int parkingspace; /*!< Which Parking Space the parkee occupies */</span><br><span style="color: hsl(120, 100%, 40%);">+ long unsigned int timeout; /*!< Time remaining before the call times out (seconds) */</span><br><span style="color: hsl(120, 100%, 40%);">+ long unsigned int duration; /*!< Duration (in seconds) that the parkee has been parked */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int parkingspace; /*!< Parking space of the parkee */</span><br><span> AST_DECLARE_STRING_FIELDS(</span><br><span> AST_STRING_FIELD(parkinglot); /*!< Name of the parking lot used to park the parkee */</span><br><span> AST_STRING_FIELD(parker_dial_string); /*!< The device string used for call control on parking timeout */</span><br><span>@@ -87,7 +90,7 @@</span><br><span> struct ast_parked_call_payload *ast_parked_call_payload_create(enum ast_parked_call_event_type event_type,</span><br><span> struct ast_channel_snapshot *parkee_snapshot, const char *parker_dial_string,</span><br><span> struct ast_channel_snapshot *retriever_snapshot, const char *parkinglot,</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int parkingspace, unsigned long int timeout, unsigned long int duration);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int parkingspace, unsigned long int timeout, unsigned long int duration);</span><br><span> </span><br><span> /*! \addtogroup StasisTopicsAndMessages</span><br><span> * @{</span><br><span>diff --git a/main/cdr.c b/main/cdr.c</span><br><span>index 1b54604..7cf93ea 100644</span><br><span>--- a/main/cdr.c</span><br><span>+++ b/main/cdr.c</span><br><span>@@ -1608,7 +1608,7 @@</span><br><span> </span><br><span> static int base_process_parked_channel(struct cdr_object *cdr, struct ast_parked_call_payload *parking_info)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- char park_info[128];</span><br><span style="color: hsl(120, 100%, 40%);">+ char park_info[AST_MAX_EXTENSION]; /* ideally: max. parking lot strlen + max. digits of ast_parkingspace_int */</span><br><span> </span><br><span> ast_assert(!strcasecmp(parking_info->parkee->name, cdr->party_a.snapshot->name));</span><br><span> </span><br><span>@@ -1617,7 +1617,7 @@</span><br><span> </span><br><span> /* Fake out where we're parked */</span><br><span> ast_string_field_set(cdr, appl, "Park");</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(park_info, sizeof(park_info), "%s:%u", parking_info->parkinglot, parking_info->parkingspace);</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(park_info, sizeof(park_info), "%s:"AST_PARKINGSPACE_FORMAT, parking_info->parkinglot, parking_info->parkingspace);</span><br><span> ast_string_field_set(cdr, data, park_info);</span><br><span> </span><br><span> /* Prevent any further changes to the App/Data fields for this record */</span><br><span>diff --git a/main/parking.c b/main/parking.c</span><br><span>index bf0d0b6..31fce92 100644</span><br><span>--- a/main/parking.c</span><br><span>+++ b/main/parking.c</span><br><span>@@ -82,7 +82,7 @@</span><br><span> struct ast_parked_call_payload *ast_parked_call_payload_create(enum ast_parked_call_event_type event_type,</span><br><span> struct ast_channel_snapshot *parkee_snapshot, const char *parker_dial_string,</span><br><span> struct ast_channel_snapshot *retriever_snapshot, const char *parkinglot,</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int parkingspace, unsigned long int timeout,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int parkingspace, unsigned long int timeout,</span><br><span> unsigned long int duration)</span><br><span> {</span><br><span> RAII_VAR(struct ast_parked_call_payload *, payload, NULL, ao2_cleanup);</span><br><span>diff --git a/res/parking/parking_applications.c b/res/parking/parking_applications.c</span><br><span>index dd2fb75..be4f054 100644</span><br><span>--- a/res/parking/parking_applications.c</span><br><span>+++ b/res/parking/parking_applications.c</span><br><span>@@ -45,7 +45,7 @@</span><br><span> <syntax></span><br><span> <parameter name="parking_lot_name"></span><br><span> <para>Specify in which parking lot to park a call.</para></span><br><span style="color: hsl(0, 100%, 40%);">- <para>The parking lot used is selected in the following order:</para></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>The parking lot is selected in the following order:</para></span><br><span> <para>1) parking_lot_name option to this application</para></span><br><span> <para>2) <variable>PARKINGLOT</variable> variable</para></span><br><span> <para>3) <literal>CHANNEL(parkinglot)</literal> function</span><br><span>@@ -68,8 +68,8 @@</span><br><span> <argument name="context" required="false" /></span><br><span> <argument name="extension" required="false" /></span><br><span> <argument name="priority" required="true" /></span><br><span style="color: hsl(0, 100%, 40%);">- <para>If the parking times out, go to this place in the dialplan</span><br><span style="color: hsl(0, 100%, 40%);">- instead of where the parking lot defines the call should go.</span><br><span style="color: hsl(120, 100%, 40%);">+ <para>If parking times out, continue at this dialplan extension,</span><br><span style="color: hsl(120, 100%, 40%);">+ instead of the destination defined for the parking lot.</span><br><span> </para></span><br><span> </option></span><br><span> <option name="t"></span><br><span>@@ -84,9 +84,9 @@</span><br><span> <para>Used to park yourself (typically in combination with an attended</span><br><span> transfer to know the parking space).</para></span><br><span> <para>If you set the <variable>PARKINGEXTEN</variable> variable to a</span><br><span style="color: hsl(0, 100%, 40%);">- parking space extension in the parking lot, Park() will attempt to park the</span><br><span style="color: hsl(0, 100%, 40%);">- call on that extension. If the extension is already in use then execution</span><br><span style="color: hsl(0, 100%, 40%);">- will continue at the next priority.</span><br><span style="color: hsl(120, 100%, 40%);">+ parking space extension in the parking lot, Park() attempts to park the</span><br><span style="color: hsl(120, 100%, 40%);">+ call on that extension. If the extension is already in use, then execution</span><br><span style="color: hsl(120, 100%, 40%);">+ continues at the next priority.</span><br><span> </para></span><br><span> <para>If the <literal>parkeddynamic</literal> option is enabled in</span><br><span> <filename>res_parking.conf</filename> the following variables can be</span><br><span>@@ -97,28 +97,28 @@</span><br><span> <para>The <variable>PARKINGDYNAMIC</variable> variable specifies the</span><br><span> parking lot to use as a template to create a dynamic parking lot. It</span><br><span> is an error to specify a non-existent parking lot for the template.</span><br><span style="color: hsl(0, 100%, 40%);">- If not set then the default parking lot is used as the template.</span><br><span style="color: hsl(120, 100%, 40%);">+ If not set, then the default parking lot is used as the template.</span><br><span> </para></span><br><span> <para>The <variable>PARKINGDYNCONTEXT</variable> variable specifies the</span><br><span> dialplan context to use for the newly created dynamic parking lot. If</span><br><span style="color: hsl(0, 100%, 40%);">- not set then the context from the parking lot template is used. The</span><br><span style="color: hsl(120, 100%, 40%);">+ not set, then the context from the parking lot template is used. The</span><br><span> context is created if it does not already exist and the new parking lot</span><br><span> needs to create extensions.</span><br><span> </para></span><br><span> <para>The <variable>PARKINGDYNEXTEN</variable> variable specifies the</span><br><span> <literal>parkext</literal> to use for the newly created dynamic</span><br><span style="color: hsl(0, 100%, 40%);">- parking lot. If not set then the <literal>parkext</literal> is used from</span><br><span style="color: hsl(120, 100%, 40%);">+ parking lot. If not set, then the <literal>parkext</literal> is used from</span><br><span> the parking lot template. If the template does not specify a</span><br><span style="color: hsl(0, 100%, 40%);">- <literal>parkext</literal> then no extensions are created for the newly</span><br><span style="color: hsl(120, 100%, 40%);">+ <literal>parkext</literal>, then no extensions are created for the newly</span><br><span> created parking lot. The dynamic parking lot cannot be created if it</span><br><span> needs to create extensions that overlap existing parking lot extensions.</span><br><span> The only exception to this is for the <literal>parkext</literal></span><br><span style="color: hsl(0, 100%, 40%);">- extension and only if neither of the overlaping parking lot's</span><br><span style="color: hsl(120, 100%, 40%);">+ extension, and only if neither of the overlaping parking lot's</span><br><span> <literal>parkext</literal> is exclusive.</span><br><span> </para></span><br><span> <para>The <variable>PARKINGDYNPOS</variable> variable specifies the</span><br><span> parking positions to use for the newly created dynamic parking lot. If</span><br><span style="color: hsl(0, 100%, 40%);">- not set then the <literal>parkpos</literal> from the parking lot template</span><br><span style="color: hsl(120, 100%, 40%);">+ not set, then the <literal>parkpos</literal> from the parking lot template</span><br><span> is used.</span><br><span> </para></span><br><span> <note></span><br><span>@@ -142,7 +142,7 @@</span><br><span> <syntax></span><br><span> <parameter name="parking_lot_name"></span><br><span> <para>Specify from which parking lot to retrieve a parked call.</para></span><br><span style="color: hsl(0, 100%, 40%);">- <para>The parking lot used is selected in the following order:</para></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>The parking lot is selected in the following order:</para></span><br><span> <para>1) parking_lot_name option</para></span><br><span> <para>2) <variable>PARKINGLOT</variable> variable</para></span><br><span> <para>3) <literal>CHANNEL(parkinglot)</literal> function</span><br><span>@@ -150,18 +150,18 @@</span><br><span> <para>4) Default parking lot.</para></span><br><span> </parameter></span><br><span> <parameter name="parking_space"></span><br><span style="color: hsl(0, 100%, 40%);">- <para>Parking space to retrieve a parked call from.</span><br><span style="color: hsl(0, 100%, 40%);">- If not provided then the first available parked call in the</span><br><span style="color: hsl(0, 100%, 40%);">- parking lot will be retrieved.</para></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>Parking space from which to retrieve a parked call.</span><br><span style="color: hsl(120, 100%, 40%);">+ If not provided, then the first available parked call in the</span><br><span style="color: hsl(120, 100%, 40%);">+ parking lot is retrieved.</para></span><br><span> </parameter></span><br><span> </syntax></span><br><span> <description></span><br><span> <para>Used to retrieve a parked call from a parking lot.</para></span><br><span> <note></span><br><span style="color: hsl(0, 100%, 40%);">- <para>If a parking lot's parkext option is set, then Parking lots</span><br><span style="color: hsl(0, 100%, 40%);">- will automatically create and manage dialplan extensions in</span><br><span style="color: hsl(0, 100%, 40%);">- the parking lot context. If that is the case then you will not</span><br><span style="color: hsl(0, 100%, 40%);">- need to manage parking extensions yourself, just include the</span><br><span style="color: hsl(120, 100%, 40%);">+ <para>If a parking lot's parkext option is set, then parking lots</span><br><span style="color: hsl(120, 100%, 40%);">+ automatically create and manage dialplan extensions in</span><br><span style="color: hsl(120, 100%, 40%);">+ the parking lot context. If that is the case, then you do not</span><br><span style="color: hsl(120, 100%, 40%);">+ need to manage parking extensions yourself; just include the</span><br><span> parking context of the parking lot.</para></span><br><span> </note></span><br><span> </description></span><br><span>@@ -177,7 +177,7 @@</span><br><span> <syntax></span><br><span> <parameter name="parking_lot_name"></span><br><span> <para>Specify in which parking lot to park a call.</para></span><br><span style="color: hsl(0, 100%, 40%);">- <para>The parking lot used is selected in the following order:</para></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>The parking lot is selected in the following order:</para></span><br><span> <para>1) parking_lot_name option to this application</para></span><br><span> <para>2) <variable>PARKINGLOT</variable> variable</para></span><br><span> <para>3) <literal>CHANNEL(parkinglot)</literal> function</span><br><span>@@ -197,8 +197,8 @@</span><br><span> <argument name="context" required="false" /></span><br><span> <argument name="extension" required="false" /></span><br><span> <argument name="priority" required="true" /></span><br><span style="color: hsl(0, 100%, 40%);">- <para>If the parking times out, go to this place in the dialplan</span><br><span style="color: hsl(0, 100%, 40%);">- instead of where the parking lot defines the call should go.</span><br><span style="color: hsl(120, 100%, 40%);">+ <para>If parking times out, continue at this dialplan extension,</span><br><span style="color: hsl(120, 100%, 40%);">+ instead of the destination defined for the parking lot.</span><br><span> </para></span><br><span> </option></span><br><span> <option name="t"></span><br><span>@@ -211,20 +211,20 @@</span><br><span> <parameter name="announce_template" required="true" argsep=":"></span><br><span> <argument name="announce" required="true"></span><br><span> <para>Colon-separated list of files to announce. The word</span><br><span style="color: hsl(0, 100%, 40%);">- <literal>PARKED</literal> will be replaced by a say_digits of the extension in which</span><br><span style="color: hsl(120, 100%, 40%);">+ <literal>PARKED</literal> is replaced by an announcement of the extension in which</span><br><span> the call is parked.</para></span><br><span> </argument></span><br><span> <argument name="announce1" multiple="true" /></span><br><span> </parameter></span><br><span> <parameter name="dial" required="true"></span><br><span style="color: hsl(0, 100%, 40%);">- <para>The app_dial style resource to call to make the</span><br><span style="color: hsl(120, 100%, 40%);">+ <para>The app_dial-style resource to call to make the</span><br><span> announcement. Console/dsp calls the console.</para></span><br><span> </parameter></span><br><span> </syntax></span><br><span> <description></span><br><span style="color: hsl(0, 100%, 40%);">- <para>Park a call into the parkinglot and announce the call to another channel.</para></span><br><span style="color: hsl(0, 100%, 40%);">- <para>The variable <variable>PARKEDAT</variable> will contain the parking extension</span><br><span style="color: hsl(0, 100%, 40%);">- into which the call was placed. Use with the Local channel to allow the dialplan to make</span><br><span style="color: hsl(120, 100%, 40%);">+ <para>Park a call into the parking lot and announce the call to another channel.</para></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>The variable <variable>PARKEDAT</variable> is set to the parking extension</span><br><span style="color: hsl(120, 100%, 40%);">+ into which the call is placed. Use with channel 'Local' to allow the dialplan to make</span><br><span> use of this information.</para></span><br><span> </description></span><br><span> <see-also></span><br><span>@@ -606,7 +606,7 @@</span><br><span> RAII_VAR(struct parked_user *, pu, NULL, ao2_cleanup); /* Parked user being retrieved */</span><br><span> struct ast_bridge *retrieval_bridge;</span><br><span> int res;</span><br><span style="color: hsl(0, 100%, 40%);">- int target_space = -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int target_space = -1;</span><br><span> struct ast_bridge_features chan_features;</span><br><span> char *parse;</span><br><span> const char *lot_name;</span><br><span>@@ -642,7 +642,7 @@</span><br><span> }</span><br><span> </span><br><span> if (!ast_strlen_zero(args.parking_space)) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (sscanf(args.parking_space, "%d", &target_space) != 1 || target_space < 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (sscanf(args.parking_space, AST_PARKINGSPACE_FORMAT, &target_space) != 1 || target_space < 0) {</span><br><span> ast_stream_and_wait(chan, "pbx-invalidpark", "");</span><br><span> ast_log(LOG_ERROR, "value '%s' for parking_space argument is invalid. Must be an integer greater than 0.\n", args.parking_space);</span><br><span> return -1;</span><br><span>@@ -797,15 +797,15 @@</span><br><span> ast_channel_cleanup(chan);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static void announce_to_dial(char *dial_string, char *announce_string, int parkingspace, struct ast_channel_snapshot *parkee_snapshot)</span><br><span style="color: hsl(120, 100%, 40%);">+static void announce_to_dial(char *dial_string, char *announce_string, ast_parkingspace_int parkingspace, struct ast_channel_snapshot *parkee_snapshot)</span><br><span> {</span><br><span> struct ast_channel *dchan;</span><br><span> struct outgoing_helper oh = { 0, };</span><br><span> int outstate;</span><br><span> struct ast_format_cap *cap_slin = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);</span><br><span style="color: hsl(0, 100%, 40%);">- char buf[13];</span><br><span> char *dial_tech;</span><br><span> char *cur_announce;</span><br><span style="color: hsl(120, 100%, 40%);">+ char buf[24]; /* A long long int has 20 characters with sign */</span><br><span> </span><br><span> dial_tech = strsep(&dial_string, "/");</span><br><span> ast_verb(3, "Dial Tech,String: (%s,%s)\n", dial_tech, dial_string);</span><br><span>@@ -816,7 +816,7 @@</span><br><span> }</span><br><span> ast_format_cap_append(cap_slin, ast_format_slin, 0);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(buf, sizeof(buf), "%d", parkingspace);</span><br><span style="color: hsl(120, 100%, 40%);">+ sprintf(buf, AST_PARKINGSPACE_FORMAT, parkingspace);</span><br><span> oh.vars = ast_variable_new("_PARKEDAT", buf, "");</span><br><span> </span><br><span> inherit_channel_vars_from_id(&oh, parkee_snapshot->uniqueid);</span><br><span>@@ -838,7 +838,7 @@</span><br><span> for (cur_announce = strsep(&announce_string, ":"); cur_announce; cur_announce = strsep(&announce_string, ":")) {</span><br><span> ast_verb(4, "Announce:%s\n", cur_announce);</span><br><span> if (!strcmp(cur_announce, "PARKED")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_say_digits(dchan, parkingspace, "", ast_channel_language(dchan));</span><br><span style="color: hsl(120, 100%, 40%);">+ parking_space_announce(dchan, parkingspace);</span><br><span> } else {</span><br><span> int dres = ast_streamfile(dchan, cur_announce, ast_channel_language(dchan));</span><br><span> if (!dres) {</span><br><span>diff --git a/res/parking/parking_bridge.c b/res/parking/parking_bridge.c</span><br><span>index e61486e..1e318bb 100644</span><br><span>--- a/res/parking/parking_bridge.c</span><br><span>+++ b/res/parking/parking_bridge.c</span><br><span>@@ -109,8 +109,8 @@</span><br><span> 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)</span><br><span> {</span><br><span> struct parked_user *new_parked_user;</span><br><span style="color: hsl(0, 100%, 40%);">- int preferred_space = -1; /* Initialize to use parking lot defaults */</span><br><span style="color: hsl(0, 100%, 40%);">- int parking_space;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int preferred_space = -1; /* Initialize to use parking lot defaults */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int parking_space;</span><br><span> const char *parkingexten;</span><br><span> </span><br><span> if (lot->mode == PARKINGLOT_DISABLED) {</span><br><span>@@ -124,7 +124,7 @@</span><br><span> }</span><br><span> </span><br><span> if (use_random_space) {</span><br><span style="color: hsl(0, 100%, 40%);">- preferred_space = ast_random() % (lot->cfg->parking_stop - lot->cfg->parking_start + 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ preferred_space = ((ast_parkingspace_int) ast_random() * (ast_parkingspace_int) ast_random()) % (lot->cfg->parking_stop - lot->cfg->parking_start + 1);</span><br><span> preferred_space += lot->cfg->parking_start;</span><br><span> } else {</span><br><span> ast_channel_lock(chan);</span><br><span>@@ -134,7 +134,7 @@</span><br><span> ast_channel_unlock(chan);</span><br><span> </span><br><span> if (!ast_strlen_zero(parkingexten)) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (sscanf(parkingexten, "%30d", &preferred_space) != 1 || preferred_space <= 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (sscanf(parkingexten, AST_PARKINGSPACE_FORMAT, &preferred_space) != 1 || preferred_space <= 0) {</span><br><span> ast_log(LOG_WARNING, "PARKINGEXTEN='%s' is not a valid parking space.\n", parkingexten);</span><br><span> ao2_ref(new_parked_user, -1);</span><br><span> return NULL;</span><br><span>@@ -301,7 +301,7 @@</span><br><span> if (ast_strlen_zero(blind_transfer) && !park_datastore->silence_announce) {</span><br><span> char saynum_buf[16];</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(saynum_buf, sizeof(saynum_buf), "%d %d", 0, pu->parking_space);</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(saynum_buf, sizeof(saynum_buf), "%d "AST_PARKINGSPACE_FORMAT, 0, pu->parking_space);</span><br><span> ast_bridge_channel_queue_playfile(bridge_channel, say_parking_space, saynum_buf, NULL);</span><br><span> }</span><br><span> </span><br><span>@@ -311,7 +311,7 @@</span><br><span> /* Set this to the bridge pvt so that we don't have to refind the parked user associated with this bridge channel again. */</span><br><span> bridge_channel->bridge_pvt = pu;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_verb(3, "Parking '" COLORIZE_FMT "' in '" COLORIZE_FMT "' at space %d\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_verb(3, "Parking '" COLORIZE_FMT "' in '" COLORIZE_FMT "' at space "AST_PARKINGSPACE_FORMAT"\n",</span><br><span> COLORIZE(COLOR_BRMAGENTA, 0, ast_channel_name(bridge_channel->chan)),</span><br><span> COLORIZE(COLOR_BRMAGENTA, 0, self->lot->name),</span><br><span> pu->parking_space);</span><br><span>diff --git a/res/parking/parking_bridge_features.c b/res/parking/parking_bridge_features.c</span><br><span>index 2770233..293b7a1 100644</span><br><span>--- a/res/parking/parking_bridge_features.c</span><br><span>+++ b/res/parking/parking_bridge_features.c</span><br><span>@@ -116,7 +116,7 @@</span><br><span> * parked_subscription_data is tracking a transfer_channel_data struct. */</span><br><span> if (message->event_type == PARKED_CALL) {</span><br><span> /* queue the saynum on the bridge channel and hangup */</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(saynum_buf, sizeof(saynum_buf), "%d %u", data->hangup_after, message->parkingspace);</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(saynum_buf, sizeof(saynum_buf), "%d "AST_PARKINGSPACE_FORMAT, data->hangup_after, message->parkingspace);</span><br><span> if (!data->transfer_data) {</span><br><span> ast_bridge_channel_queue_playfile(bridge_channel, say_parking_space, saynum_buf, NULL);</span><br><span> } else {</span><br><span>@@ -273,7 +273,7 @@</span><br><span> struct pbx_find_info info = { .stacklen = 0 }; /* the rest is reset in pbx_find_extension */</span><br><span> const char *app_at_exten;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(4, "Checking if %s@%s is a parking exten\n", exten, context);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_debug(4, "Checking whether %s@%s is a parking extension.\n", exten, context);</span><br><span> exten_obj = pbx_find_extension(NULL, NULL, &info, context, exten, 1, NULL, NULL, E_MATCH);</span><br><span> if (!exten_obj) {</span><br><span> return 0;</span><br><span>@@ -579,7 +579,7 @@</span><br><span> flatten_dial_string(dial_string_flat);</span><br><span> </span><br><span> /* Set parking timeout channel variables */</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(parking_space, sizeof(parking_space), "%d", user->parking_space);</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(parking_space, sizeof(parking_space), AST_PARKINGSPACE_FORMAT, user->parking_space);</span><br><span> ast_channel_lock(chan);</span><br><span> ast_channel_stage_snapshot(chan);</span><br><span> pbx_builtin_setvar_helper(chan, "PARKING_SPACE", parking_space);</span><br><span>@@ -657,10 +657,11 @@</span><br><span> </span><br><span> void say_parking_space(struct ast_bridge_channel *bridge_channel, const char *payload)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- unsigned int numeric_value;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int numeric_value;</span><br><span> unsigned int hangup_after;</span><br><span style="color: hsl(120, 100%, 40%);">+ char buf[40];</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (sscanf(payload, "%u %u", &hangup_after, &numeric_value) != 2) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (sscanf(payload, "%u "AST_PARKINGSPACE_FORMAT, &hangup_after, &numeric_value) != 2) {</span><br><span> /* If say_parking_space is called with a non-numeric string, we have a problem. */</span><br><span> ast_assert(0);</span><br><span> ast_bridge_channel_leave_bridge(bridge_channel,</span><br><span>@@ -668,8 +669,8 @@</span><br><span> return;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_say_digits(bridge_channel->chan, numeric_value, "",</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_language(bridge_channel->chan));</span><br><span style="color: hsl(120, 100%, 40%);">+ sprintf(buf, AST_PARKINGSPACE_FORMAT, numeric_value);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_say_digit_str(bridge_channel->chan, buf, "", ast_channel_language(bridge_channel->chan));</span><br><span> </span><br><span> if (hangup_after) {</span><br><span> ast_bridge_channel_leave_bridge(bridge_channel,</span><br><span>diff --git a/res/parking/parking_controller.c b/res/parking/parking_controller.c</span><br><span>index 9e9e540..54a7f8f 100644</span><br><span>--- a/res/parking/parking_controller.c</span><br><span>+++ b/res/parking/parking_controller.c</span><br><span>@@ -93,13 +93,13 @@</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-int parking_lot_get_space(struct parking_lot *lot, int target_override)</span><br><span style="color: hsl(120, 100%, 40%);">+ast_parkingspace_int parking_lot_get_space(struct parking_lot *lot, ast_parkingspace_int target_override)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- int original_target;</span><br><span style="color: hsl(0, 100%, 40%);">- int current_target;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int original_target;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int current_target;</span><br><span> struct ao2_iterator i;</span><br><span> struct parked_user *user;</span><br><span style="color: hsl(0, 100%, 40%);">- int wrap;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int wrap;</span><br><span> </span><br><span> if (lot->cfg->parkfindnext) {</span><br><span> /* Use next_space if the lot already has next_space set; otherwise use lot start. */</span><br><span>@@ -154,7 +154,7 @@</span><br><span> </span><br><span> static int retrieve_parked_user_targeted(void *obj, void *arg, int flags)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- int *target = arg;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int *target = arg;</span><br><span> struct parked_user *user = obj;</span><br><span> if (user->parking_space == *target) {</span><br><span> return CMP_MATCH;</span><br><span>@@ -163,7 +163,7 @@</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-struct parked_user *parking_lot_retrieve_parked_user(struct parking_lot *lot, int target)</span><br><span style="color: hsl(120, 100%, 40%);">+struct parked_user *parking_lot_retrieve_parked_user(struct parking_lot *lot, ast_parkingspace_int target)</span><br><span> {</span><br><span> RAII_VAR(struct parked_user *, user, NULL, ao2_cleanup);</span><br><span> </span><br><span>diff --git a/res/parking/parking_devicestate.c b/res/parking/parking_devicestate.c</span><br><span>index 3f6d07d..d23c3ab 100644</span><br><span>--- a/res/parking/parking_devicestate.c</span><br><span>+++ b/res/parking/parking_devicestate.c</span><br><span>@@ -30,7 +30,7 @@</span><br><span> </span><br><span> struct parking_lot_extension_inuse_search {</span><br><span> char *context;</span><br><span style="color: hsl(0, 100%, 40%);">- int exten;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int exten;</span><br><span> };</span><br><span> </span><br><span> static int retrieve_parked_user_targeted(void *obj, void *arg, int flags)</span><br><span>@@ -91,11 +91,11 @@</span><br><span> }</span><br><span> </span><br><span> search.context = context;</span><br><span style="color: hsl(0, 100%, 40%);">- if (sscanf(exten, "%d", &search.exten) != 1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (sscanf(exten, AST_PARKINGSPACE_FORMAT, &search.exten) != 1) {</span><br><span> return AST_DEVICE_INVALID;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(4, "Checking state of exten %d in context %s\n", search.exten, context);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_debug(4, "Checking state of extension "AST_PARKINGSPACE_FORMAT" in context %s\n", search.exten, context);</span><br><span> </span><br><span> lot = ao2_callback(global_lots, 0, parking_lot_search_context_extension_inuse, &data);</span><br><span> if (!lot) {</span><br><span>@@ -105,12 +105,12 @@</span><br><span> return AST_DEVICE_INUSE;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-void parking_notify_metermaids(int exten, const char *context, enum ast_device_state state)</span><br><span style="color: hsl(120, 100%, 40%);">+void parking_notify_metermaids(ast_parkingspace_int exten, const char *context, enum ast_device_state state)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(4, "Notification of state change to metermaids %d@%s\n to state '%s'\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_debug(4, "Notification of state change to metermaids "AST_PARKINGSPACE_FORMAT"@%s\n to state '%s'\n",</span><br><span> exten, context, ast_devstate2str(state));</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_devstate_changed(state, AST_DEVSTATE_CACHABLE, "park:%d@%s", exten, context);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_devstate_changed(state, AST_DEVSTATE_CACHABLE, "park:"AST_PARKINGSPACE_FORMAT"@%s", exten, context);</span><br><span> }</span><br><span> </span><br><span> void unload_parking_devstate(void)</span><br><span>diff --git a/res/parking/parking_manager.c b/res/parking/parking_manager.c</span><br><span>index 6d0a4c0..89dd545 100644</span><br><span>--- a/res/parking/parking_manager.c</span><br><span>+++ b/res/parking/parking_manager.c</span><br><span>@@ -241,7 +241,7 @@</span><br><span> "%s" /* retriever channel state (when available) */</span><br><span> "ParkerDialString: %s\r\n"</span><br><span> "Parkinglot: %s\r\n"</span><br><span style="color: hsl(0, 100%, 40%);">- "ParkingSpace: %u\r\n"</span><br><span style="color: hsl(120, 100%, 40%);">+ "ParkingSpace: "AST_PARKINGSPACE_FORMAT"\r\n"</span><br><span> "ParkingTimeout: %lu\r\n"</span><br><span> "ParkingDuration: %lu\r\n",</span><br><span> </span><br><span>@@ -403,8 +403,8 @@</span><br><span> astman_append(s, "Event: Parkinglot\r\n"</span><br><span> "%s" /* The Action ID */</span><br><span> "Name: %s\r\n"</span><br><span style="color: hsl(0, 100%, 40%);">- "StartSpace: %d\r\n"</span><br><span style="color: hsl(0, 100%, 40%);">- "StopSpace: %d\r\n"</span><br><span style="color: hsl(120, 100%, 40%);">+ "StartSpace: "AST_PARKINGSPACE_FORMAT"\r\n"</span><br><span style="color: hsl(120, 100%, 40%);">+ "StopSpace: "AST_PARKINGSPACE_FORMAT"\r\n"</span><br><span> "Timeout: %u\r\n"</span><br><span> "\r\n",</span><br><span> list_data->id_text,</span><br><span>diff --git a/res/parking/parking_tests.c b/res/parking/parking_tests.c</span><br><span>index 1572788..1e9b886 100644</span><br><span>--- a/res/parking/parking_tests.c</span><br><span>+++ b/res/parking/parking_tests.c</span><br><span>@@ -137,7 +137,7 @@</span><br><span> </span><br><span> #define TEST_LOT_NAME "unit_tests_res_parking_test_lot"</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-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)</span><br><span style="color: hsl(120, 100%, 40%);">+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)</span><br><span> {</span><br><span> RAII_VAR(struct parking_lot_cfg *, test_cfg, NULL, ao2_cleanup);</span><br><span> struct parking_lot *test_lot;</span><br><span>diff --git a/res/parking/parking_ui.c b/res/parking/parking_ui.c</span><br><span>index f12963a..b2debe0 100644</span><br><span>--- a/res/parking/parking_ui.c</span><br><span>+++ b/res/parking/parking_ui.c</span><br><span>@@ -37,7 +37,7 @@</span><br><span> </span><br><span> static void display_parked_call(struct parked_user *user, int fd)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(fd, " Space : %d\n", user->parking_space);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cli(fd, " Space : "AST_PARKINGSPACE_FORMAT"\n", user->parking_space);</span><br><span> ast_cli(fd, " Channel : %s\n", ast_channel_name(user->chan));</span><br><span> ast_cli(fd, " Parker Dial String : %s\n", user->parker_dial_string);</span><br><span> ast_cli(fd, "\n");</span><br><span>@@ -56,7 +56,7 @@</span><br><span> ast_cli(fd, "Parking Lot: %s\n--------------------------------------------------------------------------\n", lot->name);</span><br><span> ast_cli(fd, "Parking Extension : %s\n", lot->cfg->parkext);</span><br><span> ast_cli(fd, "Parking Context : %s\n", lot->cfg->parking_con);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(fd, "Parking Spaces : %d-%d\n", lot->cfg->parking_start, lot->cfg->parking_stop);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cli(fd, "Parking Spaces : "AST_PARKINGSPACE_FORMAT"-"AST_PARKINGSPACE_FORMAT"\n", lot->cfg->parking_start, lot->cfg->parking_stop);</span><br><span> ast_cli(fd, "Parking Time : %u sec\n", lot->cfg->parkingtime);</span><br><span> ast_cli(fd, "Comeback to Origin : %s\n", lot->cfg->comebacktoorigin ? "yes" : "no");</span><br><span> ast_cli(fd, "Comeback Context : %s%s\n", lot->cfg->comebackcontext, lot->cfg->comebacktoorigin ? " (comebacktoorigin=yes, not used)" : "");</span><br><span>@@ -124,8 +124,8 @@</span><br><span> }</span><br><span> </span><br><span> struct parking_lot_complete {</span><br><span style="color: hsl(0, 100%, 40%);">- int seeking; /*! Nth match to return. */</span><br><span style="color: hsl(0, 100%, 40%);">- int which; /*! Which match currently on. */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int seeking; /*! Nth match to return. */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int which; /*! Which match currently on. */</span><br><span> };</span><br><span> </span><br><span> static int complete_parking_lot_search(void *obj, void *arg, void *data, int flags)</span><br><span>@@ -137,7 +137,7 @@</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static char *complete_parking_lot(const char *word, int seeking)</span><br><span style="color: hsl(120, 100%, 40%);">+static char *complete_parking_lot(const char *word, ast_parkingspace_int seeking)</span><br><span> {</span><br><span> char *ret = NULL;</span><br><span> struct parking_lot *lot;</span><br><span>diff --git a/res/parking/res_parking.h b/res/parking/res_parking.h</span><br><span>index 3c34e5c..f7040a2 100644</span><br><span>--- a/res/parking/res_parking.h</span><br><span>+++ b/res/parking/res_parking.h</span><br><span>@@ -60,8 +60,8 @@</span><br><span> };</span><br><span> </span><br><span> struct parking_lot_cfg {</span><br><span style="color: hsl(0, 100%, 40%);">- int parking_start; /*!< First space in the parking lot */</span><br><span style="color: hsl(0, 100%, 40%);">- int parking_stop; /*!< Last space in the parking lot */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int parking_start; /*!< First space in the parking lot */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int parking_stop; /*!< Last space in the parking lot */</span><br><span> </span><br><span> unsigned int parkingtime; /*!< Analogous to parkingtime config option */</span><br><span> unsigned int comebackdialtime; /*!< Analogous to comebackdialtime config option */</span><br><span>@@ -87,7 +87,7 @@</span><br><span> };</span><br><span> </span><br><span> struct parking_lot {</span><br><span style="color: hsl(0, 100%, 40%);">- int next_space; /*!< When using parkfindnext, which space we should start searching from next time we park */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int next_space; /*!< When using parkfindnext, which space we should start searching from next time we park */</span><br><span> struct ast_bridge *parking_bridge; /*!< Bridged where parked calls will rest until they are answered or otherwise leave */</span><br><span> struct ao2_container *parked_users; /*!< List of parked users rigidly ordered by their parking space */</span><br><span> struct parking_lot_cfg *cfg; /*!< Reference to configuration object for the parking lot */</span><br><span>@@ -103,7 +103,7 @@</span><br><span> struct ast_channel *chan; /*!< Parked channel */</span><br><span> struct ast_channel_snapshot *retriever; /*!< Snapshot of the channel that retrieves a parked call */</span><br><span> struct timeval start; /*!< When the call was parked */</span><br><span style="color: hsl(0, 100%, 40%);">- int parking_space; /*!< Which parking space is used */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int parking_space; /*!< Which parking space is used */</span><br><span> char comeback[AST_MAX_CONTEXT]; /*!< Where to go on parking timeout */</span><br><span> char *parker_dial_string; /*!< dialstring to call back with comebacktoorigin. Used timeout extension generation and call control */</span><br><span> unsigned int time_limit; /*!< How long this specific channel may remain in the parking lot before timing out */</span><br><span>@@ -111,6 +111,14 @@</span><br><span> enum park_call_resolution resolution; /*!< How did the parking session end? If the call is in a bridge, lock parked_user before checking/setting */</span><br><span> };</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define parking_space_announce(channel_, space_) do { \</span><br><span style="color: hsl(120, 100%, 40%);">+ char buf[24]; /* even a long long int has never more that 20 characters. */ \</span><br><span style="color: hsl(120, 100%, 40%);">+ sprintf(buf, AST_PARKINGSPACE_FORMAT, space_); \</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_say_digit_str(channel_, buf, "", ast_channel_language(channel_)); \</span><br><span style="color: hsl(120, 100%, 40%);">+ } while (0)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #if defined(TEST_FRAMEWORK)</span><br><span> /*!</span><br><span> * \since 12.0.0</span><br><span>@@ -193,7 +201,7 @@</span><br><span> * \note lot should be locked before this is called and unlocked only after a parked_user with the space</span><br><span> * returned has been added to the parking lot.</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">-int parking_lot_get_space(struct parking_lot *lot, int target_override);</span><br><span style="color: hsl(120, 100%, 40%);">+ast_parkingspace_int parking_lot_get_space(struct parking_lot *lot, ast_parkingspace_int target_override);</span><br><span> </span><br><span> /*!</span><br><span> * \since 12.0.0</span><br><span>@@ -209,7 +217,7 @@</span><br><span> * \note The parked user will be removed from parking lot as part of this process</span><br><span> * \note Remove this reference with ao2_cleanup once it falls out of scope.</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">-struct parked_user *parking_lot_retrieve_parked_user(struct parking_lot *lot, int target);</span><br><span style="color: hsl(120, 100%, 40%);">+struct parked_user *parking_lot_retrieve_parked_user(struct parking_lot *lot, ast_parkingspace_int target);</span><br><span> </span><br><span> /*!</span><br><span> * \since 12.0.0</span><br><span>@@ -465,7 +473,7 @@</span><br><span> * \param context Context of the call parked/unparked</span><br><span> * \param state new device state</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">-void parking_notify_metermaids(int exten, const char *context, enum ast_device_state state);</span><br><span style="color: hsl(120, 100%, 40%);">+void parking_notify_metermaids(ast_parkingspace_int exten, const char *context, enum ast_device_state state);</span><br><span> </span><br><span> /*!</span><br><span> * \since 12.0.0</span><br><span>diff --git a/res/res_parking.c b/res/res_parking.c</span><br><span>index 2082718..ec406a6 100644</span><br><span>--- a/res/res_parking.c</span><br><span>+++ b/res/res_parking.c</span><br><span>@@ -435,9 +435,9 @@</span><br><span> /* The arg just needs to have the parking space with it */</span><br><span> static int parked_user_cmp_fn(void *obj, void *arg, int flags)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- int *search_space = arg;</span><br><span> struct parked_user *user = obj;</span><br><span style="color: hsl(0, 100%, 40%);">- int object_space = user->parking_space;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int *search_space = arg;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int object_space = user->parking_space;</span><br><span> </span><br><span> if (*search_space == object_space) {</span><br><span> return CMP_MATCH;</span><br><span>@@ -505,10 +505,10 @@</span><br><span> static int option_handler_parkpos(const struct aco_option *opt, struct ast_variable *var, void *obj)</span><br><span> {</span><br><span> struct parking_lot_cfg *lot_cfg = obj;</span><br><span style="color: hsl(0, 100%, 40%);">- int low;</span><br><span style="color: hsl(0, 100%, 40%);">- int high;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int low;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int high;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (sscanf(var->value, "%30d-%30d", &low, &high) != 2) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (sscanf(var->value, AST_PARKINGSPACE_FORMAT"-"AST_PARKINGSPACE_FORMAT, &low, &high) != 2) {</span><br><span> ast_log(LOG_WARNING, "Format for parking positions is a-b, where a and b are numbers\n");</span><br><span> } else if (high < low || low <= 0 || high <= 0) {</span><br><span> ast_log(LOG_WARNING, "Format for parking positions is a-b, where a <= b\n");</span><br><span>@@ -759,7 +759,7 @@</span><br><span> </span><br><span> int parking_lot_cfg_create_extensions(struct parking_lot_cfg *lot_cfg)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- int parkingspace;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_parkingspace_int parkingspace;</span><br><span> struct ast_exten *existing_exten;</span><br><span> struct ast_context *lot_context;</span><br><span> struct pbx_find_info find_info = { .stacklen = 0 }; /* the rest is reset in pbx_find_extension */</span><br><span>@@ -812,11 +812,11 @@</span><br><span> </span><br><span> /* Handle generation/confirmation for the ParkedCall extensions and hints */</span><br><span> for (parkingspace = lot_cfg->parking_start; parkingspace <= lot_cfg->parking_stop; parkingspace++) {</span><br><span style="color: hsl(0, 100%, 40%);">- char space[AST_MAX_EXTENSION];</span><br><span style="color: hsl(120, 100%, 40%);">+ char space[24]; /* even a long long int is only 20 characters long */</span><br><span> RAII_VAR(struct ast_str *, arguments_string, NULL, ast_free);</span><br><span> find_info.stacklen = 0; /* reset for pbx_find_exten */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(space, sizeof(space), "%d", parkingspace);</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(space, sizeof space, AST_PARKINGSPACE_FORMAT, parkingspace);</span><br><span> </span><br><span> /* Unlike the Park extensions, ParkedCall extensions and their hints may never be shared for any reason. */</span><br><span> if ((existing_exten = pbx_find_extension(NULL, NULL, &find_info, lot_cfg->parking_con, space, 1, NULL, NULL, E_MATCH))) {</span><br><span>@@ -824,15 +824,15 @@</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- arguments_string = ast_str_create(32);</span><br><span style="color: hsl(120, 100%, 40%);">+ arguments_string = ast_str_create(strlen(lot_cfg->name) + 1 + sizeof space);</span><br><span> if (!arguments_string) {</span><br><span> ast_unlock_context(lot_context);</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span> ast_str_set(&arguments_string, 0, "%s,%s", lot_cfg->name, space);</span><br><span style="color: hsl(0, 100%, 40%);">- if (parking_add_extension(lot_context, 0, space, 1, PARKED_CALL_APPLICATION,</span><br><span style="color: hsl(0, 100%, 40%);">- ast_str_buffer(arguments_string), parkedcall_registrar_pointer)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (parking_add_extension(lot_context, 0, space, 1, PARKED_CALL_APPLICATION, ast_str_buffer(arguments_string), parkedcall_registrar_pointer)</span><br><span style="color: hsl(120, 100%, 40%);">+ ) {</span><br><span> ast_log(LOG_ERROR, "Parking lot '%s' -- Failed to add %s extension '%s@%s' to the PBX.\n",</span><br><span> lot_cfg->name, PARKED_CALL_APPLICATION, space, lot_cfg->parking_con);</span><br><span> ast_unlock_context(lot_context);</span><br><span>@@ -847,7 +847,7 @@</span><br><span> snprintf(hint_device, sizeof(hint_device), "park:%s@%s", space, lot_cfg->parking_con);</span><br><span> </span><br><span> if ((existing_exten = pbx_find_extension(NULL, NULL, &find_info, lot_cfg->parking_con, space, PRIORITY_HINT, NULL, NULL, E_MATCH))) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Parking lot '%s' -- Needs to add a hint '%s' at '%s@%s' but one already exists owned by %s\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_ERROR, "Parking lot '%s' -- Failed to add hint '%s' at '%s@%s' because it already exists, owned by %s.\n",</span><br><span> lot_cfg->name, hint_device, space, lot_cfg->parking_con, ast_get_extension_registrar(existing_exten));</span><br><span> ast_unlock_context(lot_context);</span><br><span> return -1;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9931">change 9931</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9931"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I6059f5469d4eb039245e30f31bca95d069f30c2e </div>
<div style="display:none"> Gerrit-Change-Number: 9931 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Karl Brose <karlbrose@gmail.com> </div>