[Asterisk-cvs] asterisk/channels chan_vpb.c,1.59,1.60

bkramer at lists.digium.com bkramer at lists.digium.com
Sun Jan 16 21:41:56 CST 2005


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

Modified Files:
	chan_vpb.c 
Log Message:
/ updated caller ID to use ast_set_callerid


Index: chan_vpb.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_vpb.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- chan_vpb.c	14 Jan 2005 04:51:20 -0000	1.59
+++ chan_vpb.c	17 Jan 2005 03:45:18 -0000	1.60
@@ -486,8 +486,8 @@
  * Use ANALYSE_CID to record rings and determine location of callerid
  */
 /* #define ANALYSE_CID */
-#define RING_SKIP 600
-#define CID_MSECS 1700
+#define RING_SKIP 300
+#define CID_MSECS 3700
 
 static void get_callerid(struct vpb_pvt *p)
 {
@@ -541,16 +541,21 @@
 		cli_struct->ra_cn[0]=0;
 		/* This decodes FSK 1200baud type callerid */
 		if ((rc=vpb_cid_decode2(cli_struct, buf, CID_MSECS*8)) == VPB_OK ) {
+			/*
 			if (owner->cid.cid_num)
 				free(owner->cid.cid_num);
 			owner->cid.cid_num=NULL;
 			if (owner->cid.cid_name)
 				free(owner->cid.cid_name);
 			owner->cid.cid_name=NULL;
+			*/
 			
 			if (cli_struct->ra_cldn[0]=='\0'){
+				/*
 				owner->cid.cid_num = strdup(cli_struct->cldn);
 				owner->cid.cid_name = strdup(cli_struct->cn);
+				*/
+				ast_set_callerid(owner, cli_struct->cldn, cli_struct->cn, cli_struct->cldn);
 				if (option_verbose>3) 
 					ast_verbose(VERBOSE_PREFIX_4 "CID record - got [%s] [%s]\n",owner->cid.cid_num,owner->cid.cid_name );
 			}
@@ -567,6 +572,7 @@
 	} else 
 		ast_log(LOG_ERROR, "CID record - Failed to set record mode for caller id on %s\n", p->dev );
 }
+
 static void get_callerid_ast(struct vpb_pvt *p)
 {
 	struct callerid_state *cs;
@@ -603,21 +609,27 @@
 /*	vpb_record_get_gain(p->handle, &old_gain); */
 	cs = callerid_new(which_cid);
 	if (cs){
-/*		vpb_wave_open_write(&ws, file, VPB_MULAW); */
-/*		vpb_record_set_gain(p->handle, 3.0); */
-/*		vpb_record_set_hw_gain(p->handle,12.0); */
+/*
+		vpb_wave_open_write(&ws, file, VPB_MULAW); 
+		vpb_record_set_gain(p->handle, 3.0); 
+		vpb_record_set_hw_gain(p->handle,12.0); 
+*/
 		vpb_record_buf_start(p->handle, VPB_MULAW);
 		while((rc == 0)&&(sam_count<8000*3)){
 			vrc = vpb_record_buf_sync(p->handle, (char*)buf, sizeof(buf));
 			if (vrc != VPB_OK)
 				ast_log(LOG_ERROR, "%s: Caller ID couldnt read audio buffer!\n",p->dev);
 			rc = callerid_feed(cs,(unsigned char *)buf,sizeof(buf),AST_FORMAT_ULAW);
-/*			vpb_wave_write(ws,(char*)buf,sizeof(buf)); */
+/*
+			vpb_wave_write(ws,(char*)buf,sizeof(buf)); 
+*/
 			sam_count+=sizeof(buf);
 			if (option_verbose>3) ast_verbose(VERBOSE_PREFIX_4 "Collecting Caller ID samples [%d][%d]...\n",sam_count,rc);
 		}
 		vpb_record_buf_finish(p->handle);
-/*		vpb_wave_close_write(ws); */
+/*
+		vpb_wave_close_write(ws); 
+*/
 		if (rc == 1){
 			callerid_get(cs, &name, &number, &flags);
 			if (option_verbose>0) 
@@ -917,6 +929,8 @@
 {
 	char s[2] = {0};
 	struct ast_channel *owner = p->owner;
+	char cid_num[256];
+	char cid_name[256];
 
 	if (option_verbose > 3) {
 		char str[VPB_MAX_STR];
@@ -997,6 +1011,7 @@
 						if (option_verbose > 2)
 							ast_verbose(VERBOSE_PREFIX_3 " %s: DTMF CallerID %s\n",p->dev,p->callerid);
 						if (owner){
+							/*
 							if (owner->cid.cid_num)
 								free(owner->cid.cid_num);
 							owner->cid.cid_num=NULL;
@@ -1004,6 +1019,12 @@
 								free(owner->cid.cid_name);
 							owner->cid.cid_name=NULL;
 							owner->cid.cid_num = strdup(p->callerid);
+							*/
+							cid_name[0] = '\0';
+							cid_num[0] = '\0';
+							ast_callerid_split(p->callerid, cid_name, sizeof(cid_name), cid_num, sizeof(cid_num));
+							ast_set_callerid(owner, cid_num, cid_name, cid_num);
+
 						}
 						else {
 							if (option_verbose > 2)




More information about the svn-commits mailing list