Agent login from external application

Hello all,

How can we do an agent login (agent id / password / phone extension) with the ‘originate’ manager api?

What are the required api parameter values?
What are the required Asterisk settings (in conf files)?

I have found the following but It is not enough clear for me (for example I don’t found any reference to the agent password):

Login / Logout using the Manager API
I had a need to be able to login/Logout agents from management console that I developed to manage ACD queues.

My solution was to setup some extension and use the manager originate command to dial those extensions allowing me to login/logout agents.

To extensions.conf add

exten => 02000000001,1,AgentCallBackLogin(${CALLERIDNUM}|s|${CALLERIDNUM}@to-your-agent-context)
exten => 02000000002,1,Dial(Local/02000000003/n,D(#))
exten => 02000000003,1,AgentCallbackLogin(${CALLERIDNUM}|s|’#’)

; for local channel

exten => 1234,1,Answer
exten => 1234,2,Hangup

use the manager API originate command to login/logout see examplse below

Action: Originate
Channel: Local/02000000001/n
Context: default’
Exten: 1234
Priority: 1
Timeout: 30000’

to logout do exactly the same but change the channel to Local/02000000002/n as per the dial-plan.

The action to log an agent in is QueueAdd. The thing is you have to log the agent into the queues one by one.
Then the action for logging an agent out of all queues is AgentLogoff.

QueueAdd Parameters:

ActionID - ActionID for this transaction. Will be returned.
Queue - Queue’s name.
Interface - The name of the interface (tech/name) to add to the queue.
Penalty - A penalty (number) to apply to this member. Asterisk will distribute calls to members with higher penalties only after attempting to distribute calls to those with lower penalty.
Paused - To pause or not the member initially (true/false or 1/0).
MemberName - Text alias for the interface.

AgentLogoff Parameters:

ActionID - ActionID for this transaction. Will be returned.
Agent - Agent ID of the agent to log off.
Soft - Set to true to not hangup existing calls.

Hope this helps you.