summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-08-23 01:30:22 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-08-23 01:30:22 +0000
commit2cde73fddb9b0ce3cbeb3369a50174e79297eef3 (patch)
tree7778a9955beb55d1814262b90d5542e8999b4a23
parentdde23d5d0ffb0c5ccb286dfc570d07bfa726cdc4 (diff)
make sure realtime/high scheduling priority is relinquished before executing an AGI script (issue #4930)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6368 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rwxr-xr-xasterisk.c4
-rwxr-xr-xinclude/asterisk.h2
-rwxr-xr-xres/res_agi.c3
3 files changed, 7 insertions, 2 deletions
diff --git a/asterisk.c b/asterisk.c
index dedf23e69..fe2861533 100755
--- a/asterisk.c
+++ b/asterisk.c
@@ -674,7 +674,7 @@ static void set_icon(char *text)
fprintf(stdout, "\033]1;%s\007", text);
}
-static int set_priority(int pri)
+int ast_set_priority(int pri)
{
struct sched_param sched;
memset(&sched, 0, sizeof(sched));
@@ -1940,7 +1940,7 @@ int main(int argc, char *argv[])
ast_verbose("[ Reading Master Configuration ]");
ast_readconfig();
- if (set_priority(option_highpriority)) {
+ if (ast_set_priority(option_highpriority)) {
exit(1);
}
diff --git a/include/asterisk.h b/include/asterisk.h
index 708d503a4..e10200bbd 100755
--- a/include/asterisk.h
+++ b/include/asterisk.h
@@ -37,6 +37,8 @@ extern char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH];
extern char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH];
extern char ast_config_AST_CTL[AST_CONFIG_MAX_PATH];
+/* Provided by asterisk.c */
+extern int ast_set_priority(int);
/* Provided by module.c */
extern int load_modules(const int preload_only);
/* Provided by pbx.c */
diff --git a/res/res_agi.c b/res/res_agi.c
index 9dd62fba7..89b25e762 100755
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -279,6 +279,9 @@ static int launch_script(char *script, char *argv[], int *fds, int *efd, int *op
for (x=STDERR_FILENO + 2;x<1024;x++)
close(x);
+ /* Don't run AGI scripts with realtime priority -- it causes audio stutter */
+ ast_set_priority(0);
+
/* Execute script */
execv(script, argv);
/* Can't use ast_log since FD's are closed */