mgcp: Allow to change the receive (the loopback part) via the VTY
This commit is contained in:
parent
98a3877e97
commit
c597a4eba1
|
@ -42,6 +42,7 @@ struct mgcp_endpoint {
|
||||||
char *callid;
|
char *callid;
|
||||||
char *local_options;
|
char *local_options;
|
||||||
int conn_mode;
|
int conn_mode;
|
||||||
|
int orig_mode;
|
||||||
|
|
||||||
int bts_payload_type;
|
int bts_payload_type;
|
||||||
int net_payload_type;
|
int net_payload_type;
|
||||||
|
|
|
@ -409,6 +409,8 @@ static struct msgb *handle_create_con(struct mgcp_config *cfg, struct msgb *msg)
|
||||||
error_code = 517;
|
error_code = 517;
|
||||||
goto error2;
|
goto error2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
endp->orig_mode = endp->conn_mode;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOGP(DMGCP, LOGL_NOTICE, "Unhandled option: '%c'/%d on 0x%x\n",
|
LOGP(DMGCP, LOGL_NOTICE, "Unhandled option: '%c'/%d on 0x%x\n",
|
||||||
|
@ -513,6 +515,7 @@ static struct msgb *handle_modify_con(struct mgcp_config *cfg, struct msgb *msg)
|
||||||
error_code = 517;
|
error_code = 517;
|
||||||
goto error3;
|
goto error3;
|
||||||
}
|
}
|
||||||
|
endp->orig_mode = endp->conn_mode;
|
||||||
break;
|
break;
|
||||||
case 'Z':
|
case 'Z':
|
||||||
silent = strcmp("noanswer", (const char *)&msg->l3h[line_start + 3]) == 0;
|
silent = strcmp("noanswer", (const char *)&msg->l3h[line_start + 3]) == 0;
|
||||||
|
@ -762,4 +765,6 @@ void mgcp_free_endp(struct mgcp_endpoint *endp)
|
||||||
|
|
||||||
endp->net_seq_no = endp->bts_seq_no = 0;
|
endp->net_seq_no = endp->bts_seq_no = 0;
|
||||||
endp->net_lost_no = endp->bts_lost_no = 0;
|
endp->net_lost_no = endp->bts_lost_no = 0;
|
||||||
|
|
||||||
|
endp->conn_mode = endp->orig_mode = MGCP_CONN_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,12 +254,41 @@ DEFUN(cfg_mgcp_agent_addr,
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFUN(loop_endp,
|
||||||
|
loop_endp_cmd,
|
||||||
|
"loop-endpoint NAME (0|1)",
|
||||||
|
"Loop a given endpoint\n"
|
||||||
|
"The name in hex of the endpoint\n" "Enable/Disable the loop\n")
|
||||||
|
{
|
||||||
|
struct mgcp_endpoint *endp;
|
||||||
|
|
||||||
|
int endp_no = strtoul(argv[0], NULL, 16);
|
||||||
|
if (endp_no < 1 || endp_no >= g_cfg->number_endpoints) {
|
||||||
|
vty_out(vty, "Loopback number %s/%d is invalid.%s",
|
||||||
|
argv[0], endp_no, VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
endp = &g_cfg->endpoints[endp_no];
|
||||||
|
int loop = atoi(argv[1]);
|
||||||
|
|
||||||
|
if (loop)
|
||||||
|
endp->conn_mode = MGCP_CONN_LOOPBACK;
|
||||||
|
else
|
||||||
|
endp->conn_mode = endp->orig_mode;
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
int mgcp_vty_init(void)
|
int mgcp_vty_init(void)
|
||||||
{
|
{
|
||||||
install_element_ve(&show_mgcp_cmd);
|
install_element_ve(&show_mgcp_cmd);
|
||||||
|
install_element(ENABLE_NODE, &loop_endp_cmd);
|
||||||
|
|
||||||
install_element(CONFIG_NODE, &cfg_mgcp_cmd);
|
install_element(CONFIG_NODE, &cfg_mgcp_cmd);
|
||||||
install_node(&mgcp_node, config_write_mgcp);
|
install_node(&mgcp_node, config_write_mgcp);
|
||||||
|
|
||||||
install_default(MGCP_NODE);
|
install_default(MGCP_NODE);
|
||||||
install_element(MGCP_NODE, &ournode_exit_cmd);
|
install_element(MGCP_NODE, &ournode_exit_cmd);
|
||||||
install_element(MGCP_NODE, &ournode_end_cmd);
|
install_element(MGCP_NODE, &ournode_end_cmd);
|
||||||
|
|
Loading…
Reference in New Issue