[asterisk-commits] crichter: branch 1.2 r50335 - in /branches/1.2/channels: ./ misdn/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 10 02:51:02 MST 2007


Author: crichter
Date: Wed Jan 10 03:51:00 2007
New Revision: 50335

URL: http://svn.digium.com/view/asterisk?view=rev&rev=50335
Log:
more fixes regarding warnings for gcc-4 and first additions for the restart Information element, in the first step we initiate a restart with a CLI command

Modified:
    branches/1.2/channels/chan_misdn.c
    branches/1.2/channels/misdn/fac.c
    branches/1.2/channels/misdn/ie.c
    branches/1.2/channels/misdn/isdn_lib.c
    branches/1.2/channels/misdn/isdn_lib.h
    branches/1.2/channels/misdn/isdn_msg_parser.c

Modified: branches/1.2/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_misdn.c?view=diff&rev=50335&r1=50334&r2=50335
==============================================================================
--- branches/1.2/channels/chan_misdn.c (original)
+++ branches/1.2/channels/chan_misdn.c Wed Jan 10 03:51:00 2007
@@ -927,6 +927,22 @@
 	return 0; 
 }
 
+static int misdn_send_restart(int fd, int argc, char *argv[])
+{
+	int port;
+	
+	if (argc != 4)
+		return RESULT_SHOWUSAGE;
+  
+	port = atoi(argv[3]);
+ 
+ 	misdn_lib_send_restart(port);
+	
+	return 0;
+}
+
+
+
 static int misdn_send_digit (int fd, int argc, char *argv[])
 {
 	char *channame; 
@@ -1082,6 +1098,14 @@
   "Usage: misdn send calldeflect <channel> \"<nr>\" \n",
   complete_ch
 };
+
+static struct ast_cli_entry cli_send_restart=
+{ {"misdn","send","restart", NULL},
+  misdn_send_restart,
+  "Sends a restart for every bchannel on the given port", 
+  "Usage: misdn send restart <port>\n"
+};
+
 
 static struct ast_cli_entry cli_send_digit =
 { {"misdn","send","digit", NULL},
@@ -4218,6 +4242,7 @@
   
 	ast_cli_register(&cli_send_display);
 	ast_cli_register(&cli_send_cd);
+	ast_cli_register(&cli_send_restart);
 	ast_cli_register(&cli_send_digit);
 	ast_cli_register(&cli_toggle_echocancel);
 	ast_cli_register(&cli_set_tics);
@@ -4285,6 +4310,7 @@
 	ast_cli_unregister(&cli_send_display);
 	
 	ast_cli_unregister(&cli_send_cd);
+	ast_cli_unregister(&cli_send_restart);
 	
 	ast_cli_unregister(&cli_send_digit);
 	ast_cli_unregister(&cli_toggle_echocancel);

Modified: branches/1.2/channels/misdn/fac.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/fac.c?view=diff&rev=50335&r1=50334&r2=50335
==============================================================================
--- branches/1.2/channels/misdn/fac.c (original)
+++ branches/1.2/channels/misdn/fac.c Wed Jan 10 03:51:00 2007
@@ -28,7 +28,7 @@
 
 
 /* support stuff */
-static void strnncpy(unsigned char *dest, unsigned char *src, int len, int dst_len)
+static void strnncpy(char *dest, unsigned char *src, int len, int dst_len)
 {
 	if (len > dst_len-1)
 		len = dst_len-1;
@@ -71,7 +71,7 @@
 
 
 /* facility for siemens CENTEX (known parts implemented only) */
-void enc_ie_facility_centrex(unsigned char **ntmode, msg_t *msg, unsigned char *cnip, int setup, int nt, struct misdn_bchannel *bc)
+void enc_ie_facility_centrex(unsigned char **ntmode, msg_t *msg, char *cnip, int setup, int nt, struct misdn_bchannel *bc)
 {
 	unsigned char centrex[256];
 	int i = 0;
@@ -123,7 +123,7 @@
 	enc_ie_facility(ntmode, msg, centrex, i, nt , bc);
 }
 
-void dec_ie_facility_centrex(unsigned char *p, Q931_info_t *qi, unsigned char *centrex, int facility_len, unsigned char *cnip, int cnip_len, int nt, struct misdn_bchannel *bc)
+void dec_ie_facility_centrex(unsigned char *p, Q931_info_t *qi, unsigned char *centrex, int facility_len, char *cnip, int cnip_len, int nt, struct misdn_bchannel *bc)
 {
 
 	int i = 0;
@@ -160,7 +160,7 @@
 
 
 /* facility for CALL Deflect (known parts implemented only) */
-void enc_ie_facility_calldeflect(unsigned char **ntmode, msg_t *msg, unsigned char *nr, int nt, struct misdn_bchannel *bc)
+void enc_ie_facility_calldeflect(unsigned char **ntmode, msg_t *msg, char *nr, int nt, struct misdn_bchannel *bc)
 {
 	unsigned char fac[256];
 	
@@ -204,7 +204,7 @@
 }
 
 
-void dec_ie_facility_calldeflect(unsigned char *p, Q931_info_t *qi, unsigned char *fac, int fac_len, unsigned char *cd_nr,  int nt, struct misdn_bchannel *bc)
+void dec_ie_facility_calldeflect(unsigned char *p, Q931_info_t *qi, unsigned char *fac, int fac_len, char *cd_nr,  int nt, struct misdn_bchannel *bc)
 {
 	*cd_nr = '\0';
 	

Modified: branches/1.2/channels/misdn/ie.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/ie.c?view=diff&rev=50335&r1=50334&r2=50335
==============================================================================
--- branches/1.2/channels/misdn/ie.c (original)
+++ branches/1.2/channels/misdn/ie.c Wed Jan 10 03:51:00 2007
@@ -33,7 +33,7 @@
 #define MISDN_IE_DEBG 0
 
 /* support stuff */
-static void strnncpy(unsigned char *dest, unsigned char *src, int len, int dst_len)
+static void strnncpy(char *dest, char *src, int len, int dst_len)
 {
 	if (len > dst_len-1)
 		len = dst_len-1;
@@ -310,7 +310,7 @@
 	{
 		p = NULL;
 		if (qi->QI_ELEMENT(call_id))
-			p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(call_id) + 1;
+			p = (unsigned char*)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(call_id) + 1;
 	}
 	if (!p)
 		return;
@@ -393,7 +393,7 @@
 
 	*type = (p[1]&0x70) >> 4;
 	*plan = p[1] & 0xf;
-	strnncpy(number, p+2, p[0]-1, number_len);
+	strnncpy(number, (char*)p+2, p[0]-1, number_len);
 
 	if (MISDN_IE_DEBG) printf("    type=%d plan=%d number='%s'\n", *type, *plan, number);
 }
@@ -488,10 +488,10 @@
 		}
 		*present = (p[2]&0x60) >> 5;
 		*screen = p[2] & 0x3;
-		strnncpy(number, p+3, p[0]-2, number_len);
+		strnncpy(number, (char*)p+3, p[0]-2, number_len);
 	} else
 	{
-		strnncpy(number, p+2, p[0]-1, number_len);
+		strnncpy(number, (char*)p+2, p[0]-1, number_len);
  		/* SPECIAL workarround for IBT software bug */ 
 		/* if (number[0]==0x80) */
 		/*  strcpy((char *)number, (char *)number+1); */
@@ -590,10 +590,10 @@
 		}
 		*present = (p[2]&0x60) >> 5;
 		*screen = p[2] & 0x3;
-		strnncpy(number, p+3, p[0]-2, number_len);
+		strnncpy(number, (char*)p+3, p[0]-2, number_len);
 	} else
 	{
-		strnncpy(number, p+2, p[0]-1, number_len);
+		strnncpy(number, (char*)p+2, p[0]-1, number_len);
 	}
 
 	if (MISDN_IE_DEBG) printf("    type=%d plan=%d present=%d screen=%d number='%s'\n", *type, *plan, *present, *screen, number);
@@ -760,7 +760,7 @@
 	{
 		p = NULL;
 		if (qi->QI_ELEMENT(channel_id))
-			p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(channel_id) + 1;
+			p = (unsigned char*)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(channel_id) + 1;
 	}
 	if (!p)
 		return;
@@ -876,7 +876,7 @@
 
 
 /* IE_DISPLAY */
-void enc_ie_display(unsigned char **ntmode, msg_t *msg, unsigned char *display, int nt, struct misdn_bchannel *bc)
+void enc_ie_display(unsigned char **ntmode, msg_t *msg, char *display, int nt, struct misdn_bchannel *bc)
 {
 	unsigned char *p;
 	Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
@@ -907,7 +907,7 @@
 	strncpy((char *)p+2, (char *)display, strlen((char *)display));
 }
 
-void dec_ie_display(unsigned char *p, Q931_info_t *qi, unsigned char *display, int display_len, int nt, struct misdn_bchannel *bc)
+void dec_ie_display(unsigned char *p, Q931_info_t *qi, char *display, int display_len, int nt, struct misdn_bchannel *bc)
 {
 	*display = '\0';
 
@@ -925,7 +925,7 @@
 		return;
 	}
 
-	strnncpy(display, p+1, p[0], display_len);
+	strnncpy(display, (char*)p+1, p[0], display_len);
 
 	if (MISDN_IE_DEBG) printf("    display='%s'\n", display);
 }
@@ -957,7 +957,7 @@
 	strncpy((char *)p+2, (char *)keypad, strlen((char *)keypad));
 }
 
-void dec_ie_keypad(unsigned char *p, Q931_info_t *qi, unsigned char *keypad, int keypad_len, int nt, struct misdn_bchannel *bc)
+void dec_ie_keypad(unsigned char *p, Q931_info_t *qi, char *keypad, int keypad_len, int nt, struct misdn_bchannel *bc)
 {
 	*keypad = '\0';
 
@@ -975,7 +975,7 @@
 		return;
 	}
 
-	strnncpy(keypad, p+1, p[0], keypad_len);
+	strnncpy(keypad, (char*)p+1, p[0], keypad_len);
 
 	if (MISDN_IE_DEBG) printf("    keypad='%s'\n", keypad);
 }
@@ -1098,7 +1098,7 @@
 
 
 /* IE_REDIR_NR (redirecting = during MT_SETUP) */
-void enc_ie_redir_nr(unsigned char **ntmode, msg_t *msg, int type, int plan, int present, int screen, int reason, unsigned char *number, int nt, struct misdn_bchannel *bc)
+void enc_ie_redir_nr(unsigned char **ntmode, msg_t *msg, int type, int plan, int present, int screen, int reason, char *number, int nt, struct misdn_bchannel *bc)
 {
 	unsigned char *p;
 	Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
@@ -1172,7 +1172,7 @@
 	}
 }
 
-void dec_ie_redir_nr(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, int *reason, unsigned char *number, int number_len, int nt, struct misdn_bchannel *bc)
+void dec_ie_redir_nr(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, int *reason, char *number, int number_len, int nt, struct misdn_bchannel *bc)
 {
 	*type = -1;
 	*plan = -1;
@@ -1204,14 +1204,14 @@
 		if (!(p[2] & 0x80))
 		{
 			*reason = p[3] & 0x0f;
-			strnncpy(number, p+4, p[0]-3, number_len);
+			strnncpy(number,(char*)p+4, p[0]-3, number_len);
 		} else
 		{
-			strnncpy(number, p+3, p[0]-2, number_len);
+			strnncpy(number, (char*)p+3, p[0]-2, number_len);
 		}
 	} else
 	{
-		strnncpy(number, p+2, p[0]-1, number_len);
+		strnncpy(number, (char*)p+2, p[0]-1, number_len);
 	}
 
 	if (MISDN_IE_DEBG) printf("    type=%d plan=%d present=%d screen=%d reason=%d number='%s'\n", *type, *plan, *present, *screen, *reason, number);
@@ -1270,7 +1270,7 @@
 	}
 }
 
-void dec_ie_redir_dn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, unsigned char *number, int number_len, int nt, struct misdn_bchannel *bc)
+void dec_ie_redir_dn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, char *number, int number_len, int nt, struct misdn_bchannel *bc)
 {
 	*type = -1;
 	*plan = -1;
@@ -1297,10 +1297,10 @@
 	if (!(p[1] & 0x80))
 	{
 		*present = (p[2]&0x60) >> 5;
-		strnncpy(number, p+3, p[0]-2, number_len);
+		strnncpy(number, (char*)p+3, p[0]-2, number_len);
 	} else
 	{
-		strnncpy(number, p+2, p[0]-1, number_len);
+		strnncpy(number, (char*)p+2, p[0]-1, number_len);
 	}
 
 	if (MISDN_IE_DEBG) printf("    type=%d plan=%d present=%d number='%s'\n", *type, *plan, *present, number);
@@ -1349,7 +1349,7 @@
 	memcpy(p+3, user, user_len);
 }
 
-void dec_ie_useruser(unsigned char *p, Q931_info_t *qi, int *protocol, unsigned char *user, int *user_len, int nt, struct misdn_bchannel *bc)
+void dec_ie_useruser(unsigned char *p, Q931_info_t *qi, int *protocol, char *user, int *user_len, int nt, struct misdn_bchannel *bc)
 {
 	char debug[768];
 	int i;

Modified: branches/1.2/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/isdn_lib.c?view=diff&rev=50335&r1=50334&r2=50335
==============================================================================
--- branches/1.2/channels/misdn/isdn_lib.c (original)
+++ branches/1.2/channels/misdn/isdn_lib.c Wed Jan 10 03:51:00 2007
@@ -651,7 +651,7 @@
 {
 	int i;
 
-	for (i=0; i<=stack->b_num; i++) {
+	for (i=0; i<stack->b_num; i++) {
 		if (global_state == MISDN_INITIALIZED)  {
 			cb_event(EVENT_CLEANUP, &stack->bc[i], NULL); 
 			empty_chan_in_stack(stack,i+1);
@@ -3578,6 +3578,31 @@
 	return 0;
 }
 
+/*Sends Restart message for every bchnanel*/
+int misdn_lib_send_restart(int port)
+{
+	struct misdn_stack *stack=find_stack_by_port(port);
+	cb_log(0, port, "Sending Restarts on this port.\n");
+	
+	struct misdn_bchannel dummybc;
+	memset (&dummybc,0,sizeof(dummybc));
+	dummybc.port=stack->port;
+	dummybc.l3_id=MISDN_ID_DUMMY;
+	dummybc.nt=stack->nt;
+
+	int max=stack->pri?30:2;
+	int i;
+	for (i=1;i<max;i++) {
+		dummybc.channel=i;
+		cb_log(0, port, "Restarting channel %d\n",i);
+		misdn_lib_send_event(&dummybc, EVENT_RESTART);
+		/*do we need to wait before we get an EVENT_RESTART_ACK ?*/
+	}
+
+	return 0;
+}
+
+/*reinitializes the L2/L3*/
 int misdn_lib_port_restart(int port)
 {
 	struct misdn_stack *stack=find_stack_by_port(port);

Modified: branches/1.2/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/isdn_lib.h?view=diff&rev=50335&r1=50334&r2=50335
==============================================================================
--- branches/1.2/channels/misdn/isdn_lib.h (original)
+++ branches/1.2/channels/misdn/isdn_lib.h Wed Jan 10 03:51:00 2007
@@ -414,6 +414,7 @@
 
 int misdn_lib_port_restart(int port);
 int misdn_lib_pid_restart(int pid);
+int misdn_lib_send_restart(int port);
 
 int misdn_lib_get_port_info(int port);
 

Modified: branches/1.2/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/isdn_msg_parser.c?view=diff&rev=50335&r1=50334&r2=50335
==============================================================================
--- branches/1.2/channels/misdn/isdn_msg_parser.c (original)
+++ branches/1.2/channels/misdn/isdn_msg_parser.c Wed Jan 10 03:51:00 2007
@@ -159,7 +159,7 @@
 	{
 		int type,plan,present, screen;
 		char id[32];
-		dec_ie_calling_pn(setup->CALLING_PN, qi, &type, &plan, &present, &screen, (unsigned char *)id, sizeof(id)-1, nt,bc);
+		dec_ie_calling_pn(setup->CALLING_PN, qi, &type, &plan, &present, &screen, id, sizeof(id)-1, nt,bc);
 
 		bc->onumplan=type; 
 		strcpy(bc->oad, id);
@@ -183,13 +183,13 @@
 	{
 		int  type, plan;
 		char number[32]; 
-		dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *)setup, &type, &plan, (unsigned char *)number, sizeof(number)-1, nt,bc);
+		dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *)setup, &type, &plan, number, sizeof(number)-1, nt,bc);
 		strcpy(bc->dad, number);
 		bc->dnumplan=type; 
 	}
 	{
 		char keypad[32];
-		dec_ie_keypad(setup->KEYPAD, (Q931_info_t *)setup, (unsigned char *)keypad, sizeof(keypad)-1, nt,bc);
+		dec_ie_keypad(setup->KEYPAD, (Q931_info_t *)setup, keypad, sizeof(keypad)-1, nt,bc);
 		strcpy(bc->keypad, keypad);
 	}
 
@@ -201,7 +201,7 @@
 	{
 		int  type, plan, present, screen, reason;
 		char id[32]; 
-		dec_ie_redir_nr(setup->REDIR_NR, (Q931_info_t *)setup, &type, &plan, &present, &screen, &reason, (unsigned char *)id, sizeof(id)-1, nt,bc);
+		dec_ie_redir_nr(setup->REDIR_NR, (Q931_info_t *)setup, &type, &plan, &present, &screen, &reason, id, sizeof(id)-1, nt,bc);
     
 		strcpy(bc->rad, id);
 		bc->rnumplan=type; 
@@ -374,7 +374,7 @@
   
 	{
 		int type=bc->cpnnumplan, plan=1, present=2, screen=0;
-		enc_ie_connected_pn(&connect->CONNECT_PN, msg, type,plan, present, screen, (unsigned char*) bc->cad, nt , bc);
+		enc_ie_connected_pn(&connect->CONNECT_PN, msg, type,plan, present, screen, bc->cad, nt , bc);
 	}
 
 #if DEBUG 
@@ -977,8 +977,8 @@
 		int  type, plan;
 		char number[32];
 		char keypad[32];
-		dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *)information, &type, &plan, (unsigned char *)number, sizeof(number)-1, nt, bc);
-		dec_ie_keypad(information->KEYPAD, (Q931_info_t *)information, (unsigned char *)keypad, sizeof(keypad)-1, nt, bc);
+		dec_ie_called_pn(information->CALLED_PN, (Q931_info_t *)information, &type, &plan, number, sizeof(number)-1, nt, bc);
+		dec_ie_keypad(information->KEYPAD, (Q931_info_t *)information, keypad, sizeof(keypad)-1, nt, bc);
 		strcpy(bc->info_dad, number);
 		strcpy(bc->keypad,keypad);
 	}



More information about the asterisk-commits mailing list