[svn-commits] crichter: branch 1.2 r49135 - in /branches/1.2: channels/ channels/misdn/ con...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Jan 2 03:07:24 MST 2007


Author: crichter
Date: Tue Jan  2 04:07:22 2007
New Revision: 49135

URL: http://svn.digium.com/view/asterisk?view=rev&rev=49135
Log:
added check for channel ranges in the set/empty channel functions. set pmp_l1_check default to no. added misdn restart pid cli command. added cleaning of channel when we send a RELEASE_COMPLETE. 

Modified:
    branches/1.2/channels/chan_misdn.c
    branches/1.2/channels/misdn/isdn_lib.c
    branches/1.2/channels/misdn/isdn_lib.h
    branches/1.2/channels/misdn_config.c
    branches/1.2/configs/misdn.conf.sample

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=49135&r1=49134&r2=49135
==============================================================================
--- branches/1.2/channels/chan_misdn.c (original)
+++ branches/1.2/channels/chan_misdn.c Tue Jan  2 04:07:22 2007
@@ -578,6 +578,20 @@
 	return 0;
 }
 
+static int misdn_restart_pid (int fd, int argc, char *argv[])
+{
+	int pid;
+  
+	if (argc != 4)
+		return RESULT_SHOWUSAGE;
+  
+	pid = atoi(argv[3]);
+
+	misdn_lib_pid_restart(pid);
+
+	return 0;
+}
+
 static int misdn_port_up (int fd, int argc, char *argv[])
 {
 	int port;
@@ -1155,6 +1169,13 @@
   "Usage: misdn restart port\n"
 };
 
+static struct ast_cli_entry cli_restart_pid =
+{ {"misdn","restart","pid", NULL},
+  misdn_restart_pid,
+  "Restarts the given pid", 
+  "Usage: misdn restart pid\n"
+};
+
 static struct ast_cli_entry cli_port_up =
 { {"misdn","port","up", NULL},
   misdn_port_up,
@@ -4215,6 +4236,7 @@
 	ast_cli_register(&cli_port_block);
 	ast_cli_register(&cli_port_unblock);
 	ast_cli_register(&cli_restart_port);
+	ast_cli_register(&cli_restart_pid);
 	ast_cli_register(&cli_port_up);
 	ast_cli_register(&cli_port_down);
 	ast_cli_register(&cli_set_debug);
@@ -4280,7 +4302,7 @@
 	ast_cli_unregister(&cli_show_stacks);
 	ast_cli_unregister(&cli_port_block);
 	ast_cli_unregister(&cli_port_unblock);
-	ast_cli_unregister(&cli_restart_port);
+	ast_cli_unregister(&cli_restart_pid);
 	ast_cli_unregister(&cli_port_up);
 	ast_cli_unregister(&cli_port_down);
 	ast_cli_unregister(&cli_set_debug);

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=49135&r1=49134&r2=49135
==============================================================================
--- branches/1.2/channels/misdn/isdn_lib.c (original)
+++ branches/1.2/channels/misdn/isdn_lib.c Tue Jan  2 04:07:22 2007
@@ -174,6 +174,7 @@
 int manager_isdn_handler(iframe_t *frm ,msg_t *msg);
 
 int misdn_lib_port_restart(int port);
+int misdn_lib_pid_restart(int pid);
 
 extern struct isdn_msg msgs_g[]; 
 
@@ -446,7 +447,7 @@
 
 int empty_chan_in_stack(struct misdn_stack *stack, int channel)
 {
-	if (channel<=0) {
+	if (channel<=0 || channel>=MAX_BCHANS) {
 		cb_log(0,stack?stack->port:0, "empty_chan_inst_stack: cannot empty channel %d\n",channel);
 		return -1;
 	}
@@ -666,7 +667,7 @@
 
 	cb_log(4,stack->port,"set_chan_in_stack: %d\n",channel);
 	dump_chan_list(stack);
-	if (channel >=1 ) {
+	if (channel >=1 && channel <= MAX_BCHANS) {
 		if (!stack->channels[channel-1])
 			stack->channels[channel-1] = 1;
 		else {
@@ -2807,7 +2808,6 @@
 				stack->l1link=0;
 
 			clear_l3(stack);
-			
 			break;
 
 		case SSTATUS_L2_ESTABLISHED:
@@ -3307,6 +3307,16 @@
 		bc->need_disconnect=0;
 		bc->need_release=0;
 		bc->need_release_complete=0;
+
+		if (!stack->nt) {
+			/*create clenaup in TE*/
+			if (bc->channel>0)
+				empty_chan_in_stack(stack,bc->channel);
+			int tmpcause=bc->cause;	
+			empty_bc(bc);
+			bc->cause=tmpcause;
+			clean_up_bc(bc);
+		}
 		break;
     
 	case EVENT_CONNECT_ACKNOWLEDGE:
@@ -3556,6 +3566,15 @@
 
 	return 0; 
 
+}
+
+int misdn_lib_pid_restart(int pid) 
+{
+	struct misdn_bchannel *bc=manager_find_bc_by_pid(pid);
+
+	if (bc) {
+		manager_clean_bc(bc);
+	}
 }
 
 int misdn_lib_port_restart(int port)
@@ -4042,7 +4061,7 @@
 		empty_chan_in_stack(stack, bc->channel);
 	empty_bc(bc);
   
-	misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+	cb_event(EVENT_CLEANUP, bc, NULL); 
 }
 
 

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=49135&r1=49134&r2=49135
==============================================================================
--- branches/1.2/channels/misdn/isdn_lib.h (original)
+++ branches/1.2/channels/misdn/isdn_lib.h Tue Jan  2 04:07:22 2007
@@ -413,6 +413,8 @@
 
 
 int misdn_lib_port_restart(int port);
+int misdn_lib_pid_restart(int pid);
+
 int misdn_lib_get_port_info(int port);
 
 int misdn_lib_is_port_blocked(int port);

Modified: branches/1.2/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn_config.c?view=diff&rev=49135&r1=49134&r2=49135
==============================================================================
--- branches/1.2/channels/misdn_config.c (original)
+++ branches/1.2/channels/misdn_config.c Tue Jan  2 04:07:22 2007
@@ -89,7 +89,7 @@
 	{ "txgain", MISDN_CFG_TXGAIN, MISDN_CTYPE_INT, "0", NONE },
 	{ "te_choose_channel", MISDN_CFG_TE_CHOOSE_CHANNEL, MISDN_CTYPE_BOOL, "no", NONE },
 	{ "far_alerting", MISDN_CFG_FAR_ALERTING, MISDN_CTYPE_BOOL, "no", NONE },
-	{ "pmp_l1_check", MISDN_CFG_PMP_L1_CHECK, MISDN_CTYPE_BOOL, "yes", NONE },
+	{ "pmp_l1_check", MISDN_CFG_PMP_L1_CHECK, MISDN_CTYPE_BOOL, "no", NONE },
 	{ "reject_cause", MISDN_CFG_REJECT_CAUSE, MISDN_CTYPE_INT, "21", NONE },
 	{ "block_on_alarm", MISDN_CFG_ALARM_BLOCK, MISDN_CTYPE_BOOL, "no", NONE },
 	{ "hdlc", MISDN_CFG_HDLC, MISDN_CTYPE_BOOL, "no", NONE },

Modified: branches/1.2/configs/misdn.conf.sample
URL: http://svn.digium.com/view/asterisk/branches/1.2/configs/misdn.conf.sample?view=diff&rev=49135&r1=49134&r2=49135
==============================================================================
--- branches/1.2/configs/misdn.conf.sample (original)
+++ branches/1.2/configs/misdn.conf.sample Tue Jan  2 04:07:22 2007
@@ -183,9 +183,9 @@
 ; as well, since chan_misdn has no chance to distinguish if the L1 is down
 ; because of a lost Link or because the Provider shut it down...
 ;
-; default: yes
-;
-pmp_l1_check=yes
+; default: no
+;
+pmp_l1_check=no
 
 
 



More information about the svn-commits mailing list