[Asterisk-cvs] asterisk/channels chan_vpb.c,1.46,1.47

bkramer at lists.digium.com bkramer at lists.digium.com
Mon Nov 29 23:15:42 CST 2004


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

Modified Files:
	chan_vpb.c 
Log Message:
/ added "indication" option, to use Ast indication functions


Index: chan_vpb.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_vpb.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- chan_vpb.c	29 Nov 2004 23:20:16 -0000	1.46
+++ chan_vpb.c	30 Nov 2004 04:14:27 -0000	1.47
@@ -138,6 +138,9 @@
 /* To use or not to use Native bridging */
 static int UseNativeBridge=1;
 
+/* Use Asterisk Indication or VPB */
+static int use_ast_ind=0;
+
 #define TIMER_PERIOD_RINGBACK 2000
 #define TIMER_PERIOD_BUSY 700
 	  
@@ -1397,8 +1400,12 @@
 		p->owner = newchan;
 	}
 
-	if (newchan->_state == AST_STATE_RINGING) 
-		vpb_indicate(newchan, AST_CONTROL_RINGING);
+	if (newchan->_state == AST_STATE_RINGING){
+		if (use_ast_ind == 1)
+			ast_indicate(newchan, AST_CONTROL_RINGING);
+		else
+			vpb_indicate(newchan, AST_CONTROL_RINGING);
+	}
 
 	res= ast_mutex_unlock(&p->lock);
 /*
@@ -2174,7 +2181,8 @@
 		tmp->pvt->read = vpb_read;
 		tmp->pvt->write = vpb_write;
 		tmp->pvt->bridge = vpb_bridge;
-		tmp->pvt->indicate = vpb_indicate;
+		if (use_ast_ind == 0)
+			tmp->pvt->indicate = vpb_indicate;
 		tmp->pvt->fixup = vpb_fixup;
 		
 		strncpy(tmp->context, context, sizeof(tmp->context)-1);
@@ -2316,6 +2324,18 @@
 	vpb_seterrormode(VPB_ERROR_CODE);
 
 	ast_mutex_lock(&iflock); {
+		v = ast_variable_browse(cfg, "general");
+		while (v){
+			if (strcasecmp(v->name, "cards") == 0) {
+				ast_log(LOG_NOTICE,"VPB Driver configured to use [%d] cards\n",atoi(v->value));
+			}
+			else if (strcasecmp(v->name, "indication") == 0) {
+				use_ast_ind = 1;
+				ast_log(LOG_NOTICE,"VPB driver using Asterisk Indication functions!\n");
+			}
+			v = v->next;
+		}
+	
 		v = ast_variable_browse(cfg, "interfaces");
 		while(v) {
 			/* Create the interface list */




More information about the svn-commits mailing list