aboutsummaryrefslogtreecommitdiffstats
path: root/funcs/func_callerid.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-10-06 21:09:05 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-10-06 21:09:05 +0000
commit74ecba3091505ff537561b075f028675d514ea55 (patch)
treee9c0dfb82bcb18454c0f9a712acbe7933fc7ad81 /funcs/func_callerid.c
parentdc8b7c68a3cb790827b79a9d12d072f8acfa72e6 (diff)
Merged revisions 146799 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r146799 | tilghman | 2008-10-06 15:52:04 -0500 (Mon, 06 Oct 2008) | 8 lines Dialplan functions should not actually return 0, unless they have modified the workspace. To signal an error (and no change to the workspace), -1 should be returned instead. (closes issue #13340) Reported by: kryptolus Patches: 20080827__bug13340__2.diff.txt uploaded by Corydon76 (license 14) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@146802 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_callerid.c')
-rw-r--r--funcs/func_callerid.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c
index 9dfe0d8c7..b59f57a44 100644
--- a/funcs/func_callerid.c
+++ b/funcs/func_callerid.c
@@ -51,6 +51,7 @@ static int callerpres_write(struct ast_channel *chan, const char *cmd, char *dat
static int callerid_read(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
+ int res = -1;
char *opt = data;
if (!chan)
@@ -64,10 +65,13 @@ static int callerid_read(struct ast_channel *chan, const char *cmd, char *data,
if (!strncasecmp("all", data, 3)) {
snprintf(buf, len, "\"%s\" <%s>", name, num);
+ res = 0;
} else if (!strncasecmp("name", data, 4)) {
ast_copy_string(buf, name, len);
+ res = 0;
} else if (!strncasecmp("num", data, 3)) {
ast_copy_string(buf, num, len);
+ res = 0;
} else {
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
}
@@ -78,32 +82,40 @@ static int callerid_read(struct ast_channel *chan, const char *cmd, char *data,
snprintf(buf, len, "\"%s\" <%s>",
S_OR(chan->cid.cid_name, ""),
S_OR(chan->cid.cid_num, ""));
+ res = 0;
} else if (!strncasecmp("name", data, 4)) {
if (chan->cid.cid_name) {
ast_copy_string(buf, chan->cid.cid_name, len);
+ res = 0;
}
} else if (!strncasecmp("num", data, 3)) {
if (chan->cid.cid_num) {
ast_copy_string(buf, chan->cid.cid_num, len);
+ res = 0;
}
} else if (!strncasecmp("ani", data, 3)) {
if (!strncasecmp(data + 3, "2", 1)) {
snprintf(buf, len, "%d", chan->cid.cid_ani2);
} else if (chan->cid.cid_ani) {
ast_copy_string(buf, chan->cid.cid_ani, len);
+ res = 0;
}
} else if (!strncasecmp("dnid", data, 4)) {
if (chan->cid.cid_dnid) {
ast_copy_string(buf, chan->cid.cid_dnid, len);
+ res = 0;
}
} else if (!strncasecmp("rdnis", data, 5)) {
if (chan->cid.cid_rdnis) {
ast_copy_string(buf, chan->cid.cid_rdnis, len);
+ res = 0;
}
} else if (!strncasecmp("pres", data, 4)) {
ast_copy_string(buf, ast_named_caller_presentation(chan->cid.cid_pres), len);
+ res = 0;
} else if (!strncasecmp("ton", data, 3)) {
snprintf(buf, len, "%d", chan->cid.cid_ton);
+ res = 0;
} else {
ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
}
@@ -111,7 +123,7 @@ static int callerid_read(struct ast_channel *chan, const char *cmd, char *data,
ast_channel_unlock(chan);
}
- return 0;
+ return res;
}
static int callerid_write(struct ast_channel *chan, const char *cmd, char *data,