[zaptel-commits] russell: branch group/vldtmf r1276 - /team/group/vldtmf/zaptel.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Wed Aug 9 15:13:22 MST 2006


Author: russell
Date: Wed Aug  9 17:13:22 2006
New Revision: 1276

URL: http://svn.digium.com/view/zaptel?rev=1276&view=rev
Log:
The regular dtmf_tones list is set up to play for a defined length, and then
stop.  So, I created a dtmf_tones_continuous list for use with manually starting
and stopping dtmf on a channel.  VLDTMF is now successfully passed from my
polycom SIP phone using RFC2833 to my analog zap phone.  :)

Modified:
    team/group/vldtmf/zaptel.c

Modified: team/group/vldtmf/zaptel.c
URL: http://svn.digium.com/view/zaptel/team/group/vldtmf/zaptel.c?rev=1276&r1=1275&r2=1276&view=diff
==============================================================================
--- team/group/vldtmf/zaptel.c (original)
+++ team/group/vldtmf/zaptel.c Wed Aug  9 17:13:22 2006
@@ -337,6 +337,8 @@
 #define DIGIT_MODE_PULSE	2
 
 #include "digits.h"
+
+static struct zt_tone *dtmf_tones_continuous = NULL;
 
 static int zt_chan_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit);
 
@@ -1126,7 +1128,7 @@
 		} else	/* Note that no tone zone exists at the moment */
 			res = -ENODATA;
 	} else if (tone >= ZT_TONE_DTMF_BASE && tone <= ZT_TONE_DTMF_MAX) {
-		chan->curtone = &dtmf_tones[tone - ZT_TONE_DTMF_BASE];
+		chan->curtone = dtmf_tones_continuous + (tone - ZT_TONE_DTMF_BASE);
 		res = 0;
 	}
 
@@ -6884,6 +6886,7 @@
 
 static int __init zt_init(void) {
 	int res = 0;
+	int i = 0;
 
 #ifdef CONFIG_PROC_FS
 	proc_entries[0] = proc_mkdir("zaptel", NULL);
@@ -6916,6 +6919,16 @@
 		return res;
 	}
 #endif /* CONFIG_DEVFS_FS */
+
+	if (!(dtmf_tones_continuous = kmalloc(sizeof(dtmf_tones), GFP_KERNEL))) {
+		printk(KERN_ERR "Unable to allocate memory for continuous DTMF tones list!\n");
+		return -ENOMEM;
+	}
+
+	for (i = 0; i < (sizeof(dtmf_tones) / sizeof(dtmf_tones[0])); i++) {
+		memcpy(dtmf_tones_continuous + i, dtmf_tones + i, sizeof(dtmf_tones_continuous[i]));
+		dtmf_tones_continuous[i].next = dtmf_tones_continuous + i;
+	}
 
 	printk(KERN_INFO "Zapata Telephony Interface Registered on major %d\n", ZT_MAJOR);
 	printk(KERN_INFO "Zaptel Version: %s Echo Canceller: %s\n", ZAPTEL_VERSION,
@@ -6939,9 +6952,16 @@
 #endif
 
 	printk(KERN_INFO "Zapata Telephony Interface Unloaded\n");
-	for (x=0;x<ZT_TONE_ZONE_MAX;x++)
+	for (x = 0; x < ZT_TONE_ZONE_MAX; x++) {
 		if (tone_zones[x])
 			kfree(tone_zones[x]);
+	}
+
+	if (dtmf_tones_continuous) {
+		kfree(dtmf_tones_continuous);
+		dtmf_tones_continuous = NULL;
+	}
+
 #ifdef CONFIG_DEVFS_FS
 	devfs_unregister(timer);
 	devfs_unregister(transcode);



More information about the zaptel-commits mailing list