[Asterisk-code-review] app_meetme: Don't erroneously set global variables. (asterisk[16])

N A asteriskteam at digium.com
Wed Apr 27 06:02:26 CDT 2022


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18464 )


Change subject: app_meetme: Don't erroneously set global variables.
......................................................................

app_meetme: Don't erroneously set global variables.

The admin_exec function in app_meetme is used by the SLA
applications for internal bridging. However, in these cases,
chan is NULL. Currently, this function will set some status
variables that are intended for a channel, but since channel
is NULL, this is erroneously creating meaningless global
variables, which shouldn't be happening. This sets these
variables only if chan is not NULL.

ASTERISK-30002 #close

Change-Id: I817df6c26f5bda131678e56791b0b61ba64fc6f7
---
M apps/app_meetme.c
1 file changed, 12 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/64/18464/1

diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 17ff202..d71ffb2 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -5239,7 +5239,9 @@
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "MeetMeAdmin requires an argument!\n");
-		pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE");
+		if (chan) {
+			pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE");
+		}
 		return -1;
 	}
 
@@ -5248,7 +5250,9 @@
 
 	if (!args.command) {
 		ast_log(LOG_WARNING, "MeetmeAdmin requires a command!\n");
-		pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE");
+		if (chan) {
+			pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE");
+		}
 		return -1;
 	}
 
@@ -5261,7 +5265,9 @@
 	if (!cnf) {
 		ast_log(LOG_WARNING, "Conference number '%s' not found!\n", args.confno);
 		AST_LIST_UNLOCK(&confs);
-		pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOTFOUND");
+		if (chan) {
+			pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOTFOUND");
+		}
 		return 0;
 	}
 
@@ -5384,7 +5390,9 @@
 	AST_LIST_UNLOCK(&confs);
 
 	dispose_conf(cnf);
-	pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", res == -2 ? "NOTFOUND" : res ? "FAILED" : "OK");
+	if (chan) {
+		pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", res == -2 ? "NOTFOUND" : res ? "FAILED" : "OK");
+	}
 
 	return 0;
 }

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18464
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I817df6c26f5bda131678e56791b0b61ba64fc6f7
Gerrit-Change-Number: 18464
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220427/a691f79d/attachment-0001.html>


More information about the asterisk-code-review mailing list