aboutsummaryrefslogtreecommitdiffstats
path: root/main/pbx.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-11 22:41:01 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-11 22:41:01 +0000
commitf251215c278f37c3e7bd834feed89c9e8f80c8f4 (patch)
tree0fe1e84cdd6feb3913b86d54e744d79072c635f6 /main/pbx.c
parentec6f3dd32d30ce799effe57a2b0fc4aef504f3e2 (diff)
Fix 'd' option for app_dial and add new option to Answer application
The 'd' option would not work for channel types which use RTP to transport DTMF digits. The only way to allow for this to work was to answer the channel if we saw that this option was enabled. I realized that this may cause issues with CDRs, specifically with giving false dispositions and answer times. I therefore modified ast_answer to take another parameter which would tell if the CDR should be marked answered. I also extended this to the Answer application so that the channel may be answered but not CDRified if desired. I also modified app_dictate and app_waitforsilence to only answer the channel if it is not already up, to help not allow for faulty CDR answer times. All of these changes are going into Asterisk trunk. For 1.6.0 and 1.6.1, however, all the changes except for the change to the Answer application will go in since we do not introduce new features into stable branches (closes issue #14164) Reported by: DennisD Patches: 14164.patch uploaded by putnopvut (license 60) Tested by: putnopvut Review: http://reviewboard.digium.com/r/145 git-svn-id: http://svn.digium.com/svn/asterisk/trunk@174945 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/pbx.c')
-rw-r--r--main/pbx.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/main/pbx.c b/main/pbx.c
index 39a3d8ba2..10792e5cd 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -97,6 +97,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<para>Asterisk will wait this number of milliseconds before returning to
the dialplan after answering the call.</para>
</parameter>
+ <parameter name="nocdr">
+ <para>Asterisk will send an answer signal to the calling phone, but will not
+ set the disposition or answer time in the CDR for this call.
+ </parameter>
</syntax>
<description>
<para>If the call has not been answered, this application will
@@ -8310,15 +8314,33 @@ static int pbx_builtin_congestion(struct ast_channel *chan, void *data)
static int pbx_builtin_answer(struct ast_channel *chan, void *data)
{
int delay = 0;
+ int answer_cdr = 1;
+ char *parse;
+ AST_DECLARE_APP_ARGS(args,
+ AST_APP_ARG(delay);
+ AST_APP_ARG(answer_cdr);
+ );
+
+ if (ast_strlen_zero(data)) {
+ return __ast_answer(chan, 0, 1);
+ }
- if ((chan->_state != AST_STATE_UP) && !ast_strlen_zero(data))
+ parse = ast_strdupa(data);
+
+ AST_STANDARD_APP_ARGS(args, parse);
+
+ if (!ast_strlen_zero(args.delay) && (chan->_state != AST_STATE_UP))
delay = atoi(data);
if (delay < 0) {
delay = 0;
}
- return __ast_answer(chan, delay);
+ if (!ast_strlen_zero(args.answer_cdr) && !strcasecmp(args.answer_cdr, "nocdr")) {
+ answer_cdr = 0;
+ }
+
+ return __ast_answer(chan, delay, answer_cdr);
}
static int pbx_builtin_incomplete(struct ast_channel *chan, void *data)
@@ -8335,7 +8357,7 @@ static int pbx_builtin_incomplete(struct ast_channel *chan, void *data)
if (ast_check_hangup(chan)) {
return -1;
} else if (chan->_state != AST_STATE_UP && answer) {
- __ast_answer(chan, 0);
+ __ast_answer(chan, 0, 1);
}
return AST_PBX_INCOMPLETE;