diff options
author | Mark Michelson <mmichelson@digium.com> | 2012-09-25 19:29:14 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2012-09-25 19:29:14 +0000 |
commit | fdfb3ae5faac680bf939eea1312919bee14db76f (patch) | |
tree | 75907425ac9b850412fae5bc7b7e6d89e1aa19e1 /funcs/func_callerid.c | |
parent | b7233b18ebd9ce2f8f4bad1309fbe33edaf44e44 (diff) |
Allow for redirecting reasons to be set to arbitrary strings.
This allows for the REDIRECTING dialplan function to be
used to set the reason to any string.
The SIP channel driver has been modified to set the redirecting
reason string to the value received in a Diversion header. In
addition, SIP 480 response reason text will set the redirecting
reason as well.
(closes issue AST-942)
reported by Malcolm Davenport
(closes issue AST-943)
reported by Malcolm Davenport
Review: https://reviewboard.asterisk.org/r/2101
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373701 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs/func_callerid.c')
-rw-r--r-- | funcs/func_callerid.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c index 789575399..30026af3d 100644 --- a/funcs/func_callerid.c +++ b/funcs/func_callerid.c @@ -1493,7 +1493,7 @@ static int redirecting_read(struct ast_channel *chan, const char *cmd, char *dat if (!strcasecmp("orig", member.argv[0])) { if (member.argc == 2 && !strcasecmp("reason", member.argv[1])) { ast_copy_string(buf, - ast_redirecting_reason_name(ast_redirecting->orig_reason), len); + ast_redirecting_reason_name(&ast_redirecting->orig_reason), len); } else { status = party_id_read(buf, len, member.argc - 1, member.argv + 1, &ast_redirecting->orig); @@ -1537,7 +1537,7 @@ static int redirecting_read(struct ast_channel *chan, const char *cmd, char *dat ast_named_caller_presentation( ast_party_id_presentation(&ast_redirecting->from)), len); } else if (member.argc == 1 && !strcasecmp("reason", member.argv[0])) { - ast_copy_string(buf, ast_redirecting_reason_name(ast_redirecting->reason), len); + ast_copy_string(buf, ast_redirecting_reason_name(&ast_redirecting->reason), len); } else if (member.argc == 1 && !strcasecmp("count", member.argv[0])) { snprintf(buf, len, "%d", ast_redirecting->count); } else if (1 < member.argc && !strcasecmp("priv", member.argv[0])) { @@ -1659,10 +1659,16 @@ static int redirecting_write(struct ast_channel *chan, const char *cmd, char *da } if (reason < 0) { - ast_log(LOG_ERROR, - "Unknown redirecting orig reason '%s', value unchanged\n", val); + /* The argument passed into the function does not correspond to a pre-defined + * reason, so we can just set the reason string to what was given and set the + * code to be unknown + */ + redirecting.orig_reason.code = AST_REDIRECTING_REASON_UNKNOWN; + redirecting.orig_reason.str = val; + set_it(chan, &redirecting, NULL); } else { - redirecting.orig_reason = reason; + redirecting.orig_reason.code = reason; + redirecting.orig_reason.str = ""; set_it(chan, &redirecting, NULL); } } else { @@ -1742,9 +1748,16 @@ static int redirecting_write(struct ast_channel *chan, const char *cmd, char *da } if (reason < 0) { - ast_log(LOG_ERROR, "Unknown redirecting reason '%s', value unchanged\n", val); + /* The argument passed into the function does not correspond to a pre-defined + * reason, so we can just set the reason string to what was given and set the + * code to be unknown + */ + redirecting.reason.code = AST_REDIRECTING_REASON_UNKNOWN; + redirecting.reason.str = val; + set_it(chan, &redirecting, NULL); } else { - redirecting.reason = reason; + redirecting.reason.code = reason; + redirecting.reason.str = ""; set_it(chan, &redirecting, NULL); } } else if (member.argc == 1 && !strcasecmp("count", member.argv[0])) { |