[Asterisk-cvs] asterisk/channels chan_agent.c,1.62,1.63

martinp at lists.digium.com martinp at lists.digium.com
Tue Feb 10 15:06:08 CST 2004


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

Modified Files:
	chan_agent.c 
Log Message:
Fix some minor errors: when logging off using AgentCallbackLogin don't put again the global *AGENTID* variable. Remove the '.' from the link that is put in the userfiled of CDR record


Index: chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- chan_agent.c	5 Feb 2004 21:13:17 -0000	1.62
+++ chan_agent.c	10 Feb 2004 21:14:48 -0000	1.63
@@ -272,9 +272,10 @@
 		return -1;
 	if (!ast->monitor) {
 		snprintf(filename, sizeof(filename), "agent-%s-%s",p->agent, ast->uniqueid);
-		snprintf(tmp, sizeof(tmp), "%s%s",savecallsin ? savecallsin : "", filename);
-		if ((pointer = strchr(tmp, '.')))
+		/* substitute . for - */
+		if ((pointer = strchr(filename, '.')))
 			*pointer = '-';
+		snprintf(tmp, sizeof(tmp), "%s%s",savecallsin ? savecallsin : "", filename);
 		ast_monitor_start(ast, recordformat, tmp, needlock);
 		ast_monitor_setjoinfiles(ast, 1);
 		snprintf(tmp2, sizeof(tmp2), "%s%s.%s", urlprefix ? urlprefix : "", filename, recordformatext);
@@ -1228,11 +1229,14 @@
 								if (!strlen(p->loginchan))
 									filename = "agent-loggedoff";
 								p->acknowledged = 0;
-								/* clear the global variable that stores agentid based on the callerid */
+								/* store/clear the global variable that stores agentid based on the callerid */
 								if (chan->callerid) {
 									char agentvar[AST_MAX_BUF];
 									snprintf(agentvar, sizeof(agentvar), "%s_%s",GETAGENTBYCALLERID, chan->callerid);
-									pbx_builtin_setvar_helper(NULL, agentvar, NULL);
+									if (!strlen(p->loginchan))
+										pbx_builtin_setvar_helper(NULL, agentvar, NULL);
+									else
+										pbx_builtin_setvar_helper(NULL, agentvar, p->agent);
 								}
 							}
 						} else {
@@ -1274,12 +1278,6 @@
 								res = ast_waitstream(chan, "");
 							if (!res)
 								res = ast_safe_sleep(chan, 1000);
-							/* store agent id based on the callerid as a global variable */
-							if (chan->callerid) {
-								char agentvar[AST_MAX_BUF];
-								snprintf(agentvar, sizeof(agentvar), "%s_%s",GETAGENTBYCALLERID, chan->callerid);
-								pbx_builtin_setvar_helper(NULL, agentvar, p->agent);
-							}
 							ast_mutex_unlock(&p->lock);
 						} else if (!res) {
 #ifdef HONOR_MUSIC_CLASS




More information about the svn-commits mailing list