Skip to content

Commit e8b9c3f

Browse files
committed
res_alarmsystem: Suspend client thread until PBX fully booted.
Wait until Asterisk has finished starting fully before letting the client threads do anything useful. This ensures events which can trigger user dialplan callbacks don't fire before the PBX is fully booted, since dialplan can't be executed while Asterisk is still starting.
1 parent 36b9170 commit e8b9c3f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

res/res_alarmsystem.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,13 @@ static void *client_thread(void *arg)
16481648
numfds++;
16491649
}
16501650

1651+
/* Wait until the PBX is fully booted, similar to "core waitfullybooted"
1652+
* This is necessary because dialplan won't execute while the PBX is still booting,
1653+
* and events, including EVENT_ALARM_OKAY, can trigger user callbacks which execute dialplan. */
1654+
while (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
1655+
usleep(1000);
1656+
}
1657+
16511658
/* First send a ping to initialize UDP communication and see if the network is up.
16521659
* This will generate the event but not actually process it until we start
16531660
* executing the loop, at which time we'll service the alertpipe immediately. */

0 commit comments

Comments
 (0)