[asterisk-commits] branch crichter/0.3.0 r11714 - in
/team/crichter/0.3.0/channels: ./ misdn/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Mar 3 08:30:54 MST 2006
Author: crichter
Date: Fri Mar 3 09:30:50 2006
New Revision: 11714
URL: http://svn.digium.com/view/asterisk?rev=11714&view=rev
Log:
added port down, removed uneeded extra check, args for _control functions are now long
Modified:
team/crichter/0.3.0/channels/chan_misdn.c
team/crichter/0.3.0/channels/misdn/isdn_lib.c
team/crichter/0.3.0/channels/misdn/isdn_lib.h
Modified: team/crichter/0.3.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/chan_misdn.c?rev=11714&r1=11713&r2=11714&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/chan_misdn.c (original)
+++ team/crichter/0.3.0/channels/chan_misdn.c Fri Mar 3 09:30:50 2006
@@ -514,6 +514,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[])
{
@@ -1029,6 +1043,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},
@@ -2803,9 +2826,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");
@@ -3731,6 +3752,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);
@@ -3785,6 +3807,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: team/crichter/0.3.0/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.c?rev=11714&r1=11713&r2=11714&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.c (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.c Fri Mar 3 09:30:50 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)
{
@@ -1445,6 +1488,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) {
@@ -3250,7 +3309,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 */
@@ -3269,7 +3328,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: team/crichter/0.3.0/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.h?rev=11714&r1=11713&r2=11714&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.h (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.h Fri Mar 3 09:30:50 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