From: Naveen Albert Date: Fri, 11 Nov 2022 20:30:27 +0000 (+0000) Subject: pbx_builtins: Allow Answer to return immediately. X-Git-Tag: 20.1.0-rc1~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7df5ee7c134606e1dd9b255f4d67012c09b0f8c;p=thirdparty%2Fasterisk.git pbx_builtins: Allow Answer to return immediately. The Answer application currently waits for up to 500ms for media, even if users specify a different timeout. This adds an option to not wait for media on the channel by doing a raw answer instead. The default 500ms threshold is also documented. ASTERISK-30308 #close Change-Id: Id59cd340c44b8b8b2384c479e17e5123e917cba4 --- diff --git a/doc/CHANGES-staging/answer.txt b/doc/CHANGES-staging/answer.txt new file mode 100644 index 0000000000..7e047015b8 --- /dev/null +++ b/doc/CHANGES-staging/answer.txt @@ -0,0 +1,5 @@ +Subject: pbx_builtins + +It is now possible to not wait for media on +a channel when answering it using Answer, +by specifying the i option. diff --git a/main/pbx_builtins.c b/main/pbx_builtins.c index 7ef4d031a9..fa6e63d184 100644 --- a/main/pbx_builtins.c +++ b/main/pbx_builtins.c @@ -49,11 +49,23 @@ Asterisk will wait this number of milliseconds before returning to the dialplan after answering the call. + The minimum is 500 ms. To answer immediately without waiting for media, + use the i option. + + + + + If the call has not been answered, this application will answer it. Otherwise, it has no effect on the call. + By default, Asterisk will wait for media for up to 500 ms, or + the user specified delay, whichever is longer. If you do not want + to wait for media at all, use the i option. Hangup @@ -836,6 +848,11 @@ static int pbx_builtin_answer(struct ast_channel *chan, const char *data) delay = 0; } + if (!ast_strlen_zero(args.answer_cdr) && !strcmp(args.answer_cdr, "i")) { + /*! \todo We will remove the nocdr stuff for 21 entirely, as part of another review. */ + return ast_raw_answer(chan); + } + if (!ast_strlen_zero(args.answer_cdr) && !strcasecmp(args.answer_cdr, "nocdr")) { ast_log(AST_LOG_WARNING, "The nocdr option for the Answer application has been removed and is no longer supported.\n"); }