aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authordhubbard <dhubbard@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-13 21:23:10 +0000
committerdhubbard <dhubbard@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-13 21:23:10 +0000
commitcaed1e358dc757d1301207108eb28556d1fb6547 (patch)
tree0be51a9220e970c2b7963c540e8fdb1582ca942e /channels/chan_sip.c
parent40e0339ef9af0e3011d49cc8900ec9e79bbe1beb (diff)
added CLI 'sip unregister <peer>' for issue 9326. thanks eliel
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@61660 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 77f13f6c2..28ae6a386 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1399,6 +1399,7 @@ static int _sip_show_peer(int type, int fd, struct mansession *s, const struct m
static int sip_show_peer(int fd, int argc, char *argv[]);
static int sip_show_user(int fd, int argc, char *argv[]);
static int sip_show_registry(int fd, int argc, char *argv[]);
+static int sip_unregister(int fd, int argc, char *argv[]);
static int sip_show_settings(int fd, int argc, char *argv[]);
static const char *subscription_type2str(enum subscriptiontype subtype) attribute_pure;
static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype);
@@ -10942,6 +10943,25 @@ static int sip_show_registry(int fd, int argc, char *argv[])
#undef FORMAT2
}
+/*! \brief Unregister (force expiration) a SIP peer in the registry via CLI */
+static int sip_unregister(int fd, int argc, char *argv[])
+{
+ struct sip_peer *peer;
+ int load_realtime = 0;
+
+ if (argc != 3)
+ return RESULT_SHOWUSAGE;
+
+ if ((peer = find_peer(argv[2], NULL, load_realtime))) {
+ expire_register(peer);
+ ast_cli(fd, "Unregistered peer \'%s\'\n\n", argv[2]);
+ } else {
+ ast_cli(fd, "Attempted to unregister an unknown peer \'%s\' via CLI\n", argv[2]);
+ }
+
+ return 0;
+}
+
/*! \brief List global settings for the SIP channel */
static int sip_show_settings(int fd, int argc, char *argv[])
{
@@ -11942,6 +11962,10 @@ static const char show_reg_usage[] =
"Usage: sip show registry\n"
" Lists all registration requests and status.\n";
+static const char sip_unregister_usage[] =
+"Usage: sip unregister <peer>\n"
+" Unregister (force expiration) a SIP peer from the registry\n";
+
static const char debug_usage[] =
"Usage: sip debug\n"
" Enables dumping of SIP packets for debugging purposes\n\n"
@@ -18065,6 +18089,10 @@ static struct ast_cli_entry cli_sip[] = {
sip_show_registry, "List SIP registration status",
show_reg_usage },
+ { { "sip", "unregister", NULL },
+ sip_unregister, "Unregister (force expiration) a SIP peer from the registery\n",
+ sip_unregister_usage },
+
{ { "sip", "show", "settings", NULL },
sip_show_settings, "Show SIP global settings",
show_settings_usage },