diff options
author | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-05-26 12:14:14 +0000 |
---|---|---|
committer | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-05-26 12:14:14 +0000 |
commit | 8122e053cedd4cedb85b5607d2812e6322c9f52b (patch) | |
tree | 458b0c404cc29ffd6be6bc43e5a2ee677e956f18 /cdr | |
parent | 8a0a175fb8ce5f6fbc25858a1c52ef0b4ed47ac9 (diff) |
Use a properly allocated channel for substitution in cdr_manager.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@196622 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr')
-rw-r--r-- | cdr/cdr_manager.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 8a4a43e1f..aff60d355 100644 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -127,7 +127,6 @@ static int manager_log(struct ast_cdr *cdr) char strAnswerTime[80] = ""; char strEndTime[80] = ""; char buf[CUSTOM_FIELDS_BUF_SIZE]; - struct ast_channel dummy; if (!enablecdr) return 0; @@ -146,9 +145,14 @@ static int manager_log(struct ast_cdr *cdr) buf[0] = 0; /* Custom fields handling */ if (customfields != NULL && ast_str_strlen(customfields)) { - memset(&dummy, 0, sizeof(dummy)); - dummy.cdr = cdr; - pbx_substitute_variables_helper(&dummy, ast_str_buffer(customfields), buf, sizeof(buf) - 1); + struct ast_channel *dummy = ast_channel_alloc(0, 0, "", "", "", "", "", 0, "Substitution/%p", cdr); + if (!dummy) { + ast_log(LOG_ERROR, "Unable to allocate channel for variable substitution.\n"); + return 0; + } + dummy->cdr = ast_cdr_dup(cdr); + pbx_substitute_variables_helper(dummy, ast_str_buffer(customfields), buf, sizeof(buf) - 1); + ast_channel_release(dummy); } manager_event(EVENT_FLAG_CDR, "Cdr", |