aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-30 21:32:26 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-30 21:32:26 +0000
commitbb66637fef93cba9a6f26820cda3fc0deda0c0cd (patch)
treebbebf1dab0bee206f648c015012d4d1b98ea2b27 /channels
parent8a62a05b1794cc14e31eb33b76c9986f515502b5 (diff)
Merge IAX2 peer completion patch (bug #3462)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4934 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_iax2.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 41671fede..b14d5027b 100755
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -1690,6 +1690,26 @@ static int iax2_show_peer(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
+static char *complete_iax2_show_peer(char *line, char *word, int pos, int state)
+{
+ int which = 0;
+ struct iax2_peer *p;
+
+ /* 0 - iax2; 1 - show; 2 - peer; 3 - <peername> */
+ if(pos == 3) {
+ ast_mutex_lock(&peerl.lock);
+ for(p = peerl.peers ; p ; p = p->next) {
+ if(!strncasecmp(p->name, word, strlen(word))) {
+ if(++which > state) {
+ return strdup(p->name);
+ }
+ }
+ }
+ ast_mutex_unlock(&peerl.lock);
+ }
+
+ return NULL;
+}
static int iax2_show_stats(int fd, int argc, char *argv[])
{
@@ -1788,7 +1808,7 @@ static struct ast_cli_entry cli_show_cache =
{ { "iax2", "show", "cache", NULL }, iax2_show_cache, "Display IAX cached dialplan", show_cache_usage };
static struct ast_cli_entry cli_show_peer =
- { { "iax2", "show", "peer", NULL }, iax2_show_peer, "Show details on specific IAX peer", show_peer_usage };
+ { { "iax2", "show", "peer", NULL }, iax2_show_peer, "Show details on specific IAX peer", show_peer_usage, complete_iax2_show_peer };
static unsigned int calc_rxstamp(struct chan_iax2_pvt *p, unsigned int offset);