[asterisk-users] Agent-Login/out in 1.6

Philipp Kempgen philipp.kempgen at amooma.de
Sun May 17 09:48:34 CDT 2009


Lenz Emilitri schrieb:
> The main problem i see with thgis is that with "old-school" agents, you
> could easily have association with multiple queues. And that was quite
> useful.

> 2009/5/16 David Anthony O Reilly <oreillda at tcd.ie>

>> Hopefully somebody out there has managed to create an agent login/logout
>> without bringing voicemail into it???? If I find a way I will let you and
>> post a wiki on it as I am sure loads of people have this problem.

Logging into multiple queues seems perfectly doable to me, and we
do that in Gemeinschaft (http://www.amooma.de/gemeinschaft/ , german).
I'll try to quote the relevant parts from extensions.ael
(https://svn.amooma.com/gemeinschaft/trunk/opt/gemeinschaft/etc/asterisk/e.ael):

//---------------------------------------------------------------------
//  Queue Login/Logout
//---------------------------------------------------------------------

macro queue-login( queue ) {
	
	Set(CDR(amaflags)=OMIT);
	Answer();
	Verbose(1,### User ${user_name} wants to log in to queue ${queue});
	
	AGI(/opt/gemeinschaft/dialplan-scripts/queue-login-logout.agi,${user_name},${queue},login);
	if ("${agent_login_status}" = "loggedin") {
		// fake login for the statistics:
		QueueLog(NONE,${UNIQUEID},${CHANNEL(channeltype)}/${user_name},AGENTLOGIN,fake);
	}
	Verbose(1,### agent_login_status: ${agent_login_status});
	Wait(0.5);
	if ("${agent_login_status}" = "loggedin" || "${agent_login_status}" = "alreadyon") {
		Playback(agent-loginok);
	} else {
		Playback(beeperr);
	}
	Hangup();
}
macro queue-logout( queue ) {
	
	Set(CDR(amaflags)=OMIT);
	Answer();
	Verbose(1,### User ${user_name} wants to log out from queue ${queue});
	AGI(/opt/gemeinschaft/dialplan-scripts/queue-login-logout.agi,${user_name},${queue},logout);
	Wait(0.5);
	if ("${agent_login_status}" = "loggedout") {
		Playback(agent-loggedoff);
	} else {
		Playback(beeperr);
	}
	Hangup();
}
macro queue-logout-all() {
	
	Set(CDR(amaflags)=OMIT);
	Answer();
	Verbose(1,### User ${user_name} wants to log out from all queues);
	AGI(/opt/gemeinschaft/dialplan-scripts/queue-login-logout.agi,${user_name},0,logoutall);
	Wait(0.5);
	if ("${agent_login_status}" = "loggedout") {
		Playback(agent-loggedoff);
	} else {
		Playback(beeperr);
	}
	Hangup();
}
macro queue-logout-all-silent() {
	
	// like &queue-logout-all() but silent
	Set(CDR(amaflags)=OMIT);
	Verbose(1,### User ${user_name} wants to log out from all queues);
	AGI(/opt/gemeinschaft/dialplan-scripts/queue-login-logout.agi,${user_name},0,logoutall);
}
context queues-login-logout {
	
	*5*   => &queue-logout-all();
	_*5.  => &queue-login(${EXTEN:2});
	//_*5.* => &queue-logout(${EXTEN:2});  // does not work
	_*5X* => &queue-logout(${EXTEN:2:-1});
	_*5XX* => &queue-logout(${EXTEN:2:-1});
	_*5XXX* => &queue-logout(${EXTEN:2:-1});
	_*5XXXX* => &queue-logout(${EXTEN:2:-1});
	_*5XXXXX* => &queue-logout(${EXTEN:2:-1});
	_*5XXXXXX* => &queue-logout(${EXTEN:2:-1});
}


Instead of ${user_name} you might want to use something like
${CALLERID(num)} if you don't use Gemeinschaft.

The queue-login-logout.agi AGI script
(https://svn.amooma.com/gemeinschaft/trunk/opt/gemeinschaft/dialplan-scripts/queue-login-logout.agi)
inserts/removes the interface ("SIP/...") into/from the queue_members
Realtime family which is stored in a MySQL database.

Log in to a queue by dialing *5<queuenumber> e.g. *5300. You're
not limited to only one queue at a time.
Log out of a specific queue by dialing *5<queuenumber>*.
Log out of all queues by dialing *5*.


    Philipp Kempgen
-- 
AMOOMA GmbH - Bachstr. 126 - 56566 Neuwied  ->  http://www.amooma.de
Geschäftsführer: Stefan Wintermeyer, Handelsregister: Neuwied B14998
Asterisk: http://the-asterisk-book.com - http://das-asterisk-buch.de
Videos of the AMOOCON VoIP conference 2009 ->  http://www.amoocon.de
-- 



More information about the asterisk-users mailing list