func_channel: allow reading 4 fields from dialplan
authorSebastien Duthil <sduthil@wazo.community>
Tue, 31 Mar 2020 20:14:51 +0000 (16:14 -0400)
committerGeorge Joseph <gjoseph@digium.com>
Wed, 8 Apr 2020 14:47:55 +0000 (09:47 -0500)
The following fields return an error when read from dialplan:

- exten
- context
- userfield
- channame

ASTERISK-28796 #close

Change-Id: Ieacaac629490f8710fdacc9de80ed5916c5f6ee2

funcs/func_channel.c

index f82dad3..d143fdc 100644 (file)
@@ -357,13 +357,13 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
                locked_copy_string(chan, buf, ast_channel_appl(chan), len);
        else if (!strcasecmp(data, "appdata") && ast_channel_data(chan))
                locked_copy_string(chan, buf, ast_channel_data(chan), len);
-       else if (!strcasecmp(data, "exten") && ast_channel_data(chan))
+       else if (!strcasecmp(data, "exten"))
                locked_copy_string(chan, buf, ast_channel_exten(chan), len);
-       else if (!strcasecmp(data, "context") && ast_channel_data(chan))
+       else if (!strcasecmp(data, "context"))
                locked_copy_string(chan, buf, ast_channel_context(chan), len);
-       else if (!strcasecmp(data, "userfield") && ast_channel_data(chan))
+       else if (!strcasecmp(data, "userfield"))
                locked_copy_string(chan, buf, ast_channel_userfield(chan), len);
-       else if (!strcasecmp(data, "channame") && ast_channel_data(chan))
+       else if (!strcasecmp(data, "channame"))
                locked_copy_string(chan, buf, ast_channel_name(chan), len);
        else if (!strcasecmp(data, "linkedid")) {
                ast_channel_lock(chan);