Skip to content

Commit

Permalink
res_parking: Fail gracefully if parking lot is full.
Browse files Browse the repository at this point in the history
Currently, if a parking lot is full, bridge setup returns -1,
causing dialplan execution to terminate without TryExec.
However, such failures should be handled more gracefully,
the same way they are on other paths, as indicated by the
module's author, here:

http://lists.digium.com/pipermail/asterisk-dev/2018-December/077144.html

Now, callers will hear the parking failure announcement, and dialplan
will continue, which is consistent with existing failure modes.

Resolves: #624
  • Loading branch information
InterLinked1 authored and asterisk-org-access-app[bot] committed Mar 20, 2024
1 parent d2b6248 commit 786f45d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions res/parking/parking_applications.c
Expand Up @@ -567,7 +567,7 @@ static int park_app_exec(struct ast_channel *chan, const char *data)
RAII_VAR(struct ast_bridge *, parking_bridge, NULL, ao2_cleanup);

struct ast_bridge_features chan_features;
int res;
int res = 0;
int silence_announcements = 0;
int blind_transfer;

Expand All @@ -591,15 +591,16 @@ static int park_app_exec(struct ast_channel *chan, const char *data)

/* Initialize bridge features for the channel. */
res = ast_bridge_features_init(&chan_features);
if (res) {
/* Now for the fun part... park it! */
if (res || ast_bridge_join(parking_bridge, chan, NULL, &chan_features, NULL, 0)) {
if (!silence_announcements && !blind_transfer) {
ast_stream_and_wait(chan, "pbx-parkingfailed", "");
}
ast_bridge_features_cleanup(&chan_features);
publish_parked_call_failure(chan);
return -1;
return res;
}

/* Now for the fun part... park it! */
ast_bridge_join(parking_bridge, chan, NULL, &chan_features, NULL, 0);

/*
* If the bridge was broken for a hangup that isn't real, then
* don't run the h extension, because the channel isn't really
Expand Down

0 comments on commit 786f45d

Please sign in to comment.