aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-11 22:55:16 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-11 22:55:16 +0000
commita0800b9bc2c9f6ec37b65e745d02efd64b1f1f53 (patch)
tree83807892ffb00b1616ec723bec6f7707fef4b493
parent8be4ac7decae05827e6b700fe2208db177525740 (diff)
Merged revisions 174945 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r174945 | mmichelson | 2009-02-11 16:41:01 -0600 (Wed, 11 Feb 2009) | 29 lines 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/branches/1.6.1@174947 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_dial.c4
-rw-r--r--apps/app_dictate.c4
-rw-r--r--apps/app_waitforsilence.c4
-rw-r--r--include/asterisk/channel.h2
-rw-r--r--main/channel.c14
-rw-r--r--main/pbx.c4
6 files changed, 24 insertions, 8 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 1759fefe9..f360680cf 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -1380,6 +1380,10 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
res = -1; /* reset default */
}
+ if (ast_test_flag64(&opts, OPT_DTMF_EXIT)) {
+ __ast_answer(chan, 0, 0);
+ }
+
if (continue_exec)
*continue_exec = 0;
diff --git a/apps/app_dictate.c b/apps/app_dictate.c
index 86ccad875..abac0c8ed 100644
--- a/apps/app_dictate.c
+++ b/apps/app_dictate.c
@@ -116,7 +116,9 @@ static int dictate_exec(struct ast_channel *chan, void *data)
return -1;
}
- ast_answer(chan);
+ if (chan->_state != AST_STATE_UP) {
+ ast_answer(chan);
+ }
ast_safe_sleep(chan, 200);
for (res = 0; !res;) {
if (ast_strlen_zero(filename)) {
diff --git a/apps/app_waitforsilence.c b/apps/app_waitforsilence.c
index eedbf15ac..bb6e06f7b 100644
--- a/apps/app_waitforsilence.c
+++ b/apps/app_waitforsilence.c
@@ -168,7 +168,9 @@ static int waitfor_exec(struct ast_channel *chan, void *data, int wait_for_silen
int iterations = 1, i;
time_t waitstart;
- res = ast_answer(chan); /* Answer the channel */
+ if (chan->_state != AST_STATE_UP) {
+ res = ast_answer(chan); /* Answer the channel */
+ }
if (!data || ( (sscanf(data, "%d,%d,%d", &timereqd, &iterations, &timeout) != 3) &&
(sscanf(data, "%d,%d", &timereqd, &iterations) != 2) &&
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 80783344f..c1898bff1 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -971,7 +971,7 @@ void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval off
* \retval non-zero on failure
*/
int ast_answer(struct ast_channel *chan);
-int __ast_answer(struct ast_channel *chan, unsigned int delay);
+int __ast_answer(struct ast_channel *chan, unsigned int delay, int cdr_answer);
/*! \brief Make a call
* \param chan which channel to make the call on
diff --git a/main/channel.c b/main/channel.c
index 69689f79c..7545f4e1a 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1676,7 +1676,7 @@ int ast_hangup(struct ast_channel *chan)
}
#define ANSWER_WAIT_MS 500
-int __ast_answer(struct ast_channel *chan, unsigned int delay)
+int __ast_answer(struct ast_channel *chan, unsigned int delay, int cdr_answer)
{
int res = 0;
@@ -1704,7 +1704,9 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay)
res = chan->tech->answer(chan);
}
ast_setstate(chan, AST_STATE_UP);
- ast_cdr_answer(chan->cdr);
+ if (cdr_answer) {
+ ast_cdr_answer(chan->cdr);
+ }
ast_channel_unlock(chan);
if (delay) {
ast_safe_sleep(chan, delay);
@@ -1740,6 +1742,12 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay)
}
break;
case AST_STATE_UP:
+ /* Calling ast_cdr_answer when it it has previously been called
+ * is essentially a no-op, so it is safe.
+ */
+ if (cdr_answer) {
+ ast_cdr_answer(chan->cdr);
+ }
break;
default:
break;
@@ -1753,7 +1761,7 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay)
int ast_answer(struct ast_channel *chan)
{
- return __ast_answer(chan, 0);
+ return __ast_answer(chan, 0, 1);
}
void ast_deactivate_generator(struct ast_channel *chan)
diff --git a/main/pbx.c b/main/pbx.c
index 4f759a9c0..46d7f152f 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -7788,7 +7788,7 @@ static int pbx_builtin_answer(struct ast_channel *chan, void *data)
delay = 0;
}
- return __ast_answer(chan, delay);
+ return __ast_answer(chan, delay, 1);
}
static int pbx_builtin_incomplete(struct ast_channel *chan, void *data)
@@ -7805,7 +7805,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;