summaryrefslogtreecommitdiff
path: root/apps/app_originate.c
diff options
context:
space:
mode:
authorGregory Nietsky <gregory@distrotech.co.za>2011-09-21 10:46:09 +0000
committerGregory Nietsky <gregory@distrotech.co.za>2011-09-21 10:46:09 +0000
commit8f10934c185d376fbc90e49cece4c92383f78eb5 (patch)
treecb626aae6e18a108927a66f951b1f0bd72a3de11 /apps/app_originate.c
parent7b08b2cf53393b26050320dcdfee6edbecae94f7 (diff)
Merged revisions 337261 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10 ........ r337261 | irroot | 2011-09-21 12:42:06 +0200 (Wed, 21 Sep 2011) | 10 lines Adds a timeout argument to app_originate the default is 30s this will be used if the timout supplied is invalid or no timeout is supplied. Contributed by: jacco (thank you for the work) Review: https://reviewboard.asterisk.org/r/1310/ ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@337262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_originate.c')
-rw-r--r--apps/app_originate.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/app_originate.c b/apps/app_originate.c
index 5cfd41386..03bb6c44b 100644
--- a/apps/app_originate.c
+++ b/apps/app_originate.c
@@ -70,6 +70,9 @@ static const char app_originate[] = "Originate";
<parameter name="arg3" required="false">
<para>If the type is <literal>exten</literal>, then this is the priority that the channel is sent to. If the type is <literal>app</literal>, then this parameter is ignored.</para>
</parameter>
+ <parameter name="timeout" required="false">
+ <para>Timeout in seconds. Default is 30 seconds.</para>
+ </parameter>
</syntax>
<description>
<para>This application originates an outbound call and connects it to a specified extension or application. This application will block until the outgoing call fails or gets answered. At that point, this application will exit with the status variable set and dialplan processing will continue.</para>
@@ -101,12 +104,13 @@ static int originate_exec(struct ast_channel *chan, const char *data)
AST_APP_ARG(arg1);
AST_APP_ARG(arg2);
AST_APP_ARG(arg3);
+ AST_APP_ARG(timeout);
);
char *parse;
char *chantech, *chandata;
int res = -1;
int outgoing_status = 0;
- static const unsigned int timeout = 30;
+ unsigned int timeout = 30;
static const char default_exten[] = "s";
struct ast_format tmpfmt;
struct ast_format_cap *cap_slin = ast_format_cap_alloc_nolock();
@@ -131,6 +135,13 @@ static int originate_exec(struct ast_channel *chan, const char *data)
goto return_cleanup;
}
+ if (!ast_strlen_zero(args.timeout)) {
+ if(sscanf(args.timeout, "%u", &timeout) != 1) {
+ ast_log(LOG_NOTICE, "Invalid timeout: '%s'. Setting timeout to 30 seconds\n", args.timeout);
+ timeout = 30;
+ }
+ }
+
chandata = ast_strdupa(args.tech_data);
chantech = strsep(&chandata, "/");