[Asterisk-cvs] asterisk/channels chan_iax2.c,1.244,1.245

markster at lists.digium.com markster at lists.digium.com
Sun Jan 30 15:30:56 CST 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv12286/channels

Modified Files:
	chan_iax2.c 
Log Message:
Merge IAX2 peer completion patch (bug #3462)


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.244
retrieving revision 1.245
diff -u -d -r1.244 -r1.245
--- chan_iax2.c	30 Jan 2005 06:50:46 -0000	1.244
+++ chan_iax2.c	30 Jan 2005 21:32:26 -0000	1.245
@@ -1690,6 +1690,26 @@
 	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 @@
 { { "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);
 




More information about the svn-commits mailing list