Find and agent with an extension

im triyng to find an logged agent into asterisk, so when some body makes a call i want to find if the CID has an logged agent, if so i deny the call inmedially…
how can i do that?

i been reading about funtions like AGENT and DB_EXIST??

any help would be terrific !!! :wink:


Your question doesn’t make sense.

perhaps you could expand a little


all right … ill try it again

I have 2 agent and they are logged daily, I want that when someone tries to make outbound call, first verifying whether the extension from which the call is made if there is an agent online, …

my agents can logged from any extension :question:

so its like this


if from extension is an agent logged in then
message"you cannot make a call"
the call is proceding
end if

i’ve been reading function AGENT but this funtion ask me the agent code first… and DB_EXIST also works but knowing the Agent code and i dont have the code i only have the CID

I hope this could be more easy to undestand… i dont speak english :frowning:


Agent call back logins are deprecated.

In any case, I don’t believe that the existence of a call back login is saved against the device.

Wouldn’t simple agent logins be better, in which case they cannot make a call?

well the fact is that i need to find out with the CID if there is an agent logged in… thats al the big deal… the rest i can change it…

…ohh and the agent cant make calls while they are logged in…


ALL RIGHT… i find out how to do that is a variable called
AGENTBYCALLERID_${CALLERID(NUMBER) and its global, it give the agent code from any extension if there is an agent logged from there !!!

IM HAPPY NOW :laughing:

can anybody help me with this…

im using this piece of code in asterisk 1.2 but ti looks like ${AGENTBYCALLERID_${CALLERID(NUMBER)}}) it dosent exist… but i copy the same piece of code to a machine with asterisk 1.4 and it works perfectly… and i realy need to put this work out on asterisk 1.2

this is the complete code for asterisk 1.2 on 1.4 y replace setvar for set the rest is the same

exten => 3139000,1,answer
exten => 3139000,n,setvar(agenteis=${AGENTBYCALLERID_${CALLERID(NUMBER)}})
exten => 3139000,n,noop(------------------>${agenteis})
exten => 3139000,n,gotoif($["${agenteis}"!="")]?marcarag)
exten => 3139000,n,musiconhold()
exten => 3139000,n(marcarag),DEADAGI(showme.agi|${EXTEN}|zap/g0/${EXTEN}|outbound|Agent/${agenteis})
exten => 3139000,n,hangup

!! :question: