[asterisk-commits] murf: branch group/newcdr r171813 - in /team/group/newcdr: ./ apps/ channels/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 27 18:21:09 CST 2009


Author: murf
Date: Tue Jan 27 18:21:09 2009
New Revision: 171813

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=171813
Log:
Merged revisions 171691,171757,171793 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r171691 | mmichelson | 2009-01-27 14:58:39 -0700 (Tue, 27 Jan 2009) | 47 lines

Merged revisions 171689 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r171689 | mmichelson | 2009-01-27 15:55:08 -0600 (Tue, 27 Jan 2009) | 39 lines

Fix devicestate problems for "always-on" agent channels

A revision to chan_agent attempted to "inherit" the device
state of the underlying channel in order to report the
device state of an agent channel more accurately.

The problem with the logic here is that it makes no sense to
use this for always-on agents. If the agent is logged in, then
to the underlying channel, the agent will always appear to be
"in use," no matter if the agent is on a call or not. The reason
is that to the underlying channel, the channel is currently in use
on a call to the AgentLogin application.

The most common cause that I found for this issue to occur was for
a SIP channel to be the underlying channel type for an Agent channel.
If the SIP phone re-registers, then the registration will cause the
device state core to query the device state of the SIP channel. Since the
SIP channel is in use, the Agent channel would also inherit this status.
Once the agent channel was set to "in use" there was no way that the device
state could change on that channel unless the agent logged out.

The solution for this problem is a bit different in 1.4 than it is in the
other branches. In 1.4, there will be a one-line fix to make sure that only
callback agents will inherit device state from their underlying channel type.
For the other branches of Asterisk, since callback support has been removed, there
is also no need for device state inheritance in chan_agent, so I will simply be
removing it from the code.

In addition, the 1.4 source is getting a new comment to help the next person who
edits chan_agent.c. I'm adding a comment that a agent_pvt's loginchan field may be
used to determine if the agent is a callback agent or not.

(closes issue #14173)
Reported by: nathan
Patches:
      14173.patch uploaded by putnopvut (license 60)
Tested by: nathan, aramirez


........

................
r171757 | dvossel | 2009-01-27 15:43:36 -0700 (Tue, 27 Jan 2009) | 7 lines

Adding AES_ENCRYPT and AES_DECRYPT dialplan functions.  

(closes issue #14301)
Reported by: amorsen

review: http://reviewboard.digium.com/r/128/

................
r171793 | mattf | 2009-01-27 16:28:51 -0700 (Tue, 27 Jan 2009) | 1 line

Don't complain about lack of D-channels on PTMP connections
................

Added:
    team/group/newcdr/funcs/func_aes.c
      - copied unchanged from r171793, trunk/funcs/func_aes.c
Modified:
    team/group/newcdr/   (props changed)
    team/group/newcdr/CHANGES
    team/group/newcdr/apps/app_celgenuserevent.c
    team/group/newcdr/channels/chan_agent.c
    team/group/newcdr/channels/chan_dahdi.c

Propchange: team/group/newcdr/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jan 27 18:21:09 2009
@@ -1,1 +1,1 @@
-/trunk:1-171636
+/trunk:1-171793

Modified: team/group/newcdr/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/CHANGES?view=diff&rev=171813&r1=171812&r2=171813
==============================================================================
--- team/group/newcdr/CHANGES (original)
+++ team/group/newcdr/CHANGES Tue Jan 27 18:21:09 2009
@@ -78,6 +78,10 @@
    Totally.  Hopefully, that means more to you than it does to me.
  * Added AUDIOHOOK_INHERIT. For information on its use, please see the output
    of "core show function AUDIOHOOK_INHERIT" from the CLI
+ * Added AES_ENCRYPT. For information on its use, please see the output
+   of "core show function AES_ENCRYPT" from the CLI
+ * Added AES_DECRYPT. For information on its use, please see the output
+   of "core show function AES_DECRYPT" from the CLI
 
 Applications
 ------------

Modified: team/group/newcdr/apps/app_celgenuserevent.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/apps/app_celgenuserevent.c?view=diff&rev=171813&r1=171812&r2=171813
==============================================================================
--- team/group/newcdr/apps/app_celgenuserevent.c (original)
+++ team/group/newcdr/apps/app_celgenuserevent.c Tue Jan 27 18:21:09 2009
@@ -53,7 +53,6 @@
 static int celgenuserevent_exec(struct ast_channel *chan, void *data)
 {
 	int res = 0;
-	struct ast_module_user *u;
 	char *parse;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(event);

Modified: team/group/newcdr/channels/chan_agent.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_agent.c?view=diff&rev=171813&r1=171812&r2=171813
==============================================================================
--- team/group/newcdr/channels/chan_agent.c (original)
+++ team/group/newcdr/channels/chan_agent.c Tue Jan 27 18:21:09 2009
@@ -221,7 +221,6 @@
 static char savecallsin[AST_MAX_BUF] = "";
 static int updatecdr = 0;
 static char beep[AST_MAX_BUF] = "beep";
-struct ast_event_sub *agent_devicestate_sub = NULL;
 
 #define GETAGENTBYCALLERID	"AGENTBYCALLERID"
 
@@ -254,7 +253,6 @@
 	char agent[AST_MAX_AGENT];     /*!< Agent ID */
 	char password[AST_MAX_AGENT];  /*!< Password for Agent login */
 	char name[AST_MAX_AGENT];
-	int inherited_devicestate;     /*!< Does the underlying channel have a devicestate to pass? */
 	ast_mutex_t app_lock;          /**< Synchronization between owning applications */
 	int app_lock_flag;
 	ast_cond_t app_complete_cond;
@@ -347,53 +345,6 @@
 	.set_base_channel = agent_set_base_channel,
 };
 
-static void agent_devicestate_cb(const struct ast_event *event, void *unused)
-{
-	int res, i;
-	struct agent_pvt *p;
-	char base[AST_CHANNEL_NAME], *tmp;
-	const char *device;
-	enum ast_device_state state;
-
-	state = ast_event_get_ie_uint(event, AST_EVENT_IE_STATE);
-	device = ast_event_get_ie_str(event, AST_EVENT_IE_DEVICE);
-
-	if (ast_strlen_zero(device)) {
-		return;
-	}
-
-	/* Skip Agent status */
-	if (!strncasecmp(device, "Agent/", 6)) {
-		return;
-	}
-
-	/* Try to be safe, but don't deadlock */
-	for (i = 0; i < 10; i++) {
-		if ((res = AST_LIST_TRYLOCK(&agents)) == 0) {
-			break;
-		}
-	}
-	if (res) {
-		return;
-	}
-
-	AST_LIST_TRAVERSE(&agents, p, list) {
-		ast_mutex_lock(&p->lock);
-		if (p->chan) {
-			ast_copy_string(base, p->chan->name, sizeof(base));
-			if ((tmp = strrchr(base, '-'))) {
-				*tmp = '\0';
-			}
-			if (strcasecmp(p->chan->name, device) == 0 || strcasecmp(base, device) == 0) {
-				p->inherited_devicestate = state;
-				ast_devstate_changed(state, "Agent/%s", p->agent);
-			}
-		}
-		ast_mutex_unlock(&p->lock);
-	}
-	AST_LIST_UNLOCK(&agents);
-}
-
 /*!
  * Adds an agent to the global list of agents.
  *
@@ -457,7 +408,6 @@
 		p->app_sleep_cond = 1;
 		p->group = group;
 		p->pending = pending;
-		p->inherited_devicestate = -1;
 		AST_LIST_INSERT_TAIL(&agents, p, list);
 	}
 	
@@ -611,7 +561,6 @@
 					p->lastdisc = ast_tvadd(ast_tvnow(), ast_samp2tv(p->wrapuptime, 1000));
 			}
 			p->chan = NULL;
-			p->inherited_devicestate = -1;
 			ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
 			p->acknowledged = 0;
 		}
@@ -833,7 +782,6 @@
 	} else {
 		/* Agent hung-up */
 		p->chan = NULL;
-		p->inherited_devicestate = -1;
 		ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
 	}
 
@@ -955,7 +903,6 @@
 				/* Recognize the hangup and pass it along immediately */
 				ast_hangup(p->chan);
 				p->chan = NULL;
-				p->inherited_devicestate = -1;
 				ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
 			}
 			ast_debug(1, "Hungup, howlong is %d, autologoff is %d\n", howlong, p->autologoff);
@@ -1695,7 +1642,6 @@
 	set_agentbycallerid(p->logincallerid, NULL);
 	p->loginchan[0] ='\0';
 	p->logincallerid[0] = '\0';
-	p->inherited_devicestate = -1;
 	ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
 	if (persistent_agents)
 		dump_agents();	
@@ -2266,7 +2212,6 @@
 						/* Log us off if appropriate */
 						if (p->chan == chan) {
 							p->chan = NULL;
-							p->inherited_devicestate = -1;
 						}
 						p->acknowledged = 0;
 						logintime = time(NULL) - p->loginstart;
@@ -2481,8 +2426,6 @@
 			if (p->owner) {
 				if (res != AST_DEVICE_INUSE)
 					res = AST_DEVICE_BUSY;
-			} else if (p->inherited_devicestate > -1) {
-				res = p->inherited_devicestate;
 			} else {
 				if (res == AST_DEVICE_BUSY)
 					res = AST_DEVICE_INUSE;
@@ -2614,9 +2557,6 @@
 	/* Dialplan Functions */
 	ast_custom_function_register(&agent_function);
 
-	agent_devicestate_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE,
-												agent_devicestate_cb, "agent devicestate", NULL, AST_EVENT_IE_END);
-
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
@@ -2634,10 +2574,6 @@
 	struct agent_pvt *p;
 	/* First, take us out of the channel loop */
 	ast_channel_unregister(&agent_tech);
-	/* Delete devicestate subscription */
-	if (agent_devicestate_sub) {
-		agent_devicestate_sub = ast_event_unsubscribe(agent_devicestate_sub);
-	}
 	/* Unregister dialplan functions */
 	ast_custom_function_unregister(&agent_function);	
 	/* Unregister CLI commands */

Modified: team/group/newcdr/channels/chan_dahdi.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_dahdi.c?view=diff&rev=171813&r1=171812&r2=171813
==============================================================================
--- team/group/newcdr/channels/chan_dahdi.c (original)
+++ team/group/newcdr/channels/chan_dahdi.c Tue Jan 27 18:21:09 2009
@@ -3156,8 +3156,11 @@
 	}
 	if (newslot < 0) {
 		newslot = 0;
-		ast_log(LOG_WARNING, "No D-channels available!  Using Primary channel %d as D-channel anyway!\n",
-			pri->dchannels[newslot]);
+		/* This is annoying to see on non persistent layer 2 connections.  Let's not complain in that case */
+		if (pri->sig != SIG_BRI_PTMP) {
+			ast_log(LOG_WARNING, "No D-channels available!  Using Primary channel %d as D-channel anyway!\n",
+				pri->dchannels[newslot]);
+		}
 	}
 	if (old && (oldslot != newslot))
 		ast_log(LOG_NOTICE, "Switching from from d-channel %d to channel %d!\n",




More information about the asterisk-commits mailing list