Skip to content

Commit

Permalink
app_rpt: Exit rpt_exec if call can not be answered
Browse files Browse the repository at this point in the history
Clean up link status as we could not start the call:  Prevents periodic_process_link() from forcing "new key from 2 to 0"
Fixes: #442
  • Loading branch information
mkmer authored Jan 10, 2025
1 parent 5101b1b commit e4d8fcc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion apps/app_rpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -6737,7 +6737,17 @@ static int rpt_exec(struct ast_channel *chan, const char *data)
gettimeofday(&myrpt->lastlinktime, NULL);
rpt_mutex_lock(&myrpt->blocklock);
if (ast_channel_state(chan) != AST_STATE_UP) {
ast_answer(chan);
if (ast_answer(chan)){
ast_debug(1, "Stopped PBX on %s, state: %i :Could not answer\n", ast_channel_name(chan),ast_channel_state(chan));
l->connected = 0;
l->thisconnected = 0;
l->newkey = 0;
l->newkeytimer = 0;
rpt_mutex_unlock(&myrpt->blocklock);
rpt_mutex_unlock(&myrpt->lock);
ast_channel_pbx_set(chan, NULL);
pthread_exit(NULL);

if (l->name[0] > '9') {
if (ast_safe_sleep(chan, 500) == -1) {
return -1;
Expand Down

0 comments on commit e4d8fcc

Please sign in to comment.