Skip to content

Commit 786f45d

Browse files
res_parking: Fail gracefully if parking lot is full.
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
1 parent d2b6248 commit 786f45d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

res/parking/parking_applications.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ static int park_app_exec(struct ast_channel *chan, const char *data)
567567
RAII_VAR(struct ast_bridge *, parking_bridge, NULL, ao2_cleanup);
568568

569569
struct ast_bridge_features chan_features;
570-
int res;
570+
int res = 0;
571571
int silence_announcements = 0;
572572
int blind_transfer;
573573

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

592592
/* Initialize bridge features for the channel. */
593593
res = ast_bridge_features_init(&chan_features);
594-
if (res) {
594+
/* Now for the fun part... park it! */
595+
if (res || ast_bridge_join(parking_bridge, chan, NULL, &chan_features, NULL, 0)) {
596+
if (!silence_announcements && !blind_transfer) {
597+
ast_stream_and_wait(chan, "pbx-parkingfailed", "");
598+
}
595599
ast_bridge_features_cleanup(&chan_features);
596600
publish_parked_call_failure(chan);
597-
return -1;
601+
return res;
598602
}
599603

600-
/* Now for the fun part... park it! */
601-
ast_bridge_join(parking_bridge, chan, NULL, &chan_features, NULL, 0);
602-
603604
/*
604605
* If the bridge was broken for a hangup that isn't real, then
605606
* don't run the h extension, because the channel isn't really

0 commit comments

Comments
 (0)