mirror of
https://github.com/asterisk/asterisk.git
synced 2026-06-05 13:55:30 +00:00
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.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@49135 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -578,6 +578,20 @@ static int misdn_restart_port (int fd, int argc, char *argv[])
|
||||
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 @@ static struct ast_cli_entry cli_restart_port =
|
||||
"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 @@ int load_module(void)
|
||||
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 @@ int unload_module(void)
|
||||
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);
|
||||
|
||||
@@ -174,6 +174,7 @@ int setup_bc(struct misdn_bchannel *bc);
|
||||
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 @@ static int find_free_chan_in_stack(struct misdn_stack *stack, int channel)
|
||||
|
||||
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 @@ int set_chan_in_stack(struct misdn_stack *stack, int channel)
|
||||
|
||||
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 @@ int handle_mgmt(msg_t *msg)
|
||||
stack->l1link=0;
|
||||
|
||||
clear_l3(stack);
|
||||
|
||||
break;
|
||||
|
||||
case SSTATUS_L2_ESTABLISHED:
|
||||
@@ -3307,6 +3307,16 @@ int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event )
|
||||
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:
|
||||
@@ -3558,6 +3568,15 @@ int queue_cleanup_bc(struct misdn_bchannel *bc)
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct misdn_stack *stack=find_stack_by_port(port);
|
||||
@@ -4042,7 +4061,7 @@ void manager_clean_bc(struct misdn_bchannel *bc )
|
||||
empty_chan_in_stack(stack, bc->channel);
|
||||
empty_bc(bc);
|
||||
|
||||
misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
|
||||
cb_event(EVENT_CLEANUP, bc, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -413,6 +413,8 @@ void manager_ph_control(struct misdn_bchannel *bc, int c1, int c2);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
@@ -89,7 +89,7 @@ static const struct misdn_cfg_spec port_spec[] = {
|
||||
{ "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 },
|
||||
|
||||
@@ -183,9 +183,9 @@ te_choose_channel=no
|
||||
; 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
|
||||
; default: no
|
||||
;
|
||||
pmp_l1_check=yes
|
||||
pmp_l1_check=no
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user