[svn-commits] mnicholson: branch group/newcdr r198633 - in /team/group/newcdr: ./ apps/ cha...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jun 1 14:04:53 CDT 2009


Author: mnicholson
Date: Mon Jun  1 14:04:49 2009
New Revision: 198633

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=198633
Log:
Merged revisions 198217,198248,198285,198312,198371,198375,198434,198437-198438,198442,198470,198498,198500,198511,198529-198530,198558,198561,198565,198597 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r198217 | eliel | 2009-05-29 20:04:57 -0500 (Fri, 29 May 2009) | 10 lines
  
  Remove not used code in the Agent channel.
  
  This code was there because of the AgentCallbackLogin() application.
  ->loginchan[] member was only used by AgentCallbackLogin().
  Agent where dumped to astdb if they where logged in using AgentCallbacklogin()
  so they are not being dumper anymore.
  
  Review: https://reviewboard.asterisk.org/r/267/
................
  r198248 | file | 2009-05-29 21:31:48 -0500 (Fri, 29 May 2009) | 2 lines
  
  When removing all packets from a dialog we also need to free the data if present.
................
  r198285 | seanbright | 2009-05-29 22:26:06 -0500 (Fri, 29 May 2009) | 15 lines
  
  Merged revisions 198251 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r198251 | seanbright | 2009-05-29 22:46:41 -0400 (Fri, 29 May 2009) | 8 lines
    
    Treat an empty FORWARD_CONTEXT the same way we treat a missing one.
    
    (closes issue #15056)
    Reported by: p_lindheimer
    Patches:
          05292009_bug15056.diff uploaded by seanbright (license 71)
    Tested by: p_lindheimer
  ........
................
  r198312 | russell | 2009-05-29 22:43:23 -0500 (Fri, 29 May 2009) | 12 lines
  
  Merged revisions 198311 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r198311 | russell | 2009-05-29 22:42:46 -0500 (Fri, 29 May 2009) | 5 lines
    
    Fix a crash that occurred when MWI SMDI messages expired.
    
    (closes issue #14561)
    Reported by: cmoss28
  ........
................
  r198371 | seanbright | 2009-05-30 14:38:58 -0500 (Sat, 30 May 2009) | 19 lines
  
  Merged revisions 198370 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r198370 | seanbright | 2009-05-30 15:36:20 -0400 (Sat, 30 May 2009) | 12 lines
    
    Properly terminate AMI JabberSend response messages.
    
    The response message (either Error or Success) needs an extra trailing \r\n
    after the fields to inform the client that the message is complete.
    
    (closes issue #14876)
    Reported by: srt
    Patches:
          05302009_1.4_res_jabber.c.diff uploaded by seanbright (license 71)
          asterisk_14876.patch uploaded by srt (license 378)
          trunk-14876-2.diff uploaded by phsultan (license 73)
  ........
................
  r198375 | seanbright | 2009-05-30 15:11:33 -0500 (Sat, 30 May 2009) | 13 lines
  
  Properly terminate the receive buffer before sending to iksemel.
  
  aji_io_recv takes the maximum number of bytes to read (instead of the total
  buffer size), so we have to subtract 1 from our buffer size.  Without this, when
  we receive packets that are larger than our buffer, iksemel will choke and
  things get wonky.
  
  (closes issue #15232)
  Reported by: lp0
  Patches:
        05302009_res_jabber.c.patch uploaded by seanbright (license 71)
  Tested by: seanbright, lp0
................
  r198434 | russell | 2009-05-30 20:19:30 -0500 (Sat, 30 May 2009) | 2 lines
  
  Constify the ast_frame arg to ast_queue_frame().
................
  r198437 | eliel | 2009-05-30 20:22:15 -0500 (Sat, 30 May 2009) | 11 lines
  
  Avoid a crash when res_timing_dahdi is unloaded but wasn't properly loaded.
  
  if dahdi_test_timer() fails, timing_funcs_handle remains NULL causing a crash
  when calling ast_unregister_timing_interface() with a NULL pointer.
  
  (closes issue #15234)
  Reported by: eliel
  Patches:
        timing_dahdi1.diff uploaded by eliel (license 64)
................
  r198438 | russell | 2009-05-30 20:40:02 -0500 (Sat, 30 May 2009) | 2 lines
  
  Constification and remove some unused code.
................
  r198442 | eliel | 2009-05-30 21:09:06 -0500 (Sat, 30 May 2009) | 3 lines
  
  Filter the say.o object, it is being added later.
................
  r198470 | tilghman | 2009-05-31 12:52:28 -0500 (Sun, 31 May 2009) | 2 lines
  
  Fix documentation for FIELDQTY.
................
  r198498 | file | 2009-06-01 08:31:27 -0500 (Mon, 01 Jun 2009) | 5 lines
  
  Fix a bug where the Event and Content-Type headers were added twice to outgoing SIP NOTIFY messages.
  
  (closes issue #15239)
  Reported by: pj
................
  r198500 | mmichelson | 2009-06-01 09:02:05 -0500 (Mon, 01 Jun 2009) | 6 lines
  
  Remove documentation for the 'exten' argument to the AGENT function.
  
  Since AgentCallbackLogin has been removed, this should not be documented
  any more.
................
  r198511 | mmichelson | 2009-06-01 09:19:49 -0500 (Mon, 01 Jun 2009) | 3 lines
  
  Add missing unlock of local pvt.
................
  r198529 | mmichelson | 2009-06-01 09:42:57 -0500 (Mon, 01 Jun 2009) | 5 lines
  
  Remove extra lock from local_indicate in connected line case.
  
  Oh, and this fixes a deadlock I was seeing.
................
  r198530 | mmichelson | 2009-06-01 09:45:43 -0500 (Mon, 01 Jun 2009) | 3 lines
  
  Remove extra lock from app_queue.
................
  r198558 | dvossel | 2009-06-01 10:23:21 -0500 (Mon, 01 Jun 2009) | 3 lines
  
  Fixed an issue in the threadstorage cli functions resulting from the constification of struct ast_cli_args in r196072.
................
  r198561 | eliel | 2009-06-01 10:38:48 -0500 (Mon, 01 Jun 2009) | 2 lines
  
  Move static documentation of E|Dead|AGI() application and manager action to XML.
................
  r198565 | eliel | 2009-06-01 11:09:42 -0500 (Mon, 01 Jun 2009) | 2 lines
  
  Move JabberSend manager action from static docs to the AstXML form.
................
  r198597 | eliel | 2009-06-01 12:53:38 -0500 (Mon, 01 Jun 2009) | 3 lines
  
  Do not add say.o in a separate line.
................

Modified:
    team/group/newcdr/   (props changed)
    team/group/newcdr/apps/app_dial.c
    team/group/newcdr/apps/app_queue.c
    team/group/newcdr/channels/chan_agent.c
    team/group/newcdr/channels/chan_local.c
    team/group/newcdr/channels/chan_sip.c
    team/group/newcdr/configs/agents.conf.sample
    team/group/newcdr/funcs/func_strings.c
    team/group/newcdr/include/asterisk/channel.h
    team/group/newcdr/main/Makefile
    team/group/newcdr/main/channel.c
    team/group/newcdr/main/manager.c
    team/group/newcdr/main/threadstorage.c
    team/group/newcdr/res/res_agi.c
    team/group/newcdr/res/res_jabber.c
    team/group/newcdr/res/res_smdi.c
    team/group/newcdr/res/res_timing_dahdi.c

Propchange: team/group/newcdr/
------------------------------------------------------------------------------
    automerge = on

Propchange: team/group/newcdr/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/newcdr/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jun  1 14:04:49 2009
@@ -1,1 +1,1 @@
-/trunk:1-198196
+/trunk:1-198625

Modified: team/group/newcdr/apps/app_dial.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/apps/app_dial.c?view=diff&rev=198633&r1=198632&r2=198633
==============================================================================
--- team/group/newcdr/apps/app_dial.c (original)
+++ team/group/newcdr/apps/app_dial.c Mon Jun  1 14:04:49 2009
@@ -746,6 +746,9 @@
 		const char *forward_context;
 		ast_channel_lock(c);
 		forward_context = pbx_builtin_getvar_helper(c, "FORWARD_CONTEXT");
+		if (ast_strlen_zero(forward_context)) {
+			forward_context = NULL;
+		}
 		snprintf(tmpchan, sizeof(tmpchan), "%s@%s", c->call_forward, forward_context ? forward_context : c->context);
 		ast_channel_unlock(c);
 		stuff = tmpchan;

Modified: team/group/newcdr/apps/app_queue.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/apps/app_queue.c?view=diff&rev=198633&r1=198632&r2=198633
==============================================================================
--- team/group/newcdr/apps/app_queue.c (original)
+++ team/group/newcdr/apps/app_queue.c Mon Jun  1 14:04:49 2009
@@ -2735,7 +2735,6 @@
 		strcpy(tmp->chan->cdr->accountcode, qe->chan->cdr->accountcode);
 		strcpy(tmp->chan->cdr->userfield, qe->chan->cdr->userfield);
 	}
-	ast_channel_unlock(qe->chan);
 
 	/* Place the call, but don't wait on the answer */
 	if ((res = ast_call(tmp->chan, location, 0))) {

Modified: team/group/newcdr/channels/chan_agent.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/channels/chan_agent.c?view=diff&rev=198633&r1=198632&r2=198633
==============================================================================
--- team/group/newcdr/channels/chan_agent.c (original)
+++ team/group/newcdr/channels/chan_agent.c Mon Jun  1 14:04:49 2009
@@ -156,9 +156,6 @@
 					<enum name="mohclass">
 						<para>MusicOnHold class</para>
 					</enum>
-					<enum name="exten">
-						<para>The callback extension for the Agent (AgentCallbackLogin)</para>
-					</enum>
 					<enum name="channel">
 						<para>The name of the active channel for the Agent (AgentLogin)</para>
 					</enum>
@@ -212,9 +209,6 @@
 static const char pa_family[] = "Agents";          /*!< Persistent Agents astdb family */
 #define PA_MAX_LEN 2048                             /*!< The maximum length of each persistent member agent database entry */
 
-static int persistent_agents = 0;                   /*!< queues.conf [general] option */
-static void dump_agents(void);
-
 #define DEFAULT_ACCEPTDTMF '#'
 #define DEFAULT_ENDDTMF '*'
 
@@ -275,7 +269,6 @@
 	ast_cond_t app_complete_cond;
 	volatile int app_sleep_cond;   /**< Sleep condition for the login app */
 	struct ast_channel *owner;     /**< Agent */
-	char loginchan[80];            /**< channel they logged in from */
 	char logincallerid[80];        /**< Caller ID they had when they logged in */
 	struct ast_channel *chan;      /**< Channel we use */
 	unsigned int flags;            /**< Flags show if settings were applied with channel vars */
@@ -319,7 +312,6 @@
 /*--- Forward declarations */
 static struct ast_channel *agent_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
 static int agent_devicestate(void *data);
-static void agent_logoff_maintenance(struct agent_pvt *p, char *loginchan, long logintime, const char *uniqueid, char *logcommand);
 static int agent_digit_begin(struct ast_channel *ast, char digit);
 static int agent_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
 static int agent_call(struct ast_channel *ast, char *dest, int timeout);
@@ -332,7 +324,6 @@
 static int agent_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen);
 static int agent_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct ast_channel *bridge);
-static void set_agentbycallerid(const char *callerid, const char *agent);
 static char *complete_agent_logoff_cmd(const char *line, const char *word, int pos, int state);
 static struct ast_channel* agent_get_base_channel(struct ast_channel *chan);
 static int agent_set_base_channel(struct ast_channel *chan, struct ast_channel *base);
@@ -539,7 +530,6 @@
 	struct agent_pvt *p = ast->tech_pvt;
 	struct ast_frame *f = NULL;
 	static struct ast_frame answer_frame = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
-	const char *status;
 	int cur_time = time(NULL);
 	ast_mutex_lock(&p->lock);
 	CHECK_FORMATS(ast, p);
@@ -553,33 +543,9 @@
 	} else
 		f = &ast_null_frame;
 	if (!f) {
-		/* If there's a channel, hang it up (if it's on a callback) make it NULL */
+		/* If there's a channel, make it NULL */
 		if (p->chan) {
 			p->chan->_bridge = NULL;
-			/* Note that we don't hangup if it's not a callback because Asterisk will do it
-			   for us when the PBX instance that called login finishes */
-			if (!ast_strlen_zero(p->loginchan)) {
-				if (p->chan)
-					ast_debug(1, "Bridge on '%s' being cleared (2)\n", p->chan->name);
-				if (p->owner->_state != AST_STATE_UP) {
-					int howlong = cur_time - p->start;
-					if (p->autologoff && howlong >= p->autologoff) {
-						p->loginstart = 0;
-							ast_log(LOG_NOTICE, "Agent '%s' didn't answer/confirm within %d seconds (waited %d)\n", p->name, p->autologoff, howlong);
-						agent_logoff_maintenance(p, p->loginchan, (cur_time = p->loginstart), ast->uniqueid, "Autologoff");
-					}
-				}
-				status = pbx_builtin_getvar_helper(p->chan, "CHANLOCALSTATUS");
-				if (autologoffunavail && status && !strcasecmp(status, "CHANUNAVAIL")) {
-					long logintime = cur_time - p->loginstart;
-					p->loginstart = 0;
-					ast_log(LOG_NOTICE, "Agent read: '%s' is not available now, auto logoff\n", p->name);
-					agent_logoff_maintenance(p, p->loginchan, logintime, ast->uniqueid, "Chanunavail");
-				}
-				ast_hangup(p->chan);
-				if (p->wrapuptime && p->acknowledged)
-					p->lastdisc = ast_tvadd(ast_tvnow(), ast_samp2tv(p->wrapuptime, 1000));
-			}
 			p->chan = NULL;
 			ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
 			p->acknowledged = 0;
@@ -595,7 +561,6 @@
 			int howlong = cur_time - p->start;
 			if (p->autologoff && (howlong >= p->autologoff)) {
 				ast_log(LOG_NOTICE, "Agent '%s' didn't answer/confirm within %d seconds (waited %d)\n", p->name, p->autologoff, howlong);
-				agent_logoff_maintenance(p, p->loginchan, (cur_time - p->loginstart), ast->uniqueid, "Autologoff");
 				agent_logoff(p->agent, 0);
 			}
 		}
@@ -784,16 +749,6 @@
 		if (newstate)
 			ast_setstate(ast, newstate);
 		return res;
-	} else if (!ast_strlen_zero(p->loginchan)) {
-		time(&p->start);
-		/* Call on this agent */
-		ast_verb(3, "outgoing agentcall, to agent '%s', on '%s'\n", p->agent, p->chan->name);
-		ast_channel_set_connected_line(p->chan, &ast->connected);
-		ast_channel_inherit_variables(ast, p->chan);
-		res = ast_call(p->chan, p->loginchan, 0);
-		CLEANUP(ast,p);
-		ast_mutex_unlock(&p->lock);
-		return res;
 	}
 	ast_verb(3, "agent_call, call to agent '%s' call on '%s'\n", p->agent, p->chan->name);
 	ast_debug(3, "Playing beep, lang '%s'\n", p->chan->language);
@@ -822,9 +777,9 @@
 	}
 	if(!res) {
 		/* Call is immediately up, or might need ack */
-		if (p->ackcall > 1)
+		if (p->ackcall) {
 			newstate = AST_STATE_RINGING;
-		else {
+		} else {
 			newstate = AST_STATE_UP;
 			if (recordagentcalls)
 				agent_start_monitoring(ast, 0);
@@ -839,19 +794,6 @@
 	return res;
 }
 
-/*! \brief store/clear the global variable that stores agentid based on the callerid */
-static void set_agentbycallerid(const char *callerid, const char *agent)
-{
-	char buf[AST_MAX_BUF];
-
-	/* if there is no Caller ID, nothing to do */
-	if (ast_strlen_zero(callerid))
-		return;
-
-	snprintf(buf, sizeof(buf), "%s_%s", GETAGENTBYCALLERID, callerid);
-	pbx_builtin_setvar_helper(NULL, buf, agent);
-}
-
 /*! \brief return the channel or base channel if one exists.  This function assumes the channel it is called on is already locked */
 struct ast_channel* agent_get_base_channel(struct ast_channel *chan)
 {
@@ -890,7 +832,7 @@
 {
 	struct agent_pvt *p = ast->tech_pvt;
 	int howlong = 0;
-	const char *status;
+
 	ast_mutex_lock(&p->lock);
 	p->owner = NULL;
 	ast->tech_pvt = NULL;
@@ -915,37 +857,7 @@
 	if (p->chan) {
 		p->chan->_bridge = NULL;
 		/* If they're dead, go ahead and hang up on the agent now */
-		if (!ast_strlen_zero(p->loginchan)) {
-			/* Store last disconnect time */
-			if (p->wrapuptime)
-				p->lastdisc = ast_tvadd(ast_tvnow(), ast_samp2tv(p->wrapuptime, 1000));
-			else
-				p->lastdisc = ast_tv(0,0);
-			if (p->chan) {
-				status = pbx_builtin_getvar_helper(p->chan, "CHANLOCALSTATUS");
-				if (autologoffunavail && status && !strcasecmp(status, "CHANUNAVAIL")) {
-					long logintime = time(NULL) - p->loginstart;
-					p->loginstart = 0;
-					ast_log(LOG_NOTICE, "Agent hangup: '%s' is not available now, auto logoff\n", p->name);
-					agent_logoff_maintenance(p, p->loginchan, logintime, ast->uniqueid, "Chanunavail");
-				}
-				/* Recognize the hangup and pass it along immediately */
-				ast_hangup(p->chan);
-				p->chan = NULL;
-				ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
-			}
-			ast_debug(1, "Hungup, howlong is %d, autologoff is %d\n", howlong, p->autologoff);
-			if ((p->deferlogoff) || (howlong && p->autologoff && (howlong > p->autologoff))) {
-				long logintime = time(NULL) - p->loginstart;
-				p->loginstart = 0;
-				if (!p->deferlogoff)
-					ast_log(LOG_NOTICE, "Agent '%s' didn't answer/confirm within %d seconds (waited %d)\n", p->name, p->autologoff, howlong);
-				p->deferlogoff = 0;
-				agent_logoff_maintenance(p, p->loginchan, logintime, ast->uniqueid, "Autologoff");
-				if (persistent_agents)
-					dump_agents();
-			}
-		} else if (p->dead) {
+		if (p->dead) {
 			ast_channel_lock(p->chan);
 			ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
 			ast_channel_unlock(p->chan);
@@ -961,10 +873,7 @@
 
 	/* Only register a device state change if the agent is still logged in */
 	if (!p->loginstart) {
-		p->loginchan[0] = '\0';
 		p->logincallerid[0] = '\0';
-		if (persistent_agents)
-			dump_agents();
 	} else {
 		ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Agent/%s", p->agent);
 	}
@@ -992,10 +901,8 @@
 			ast_mutex_unlock(&p->lock);
 		}
 		/* Release ownership of the agent to other threads (presumably running the login app). */
-		if (ast_strlen_zero(p->loginchan)) {
-			p->app_lock_flag = 0;
-			ast_cond_signal(&p->app_complete_cond);
-		}
+		p->app_lock_flag = 0;
+		ast_cond_signal(&p->app_complete_cond);
 	}
 	return 0;
 }
@@ -1132,7 +1039,7 @@
 	alreadylocked = p->app_lock_flag;
 	p->app_lock_flag = 1;
 
-	if(ast_strlen_zero(p->loginchan) && alreadylocked) {
+	if (alreadylocked) {
 		if (p->chan) {
 			ast_queue_frame(p->chan, &ast_null_frame);
 			ast_mutex_unlock(&p->lock);	/* For other thread to read the condition. */
@@ -1149,18 +1056,6 @@
 			ast_cond_signal(&p->app_complete_cond);
 			return NULL;
 		}
-	} else if (!ast_strlen_zero(p->loginchan)) {
-		if (p->chan)
-			ast_queue_frame(p->chan, &ast_null_frame);
-		if (!p->chan) {
-			ast_log(LOG_WARNING, "Agent disconnected while we were connecting the call\n");
-			p->owner = NULL;
-			tmp->tech_pvt = NULL;
-			p->app_sleep_cond = 1;
-			tmp = ast_channel_release(tmp);
-			ast_mutex_unlock(&p->lock);     /* For other thread to read the condition. */
-			return NULL;
-		}	
 	} 
 	if (p->chan)
 		ast_indicate(p->chan, AST_CONTROL_UNHOLD);
@@ -1179,7 +1074,6 @@
 	struct ast_config *ucfg;
 	struct ast_variable *v;
 	struct agent_pvt *p;
-	const char *general_val;
 	const char *catname;
 	const char *hasagent;
 	int genhasagent;
@@ -1222,8 +1116,6 @@
 	savecallsin[0] = '\0';
 
 	/* Read in [general] section for persistence */
-	if ((general_val = ast_variable_retrieve(cfg, "general", "persistentagents")))
-		persistent_agents = ast_true(general_val);
 	multiplelogin = ast_true(ast_variable_retrieve(cfg, "general", "multiplelogin"));
 
 	/* Read in the [agents] section */
@@ -1239,12 +1131,9 @@
 			if (autologoff < 0)
 				autologoff = 0;
 		} else if (!strcasecmp(v->name, "ackcall")) {
-			if (!strcasecmp(v->value, "always"))
-				ackcall = 2;
-			else if (ast_true(v->value))
+			if (ast_true(v->value) || !strcasecmp(v->value, "always")) {
 				ackcall = 1;
-			else
-				ackcall = 0;
+			}
 		} else if (!strcasecmp(v->name, "endcall")) {
 			endcall = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "acceptdtmf")) {
@@ -1371,7 +1260,7 @@
 	if (needlock)
 		AST_LIST_UNLOCK(&agents);
 	if (parent && chan)  {
-		if (newlyavailable->ackcall > 1) {
+		if (newlyavailable->ackcall) {
 			/* Don't do beep here */
 			res = 0;
 		} else {
@@ -1469,8 +1358,7 @@
 	AST_LIST_LOCK(&agents);
 	AST_LIST_TRAVERSE(&agents, p, list) {
 		ast_mutex_lock(&p->lock);
-		if (!p->pending && ((groupmatch && (p->group & groupmatch)) || !strcmp(data, p->agent)) &&
-		    ast_strlen_zero(p->loginchan)) {
+		if (!p->pending && ((groupmatch && (p->group & groupmatch)) || !strcmp(data, p->agent))) {
 			if (p->chan)
 				hasagent++;
 			now = ast_tvnow();
@@ -1493,23 +1381,16 @@
 		AST_LIST_TRAVERSE(&agents, p, list) {
 			ast_mutex_lock(&p->lock);
 			if (!p->pending && ((groupmatch && (p->group & groupmatch)) || !strcmp(data, p->agent))) {
-				if (p->chan || !ast_strlen_zero(p->loginchan))
+				if (p->chan) {
 					hasagent++;
+				}
 				now = ast_tvnow();
-#if 0
-				ast_log(LOG_NOTICE, "Time now: %ld, Time of lastdisc: %ld\n", now.tv_sec, p->lastdisc.tv_sec);
-#endif
 				if (!p->lastdisc.tv_sec || (now.tv_sec >= p->lastdisc.tv_sec)) {
 					p->lastdisc = ast_tv(0, 0);
 					/* Agent must be registered, but not have any active call, and not be in a waiting state */
 					if (!p->owner && p->chan) {
 						/* Could still get a fixed agent */
 						chan = agent_new(p, AST_STATE_DOWN, requestor ? requestor->linkedid : NULL);
-					} else if (!p->owner && !ast_strlen_zero(p->loginchan)) {
-						/* Adjustable agent */
-						p->chan = ast_request("Local", format, requestor, p->loginchan, cause);
-						if (p->chan)
-							chan = agent_new(p, AST_STATE_DOWN, requestor ? requestor->linkedid : NULL);
 					}
 					if (chan) {
 						ast_mutex_unlock(&p->lock);
@@ -1562,7 +1443,6 @@
 {
 	const char *id = astman_get_header(m,"ActionID");
 	char idText[256] = "";
-	char chanbuf[256];
 	struct agent_pvt *p;
 	char *username = NULL;
 	char *loginChan = NULL;
@@ -1588,16 +1468,7 @@
 		/* Set a default status. It 'should' get changed. */
 		status = "AGENT_UNKNOWN";
 
-		if (!ast_strlen_zero(p->loginchan) && !p->chan) {
-			loginChan = p->loginchan;
-			talkingto = "n/a";
-			talkingtoChan = "n/a";
-			status = "AGENT_IDLE";
-			if (p->acknowledged) {
-				snprintf(chanbuf, sizeof(chanbuf), " %s (Confirmed)", p->loginchan);
-				loginChan = chanbuf;
-			}
-		} else if (p->chan) {
+		if (p->chan) {
 			loginChan = ast_strdupa(p->chan->name);
 			if (p->owner && p->owner->_bridge) {
 				talkingto = p->chan->cid.cid_num;
@@ -1638,49 +1509,9 @@
 	return 0;
 }
 
-static void agent_logoff_maintenance(struct agent_pvt *p, char *loginchan, long logintime, const char *uniqueid, char *logcommand)
-{
-	char *tmp = NULL;
-	char agent[AST_MAX_AGENT];
-
-	if (!ast_strlen_zero(logcommand))
-		tmp = logcommand;
-	else
-		tmp = ast_strdupa("");
-
-	snprintf(agent, sizeof(agent), "Agent/%s", p->agent);
-
-	if (!ast_strlen_zero(uniqueid)) {
-		manager_event(EVENT_FLAG_AGENT, "Agentcallbacklogoff",
-				"Agent: %s\r\n"
-				"Reason: %s\r\n"
-				"Loginchan: %s\r\n"
-				"Logintime: %ld\r\n"
-				"Uniqueid: %s\r\n", 
-				p->agent, tmp, loginchan, logintime, uniqueid);
-	} else {
-		manager_event(EVENT_FLAG_AGENT, "Agentcallbacklogoff",
-				"Agent: %s\r\n"
-				"Reason: %s\r\n"
-				"Loginchan: %s\r\n"
-				"Logintime: %ld\r\n",
-				p->agent, tmp, loginchan, logintime);
-	}
-
-	ast_queue_log("NONE", ast_strlen_zero(uniqueid) ? "NONE" : uniqueid, agent, "AGENTCALLBACKLOGOFF", "%s|%ld|%s", loginchan, logintime, tmp);
-	set_agentbycallerid(p->logincallerid, NULL);
-	p->loginchan[0] ='\0';
-	p->logincallerid[0] = '\0';
-	ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
-	if (persistent_agents)
-		dump_agents();
-
-}
-
 static int agent_logoff(const char *agent, int soft)
 {
 	struct agent_pvt *p;
-	long logintime;
 	int ret = -1; /* Return -1 if no agent if found */
 
 	AST_LIST_LOCK(&agents);
@@ -1710,10 +1541,6 @@
 					ast_mutex_unlock(&p->lock);
 				} else
 					p->deferlogoff = 1;
-			} else {
-				logintime = time(NULL) - p->loginstart;
-				p->loginstart = 0;
-				agent_logoff_maintenance(p, p->loginchan, logintime, NULL, "CommandLogoff");
 			}
 			break;
 		}
@@ -1855,15 +1682,6 @@
 				 else 
 					strcpy(talkingto, " is idle");
 				online_agents++;
-			} else if (!ast_strlen_zero(p->loginchan)) {
-				if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > 0 || !(p->lastdisc.tv_sec)) 
-					snprintf(location, sizeof(location) - 20, "available at '%s'", p->loginchan);
-				else 
-					snprintf(location, sizeof(location) - 20, "wrapping up at '%s'", p->loginchan);
-				talkingto[0] = '\0';
-				online_agents++;
-				if (p->acknowledged)
-					strncat(location, " (Confirmed)", sizeof(location) - strlen(location) - 1);
 			} else {
 				strcpy(location, "not logged in");
 				talkingto[0] = '\0';
@@ -1929,13 +1747,6 @@
 				strcpy(talkingto, " is idle");
 			agent_status = 1;
 			online_agents++;
-		} else if (!ast_strlen_zero(p->loginchan)) {
-			snprintf(location, sizeof(location) - 20, "available at '%s'", p->loginchan);
-			talkingto[0] = '\0';
-			agent_status = 1;
-			online_agents++;
-			if (p->acknowledged)
-				strncat(location, " (Confirmed)", sizeof(location) - strlen(location) - 1);
 		}
 		if (!ast_strlen_zero(p->moh))
 			snprintf(music, sizeof(music), " (musiconhold is '%s')", p->moh);
@@ -2083,12 +1894,11 @@
 
 				/* Set Channel Specific Agent Overrides */
 				if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTACKCALL"))) {
-					if (!strcasecmp(pbx_builtin_getvar_helper(chan, "AGENTACKCALL"), "always"))
-						p->ackcall = 2;
-					else if (ast_true(pbx_builtin_getvar_helper(chan, "AGENTACKCALL")))
+					if (ast_true(pbx_builtin_getvar_helper(chan, "AGENTACKCALL"))) {
 						p->ackcall = 1;
-					else
+					} else {
 						p->ackcall = 0;
+					}
 					tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTACKCALL");
 					ast_verb(3, "Saw variable AGENTACKCALL=%s, setting ackcall to: %d for Agent '%s'.\n", tmpoptions, p->ackcall, p->agent);
 					ast_set_flag(p, AGENT_FLAG_ACKCALL);
@@ -2134,7 +1944,6 @@
 					long logintime;
 					snprintf(agent, sizeof(agent), "Agent/%s", p->agent);
 
-					p->loginchan[0] = '\0';
 					p->logincallerid[0] = '\0';
 					p->acknowledged = 0;
 					
@@ -2177,10 +1986,11 @@
 								    ast_getformatname(chan->readformat), ast_getformatname(chan->writeformat));
 						/* Login this channel and wait for it to go away */
 						p->chan = chan;
-						if (p->ackcall > 1)
+						if (p->ackcall) {
 							check_beep(p, 0);
-						else
+						} else {
 							check_availability(p, 0);
+						}
 						ast_mutex_unlock(&p->lock);
 						AST_LIST_UNLOCK(&agents);
 						ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Agent/%s", p->agent);
@@ -2205,10 +2015,11 @@
 									ast_debug(1, "Wrapup time for %s expired!\n", p->agent);
 									p->lastdisc = ast_tv(0, 0);
 									ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Agent/%s", p->agent);
-									if (p->ackcall > 1)
+									if (p->ackcall) {
 										check_beep(p, 0);
-									else
+									} else {
 										check_availability(p, 0);
+									}
 								}
 							}
 							ast_mutex_unlock(&p->lock);
@@ -2221,11 +2032,12 @@
 							ast_mutex_unlock(&p->app_lock);
 							ast_mutex_lock(&p->lock);
 							ast_mutex_unlock(&p->lock);
-							if (p->ackcall > 1) 
+							if (p->ackcall) {
 								res = agent_ack_sleep(p);
-							else
+							} else {
 								res = ast_safe_sleep_conditional( chan, 1000, agent_cont_sleep, p );
-							if ((p->ackcall > 1)  && (res == 1)) {
+							}
+							if (p->ackcall && (res == 1)) {
 								AST_LIST_LOCK(&agents);
 								ast_mutex_lock(&p->lock);
 								check_availability(p, 0);
@@ -2352,84 +2164,6 @@
 	return 0;
 }
 
-/*!
- * \brief Dump AgentCallbackLogin agents to the ASTdb database for persistence
- */
-static void dump_agents(void)
-{
-	struct agent_pvt *cur_agent = NULL;
-	char buf[256];
-
-	AST_LIST_TRAVERSE(&agents, cur_agent, list) {
-		if (cur_agent->chan)
-			continue;
-
-		if (!ast_strlen_zero(cur_agent->loginchan)) {
-			snprintf(buf, sizeof(buf), "%s;%s", cur_agent->loginchan, cur_agent->logincallerid);
-			if (ast_db_put(pa_family, cur_agent->agent, buf))
-				ast_log(LOG_WARNING, "failed to create persistent entry in ASTdb for %s!\n", buf);
-			else
-				ast_debug(1, "Saved Agent: %s on %s\n", cur_agent->agent, cur_agent->loginchan);
-		} else {
-			/* Delete -  no agent or there is an error */
-			ast_db_del(pa_family, cur_agent->agent);
-		}
-	}
-}
-
-/*!
- * \brief Reload the persistent agents from astdb.
- */
-static void reload_agents(void)
-{
-	char *agent_num;
-	struct ast_db_entry *db_tree;
-	struct ast_db_entry *entry;
-	struct agent_pvt *cur_agent;
-	char agent_data[256];
-	char *parse;
-	char *agent_chan;
-	char *agent_callerid;
-
-	db_tree = ast_db_gettree(pa_family, NULL);
-
-	AST_LIST_LOCK(&agents);
-	for (entry = db_tree; entry; entry = entry->next) {
-		agent_num = entry->key + strlen(pa_family) + 2;
-		AST_LIST_TRAVERSE(&agents, cur_agent, list) {
-			ast_mutex_lock(&cur_agent->lock);
-			if (strcmp(agent_num, cur_agent->agent) == 0)
-				break;
-			ast_mutex_unlock(&cur_agent->lock);
-		}
-		if (!cur_agent) {
-			ast_db_del(pa_family, agent_num);
-			continue;
-		} else
-			ast_mutex_unlock(&cur_agent->lock);
-		if (!ast_db_get(pa_family, agent_num, agent_data, sizeof(agent_data)-1)) {
-			ast_debug(1, "Reload Agent from AstDB: %s on %s\n", cur_agent->agent, agent_data);
-			parse = agent_data;
-			agent_chan = strsep(&parse, ";");
-			agent_callerid = strsep(&parse, ";");
-			ast_copy_string(cur_agent->loginchan, agent_chan, sizeof(cur_agent->loginchan));
-			if (agent_callerid) {
-				ast_copy_string(cur_agent->logincallerid, agent_callerid, sizeof(cur_agent->logincallerid));
-				set_agentbycallerid(cur_agent->logincallerid, cur_agent->agent);
-			} else
-				cur_agent->logincallerid[0] = '\0';
-			if (cur_agent->loginstart == 0)
-				time(&cur_agent->loginstart);
-			ast_devstate_changed(AST_DEVICE_UNKNOWN, "Agent/%s", cur_agent->agent);	
-		}
-	}
-	AST_LIST_UNLOCK(&agents);
-	if (db_tree) {
-		ast_log(LOG_NOTICE, "Agents successfully reloaded from database.\n");
-		ast_db_freetree(db_tree);
-	}
-}
-
 /*! \brief Part of PBX channel interface */
 static int agent_devicestate(void *data)
 {
@@ -2458,7 +2192,7 @@
 			} else {
 				if (res == AST_DEVICE_BUSY)
 					res = AST_DEVICE_INUSE;
-				if (p->chan || !ast_strlen_zero(p->loginchan)) {
+				if (p->chan) {
 					if (res == AST_DEVICE_INVALID)
 						res = AST_DEVICE_UNKNOWN;
 				} else if (res == AST_DEVICE_INVALID)	
@@ -2523,8 +2257,9 @@
 
 	if (!strcasecmp(args.item, "status")) {
 		char *status = "LOGGEDOUT";
-		if (agent->chan || !ast_strlen_zero(agent->loginchan)) 
-			status = "LOGGEDIN";	
+		if (agent->chan) {
+			status = "LOGGEDIN";
+		}
 		ast_copy_string(buf, status, len);
 	} else if (!strcasecmp(args.item, "password")) 
 		ast_copy_string(buf, agent->password, len);
@@ -2539,8 +2274,9 @@
 			if (tmp)
 				*tmp = '\0';
 		} 
-	} else if (!strcasecmp(args.item, "exten"))
-		ast_copy_string(buf, agent->loginchan, len);	
+	} else if (!strcasecmp(args.item, "exten")) {
+		buf[0] = '\0';
+	}
 
 	AST_LIST_UNLOCK(&agents);
 
@@ -2570,8 +2306,6 @@
 	/* Read in the config */
 	if (!read_agent_config(0))
 		return AST_MODULE_LOAD_DECLINE;
-	if (persistent_agents)
-		reload_agents();
 	/* Dialplan applications */
 	ast_register_application_xml(app, login_exec);
 	ast_register_application_xml(app3, agentmonitoroutgoing_exec);
@@ -2591,11 +2325,7 @@
 
 static int reload(void)
 {
-	if (!read_agent_config(1)) {
-		if (persistent_agents)
-			reload_agents();
-	}
-	return 0;
+	return read_agent_config(1);
 }
 
 static int unload_module(void)

Modified: team/group/newcdr/channels/chan_local.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/channels/chan_local.c?view=diff&rev=198633&r1=198632&r2=198633
==============================================================================
--- team/group/newcdr/channels/chan_local.c (original)
+++ team/group/newcdr/channels/chan_local.c Mon Jun  1 14:04:49 2009
@@ -434,10 +434,11 @@
 			}
 			f.subclass = condition;
 			f.data.ptr = frame_data;
-			ast_mutex_lock(&p->lock);
 			if (!(res = local_queue_frame(p, isoutbound, &f, ast, 1))) {
 				ast_mutex_unlock(&p->lock);
 			}
+		} else {
+			ast_mutex_unlock(&p->lock);
 		}
 	} else {
 		/* Queue up a frame representing the indication as a control frame */

Modified: team/group/newcdr/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/channels/chan_sip.c?view=diff&rev=198633&r1=198632&r2=198633
==============================================================================
--- team/group/newcdr/channels/chan_sip.c (original)
+++ team/group/newcdr/channels/chan_sip.c Mon Jun  1 14:04:49 2009
@@ -3079,6 +3079,9 @@
 		dialog->packets = dialog->packets->next;
 		AST_SCHED_DEL(sched, cp->retransid);
 		dialog_unref(cp->owner, "remove all current packets in this dialog, and the pointer to the dialog too as part of __sip_destroy");
+		if (cp->data) {
+			ast_free(cp->data);
+		}
 		ast_free(cp);
 	}
 
@@ -10792,8 +10795,6 @@
 
 	reqprep(&req, p, SIP_NOTIFY, 0, 1);
 
-	add_header(&req, "Event", subscriptiontype->event);
-	add_header(&req, "Content-Type", subscriptiontype->mediatype);
 	switch(state) {
 	case AST_EXTENSION_DEACTIVATED:
 		if (timeout)

Modified: team/group/newcdr/configs/agents.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/configs/agents.conf.sample?view=diff&rev=198633&r1=198632&r2=198633
==============================================================================
--- team/group/newcdr/configs/agents.conf.sample (original)
+++ team/group/newcdr/configs/agents.conf.sample Mon Jun  1 14:04:49 2009
@@ -3,13 +3,6 @@
 ;
 
 [general]
-;
-; Define whether callbacklogins should be stored in astdb for
-; persistence. Persistent logins will be reloaded after
-; Asterisk restarts.
-;
-persistentagents=yes
-
 ; Enable or disable a single extension from logging in as multiple agents.
 ; The default value is "yes".
 ;multiplelogin=yes
@@ -37,11 +30,10 @@
 ;autologoffunavail=yes
 ;
 ; Define ackcall to require a DTMF acknowledgement when
-; an agent logs in using agentcallbacklogin.  Default is "no".
-; Can also be set to "always", which will also require AgentLogin
-; agents to acknowledge calls. Use the acceptdtmf option to
-; configure what DTMF key press should be used to acknowledge the
-; call. The default is '#'.
+; an agent logs in using AgentLogin.  Default is "no".
+; Use the acceptdtmf option to configure what DTMF key
+; press should be used to acknowledge the call. The
+; default is '#'.
 ;
 ;ackcall=no
 ;acceptdtmf=#

Modified: team/group/newcdr/funcs/func_strings.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/funcs/func_strings.c?view=diff&rev=198633&r1=198632&r2=198633
==============================================================================
--- team/group/newcdr/funcs/func_strings.c (original)
+++ team/group/newcdr/funcs/func_strings.c Mon Jun  1 14:04:49 2009
@@ -51,7 +51,12 @@
 			<parameter name="delim" required="true" />
 		</syntax>
 		<description>
-			<para>Example: ${FIELDQTY(ex-amp-le,-)} returns 3</para>
+			<para>The delimiter may be specified as a special or extended ASCII character, by encoding it.  The characters
+			<literal>\n</literal>, <literal>\r</literal>, and <literal>\t</literal> are all recognized as the newline,
+			carriage return, and tab characters, respectively.  Also, octal and hexadecimal specifications are recognized
+			by the patterns <literal>\0nnn</literal> and <literal>\xHH</literal>, respectively.  For example, if you wanted
+			to encode a comma as the delimiter, you could use either <literal>\054</literal> or <literal>\x2C</literal>.</para>
+			<para>Example: If ${example} contains <literal>ex-amp-le</literal>, then ${FIELDQTY(example,-)} returns 3.</para>
 		</description>
 	</function>
 	<function name="LISTFILTER" language="en_US">

Modified: team/group/newcdr/include/asterisk/channel.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/include/asterisk/channel.h?view=diff&rev=198633&r1=198632&r2=198633
==============================================================================
--- team/group/newcdr/include/asterisk/channel.h (original)
+++ team/group/newcdr/include/asterisk/channel.h Mon Jun  1 14:04:49 2009
@@ -947,7 +947,7 @@
  *
  * \note The channel does not need to be locked before calling this function.
  */
-int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f);
+int ast_queue_frame(struct ast_channel *chan, const struct ast_frame *f);
 
 /*!
  * \brief Queue an outgoing frame to the head of the frame queue
@@ -961,7 +961,7 @@
  * \retval 0 success
  * \retval non-zero failure
  */
-int ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *f);
+int ast_queue_frame_head(struct ast_channel *chan, const struct ast_frame *f);
 
 /*!
  * \brief Queue a hangup frame

Modified: team/group/newcdr/main/Makefile
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/main/Makefile?view=diff&rev=198633&r1=198632&r2=198633
==============================================================================
--- team/group/newcdr/main/Makefile (original)
+++ team/group/newcdr/main/Makefile Mon Jun  1 14:04:49 2009
@@ -25,10 +25,6 @@
 # otherwise modules will not have them available if none of the static
 # objects use it.
 OBJS+=stdtime/localtime.o
-
-# At the moment say.o is an optional component which can be overridden
-# by a module.
-OBJS+=say.o
 
 AST_LIBS += $(OPENSSL_LIB)
 AST_LIBS += $(BKTR_LIB)

Modified: team/group/newcdr/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/main/channel.c?view=diff&rev=198633&r1=198632&r2=198633
==============================================================================
--- team/group/newcdr/main/channel.c (original)
+++ team/group/newcdr/main/channel.c Mon Jun  1 14:04:49 2009
@@ -1046,7 +1046,7 @@
 }
 
 /*! \brief Queue an outgoing media frame */
-static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, int head)
+static int __ast_queue_frame(struct ast_channel *chan, const struct ast_frame *fin, int head)
 {
 	struct ast_frame *f;
 	struct ast_frame *cur;
@@ -1107,12 +1107,12 @@
 	return 0;
 }
 
-int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin)
+int ast_queue_frame(struct ast_channel *chan, const struct ast_frame *fin)
 {
 	return __ast_queue_frame(chan, fin, 0);
 }
 
-int ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *fin)
+int ast_queue_frame_head(struct ast_channel *chan, const struct ast_frame *fin)
 {
 	return __ast_queue_frame(chan, fin, 1);
 }

Modified: team/group/newcdr/main/manager.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/main/manager.c?view=diff&rev=198633&r1=198632&r2=198633
==============================================================================
--- team/group/newcdr/main/manager.c (original)
+++ team/group/newcdr/main/manager.c Mon Jun  1 14:04:49 2009
@@ -756,8 +756,8 @@
  * Digest Authentication http header).
  */
 #define MAX_BLACKLIST_CMD_LEN 2
-static struct {
-	char *words[AST_MAX_CMD_LEN];
+static const struct {
+	const char *words[AST_MAX_CMD_LEN];
 } command_blacklist[] = {
 	{{ "module", "load", NULL }},
 	{{ "module", "unload", NULL }},
@@ -880,7 +880,6 @@
 	AST_RWLIST_WRLOCK(&manager_hooks);
 	AST_RWLIST_INSERT_TAIL(&manager_hooks, hook, list);
 	AST_RWLIST_UNLOCK(&manager_hooks);
-	return;
 }
 
 /*! \brief Delete a custom hook to be called when an event is fired */
@@ -889,51 +888,7 @@
 	AST_RWLIST_WRLOCK(&manager_hooks);
 	AST_RWLIST_REMOVE(&manager_hooks, hook, list);
 	AST_RWLIST_UNLOCK(&manager_hooks);
-	return;
-}
-
-/*! \brief
- * Event list management functions.
- * We assume that the event list always has at least one element,
- * and the delete code will not remove the last entry even if the
- *
- */
-#if 0
-static time_t __deb(time_t start, const char *msg)
-{

[... 418 lines stripped ...]



More information about the svn-commits mailing list