[Asterisk-cvs] asterisk manager.c,1.83,1.84 pbx.c,1.198,1.199

markster at lists.digium.com markster at lists.digium.com
Mon Jan 31 19:52:02 CST 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv20826

Modified Files:
	manager.c pbx.c 
Log Message:
Allow hints to have names (bug #3471)


Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- manager.c	27 Jan 2005 16:33:12 -0000	1.83
+++ manager.c	1 Feb 2005 01:53:24 -0000	1.84
@@ -1042,7 +1042,7 @@
 	if (!context || ast_strlen_zero(context))
 		context = "default";
 	status = ast_extension_state(NULL, context, exten);
-	ast_get_hint(hint, sizeof(hint) - 1, NULL, context, exten);
+	ast_get_hint(hint, sizeof(hint) - 1, NULL, 0, NULL, context, exten);
         if (id && !ast_strlen_zero(id)) {
                 snprintf(idText,256,"ActionID: %s\r\n",id);
         }

Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -d -r1.198 -r1.199
--- pbx.c	21 Jan 2005 07:06:24 -0000	1.198
+++ pbx.c	1 Feb 2005 01:53:24 -0000	1.199
@@ -900,7 +900,12 @@
 		} else
 			*ret = NULL;
 	} else if (c && !strcmp(var, "HINT")) {
-		if (!ast_get_hint(workspace, workspacelen, c, c->context, c->exten))
+		if (!ast_get_hint(workspace, workspacelen, NULL, 0, c, c->context, c->exten))
+			*ret = NULL;
+		else
+			*ret = workspace;
+	} else if (c && !strcmp(var, "HINTNAME")) {
+		if (!ast_get_hint(NULL, 0, workspace, workspacelen, c, c->context, c->exten))
 			*ret = NULL;
 		else
 			*ret = workspace;
@@ -1787,19 +1792,26 @@
 			prev = list;
 			list = list->next;    
 		}
-    	}
+	}
 
 	ast_mutex_unlock(&hintlock);
 	return -1;
 }
 
 
-int ast_get_hint(char *hint, int hintsize, struct ast_channel *c, const char *context, const char *exten)
+int ast_get_hint(char *hint, int hintsize, char *name, int namesize, struct ast_channel *c, const char *context, const char *exten)
 {
 	struct ast_exten *e;
+	void *tmp;
 	e = ast_hint_extension(c, context, exten);
-	if (e) {	
-	    strncpy(hint, ast_get_extension_app(e), hintsize - 1);
+	if (e) {
+		if (hint) 
+		    strncpy(hint, ast_get_extension_app(e), hintsize - 1);
+		if (name) {
+			tmp = ast_get_extension_app_data(e);
+			if (tmp)
+				strncpy(name, (char *)tmp, namesize - 1);
+		}
 	    return -1;
 	}
 	return 0;	




More information about the svn-commits mailing list