res_stasis: signal when new command is queued

res_statsis's app loop sleeps for up to .2s waiting on input
to a channel before re-checking the command queue. This can
cause delays between channel setup and bridge.

This change is to send a SIGURG on the sleeping thread when
a new command is enqueued. This exits the sleeping thread out
of the ast_waitfor() call triggering the new command being
processed on the channel immediately.

Resolves: #362

UserNote: Call setup times should be significantly improved
when using ARI.

(cherry picked from commit 7ea0e3bfda)
This commit is contained in:
Mike Bradeen
2023-10-02 12:35:32 -06:00
committed by Asterisk Development Team
parent 849cf31e51
commit 054ec2bf4a
3 changed files with 33 additions and 0 deletions

View File

@@ -1548,7 +1548,11 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc,
continue;
}
/* Set this thread's id as the control thread id so that any
new commands can signal out of this wait */
control_set_thread(control, pthread_self());
r = ast_waitfor(chan, MAX_WAIT_MS);
control_set_thread(control, AST_PTHREADT_NULL);
if (r < 0) {
ast_debug(3, "%s: Poll error\n",