Summary:ASTERISK-02655: [patch] Add manager cmd - Action: Agents
Reporter:drmac (drmac)Labels:
Date Opened:2004-10-22 13:27:35Date Closed:2008-01-15 15:15:21.000-0600
Versions:Frequency of
Environment:Attachments:( 0) agents.php
( 1) chan_agent_1.91_manager_agents.patch
( 2) chan-agent-manager-agents.patch.txt
( 3) manager-agents.patch
Description:Right now, the only method of getting agent status from manager is by executing Command: show agents. Not exactly the best way.

This patch adds 'Action: Agents' and produces the following sample output:

Event: Agents
Agent: 3155
Name: Joe Schmoe
LoggedInChan: 3155@cytel-internal
LoggedInTime: 1098467530
TalkingTo: n/a

Status will obviously change depending on the agents status:

AGENT_LOGGEDOFF - Agent isn't logged in
AGENT_IDLE      - Agent is logged in, and waiting for call
AGENT_ONCALL    - Agent is logged in, and on a call

If agent is on call, TalkingTo will reflect the callerid of the caller.


Also attached is a small PHP script to utilize the patch.
Comments:By: Mark Spencer (markster) 2004-10-22 13:30:58

Can you please confirm you have a disclaimer on file?  Thanks.

By: drmac (drmac) 2004-10-22 13:48:40

Figured my karma +1 would make that so people didn't have to ask anymore ;)

Yes, its on file.

By: bmerrills (bmerrills) 2004-10-25 03:07:06

With CVS from today, i get the following compiler errors:

gcc -pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g  -Iinclude -I../include -D_REENTRANT -D_GNU_SOURCE  -O6 -march=i686   -DZAPTEL_OPTIMIZATIONS  -DASTERISK_VERSION=\"CVS-HEAD-10/25/04-10:11:46\" -DASTERISK_VERSION_NUM=999999 -DINSTALL_PREFIX=\"\" -DASTETCDIR=\"/etc/asterisk\" -DASTLIBDIR=\"/usr/lib/asterisk\" -DASTVARLIBDIR=\"/var/lib/asterisk\" -DASTVARRUNDIR=\"/var/run\" -DASTSPOOLDIR=\"/var/spool/asterisk\" -DASTLOGDIR=\"/var/log/asterisk\" -DASTCONFPATH=\"/etc/asterisk/asterisk.conf\" -DASTMODDIR=\"/usr/lib/asterisk/modules\" -DASTAGIDIR=\"/var/lib/asterisk/agi-bin\"     -DBUSYDETECT_MARTIN      -Wno-missing-prototypes -Wno-missing-declarations   -DZAPATA_PRI   -DIAX_TRUNKING   -DCRYPTO -fPIC    -c -o chan_agent.o chan_agent.c
chan_agent.c: In function `action_agents':
chan_agent.c:1190: structure has no member named `bridge'
chan_agent.c:1191: structure has no member named `callerid'
make[1]: *** [chan_agent.o] Error 1
make[1]: Leaving directory `/usr/src/asterisk-cvs-ready/asterisk/channels'
make: *** [subdirs] Error 1

Realised, this patch is for stable, was compiling against latest CVS. Could this patch be modified for latest CVS? seems like a step in the right derection? :)

edited on: 10-25-04 04:36

By: drmac (drmac) 2004-10-25 22:12:02

Hehe. Yea, its for stable. Yes, I will update it tomorrow for 1.1


By: Russell Bryant (russell) 2004-11-07 20:05:54.000-0600

Request for update.  Please attach a patch for CVS head or this will have to be closed due to lack of interest.  New features won't make it in to stable.

-- Housekeeping

By: drmac (drmac) 2004-11-08 10:22:30.000-0600

Uploaded chan-agent-manager-agents.patch.txt to work with most recent CVS.

By: Mark Spencer (markster) 2004-11-08 10:50:50.000-0600

Hrm, it still didn't apply here, I got two rejects :(

By: drmac (drmac) 2004-11-08 11:27:35.000-0600

rejects? I am using the following command:

(pwd is /usr/src/asterisk/)

"cvs diff -u channels/chan_agents.c >mypatchfile.patch"

should I be doing something different?

By: jmls (jmls) 2004-11-08 12:39:26.000-0600

oops. I got 2 rejects as well. Sorry for the erroneous note.

By: drmac (drmac) 2004-11-08 16:37:35.000-0600

what are you getting rejects on?  Here is my output:

[root@dev-asterisk asterisk]# rm channels/chan_agent.c

[root@dev-asterisk asterisk]# cvs update
U channels/chan_agent.c

[root@dev-asterisk asterisk]# patch -p0 <chan-agent-manager-event.patch
patching file channels/chan_agent.c

[root@dev-asterisk asterisk]#

See!?! I've got no probs. Am I doing something wrong?

By: jmls (jmls) 2004-11-09 01:27:40.000-0600

# rm -f channels/chan_agent.c
# cvs update
cvs server: Updating channels
U channels/chan_agent.c

# patch -p0 <*.patch
patching file channels/chan_agent.c
Hunk #1 succeeded at 82 with fuzz 2.
Hunk #2 succeeded at 1164 with fuzz 1.
Hunk #3 FAILED at 1799.
Hunk #4 FAILED at 1821.
2 out of 4 hunks FAILED -- saving rejects to file channels/chan_agent.c.rej

By: drmac (drmac) 2004-11-09 11:28:24.000-0600

I'm sorry. I'm using "make update" instead of cvs update. Will that make a big difference?

By: drmac (drmac) 2004-11-09 11:31:20.000-0600

no it doesn't. I did it again and it still works fine for me.

[root@dev-asterisk asterisk]# rm channels/chan_agent.c
rm: remove regular file `channels/chan_agent.c'? y

[root@dev-asterisk asterisk]# cvs update
cvs server: Updating channels
U channels/chan_agent.c

[root@dev-asterisk asterisk]# grep chan_agent channels/CVS/Entries
/chan_agent.c/1.89/Tue Nov  9 16:21:44 2004//

[root@dev-asterisk asterisk]# patch -p0 <chan-agent-manager-event.patch
patching file channels/chan_agent.c

I'm at a loss...

By: Mark Spencer (markster) 2004-11-14 19:39:12.000-0600

Oh, it's probably because you're on stable.  You need to be on CVS head! :)

By: drmac (drmac) 2004-11-15 10:06:20.000-0600

say what? I've always been on CVS head. How do I ensure I am on cvs head? Every day I do a "make update" and always get changes.

Is there a map of the whole CVS tree somewhere? I thought 1.0 was "stable" and every "cvs update" past that was un-stable.


By: jmls (jmls) 2004-11-23 03:59:40.000-0600

a "cvs update" updates the branch that you are on - so if you had the 1.0 stable branch, cvs update would apply any changes made to the 1.0 branch, not the HEAD. In general, updates to a "stable" branch are bug fixes, not feature enhancements.

create a new directory, and check out the HEAD, then apply your patches to these files.

BTW - I *really* want your patch into the system ! Please!

By: drmac (drmac) 2004-11-23 08:25:20.000-0600

OK. I just did a "make update" and when it finished I did this:

cat .version

and got this:


so if this is NOT the most recent version of asterisk possible, please someone give me the exact command to execute to checkout what I need. Thanks.

By: drmac (drmac) 2004-11-23 08:41:46.000-0600

Okies. I'm guessing I finally got the most recent CVS.

/chan_agent.c/1.91/Tue Nov 23 13:26:28 2004//

I've uploaded a new patchfile that should work with this version of chan_agent.c


By: Mark Spencer (markster) 2004-11-23 12:57:19.000-0600

Looks ready to merge pending the author confirming they've submitted a disclaimer.

By: drmac (drmac) 2004-11-23 14:03:29.000-0600

*grin* that was the first question you asked me mark.

maby someone can modify the bug system to make it so people with confirmed disclaimers show up as "drmac(D)"

By: Mark Spencer (markster) 2004-12-01 00:02:12.000-0600

You're right, I did ask and you did answer.  Added to CVS head, thank you very much.

By: Russell Bryant (russell) 2004-12-02 19:15:29.000-0600

not in 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:15:21.000-0600

Repository: asterisk
Revision: 4363

U   trunk/channels/chan_agent.c
A   trunk/contrib/scripts/agents.php

r4363 | markster | 2008-01-15 15:15:20 -0600 (Tue, 15 Jan 2008) | 2 lines

Merge manager action and example (bug ASTERISK-2655)