]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_parking: Cleanup find_channel_parking_lot_name() usage. 75/2475/1
authorRichard Mudgett <rmudgett@digium.com>
Wed, 23 Mar 2016 19:24:49 +0000 (14:24 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 25 Mar 2016 23:30:41 +0000 (18:30 -0500)
Change-Id: I8f7a8890aef27824301c642d4d15407ac83e6f02

res/parking/parking_applications.c
res/parking/parking_bridge_features.c
res/parking/res_parking.h
res/res_parking.c

index d8cda6f50a203e581f04fda68577493b6eeeb49c..95a87ef3e5c4cc7ead58a9e31b43d6b66c48415e 100644 (file)
@@ -567,7 +567,7 @@ static int parked_call_app_exec(struct ast_channel *chan, const char *data)
        int target_space = -1;
        struct ast_bridge_features chan_features;
        char *parse;
-       char *lot_name;
+       const char *lot_name;
 
        AST_DECLARE_APP_ARGS(args,
                AST_APP_ARG(lot_name);
index a21be90687ec565a32c600a6ba4df5db11c4a499..becb74ef9a882f70b18309a005c518c2aed7a8f3 100644 (file)
@@ -474,19 +474,12 @@ static int parking_park_bridge_channel(struct ast_bridge_channel *bridge_channel
 static int parking_park_call(struct ast_bridge_channel *parker, char *exten, size_t length)
 {
        RAII_VAR(struct parking_lot *, lot, NULL, ao2_cleanup);
-       const char *lot_name = NULL;
+       const char *lot_name;
 
        ast_channel_lock(parker->chan);
-       lot_name = find_channel_parking_lot_name(parker->chan);
-       if (!ast_strlen_zero(lot_name)) {
-               lot_name = ast_strdupa(lot_name);
-       }
+       lot_name = ast_strdupa(find_channel_parking_lot_name(parker->chan));
        ast_channel_unlock(parker->chan);
 
-       if (ast_strlen_zero(lot_name)) {
-               return -1;
-       }
-
        lot = parking_lot_find_by_name(lot_name);
        if (!lot) {
                ast_log(AST_LOG_WARNING, "Cannot Park %s: lot %s unknown\n",
index 3d77e514c48f758abba4aac0a315ddd0d8be25ac..b8be0419b58c41f6d6df14e6e229e91892d025ef 100644 (file)
@@ -308,8 +308,9 @@ struct parking_lot *parking_create_dynamic_lot_forced(const char *name, struct a
  *
  * \param chan The channel we want the parking lot name for
  *
- * \retval name of the channel's assigned parking lot if it is defined by the channel in some way
- * \retval name of the default parking lot if it is not
+ * \return name of the parking lot to use for the channel.
+ *
+ * \note Always returns a parking lot name.
  *
  * \note Channel needs to be locked while the returned string is in use.
  */
index 3edbd466339b0a182891c03d58631c74e7a7eb92..f062b4f9789ec247715d50a4fa7f6cbf94fa4d01 100644 (file)
@@ -568,14 +568,13 @@ const char *find_channel_parking_lot_name(struct ast_channel *chan)
 
        /* The channel variable overrides everything */
        name = pbx_builtin_getvar_helper(chan, "PARKINGLOT");
-       if (ast_strlen_zero(name) && !ast_strlen_zero(ast_channel_parkinglot(chan))) {
-               /* Use the channel's parking lot. */
-               name = ast_channel_parkinglot(chan);
-       }
-
-       /* If the name couldn't be pulled from that either, use the default parking lot name. */
        if (ast_strlen_zero(name)) {
-               name = DEFAULT_PARKING_LOT;
+               /* Try the channel's parking lot. */
+               name = ast_channel_parkinglot(chan);
+               if (ast_strlen_zero(name)) {
+                       /* Fall back to the default parking lot. */
+                       name = DEFAULT_PARKING_LOT;
+               }
        }
 
        return name;