[asterisk-commits] jdixon: branch jdixon/chan_usbradio-1.4 r156122 - /team/jdixon/chan_usbradio-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 12 03:16:56 CST 2008


Author: jdixon
Date: Wed Nov 12 03:16:55 2008
New Revision: 156122

URL: http://svn.digium.com/view/asterisk?view=rev&rev=156122
Log:
Fixed remote DTMF sending problem

Modified:
    team/jdixon/chan_usbradio-1.4/channels/chan_irlp.c

Modified: team/jdixon/chan_usbradio-1.4/channels/chan_irlp.c
URL: http://svn.digium.com/view/asterisk/team/jdixon/chan_usbradio-1.4/channels/chan_irlp.c?view=diff&rev=156122&r1=156121&r2=156122
==============================================================================
--- team/jdixon/chan_usbradio-1.4/channels/chan_irlp.c (original)
+++ team/jdixon/chan_usbradio-1.4/channels/chan_irlp.c Wed Nov 12 03:16:55 2008
@@ -241,6 +241,7 @@
 static unsigned int xcount = 0;
 static char havedtmf = 0;
 static char irlp_dtmf_string[64];
+static char irlp_dtmf_special = 0;
 time_t keepalive = 0;
 
 #ifdef OLD_ASTERISK
@@ -298,6 +299,7 @@
 	ctrl_port = audio_port + 1;
 	havedtmf = 0;
 	memset(irlp_dtmf_string,0,sizeof(irlp_dtmf_string));
+	irlp_dtmf_special = 0;
 	if (curcall)
 	{
 	       curcall->nativeformats = AST_FORMAT_ADPCM;
@@ -1028,7 +1030,7 @@
 
 static int irlp_text(struct ast_channel *ast, const char *text)
 {
-int	destnode,hisnode,seqno,i;
+int	destnode,hisnode,seqno,i,j;
 char	c;
 
 	struct irlp_pvt *p = ast->tech_pvt;
@@ -1039,12 +1041,29 @@
 	if (destnode != (in_node + 40000)) return(0);
 	if (c == '*') c = 'S';
 	if (c == '#') c = 'P';
+	if ((c == 'D') && (!irlp_dtmf_special))
+	{
+		irlp_dtmf_special = 1;
+		return 0;
+	}
 	i = strlen(irlp_dtmf_string);
-	if (i < (sizeof(irlp_dtmf_string) - 1))
+	j = 1;
+	if (irlp_dtmf_special && (c != 'D')) j = 2;
+	if (i < (sizeof(irlp_dtmf_string) - j))
 	{
 		irlp_dtmf_string[i + 1] = 0;
-		irlp_dtmf_string[i] = c;
-	}
+		if ((irlp_dtmf_special) && (c != 'D'))
+		{
+			irlp_dtmf_string[i + 2] = 0;
+			irlp_dtmf_string[i] = 'P';
+			irlp_dtmf_string[i + 1] = c;
+		}
+		else 
+		{
+			irlp_dtmf_string[i] = c;
+		}
+	}
+	irlp_dtmf_special = 0;
 	return 0;
 }
 
@@ -1298,6 +1317,7 @@
 			ast_log(LOG_NOTICE,"Sent DTMF %s to IRLP\n",irlp_dtmf_string);
 		}
 		irlp_dtmf_string[0] = 0;
+		irlp_dtmf_special = 0;
 	}
 
 	if (!p->txkey) return(0);




More information about the asterisk-commits mailing list