[asterisk-commits] trunk r12288 - in /trunk/channels: ./ misdn/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Mar 7 04:17:00 MST 2006


Author: crichter
Date: Tue Mar  7 05:16:56 2006
New Revision: 12288

URL: http://svn.digium.com/view/asterisk?rev=12288&view=rev
Log:
added misdn port down to send a L1 Deactivate to a NT Port. changed some default values regarding jitterbuffer.

Modified:
    trunk/channels/chan_misdn.c
    trunk/channels/misdn/isdn_lib.c
    trunk/channels/misdn/isdn_lib.h

Modified: trunk/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_misdn.c?rev=12288&r1=12287&r2=12288&view=diff
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Tue Mar  7 05:16:56 2006
@@ -515,6 +515,20 @@
 	return 0;
 }
 
+static int misdn_port_down (int fd, int argc, char *argv[])
+{
+	int port;
+	
+	if (argc != 4)
+		return RESULT_SHOWUSAGE;
+	
+	port = atoi(argv[3]);
+	
+	misdn_lib_get_port_down(port);
+  
+	return 0;
+}
+
 
 static int misdn_show_config (int fd, int argc, char *argv[])
 {
@@ -1030,6 +1044,15 @@
   "Tries to establish L1 on the given port", 
   "Usage: misdn port up <port>\n"
 };
+
+static struct ast_cli_entry cli_port_down =
+{ {"misdn","port","down", NULL},
+  misdn_port_down,
+  "Tries to deacivate the L1 on the given port", 
+  "Usage: misdn port up <port>\n"
+};
+
+
 
 static struct ast_cli_entry cli_show_stacks =
 { {"misdn","show","stacks", NULL},
@@ -2807,9 +2830,7 @@
 				default:
 					chan_misdn_log(2,  bc->port, "* --> In State Default\n");
 					chan_misdn_log(2,  bc->port, "* --> Queue Hangup\n");
-	
-					
-					if (ast && MISDN_ASTERISK_PVT(ast)) {
+					if (ast) {
 						ast_queue_hangup(ast);
 					} else {
 						chan_misdn_log (0,  bc->port, "!! Not really queued!\n");
@@ -3735,6 +3756,7 @@
 
 	ast_cli_register(&cli_restart_port);
 	ast_cli_register(&cli_port_up);
+	ast_cli_register(&cli_port_down);
 	ast_cli_register(&cli_set_debug);
 	ast_cli_register(&cli_set_crypt_debug);
 	ast_cli_register(&cli_reload);
@@ -3789,6 +3811,7 @@
 	ast_cli_unregister(&cli_show_stacks);
 	ast_cli_unregister(&cli_restart_port);
 	ast_cli_unregister(&cli_port_up);
+	ast_cli_unregister(&cli_port_down);
 	ast_cli_unregister(&cli_set_debug);
 	ast_cli_unregister(&cli_set_crypt_debug);
 	ast_cli_unregister(&cli_reload);

Modified: trunk/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.c?rev=12288&r1=12287&r2=12288&view=diff
==============================================================================
--- trunk/channels/misdn/isdn_lib.c (original)
+++ trunk/channels/misdn/isdn_lib.c Tue Mar  7 05:16:56 2006
@@ -192,7 +192,7 @@
 struct misdn_bchannel *manager_find_bc_by_pid(int pid);
 struct misdn_bchannel *manager_find_bc_holded(struct misdn_bchannel* bc);
 unsigned char * manager_flip_buf_bits ( unsigned char * buf , int len);
-void manager_ph_control_block(struct misdn_bchannel *bc, int c1, void *c2, int c2_len);
+void manager_ph_control_block(struct misdn_bchannel *bc, long c1, void *c2, int c2_len);
 void manager_clean_bc(struct misdn_bchannel *bc );
 void manager_bchannel_setup (struct misdn_bchannel *bc);
 void manager_bchannel_cleanup (struct misdn_bchannel *bc);
@@ -595,6 +595,49 @@
 static int newteid=0;
 
 #define MAXPROCS 0x100
+
+int misdn_lib_get_l1_down(struct misdn_stack *stack)
+{
+	/* Pull Up L1 */ 
+	iframe_t act;
+	act.prim = PH_DEACTIVATE | REQUEST; 
+	act.addr = (stack->upper_id | FLG_MSG_DOWN)  ;
+
+	
+	act.dinfo = 0;
+	act.len = 0;
+
+	return mISDN_write(stack->midev, &act, mISDN_HEADER_LEN+act.len, TIMEOUT_1SEC);
+
+
+}
+
+
+int misdn_lib_get_l2_down(struct misdn_stack *stack)
+{
+	
+	if (stack->ptp && (stack->nt) ) {
+		msg_t *dmsg;
+		/* L2 */
+		dmsg = create_l2msg(DL_RELEASE| REQUEST, 0, 0);
+		
+		if (stack->nst.manager_l3(&stack->nst, dmsg))
+			free_msg(dmsg);
+		
+	} else {
+		iframe_t act;
+		
+		act.prim = DL_RELEASE| REQUEST;
+		act.addr = (stack->upper_id |FLG_MSG_DOWN)  ;
+		
+		act.dinfo = 0;
+		act.len = 0;
+		return mISDN_write(stack->midev, &act, mISDN_HEADER_LEN+act.len, TIMEOUT_1SEC);
+	}
+	
+	return 0;
+}
+
 
 int misdn_lib_get_l1_up(struct misdn_stack *stack)
 {
@@ -1443,6 +1486,22 @@
 }
 
 
+int misdn_lib_get_port_down (int port) 
+{ /* Pull Down L1 */ 
+	struct misdn_stack *stack;
+	for (stack=glob_mgr->stack_list;
+	     stack;
+	     stack=stack->next) {
+		if (stack->port == port) {
+				if (stack->l2link)
+					misdn_lib_get_l2_down(stack);
+				misdn_lib_get_l1_down(stack);
+			return 0;
+		}
+	}
+	return 0;
+}
+
 int misdn_lib_send_facility(struct misdn_bchannel *bc, enum facility_type fac, void *data)
 {
 	switch (fac) {
@@ -3246,7 +3305,7 @@
 /*
  * send control information to the channel (dsp-module)
  */
-void manager_ph_control(struct misdn_bchannel *bc, int c1, int c2)
+void manager_ph_control(struct misdn_bchannel *bc, long c1, long c2)
 {
 	unsigned char buffer[mISDN_HEADER_LEN+2*sizeof(long)];
 	iframe_t *ctrl = (iframe_t *)buffer; /* preload data */
@@ -3265,7 +3324,7 @@
 /*
  * send control information to the channel (dsp-module)
  */
-void manager_ph_control_block(struct misdn_bchannel *bc, int c1, void *c2, int c2_len)
+void manager_ph_control_block(struct misdn_bchannel *bc, long c1, void *c2, int c2_len)
 {
 	unsigned char buffer[mISDN_HEADER_LEN+sizeof(long)+c2_len];
 	iframe_t *ctrl = (iframe_t *)buffer;

Modified: trunk/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.h?rev=12288&r1=12287&r2=12288&view=diff
==============================================================================
--- trunk/channels/misdn/isdn_lib.h (original)
+++ trunk/channels/misdn/isdn_lib.h Tue Mar  7 05:16:56 2006
@@ -329,13 +329,15 @@
 
 int misdn_lib_tx2misdn_frm(struct misdn_bchannel *bc, void *data, int len);
 
-void manager_ph_control(struct misdn_bchannel *bc, int c1, int c2);
+void manager_ph_control(struct misdn_bchannel *bc, long c1, long c2);
 
 
 int misdn_lib_port_restart(int port);
 int misdn_lib_get_port_info(int port);
 
 int misdn_lib_port_up(int port, int notcheck);
+
+int misdn_lib_get_port_down(int port);
 
 int misdn_lib_get_port_up (int port) ;
      



More information about the asterisk-commits mailing list