[asterisk-commits] dhubbard: trunk r61660 -
/trunk/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Apr 13 14:23:10 MST 2007
Author: dhubbard
Date: Fri Apr 13 16:23:10 2007
New Revision: 61660
URL: http://svn.digium.com/view/asterisk?view=rev&rev=61660
Log:
added CLI 'sip unregister <peer>' for issue 9326. thanks eliel
Modified:
trunk/channels/chan_sip.c
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=61660&r1=61659&r2=61660
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Apr 13 16:23:10 2007
@@ -1399,6 +1399,7 @@
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 @@
#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[])
{
@@ -11941,6 +11961,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"
@@ -18065,6 +18089,10 @@
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 },
More information about the asterisk-commits
mailing list