Skip to content

Commit

Permalink
res_alarmsystem: Suspend client thread until PBX fully booted.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
InterLinked1 committed Sep 14, 2024
1 parent 36b9170 commit e8b9c3f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions res/res_alarmsystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,13 @@ static void *client_thread(void *arg)
numfds++;
}

/* Wait until the PBX is fully booted, similar to "core waitfullybooted"
* This is necessary because dialplan won't execute while the PBX is still booting,
* and events, including EVENT_ALARM_OKAY, can trigger user callbacks which execute dialplan. */
while (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
usleep(1000);
}

/* First send a ping to initialize UDP communication and see if the network is up.
* This will generate the event but not actually process it until we start
* executing the loop, at which time we'll service the alertpipe immediately. */
Expand Down

0 comments on commit e8b9c3f

Please sign in to comment.