aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-11-01 21:11:57 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-11-01 21:11:57 +0000
commita68250b79bf5358b7cf67bbd9185409a17993abc (patch)
tree9174292f27151eeb3b58254ab97faf9e9063b7f4
parent5f0fa721d1ae6458155e5c58ffc838c6195484eb (diff)
issue #5564
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6935 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xChangeLog4
-rwxr-xr-xapps/app_parkandannounce.c5
-rwxr-xr-xchannel.c8
-rwxr-xr-xinclude/asterisk/channel.h2
4 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f34134db9..6206f02b0 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2005-11-01 Kevin P. Fleming <kpfleming@digium.com>
+ * apps/app_parkandannounce.c (parkandannounce_exec): supply parent channel to ast_request_and_dial so channel variables can be inherited (issue #5564)
+ * include/asterisk/channel.h: add parent_channel field
+ * channel.c (__ast_request_and_dial): use parent_channel field to inherit variables into new channel
+
* apps/app_cut.c (cut_internal): use ast_separate_app_args() instead of open code (issue #5560)
* apps/app_mixmonitor.c (launch_monitor_thread): ast_strlen_zero can handle NULL input (issue #5561)
diff --git a/apps/app_parkandannounce.c b/apps/app_parkandannounce.c
index 6c9650fdb..1db9101a5 100755
--- a/apps/app_parkandannounce.c
+++ b/apps/app_parkandannounce.c
@@ -77,6 +77,7 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data)
char *s,*orig_s;
struct ast_channel *dchan;
+ struct outgoing_helper oh;
int outstate;
struct localuser *u;
@@ -178,7 +179,9 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data)
/* Now place the call to the extention */
- dchan = ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR, dialstr,30000, &outstate, chan->cid.cid_num, chan->cid.cid_name);
+ memset(&oh, 0, sizeof(oh));
+ oh.parent_channel = chan;
+ dchan = __ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR, dialstr,30000, &outstate, chan->cid.cid_num, chan->cid.cid_name, &oh);
if(dchan) {
if(dchan->_state == AST_STATE_UP) {
diff --git a/channel.c b/channel.c
index b67dc707a..e2448436a 100755
--- a/channel.c
+++ b/channel.c
@@ -2355,8 +2355,12 @@ struct ast_channel *__ast_request_and_dial(const char *type, int format, void *d
chan = ast_request(type, format, data, &cause);
if (chan) {
if (oh) {
- ast_set_variables(chan, oh->vars);
- ast_set_callerid(chan, oh->cid_num, oh->cid_name, oh->cid_num);
+ if (oh->vars)
+ ast_set_variables(chan, oh->vars);
+ if (oh->cid_num && *oh->cid_num && oh->cid_name && *oh->cid_name)
+ ast_set_callerid(chan, oh->cid_num, oh->cid_name, oh->cid_num);
+ if (oh->parent_channel)
+ ast_channel_inherit_variables(oh->parent_channel, chan);
}
ast_set_callerid(chan, cid_num, cid_name, cid_num);
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 6599edbb5..ce5975dbe 100755
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -434,6 +434,7 @@ struct chanmon;
oh.cid_num = cid_num; \
oh.cid_name = cid_name; \
oh.vars = vars; \
+ oh.parent_channel = NULL; \
}
struct outgoing_helper {
@@ -443,6 +444,7 @@ struct outgoing_helper {
const char *cid_num;
const char *cid_name;
struct ast_variable *vars;
+ struct ast_channel *parent_channel;
};
#define AST_CDR_TRANSFER (1 << 0)