[Asterisk-cvs] asterisk/channels chan_skinny.c,1.28,1.29

jeremy at lists.digium.com jeremy at lists.digium.com
Thu Mar 4 01:34:28 CST 2004


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

Modified Files:
	chan_skinny.c 
Log Message:
check to see if sub->rtp is allocated. Bug #1040


Index: chan_skinny.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_skinny.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- chan_skinny.c	4 Mar 2004 01:11:25 -0000	1.28
+++ chan_skinny.c	4 Mar 2004 06:25:27 -0000	1.29
@@ -628,18 +628,18 @@
 struct skinny_line {
 	ast_mutex_t lock;
 	char name[80];
-	char label[42];							/* Label that shows next to the line buttons */
+	char label[42];					/* Label that shows next to the line buttons */
   	struct skinny_subchannel *sub;			/* pointer to our current connection, channel and stuff */
 	char accountcode[80];
 	char exten[AST_MAX_EXTENSION];			/* Extention where to start */
 	char context[AST_MAX_EXTENSION];
 	char language[MAX_LANGUAGE];
 	char callerid[AST_MAX_EXTENSION];		/* Caller*ID */
-	char lastcallerid[AST_MAX_EXTENSION];	/* Last Caller*ID */
+	char lastcallerid[AST_MAX_EXTENSION];		/* Last Caller*ID */
 	char call_forward[AST_MAX_EXTENSION];	
 	char mailbox[AST_MAX_EXTENSION];
 	char musicclass[MAX_LANGUAGE];
-	int curtone;						/* Current tone */
+	int curtone;					/* Current tone */
 	unsigned int callgroup;
 	unsigned int pickupgroup;
 	int callwaiting;
@@ -681,7 +681,7 @@
 	struct skinny_device *next;
 } *devices = NULL;
 
-struct skinnysession {
+static struct skinnysession {
 	pthread_t t;
 	ast_mutex_t lock;
 	struct sockaddr_in sin;
@@ -704,8 +704,7 @@
 
 static struct skinny_subchannel *find_subchannel_by_line(struct skinny_line *l)
 {
-	/* Need to figure out how to determine which sub we want */
-	
+	/* XXX Need to figure out how to determine which sub we want */
 	struct skinny_subchannel *sub = l->sub;
 	return sub;
 }
@@ -2199,12 +2198,13 @@
 		sin.sin_port = htons(port);
 	
 		sub = find_subchannel_by_line(s->device->lines);
-		ast_rtp_set_peer(sub->rtp, &sin);
-		ast_rtp_get_us(sub->rtp, &us);
-		
-		printf("us port: %d\n", ntohs(us.sin_port));
-		printf("sin port: %d\n", ntohs(sin.sin_port));
-
+		if (sub->rtp) {
+			ast_rtp_set_peer(sub->rtp, &sin);
+			ast_rtp_get_us(sub->rtp, &us);	
+		} else {
+			ast_log(LOG_ERROR, "No RTP structure, this is very bad\n");
+			break;
+		}
 		memset(req, 0, SKINNY_MAX_PACKET);
         	req->len = sizeof(start_media_transmission_message)+4;
         	req->e = START_MEDIA_TRANSMISSION_MESSAGE;
@@ -2391,16 +2391,6 @@
 {
 	int res;
 
-#if 0
-	/* Add an I/O event to our TCP socket */
-	if (skinnysock > -1)  {
-		ast_io_add(io, skinnysock, accept_thread, AST_IO_IN, NULL);
-	} else {
-		ast_log(LOG_WARNING, "Unable to create I/O socket event\n");		
-	}
-#endif
-
-
 	/* This thread monitors all the interfaces which are not yet in use
 	   (and thus do not have a separate thread) indefinitely */
 	/* From here on out, we die whenever asked */
@@ -2626,7 +2616,6 @@
 	}
 	ast_mutex_unlock(&netlock);
 
-
 	/* and unload the configuration when were done */
 	ast_destroy(cfg);
 
@@ -2714,27 +2703,16 @@
 
 int unload_module()
 {
+#if 0
+	struct skinny_session *session, s;
+	struct skinny_subchannel *sub;
+	struct skinny_line *line = session;
 
-#if 0	
-	struct skinny_subchannel *p, *pl;
-
-	ast_channel_unregister(type);
-        ast_verbose("Skinny module unloading\n");
-        
-	/* First, take us out of the channel loop */
-	ast_channel_unregister(type);
-	
 	/* close all IP connections */
 	if (!ast_mutex_lock(&devicelock)) {
-		/* Hangup all interfaces if they have an owner */
-		p = iflist;
-		while(p) {
-			if (p->owner)
-				ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
-			p = p->next;
-		}
-		iflist = NULL;
-		ast_mutex_unlock(&iflock);
+		/* Terminate tcp listener thread */
+		
+
 	} else {
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
 		return -1;
@@ -2751,7 +2729,6 @@
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
 		return -1;
 	}
-
 	if (!ast_mutex_lock(&iflock)) {
 		/* Destroy all the interfaces and free their memory */
 		p = iflist;
@@ -2767,9 +2744,14 @@
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
 		return -1;
 	}
+
+        ast_rtp_proto_register(&skinny_rtp);
+        ast_cli_register(&cli_show_lines);
+        ast_cli_register(&cli_debug);
+        ast_cli_register(&cli_no_debug);
+
+	return 0;
 #endif
-	/* if we're still here something was fscked up */   
-	return -1;
 }
 
 int usecount()




More information about the svn-commits mailing list