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[])
{
"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},
misdn_show_stacks,
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");
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);
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);
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);
#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)
{
/* Pull Up L1 */
}
+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) {
/*
* 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 */
/*
* 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;
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_port_up(int port, int notcheck);
+int misdn_lib_get_port_down(int port);
+
int misdn_lib_get_port_up (int port) ;
int misdn_lib_maxports_get(void) ;