[Asterisk-cvs] asterisk/pbx pbx_realtime.c,1.3,1.4

markster at lists.digium.com markster at lists.digium.com
Mon Nov 22 13:39:55 CST 2004


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

Modified Files:
	pbx_realtime.c 
Log Message:
Realtime improvements


Index: pbx_realtime.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_realtime.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pbx_realtime.c	22 Nov 2004 14:33:42 -0000	1.3
+++ pbx_realtime.c	22 Nov 2004 18:39:40 -0000	1.4
@@ -87,9 +87,24 @@
 {
 	struct ast_variable *var;
 	char pri[20];
+	char *ematch;
+	char rexten[AST_MAX_EXTENSION + 20]="";
 	snprintf(pri, sizeof(pri), "%d", priority);
-	printf("%s/%s/%s/%s exists\n", table, context, exten, pri);
-	var = ast_load_realtime(table, "context", context, "exten", exten, "priority", pri, NULL);
+	switch(mode) {
+	case MODE_MATCHMORE:
+		ematch = "exten LIKE";
+		snprintf(rexten, sizeof(rexten), "%s_%%", exten);
+		break;
+	case MODE_CANMATCH:
+		ematch = "exten LIKE";
+		snprintf(rexten, sizeof(rexten), "%s%%", exten);
+		break;
+	case MODE_MATCH:
+	default:
+		ematch = "exten";
+		strncpy(rexten, exten, sizeof(rexten) - 1);
+	}
+	var = ast_load_realtime(table, "context", context, ematch, rexten, "priority", pri, NULL);
 	return var;
 }
 
@@ -143,6 +158,8 @@
 {
 	REALTIME_COMMON(MODE_MATCHMORE);
 	if (var) ast_destroy_realtime(var);
+	if (var)
+		res = 1;
 	return res > 0 ? res : 0;
 }
 




More information about the svn-commits mailing list