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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 22 11:39:42 CDT 2008


Author: jdixon
Date: Fri Aug 22 11:39:41 2008
New Revision: 139453

URL: http://svn.digium.com/view/asterisk?view=rev&rev=139453
Log:
Fixed more stuff

Modified:
    team/jdixon/chan_usbradio-1.4/dev-1.0/channels/chan_echolink.c

Modified: team/jdixon/chan_usbradio-1.4/dev-1.0/channels/chan_echolink.c
URL: http://svn.digium.com/view/asterisk/team/jdixon/chan_usbradio-1.4/dev-1.0/channels/chan_echolink.c?view=diff&rev=139453&r1=139452&r2=139453
==============================================================================
--- team/jdixon/chan_usbradio-1.4/dev-1.0/channels/chan_echolink.c (original)
+++ team/jdixon/chan_usbradio-1.4/dev-1.0/channels/chan_echolink.c Fri Aug 22 11:39:41 2008
@@ -31,7 +31,7 @@
 /*** MODULEINFO
  ***/
 
-/* Version 0.6, 08/22/2008
+/* Version 0.7, 08/22/2008
 Echolink channel driver for Asterisk/app_rpt.
 A lot more has to be added,
 Here is what comes to mind first:
@@ -245,6 +245,7 @@
 	struct ast_dsp *dsp;
 	struct ast_module_user *u;
 	struct ast_trans_pvt *xpath;
+	unsigned int nodenum;
 };
 
 struct rtcp_sdes_request_item {
@@ -719,18 +720,47 @@
 	return 0;
 }
 
+static int el_digit_begin(struct ast_channel *ast, char digit)
+{
+	return -1;
+}
+
+static int el_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
+{
+	return -1;
+}
+
 static int el_text(struct ast_channel *ast, const char *text)
 {
-	return 0;
-}
-
-static int el_digit_begin(struct ast_channel *ast, char digit)
-{
-	return 0;
-}
-
-static int el_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
-{
+	struct el_pvt *p = ast->tech_pvt;
+	char *cmd = NULL,*arg1 = NULL,*arg2 = NULL;
+	char *arg3 = NULL,delim = ' ',*saveptr;
+	char buf[200],*ptr,str[200],*arg4 = NULL;
+
+	strncpy(buf,text,sizeof(buf) - 1);
+	ptr = strchr(buf, (int)'\r'); 
+	if (ptr) *ptr = '\0';
+	ptr = strchr(buf, (int)'\n');    
+	if (ptr) *ptr = '\0';
+	cmd = strtok_r(buf, &delim, &saveptr);
+	if (!cmd)
+	{
+		return 0;
+	}
+
+	arg1 = strtok_r(NULL, &delim, &saveptr);
+	arg2 = strtok_r(NULL, &delim, &saveptr);
+	arg3 = strtok_r(NULL, &delim, &saveptr);
+	arg4 = strtok_r(NULL, &delim, &saveptr);
+
+	if (!strcasecmp(cmd,"D"))
+	{
+		sprintf(str,"3%06u",p->nodenum);
+		/* if not for this one, we cant go any farther */
+		if (strcmp(arg1,str)) return 0;
+		ast_senddigit(ast,*arg4);
+		return 0;
+	}
 	return 0;
 }
 
@@ -1195,6 +1225,7 @@
 {
 	struct ast_channel *tmp;
 	struct el_instance *instp = i->instp;
+
 	tmp = ast_channel_alloc(1, state, 0, 0, "", instp->astnode, instp->context, 0, "echolink/%s", i->stream);
 	if (tmp) {
 		tmp->tech = &el_tech;
@@ -1218,6 +1249,7 @@
 		}
 		i->owner = tmp;
 		i->u = ast_module_user_add(tmp);
+		i->nodenum = nodenum;
 		if (state != AST_STATE_DOWN) {
 			if (ast_pbx_start(tmp)) {
 				ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
@@ -1232,7 +1264,7 @@
 
 static struct ast_channel *el_request(const char *type, int format, void *data, int *cause)
 {
-	int oldformat;
+	int oldformat,nodenum;
 	struct el_pvt *p;
 	struct ast_channel *tmp = NULL;
 	char *str,*cp;
@@ -1245,11 +1277,13 @@
 	}
 	str = strdup((char *)data);
 	cp = strchr(str,'/');
-	if (cp) *cp = 0;
+	if (cp) *cp++ = 0;
+	nodenum = 0;
+	if (*cp && *++cp) nodenum = atoi(cp);
 	p = el_alloc(str);
 	free(str);
 	if (p) {
-		tmp = el_new(p, AST_STATE_DOWN,0);
+		tmp = el_new(p, AST_STATE_DOWN,nodenum);
 		if (!tmp)
 			el_destroy(p);
 	}
@@ -1448,7 +1482,7 @@
 		strncpy(el_node_key->call,call,EL_CALL_SIZE);
 		strncpy(el_node_key->ip, instp->el_node_test.ip, EL_IP_SIZE);
 		strncpy(el_node_key->name,name,EL_NAME_SIZE); 
-		el_node_key->nodenum = 385239;
+		el_node_key->nodenum = 123456;
 		el_node_key->countdown = instp->rtcptimeout;
 		el_node_key->seqnum = 1;
 		el_node_key->instp = instp;




More information about the asterisk-commits mailing list