[asterisk-commits] russell: branch russell/chan_console r82058 - in /team/russell/chan_console: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 8 23:11:56 CDT 2007


Author: russell
Date: Sat Sep  8 23:11:55 2007
New Revision: 82058

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82058
Log:
resolve, reset

Added:
    team/russell/chan_console/funcs/func_extstate.c
      - copied unchanged from r82029, trunk/funcs/func_extstate.c
Modified:
    team/russell/chan_console/   (props changed)
    team/russell/chan_console/.cleancount
    team/russell/chan_console/CHANGES
    team/russell/chan_console/Makefile
    team/russell/chan_console/apps/app_meetme.c
    team/russell/chan_console/apps/app_queue.c
    team/russell/chan_console/apps/app_voicemail.c
    team/russell/chan_console/apps/app_zapateller.c
    team/russell/chan_console/channels/chan_gtalk.c
    team/russell/chan_console/channels/chan_phone.c
    team/russell/chan_console/channels/chan_sip.c
    team/russell/chan_console/channels/chan_skinny.c
    team/russell/chan_console/channels/chan_zap.c
    team/russell/chan_console/channels/iax2-parser.c
    team/russell/chan_console/configs/extensions.conf.sample
    team/russell/chan_console/configs/queues.conf.sample
    team/russell/chan_console/configure.ac
    team/russell/chan_console/contrib/scripts/safe_asterisk
    team/russell/chan_console/funcs/func_devstate.c
    team/russell/chan_console/include/asterisk/astobj2.h
    team/russell/chan_console/include/asterisk/audiohook.h
    team/russell/chan_console/include/asterisk/autoconfig.h.in
    team/russell/chan_console/include/asterisk/channel.h
    team/russell/chan_console/include/asterisk/config.h
    team/russell/chan_console/include/asterisk/devicestate.h
    team/russell/chan_console/include/asterisk/features.h
    team/russell/chan_console/include/asterisk/file.h
    team/russell/chan_console/include/asterisk/jabber.h
    team/russell/chan_console/include/asterisk/lock.h
    team/russell/chan_console/include/asterisk/sha1.h
    team/russell/chan_console/include/asterisk/slinfactory.h
    team/russell/chan_console/include/asterisk/stringfields.h
    team/russell/chan_console/include/asterisk/strings.h
    team/russell/chan_console/main/asterisk.c
    team/russell/chan_console/main/astobj2.c
    team/russell/chan_console/main/audiohook.c
    team/russell/chan_console/main/channel.c
    team/russell/chan_console/main/config.c
    team/russell/chan_console/main/file.c
    team/russell/chan_console/main/say.c
    team/russell/chan_console/main/sha1.c
    team/russell/chan_console/res/res_config_odbc.c
    team/russell/chan_console/res/res_config_sqlite.c
    team/russell/chan_console/res/res_crypto.c
    team/russell/chan_console/res/res_features.c
    team/russell/chan_console/res/res_jabber.c
    team/russell/chan_console/utils/   (props changed)

Propchange: team/russell/chan_console/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/russell/chan_console/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/russell/chan_console/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Sep  8 23:11:55 2007
@@ -1,1 +1,1 @@
-/trunk:1-81460
+/trunk:1-82057

Modified: team/russell/chan_console/.cleancount
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/.cleancount?view=diff&rev=82058&r1=82057&r2=82058
==============================================================================
--- team/russell/chan_console/.cleancount (original)
+++ team/russell/chan_console/.cleancount Sat Sep  8 23:11:55 2007
@@ -1,1 +1,1 @@
-31
+32

Modified: team/russell/chan_console/CHANGES
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/CHANGES?view=diff&rev=82058&r1=82057&r2=82058
==============================================================================
--- team/russell/chan_console/CHANGES (original)
+++ team/russell/chan_console/CHANGES Sat Sep  8 23:11:55 2007
@@ -25,7 +25,7 @@
 
 Dialplan functions
 ------------------
-  * Added the DEVSTATE() dialplan function which allows retrieving any device
+  * Added the DEVICE_STATE() dialplan function which allows retrieving any device
     state in the dialplan, as well as creating custom device states that are
     controllable from the dialplan.
   * Extend CALLERID() function with "pres" and "ton" parameters to
@@ -38,6 +38,12 @@
     mutex.  No deadlocks are possible, as LOCK() only allows a single lock to be
     held for any given channel.  Also, locks are automatically freed when a
     channel is hung up.
+  * Added HINT() dialplan function that allows retrieving hint information.
+    Hints are mappings between extensions and devices for the sake of 
+    determining the state of an extension.  This function can retrieve the list
+    of devices or the name associated with a hint.
+  * Added EXTENSION_STATE() dialplan function which allows retrieving the state
+    of any extension.
 
 CLI Changes
 -----------
@@ -83,6 +89,10 @@
   * Added the srvlookup option to iax.conf
   * Added support for OSP.  The token is set and retrieved through the CHANNEL()
      dialplan function.
+
+Skinny changes
+-------------
+  * Added skinny show device, skinny show line, and skinny show settings CLI commands.
 
 DUNDi changes
 -------------

Modified: team/russell/chan_console/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/Makefile?view=diff&rev=82058&r1=82057&r2=82058
==============================================================================
--- team/russell/chan_console/Makefile (original)
+++ team/russell/chan_console/Makefile Sat Sep  8 23:11:55 2007
@@ -77,8 +77,9 @@
 endif
 
 # Some build systems, such as the one in openwrt, like to pass custom target
-# CFLAGS in the COPTS variable.
+# CFLAGS and LDFLAGS in the COPTS and LDOPTS variables.
 ASTCFLAGS+=$(COPTS)
+ASTLDFLAGS+=$(LDOPTS)
 
 #Uncomment this to see all build commands instead of 'quiet' output
 #NOISY_BUILD=yes

Modified: team/russell/chan_console/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/apps/app_meetme.c?view=diff&rev=82058&r1=82057&r2=82058
==============================================================================
--- team/russell/chan_console/apps/app_meetme.c (original)
+++ team/russell/chan_console/apps/app_meetme.c Sat Sep  8 23:11:55 2007
@@ -1819,13 +1819,6 @@
 					if (musiconhold == 0 && (confflags & CONFFLAG_MOH)) {
 						ast_moh_start(chan, NULL, NULL);
 						musiconhold = 1;
-					} else {
-						ztc.confmode = ZT_CONF_CONF;
-						if (ioctl(fd, ZT_SETCONF, &ztc)) {
-							ast_log(LOG_WARNING, "Error setting conference\n");
-							close(fd);
-							goto outrun;
-						}
 					}
 				} else if(currentmarked >= 1 && lastmarked == 0) {
 					/* Marked user entered, so cancel timeout */

Modified: team/russell/chan_console/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/apps/app_queue.c?view=diff&rev=82058&r1=82057&r2=82058
==============================================================================
--- team/russell/chan_console/apps/app_queue.c (original)
+++ team/russell/chan_console/apps/app_queue.c Sat Sep  8 23:11:55 2007
@@ -193,13 +193,15 @@
 static char *app_pqm = "PauseQueueMember" ;
 static char *app_pqm_synopsis = "Pauses a queue member" ;
 static char *app_pqm_descrip =
-"   PauseQueueMember([queuename],interface[,options]):\n"
+"   PauseQueueMember([queuename],interface[,options[,reason]]):\n"
 "Pauses (blocks calls for) a queue member.\n"
 "The given interface will be paused in the given queue.  This prevents\n"
 "any calls from being sent from the queue to the interface until it is\n"
 "unpaused with UnpauseQueueMember or the manager interface.  If no\n"
 "queuename is given, the interface is paused in every queue it is a\n"
 "member of. The application will fail if the interface is not found.\n"
+"The reason string is entirely optional and is used to add extra information\n"
+"to the appropriate queue_log entries and manager events.\n"
 "  This application sets the following channel variable upon completion:\n"
 "     PQMSTATUS      The status of the attempt to pause a queue member as a\n"
 "                     text string, one of\n"
@@ -209,10 +211,12 @@
 static char *app_upqm = "UnpauseQueueMember" ;
 static char *app_upqm_synopsis = "Unpauses a queue member" ;
 static char *app_upqm_descrip =
-"   UnpauseQueueMember([queuename],interface[,options]):\n"
+"   UnpauseQueueMember([queuename],interface[,options[,reason]]):\n"
 "Unpauses (resumes calls to) a queue member.\n"
 "This is the counterpart to PauseQueueMember and operates exactly the\n"
 "same way, except it unpauses instead of pausing the given interface.\n"
+"The reason string is entirely optional and is used to add extra information\n"
+"to the appropriate queue_log entries and manager events.\n"
 "  This application sets the following channel variable upon completion:\n"
 "     UPQMSTATUS       The status of the attempt to unpause a queue \n"
 "                      member as a text string, one of\n"
@@ -412,7 +416,7 @@
 static AST_LIST_HEAD_STATIC(queues, call_queue);
 
 static void update_realtime_members(struct call_queue *q);
-static int set_member_paused(const char *queuename, const char *interface, int paused);
+static int set_member_paused(const char *queuename, const char *interface, const char *reason, int paused);
 
 static void set_queue_result(struct ast_channel *chan, enum queue_result res)
 {
@@ -2013,7 +2017,7 @@
 	ast_verb(3, "Nobody picked up in %d ms\n", rnatime);
 	ast_queue_log(qe->parent->name, qe->chan->uniqueid, membername, "RINGNOANSWER", "%d", rnatime);
 	if (qe->parent->autopause) {
-		if (!set_member_paused(qe->parent->name, interface, 1)) {
+		if (!set_member_paused(qe->parent->name, interface, "Auto-Pause", 1)) {
 			ast_verb(3, "Auto-Pausing Queue Member %s in queue %s since they failed to answer.\n", interface, qe->parent->name);
 		} else {
 			ast_verb(3, "Failed to pause Queue Member %s in queue %s!\n", interface, qe->parent->name);
@@ -2041,9 +2045,16 @@
 	char on[80] = "";
 	char membername[80] = "";
 	long starttime = 0;
-	long endtime = 0;	
+	long endtime = 0;
+#ifdef HAVE_EPOLL
+	struct callattempt *epollo;
+#endif
 
 	starttime = (long) time(NULL);
+#ifdef HAVE_EPOLL
+	for (epollo = outgoing; epollo; epollo = epollo->q_next)
+		ast_poll_channel_add(in, epollo->chan);
+#endif
 	
 	while (*to && !peer) {
 		int numlines, retry, pos = 1;
@@ -2248,6 +2259,11 @@
 			rna(orig, qe, on, membername);
 	}
 
+#ifdef HAVE_EPOLL
+	for(epollo = outgoing; epollo; epollo = epollo->q_next)
+		ast_poll_channel_del(in, epollo->chan);
+#endif
+
 	return peer;
 }
 
@@ -2625,11 +2641,11 @@
 			/* Must gotten hung up */
 			res = -1;
 		} else {
+			/* User exited by pressing a digit */
 			res = digit;
-			if (res > 0 && !valid_exit(qe, res))
-				res = 0;
-		}
-		ast_debug(1, "%s: Nobody answered.\n", qe->chan->name);
+		}
+		if (res == -1)
+			ast_debug(1, "%s: Nobody answered.\n", qe->chan->name);
 	} else { /* peer is valid */
 		/* Ah ha!  Someone answered within the desired timeframe.  Of course after this
 		   we will always return with -1 so that it is hung up properly after the
@@ -2726,6 +2742,27 @@
 				ast_log(LOG_WARNING, "Announcement file '%s' is unavailable, continuing anyway...\n", qe->parent->sound_callerannounce);
 		}
 
+		ast_mutex_lock(&qe->parent->lock);
+		/* if setinterfacevar is defined, make member variables available to the channel */
+		/* use  pbx_builtin_setvar to set a load of variables with one call */
+		if (qe->parent->setinterfacevar) {
+			snprintf(interfacevar,sizeof(interfacevar), "MEMBERINTERFACE=%s|MEMBERNAME=%s|MEMBERCALLS=%d|MEMBERLASTCALL=%ld|MEMBERPENALTY=%d|MEMBERDYNAMIC=%d|MEMBERREALTIME=%d",
+				member->interface, member->membername, member->calls, (long)member->lastcall, member->penalty, member->dynamic, member->realtime);
+		 	pbx_builtin_setvar(qe->chan, interfacevar);
+		}
+		
+		/* if setqueueentryvar is defined, make queue entry (i.e. the caller) variables available to the channel */
+		/* use  pbx_builtin_setvar to set a load of variables with one call */
+		if (qe->parent->setqueueentryvar) {
+			snprintf(interfacevar,sizeof(interfacevar), "QEHOLDTIME=%ld|QEORIGINALPOS=%d",
+				(long) time(NULL) - qe->start, qe->opos);
+			pbx_builtin_setvar(qe->chan, interfacevar);
+		}
+	
+		/* try to set queue variables if configured to do so*/
+		set_queue_variables(qe);
+		ast_mutex_unlock(&qe->parent->lock);
+		
 		/* Begin Monitoring */
 		if (qe->parent->monfmt && *qe->parent->monfmt) {
 			if (!qe->parent->montype) {
@@ -2820,27 +2857,6 @@
 			ast_channel_sendurl(peer, url);
 		}
 		
-		ast_mutex_lock(&qe->parent->lock);
-		/* if setinterfacevar is defined, make member variables available to the channel */
-		/* use  pbx_builtin_setvar to set a load of variables with one call */
-		if (qe->parent->setinterfacevar) {
-			snprintf(interfacevar,sizeof(interfacevar), "MEMBERINTERFACE=%s|MEMBERNAME=%s|MEMBERCALLS=%d|MEMBERLASTCALL=%ld|MEMBERPENALTY=%d|MEMBERDYNAMIC=%d|MEMBERREALTIME=%d",
-				member->interface, member->membername, member->calls, (long)member->lastcall, member->penalty, member->dynamic, member->realtime);
-		 	pbx_builtin_setvar(qe->chan, interfacevar);
-		}
-		
-		/* if setqueueentryvar is defined, make queue entry (i.e. the caller) variables available to the channel */
-		/* use  pbx_builtin_setvar to set a load of variables with one call */
-		if (qe->parent->setqueueentryvar) {
-			snprintf(interfacevar,sizeof(interfacevar), "QEHOLDTIME=%ld|QEORIGINALPOS=%d",
-				(long) time(NULL) - qe->start, qe->opos);
-			pbx_builtin_setvar(qe->chan, interfacevar);
-		}
-	
-		/* try to set queue variables if configured to do so*/
-		set_queue_variables(qe);
-		ast_mutex_unlock(&qe->parent->lock);
-		
 		/* run a macro for this connection if defined. The macro simply returns, no action is taken on the result */
 		/* use macro from dialplan if passed as a option, otherwise use the default queue macro */
 		if (!ast_strlen_zero(macro)) {
@@ -3166,7 +3182,7 @@
 	return res;
 }
 
-static int set_member_paused(const char *queuename, const char *interface, int paused)
+static int set_member_paused(const char *queuename, const char *interface, const char *reason, int paused)
 {
 	int found = 0;
 	struct call_queue *q;
@@ -3194,14 +3210,24 @@
 				if(mem->realtime)
 					update_realtime_member_field(mem, queuename, "paused", paused ? "1" : "0");
 
-				ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"), "%s", "");
-
-				manager_event(EVENT_FLAG_AGENT, "QueueMemberPaused",
-					"Queue: %s\r\n"
-					"Location: %s\r\n"
-					"MemberName: %s\r\n"
-					"Paused: %d\r\n",
-						q->name, mem->interface, mem->membername, paused);
+				ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"), "%s", S_OR(reason, ""));
+				
+				if (!ast_strlen_zero(reason)) {
+					manager_event(EVENT_FLAG_AGENT, "QueueMemberPaused",
+						"Queue: %s\r\n"
+						"Location: %s\r\n"
+						"MemberName: %s\r\n"
+						"Paused: %d\r\n"
+						"Reason: %s\r\n",
+							q->name, mem->interface, mem->membername, paused, reason);
+				} else {
+					manager_event(EVENT_FLAG_AGENT, "QueueMemberPaused",
+						"Queue: %s\r\n"
+						"Location: %s\r\n"
+						"MemberName: %s\r\n"
+						"Paused: %d\r\n",
+							q->name, mem->interface, mem->membername, paused);
+				}
 			}
 		}
 		ast_mutex_unlock(&q->lock);
@@ -3313,10 +3339,11 @@
 		AST_APP_ARG(queuename);
 		AST_APP_ARG(interface);
 		AST_APP_ARG(options);
+		AST_APP_ARG(reason);
 	);
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "PauseQueueMember requires an argument ([queuename]|interface[|options])\n");
+		ast_log(LOG_WARNING, "PauseQueueMember requires an argument ([queuename]|interface[|options][|reason])\n");
 		return -1;
 	}
 
@@ -3325,11 +3352,11 @@
 	AST_STANDARD_APP_ARGS(args, parse);
 
 	if (ast_strlen_zero(args.interface)) {
-		ast_log(LOG_WARNING, "Missing interface argument to PauseQueueMember ([queuename]|interface[|options])\n");
+		ast_log(LOG_WARNING, "Missing interface argument to PauseQueueMember ([queuename]|interface[|options[|reason]])\n");
 		return -1;
 	}
 
-	if (set_member_paused(args.queuename, args.interface, 1)) {
+	if (set_member_paused(args.queuename, args.interface, args.reason, 1)) {
 		ast_log(LOG_WARNING, "Attempt to pause interface %s, not found\n", args.interface);
 		pbx_builtin_setvar_helper(chan, "PQMSTATUS", "NOTFOUND");
 		return -1;
@@ -3347,10 +3374,11 @@
 		AST_APP_ARG(queuename);
 		AST_APP_ARG(interface);
 		AST_APP_ARG(options);
+		AST_APP_ARG(reason);
 	);
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "UnpauseQueueMember requires an argument ([queuename]|interface[|options])\n");
+		ast_log(LOG_WARNING, "UnpauseQueueMember requires an argument ([queuename]|interface[|options[|reason]])\n");
 		return -1;
 	}
 
@@ -3359,11 +3387,11 @@
 	AST_STANDARD_APP_ARGS(args, parse);
 
 	if (ast_strlen_zero(args.interface)) {
-		ast_log(LOG_WARNING, "Missing interface argument to PauseQueueMember ([queuename]|interface[|options])\n");
+		ast_log(LOG_WARNING, "Missing interface argument to PauseQueueMember ([queuename]|interface[|options[|reason]])\n");
 		return -1;
 	}
 
-	if (set_member_paused(args.queuename, args.interface, 0)) {
+	if (set_member_paused(args.queuename, args.interface, args.reason, 0)) {
 		ast_log(LOG_WARNING, "Attempt to unpause interface %s, not found\n", args.interface);
 		pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "NOTFOUND");
 		return -1;
@@ -3821,6 +3849,7 @@
 {
 	int count = 0;
 	struct call_queue *q;
+	struct member *m;
 
 	buf[0] = '\0';
 	
@@ -3839,7 +3868,12 @@
 	AST_LIST_UNLOCK(&queues);
 
 	if (q) {
-		count = q->membercount;
+		for (m = q->members; m; m = m->next) {
+			/* Count the agents who are logged in and presently answering calls */
+			if ((m->status != AST_DEVICE_UNAVAILABLE) && (m->status != AST_DEVICE_INVALID)) {
+				count++;
+			}
+		}
 		ast_mutex_unlock(&q->lock);
 	} else
 		ast_log(LOG_WARNING, "queue %s was not found\n", data);
@@ -4535,12 +4569,13 @@
 
 static int manager_pause_queue_member(struct mansession *s, const struct message *m)
 {
-	const char *queuename, *interface, *paused_s;
+	const char *queuename, *interface, *paused_s, *reason;
 	int paused;
 
 	interface = astman_get_header(m, "Interface");
 	paused_s = astman_get_header(m, "Paused");
-	queuename = astman_get_header(m, "Queue");	/* Optional - if not supplied, pause the given Interface in all queues */
+	queuename = astman_get_header(m, "Queue");      /* Optional - if not supplied, pause the given Interface in all queues */
+	reason = astman_get_header(m, "Reason");        /* Optional - Only used for logging purposes */
 
 	if (ast_strlen_zero(interface) || ast_strlen_zero(paused_s)) {
 		astman_send_error(s, m, "Need 'Interface' and 'Paused' parameters.");
@@ -4549,7 +4584,7 @@
 
 	paused = abs(ast_true(paused_s));
 
-	if (set_member_paused(queuename, interface, paused))
+	if (set_member_paused(queuename, interface, reason, paused))
 		astman_send_error(s, m, "Interface not found");
 	else
 		astman_send_ack(s, m, paused ? "Interface paused successfully" : "Interface unpaused successfully");

Modified: team/russell/chan_console/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/apps/app_voicemail.c?view=diff&rev=82058&r1=82057&r2=82058
==============================================================================
--- team/russell/chan_console/apps/app_voicemail.c (original)
+++ team/russell/chan_console/apps/app_voicemail.c Sat Sep  8 23:11:55 2007
@@ -4618,7 +4618,7 @@
 {
 	BODY *body;
 	char *header_content;
-	char cid[256];
+	char cid[256], cidN[256];
 	char context[256];
 	char origtime[32];
 	char duration[16];
@@ -4682,11 +4682,16 @@
 	}
 
 	/* Get info from headers!! */
+	if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:", buf, sizeof(buf))))
+		ast_copy_string(cidN, temp, sizeof(cidN));
+	else
+		cidN[0] = '\0';
+
 	if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:", buf, sizeof(buf))))
-		ast_copy_string(cid, temp, sizeof(cid)); 
-	else 
+		snprintf(cid, sizeof(cid), "\"%s\" <%s>", cidN, temp);
+	else
 		cid[0] = '\0';
-	
+
 	if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Context:", buf, sizeof(buf))))
 		ast_copy_string(context, temp, sizeof(context)); 
 	else
@@ -8656,14 +8661,16 @@
 {
 	int res = 0;
 #ifdef IMAP_STORAGE
-	char origtimeS[256], cidS[256], contextS[256];
+	char origtimeS[256], cidN[256], cid[256], contextS[256];
 	char *header_content, *temp;
 	char buf[1024];
+#else
+	char *cid;
 #endif
 	char filename[PATH_MAX];
 	struct ast_config *msg_cfg = NULL;
 	const char *origtime, *context;
-	char *cid, *name, *num;
+	char *name, *num;
 	int retries = 0;
 	struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
 
@@ -8686,12 +8693,14 @@
 	}
 	
 	/* Get info from headers!! */
+	if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:", buf, sizeof(buf))))
+		ast_copy_string(cidN, temp, sizeof(cidN));
+	else
+		cidN[0] = '\0';
+
 	if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:", buf, sizeof(buf))))
-		ast_copy_string(cidS, temp, sizeof(cidS));
+		snprintf(cid, sizeof(cid), "\"%s\" <%s>",cidN, temp);
 	else
-		cidS[0] = '\0';
-	
-	cid = &cidS[0];
 
 	if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Context:", buf, sizeof(buf))))
 		ast_copy_string(contextS,temp, sizeof(contextS));

Modified: team/russell/chan_console/apps/app_zapateller.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/apps/app_zapateller.c?view=diff&rev=82058&r1=82057&r2=82058
==============================================================================
--- team/russell/chan_console/apps/app_zapateller.c (original)
+++ team/russell/chan_console/apps/app_zapateller.c Sat Sep  8 23:11:55 2007
@@ -50,10 +50,14 @@
 "  Zapateller(options):  Generates special information tone to block\n"
 "telemarketers from calling you.  Options is a pipe-delimited list of\n" 
 "options.  The following options are available:\n"
-"'answer' causes the line to be answered before playing the tone,\n" 
-"'nocallerid' causes Zapateller to only play the tone if there\n"
-"is no callerid information available.  Options should be separated by |\n"
-"characters\n";
+"    'answer'     - causes the line to be answered before playing the tone,\n" 
+"    'nocallerid' - causes Zapateller to only play the tone if there is no\n"
+"                   callerid information available.  Options should be\n"
+"                   separated by | characters\n\n"
+"  This application will set the following channel variable upon completion:\n"
+"    ZAPATELLERSTATUS - This will contain the last action accomplished by the\n"
+"                        Zapateller application. Possible values include:\n"
+"                        NOTHING | ANSWERED | ZAPPED\n\n";
 
 
 static int zapateller_exec(struct ast_channel *chan, void *data)
@@ -74,10 +78,13 @@
 			nocallerid = 1;
 	}
 
+	pbx_builtin_setvar_helper(chan, "ZAPATELLERSTATUS", "NOTHING");
 	ast_stopstream(chan);
 	if (chan->_state != AST_STATE_UP) {
-		if (answer) 
+		if (answer) {
 			res = ast_answer(chan);
+			pbx_builtin_setvar_helper(chan, "ZAPATELLERSTATUS", "ANSWERED");
+		}
 		if (!res)
 			res = ast_safe_sleep(chan, 500);
 	}
@@ -93,7 +100,8 @@
 		res = ast_tonepair(chan, 1800, 0, 330, 0);
 	if (!res) 
 		res = ast_tonepair(chan, 0, 0, 1000, 0);
-
+	
+	pbx_builtin_setvar_helper(chan, "ZAPATELLERSTATUS", "ZAPPED");
 	return res;
 }
 

Modified: team/russell/chan_console/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_gtalk.c?view=diff&rev=82058&r1=82057&r2=82058
==============================================================================
--- team/russell/chan_console/channels/chan_gtalk.c (original)
+++ team/russell/chan_console/channels/chan_gtalk.c Sat Sep  8 23:11:55 2007
@@ -111,8 +111,8 @@
 	time_t laststun;
 	struct gtalk *parent;	         /*!< Parent client */
 	char sid[100];
-	char us[100];
-	char them[100];
+	char us[AJI_MAX_JIDLEN];
+	char them[AJI_MAX_JIDLEN];
 	char ring[10];                   /*!< Message ID of ring */
 	iksrule *ringrule;               /*!< Rule for matching RING request */
 	int initiator;                   /*!< If we're the initiator */
@@ -154,8 +154,8 @@
 	struct gtalk_pvt *p;
 	struct ast_codec_pref prefs;
 	int amaflags;			/*!< AMA Flags */
-	char user[100];
-	char context[100];
+	char user[AJI_MAX_JIDLEN];
+	char context[AST_MAX_CONTEXT];
 	char accountcode[AST_MAX_ACCOUNT_CODE];	/*!< Account code */
 	int capability;
 	ast_group_t callgroup;	/*!< Call group */
@@ -1572,7 +1572,7 @@
 	struct gtalk_pvt *p;
 	struct ast_channel *chan;
 	int numchans = 0;
-	char them[100];
+	char them[AJI_MAX_JIDLEN];
 	char *jid = NULL;
 	char *resource = NULL;
 
@@ -1760,7 +1760,7 @@
 {
 	char *cat = NULL;
 	struct ast_config *cfg = NULL;
-	char context[100];
+	char context[AST_MAX_CONTEXT];
 	int allowguest = 1;
 	struct ast_variable *var;
 	struct gtalk *member;

Modified: team/russell/chan_console/channels/chan_phone.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_phone.c?view=diff&rev=82058&r1=82057&r2=82058
==============================================================================
--- team/russell/chan_console/channels/chan_phone.c (original)
+++ team/russell/chan_console/channels/chan_phone.c Sat Sep  8 23:11:55 2007
@@ -1284,7 +1284,8 @@
 {
 	struct phone_pvt *p, *pl;
 	/* First, take us out of the channel loop */
-	ast_channel_unregister(cur_tech);
+	if (cur_tech)
+		ast_channel_unregister(cur_tech);
 	if (!ast_mutex_lock(&iflock)) {
 		/* Hangup all interfaces if they have an owner */
 		p = iflist;
@@ -1359,7 +1360,7 @@
 	if (ast_mutex_lock(&iflock)) {
 		/* It's a little silly to lock it, but we mind as well just to be sure */
 		ast_log(LOG_ERROR, "Unable to lock interface list???\n");
-		return -1;
+		return AST_MODULE_LOAD_FAILURE;
 	}
 	v = ast_variable_browse(cfg, "interfaces");
 	while(v) {
@@ -1375,7 +1376,7 @@
 					ast_config_destroy(cfg);
 					ast_mutex_unlock(&iflock);
 					__unload_module();
-					return -1;
+					return AST_MODULE_LOAD_FAILURE;
 				}
 		} else if (!strcasecmp(v->name, "silencesupression")) {
 			silencesupression = ast_true(v->value);
@@ -1445,12 +1446,12 @@
 		ast_log(LOG_ERROR, "Unable to register channel class 'Phone'\n");
 		ast_config_destroy(cfg);
 		__unload_module();
-		return -1;
+		return AST_MODULE_LOAD_FAILURE;
 	}
 	ast_config_destroy(cfg);
 	/* And start the monitor for the first time */
 	restart_monitor();
-	return 0;
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Linux Telephony API Support");

Modified: team/russell/chan_console/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_sip.c?view=diff&rev=82058&r1=82057&r2=82058
==============================================================================
--- team/russell/chan_console/channels/chan_sip.c (original)
+++ team/russell/chan_console/channels/chan_sip.c Sat Sep  8 23:11:55 2007
@@ -662,8 +662,8 @@
 #define DEC_CALL_RINGING 2
 #define INC_CALL_RINGING 3
 
-/*! \brief sip_request: The data grabbed from the UDP socket
- *
+/*! \brief The data grabbed from the UDP socket
+ * \verbatim
  * Incoming messages: we first store the data from the socket in data[],
  * adding a trailing \0 to make string parsing routines happy.
  * Then call parse_request() and req.method = find_sip_method();
@@ -683,11 +683,12 @@
  * and then fill the rest with add_header() and add_line().
  * The \r\n at the end of the line are still there, so the get_header()
  * and similar functions don't work on these packets. 
+ * \endverbatim
  */
 struct sip_request {
 	char *rlPart1; 	        /*!< SIP Method Name or "SIP/2.0" protocol version */
 	char *rlPart2; 	        /*!< The Request URI or Response Status */
-	int len;                /*!< bytes used in data[], excluding trailing '\0'. Rarely used. */
+	int len;                /*!< bytes used in data[], excluding trailing null terminator. Rarely used. */
 	int headers;            /*!< # of SIP Headers */
 	int method;             /*!< Method of this request */
 	int lines;              /*!< Body Content */
@@ -1824,7 +1825,7 @@
 /* wrapper macro to tell whether t points to one of the sip_tech descriptors */
 #define IS_SIP_TECH(t)  ((t) == &sip_tech || (t) == &sip_tech_info)
 
-/*! \begin map from an integer value to a string.
+/*! \brief map from an integer value to a string.
  * If no match is found, return errorstring
  */
 static const char *map_x_s(const struct _map_x_s *table, int x, const char *errorstring)
@@ -1837,7 +1838,7 @@
 	return errorstring;
 }
 
-/*! \begin map from a string to an integer value, case insensitive.
+/*! \brief map from a string to an integer value, case insensitive.
  * If no match is found, return errorvalue.
  */
 static int map_s_x(const struct _map_x_s *table, const char *s, int errorvalue)
@@ -14007,8 +14008,17 @@
 	transferer->readformat = chan2->readformat;
 	transferer->writeformat = chan2->writeformat;
 
-	/* Prepare for taking over the channel */
+	/* Prepare for taking over the channel.  Go ahead and grab this channel
+	 * lock here to avoid a deadlock with callbacks into the channel driver
+	 * that hold the channel lock and want the pvt lock.  */
+	while (ast_channel_trylock(chan2)) {
+		struct sip_pvt *pvt = chan2->tech_pvt;
+		sip_pvt_unlock(pvt);
+		usleep(1);
+		sip_pvt_lock(pvt);
+	}
 	ast_channel_masquerade(transferer, chan2);
+	ast_channel_unlock(chan2);
 
 	/* Setup the extensions and such */
 	ast_copy_string(transferer->context, chan2->context, sizeof(transferer->context));

Modified: team/russell/chan_console/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_skinny.c?view=diff&rev=82058&r1=82057&r2=82058
==============================================================================
--- team/russell/chan_console/channels/chan_skinny.c (original)
+++ team/russell/chan_console/channels/chan_skinny.c Sat Sep  8 23:11:55 2007
@@ -2179,9 +2179,9 @@
 
 static int skinny_do_debug(int fd, int argc, char *argv[])
 {
-	if (argc != 3) {
+	if (argc != 3)
 		return RESULT_SHOWUSAGE;
-	}
+
 	skinnydebug = 1;
 	ast_cli(fd, "Skinny Debugging Enabled\n");
 	return RESULT_SUCCESS;
@@ -2189,26 +2189,52 @@
 
 static int skinny_no_debug(int fd, int argc, char *argv[])
 {
-	if (argc != 4) {
+	if (argc != 4)
 		return RESULT_SHOWUSAGE;
-	}
+
 	skinnydebug = 0;
 	ast_cli(fd, "Skinny Debugging Disabled\n");
 	return RESULT_SUCCESS;
 }
 
+static char *complete_skinny_devices(const char *word, int state)
+{
+	struct skinny_device *d;
+	char *result = NULL;
+	int wordlen = strlen(word), which = 0;
+
+	for (d = devices; d && !result; d = d->next) {
+		if (!strncasecmp(word, d->id, wordlen) && ++which > state)
+			result = ast_strdup(d->id);
+	}
+
+	return result;
+}
+
+static char *complete_skinny_show_device(const char *line, const char *word, int pos, int state)
+{
+	return (pos == 3 ? ast_strdup(complete_skinny_devices(word, state)) : NULL);
+}
+
 static char *complete_skinny_reset(const char *line, const char *word, int pos, int state)
 {
+	return (pos == 2 ? ast_strdup(complete_skinny_devices(word, state)) : NULL);
+}
+
+static char *complete_skinny_show_lines(const char *line, const char *word, int pos, int state)
+{
 	struct skinny_device *d;
-
+	struct skinny_line *l;
 	char *result = NULL;
-	int wordlen = strlen(word);
-	int which = 0;
-
-	if (pos == 2) {
-		for (d = devices; d && !result; d = d->next) {
-			if (!strncasecmp(word, d->id, wordlen) && ++which > state)
-				result = ast_strdup(d->id);
+	int wordlen = strlen(word), which = 0;
+
+	if (pos != 3)
+		return NULL;
+	
+	for (d = devices; d && !result; d = d->next) {
+		for (l = d->lines; l && !result; l = l->next) {
+			if (!strncasecmp(word, l->name, wordlen) && ++which > state)
+				result = ast_strdup(l->name);
 		}
 	}
 
@@ -2220,14 +2246,14 @@
 	struct skinny_device *d;
 	struct skinny_req *req;
 
-	if (argc < 3 || argc > 4) {
+	if (argc < 3 || argc > 4)
 		return RESULT_SHOWUSAGE;
-	}
+
 	ast_mutex_lock(&devicelock);
 
 	for (d = devices; d; d = d->next) {
 		int fullrestart = 0;
-		if (!strcasecmp(argv[2], d->id) || !strcasecmp(argv[2], "all")) {
+		if (!strcasecmp(argv[2], d->id) || !strcasecmp(argv[2], d->name) || !strcasecmp(argv[2], "all")) {
 			if (!(d->session))
 				continue;
 
@@ -2321,32 +2347,97 @@
 	}
 }
 
+/*! \brief Print codec list from preference to CLI/manager */
+static void print_codec_to_cli(int fd, struct ast_codec_pref *pref)
+{
+	int x, codec;
+
+	for(x = 0; x < 32 ; x++) {
+		codec = ast_codec_pref_index(pref, x);
+		if (!codec)
+			break;
+		ast_cli(fd, "%s", ast_getformatname(codec));
+		ast_cli(fd, ":%d", pref->framing[x]);
+		if (x < 31 && ast_codec_pref_index(pref, x + 1))
+			ast_cli(fd, ",");
+	}
+	if (!x)
+		ast_cli(fd, "none");
+}
+
 static int skinny_show_devices(int fd, int argc, char *argv[])
 {
 	struct skinny_device *d;
 	struct skinny_line *l;
-	int numlines = 0;
-
-	if (argc != 3) {
+
+	if (argc != 3)
 		return RESULT_SHOWUSAGE;
-	}
+
 	ast_mutex_lock(&devicelock);
 
 	ast_cli(fd, "Name                 DeviceId         IP              Type            R NL\n");
 	ast_cli(fd, "-------------------- ---------------- --------------- --------------- - --\n");
+
 	for (d = devices; d; d = d->next) {
-		numlines = 0;
-		for (l = d->lines; l; l = l->next) {
+		int numlines = 0;
+
+		for (l = d->lines; l; l = l->next)
 			numlines++;
-		}
-
+		
 		ast_cli(fd, "%-20s %-16s %-15s %-15s %c %2d\n",
-				d->name,
-				d->id,
-				d->session?ast_inet_ntoa(d->session->sin.sin_addr):"",
-				device2str(d->type),
-				d->registered?'Y':'N',
-				numlines);
+			d->name,
+			d->id,
+			d->session?ast_inet_ntoa(d->session->sin.sin_addr):"",
+			device2str(d->type),
+			d->registered?'Y':'N',
+			numlines);
+	}
+
+	ast_mutex_unlock(&devicelock);
+
+	return RESULT_SUCCESS;
+}
+
+/*! \brief Show device information */
+static int skinny_show_device(int fd, int argc, char *argv[])
+{
+	struct skinny_device *d;
+	struct skinny_line *l;
+	struct skinny_speeddial *sd;
+	struct skinny_addon *a;
+
+	if (argc < 4)
+		return RESULT_SHOWUSAGE;
+
+	ast_mutex_lock(&devicelock);
+	for (d = devices; d; d = d->next) {
+		if (!strcasecmp(argv[3], d->id) || !strcasecmp(argv[3], d->name)) {
+			int numlines = 0, numaddons = 0, numspeeddials = 0;
+
+			for (l = d->lines; l; l = l->next)
+				numlines++;
+
+			ast_cli(fd, "Name:        %s\n", d->name);
+			ast_cli(fd, "Id:          %s\n", d->id);
+			ast_cli(fd, "version:     %s\n", S_OR(d->version_id, "Unknown"));
+			ast_cli(fd, "Ip address:  %s\n", (d->session ? ast_inet_ntoa(d->session->sin.sin_addr) : "Unknown"));
+			ast_cli(fd, "Port:        %d\n", (d->session ? ntohs(d->session->sin.sin_port) : 0));
+			ast_cli(fd, "Device Type: %s\n", device2str(d->type));
+			ast_cli(fd, "Registered:  %s\n", (d->registered ? "Yes" : "No"));
+			ast_cli(fd, "Lines:       %d\n", numlines);
+			for (l = d->lines; l; l = l->next)
+				ast_cli(fd, "  %s (%s)\n", l->name, l->label);
+			for (a = d->addons; a; a = a->next)
+				numaddons++;
+			ast_cli(fd, "Addons:      %d\n", numaddons);
+			for (a = d->addons; a; a = a->next)
+				ast_cli(fd, "  %s\n", a->type);
+			for (sd = d->speeddials; sd; sd = sd->next)
+				numspeeddials++;
+			ast_cli(fd, "Speeddials:  %d\n", numspeeddials);
+			for (sd = d->speeddials; sd; sd = sd->next)
+				ast_cli(fd, "  %s (%s) ishint: %d\n", sd->exten, sd->label, sd->isHint);
+		}
 	}
 	ast_mutex_unlock(&devicelock);
 	return RESULT_SUCCESS;
@@ -2357,11 +2448,11 @@
 	struct skinny_device *d;
 	struct skinny_line *l;
 
-	if (argc != 3) {
+	if (argc != 3)
 		return RESULT_SHOWUSAGE;
-	}
+	
 	ast_mutex_lock(&devicelock);
-
+	
 	ast_cli(fd, "Device Name          Instance Name                 Label               \n");
 	ast_cli(fd, "-------------------- -------- -------------------- --------------------\n");
 	for (d = devices; d; d = d->next) {
@@ -2373,8 +2464,97 @@
 				l->label);
 		}
 	}
-
+	
 	ast_mutex_unlock(&devicelock);
+	return RESULT_SUCCESS;
+}
+
+/*! \brief List line information. */
+static int skinny_show_line(int fd, int argc, char *argv[])
+{
+	struct skinny_device *d;
+	struct skinny_line *l;
+
+	char codec_buf[512];
+	char group_buf[256];
+
+	if (argc < 4)
+		return RESULT_SHOWUSAGE;
+	
+	ast_mutex_lock(&devicelock);
+
+	/* Show all lines matching the one supplied */
+	for (d = devices; d; d = d->next) {
+		if (argc == 6 && (strcasecmp(argv[5], d->id) && strcasecmp(argv[5], d->name)))
+			continue;
+		for (l = d->lines; l; l = l->next) {
+			if (strcasecmp(argv[3], l->name))
+				continue;
+			ast_cli(fd, "Line:             %s\n", l->name);
+			ast_cli(fd, "On Device:        %s\n", d->name);
+			ast_cli(fd, "Line Label:       %s\n", l->label);
+			ast_cli(fd, "Extension:        %s\n", S_OR(l->exten, "<not set>"));
+			ast_cli(fd, "Context:          %s\n", l->context);
+			ast_cli(fd, "CallGroup:        %s\n", ast_print_group(group_buf, sizeof(group_buf), l->callgroup));
+			ast_cli(fd, "PickupGroup:      %s\n", ast_print_group(group_buf, sizeof(group_buf), l->pickupgroup));
+			ast_cli(fd, "Language:         %s\n", S_OR(l->language, "<not set>"));
+			ast_cli(fd, "Accountcode:      %s\n", S_OR(l->accountcode, "<not set>"));
+			ast_cli(fd, "AmaFlag:          %s\n", ast_cdr_flags2str(l->amaflags));
+			ast_cli(fd, "CallerId Number:  %s\n", S_OR(l->cid_num, "<not set>"));
+			ast_cli(fd, "CallerId Name:    %s\n", S_OR(l->cid_name, "<not set>"));
+			ast_cli(fd, "Hide CallerId:    %s\n", (l->hidecallerid ? "Yes" : "No"));
+			ast_cli(fd, "CallForward:      %s\n", S_OR(l->call_forward, "<not set>"));
+			ast_cli(fd, "VoicemailBox:     %s\n", S_OR(l->mailbox, "<not set>"));
+			ast_cli(fd, "VoicemailNumber:  %s\n", S_OR(l->vmexten, "<not set>"));
+			ast_cli(fd, "MWIblink:         %d\n", l->mwiblink);
+			ast_cli(fd, "Regextension:     %s\n", S_OR(l->regexten, "<not set>"));
+			ast_cli(fd, "Regcontext:       %s\n", S_OR(l->regcontext, "<not set>"));
+			ast_cli(fd, "MoHInterpret:     %s\n", S_OR(l->mohinterpret, "<not set>"));
+			ast_cli(fd, "MoHSuggest:       %s\n", S_OR(l->mohsuggest, "<not set>"));
+			ast_cli(fd, "Last dialed nr:   %s\n", S_OR(l->lastnumberdialed, "<no calls made yet>"));
+			ast_cli(fd, "Last CallerID:    %s\n", S_OR(l->lastcallerid, "<not set>"));
+			ast_cli(fd, "Transfer enabled: %s\n", (l->transfer ? "Yes" : "No"));
+			ast_cli(fd, "Callwaiting:      %s\n", (l->callwaiting ? "Yes" : "No"));
+			ast_cli(fd, "3Way Calling:     %s\n", (l->threewaycalling ? "Yes" : "No"));
+			ast_cli(fd, "Can forward:      %s\n", (l->cancallforward ? "Yes" : "No"));
+			ast_cli(fd, "Do Not Disturb:   %s\n", (l->dnd ? "Yes" : "No"));
+			ast_cli(fd, "NAT:              %s\n", (l->nat ? "Yes" : "No"));
+			ast_cli(fd, "immediate:        %s\n", (l->immediate ? "Yes" : "No"));
+			ast_cli(fd, "Group:            %d\n", l->group);
+			ast_cli(fd, "Codecs:           ");
+			ast_getformatname_multiple(codec_buf, sizeof(codec_buf) -1, l->capability);
+			ast_cli(fd, "%s\n", codec_buf);
+			ast_cli(fd, "Codec Order:      (");
+			print_codec_to_cli(fd, &l->prefs);
+			ast_cli(fd, ")\n");
+			ast_cli(fd, "\n");
+		}
+	}
+	
+	ast_mutex_unlock(&devicelock);
+	return RESULT_SUCCESS;
+}
+
+/*! \brief List global settings for the Skinny subsystem. */
+static int skinny_show_settings(int fd, int argc, char *argv[])
+{
+	if (argc != 3)
+		return RESULT_SHOWUSAGE;
+
+	ast_cli(fd, "\nGlobal Settings:\n");

[... 2405 lines stripped ...]



More information about the asterisk-commits mailing list