diff options
author | Harald Welte <laforge@gnumonks.org> | 2012-01-27 00:41:39 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2012-01-27 00:41:39 +0100 |
commit | 6a85705d517dc3b88c23768b451ea9464fd1b7a0 (patch) | |
tree | 2b283e63d2d21899e472a15960ee91db7b4772b2 /openbsc/src/libmgcp/mgcp_protocol.c | |
parent | 50f93a4acde733ab03b85cde9c525bad1a3aec8b (diff) |
MGCP: Add VTY commands to reset (RSIP) one or all endpoints
Diffstat (limited to 'openbsc/src/libmgcp/mgcp_protocol.c')
-rw-r--r-- | openbsc/src/libmgcp/mgcp_protocol.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c index 538c35015..607e230ff 100644 --- a/openbsc/src/libmgcp/mgcp_protocol.c +++ b/openbsc/src/libmgcp/mgcp_protocol.c @@ -1087,6 +1087,36 @@ static void send_dlcx(struct mgcp_endpoint *endp, int endpoint) send_trans(endp->cfg, buf, len); } +static int send_agent(struct mgcp_config *cfg, const char *buf, int len) +{ + return write(cfg->gw_fd.bfd.fd, buf, len); +} + +int mgcp_send_reset_all(struct mgcp_config *cfg) +{ + static const char mgcp_reset[] = { + "RSIP 1 *@mgw MGCP 1.0\r\n" + }; + + return send_agent(cfg, mgcp_reset, sizeof mgcp_reset -1); +} + +int mgcp_send_reset_ep(struct mgcp_endpoint *endp, int endpoint) +{ + char buf[128]; + int len; + + len = snprintf(buf, sizeof(buf), + "RSIP 39 %x@mgw MGCP 1.0\r\n" + , endpoint); + if (len < 0) + return len; + + buf[sizeof(buf) - 1] = '\0'; + + return send_agent(endp->cfg, buf, len); +} + static void create_transcoder(struct mgcp_endpoint *endp) { int port; |