I`m looking for help for the below code.
It was working fine but after update or something else!, it 'seems that is not working any more!!!
[check-agent]
exten => _X.,1,noop(select agent)
same => n,noop(${CALLERID(num)})
same => n,MYSQL(Connect connid localhost user pass asteriskcdrdb)
same => n,MYSQL(Query resultid ${connid} Select cnum from cdr where dst like “%${CALLERID(num)}” and calldate > DATE_SUB( now(), INTERVAL 30 MINUTE ) ORDER BY calldate DESC LIMIT 1)
same => n,MYSQL(Fetch fetchid ${resultid} agentnum)
same => n,MYSQL(Disconnect ${connid})
same => n,noop(${agentnum})
same => n,set(agentnum=a${agentnum})
same => n,noop(${agentnum})
same => n,GotoIf($[${agentnum} = a]?none:exist)
same => n(exist),noop(goto agent)
same => n,goto(from-internal,${agentnum:1},1)
same => n(none),noop(goto trunk)
same => n,goto(from-trunk,99998901,1)
The code is for directing incoming call based on the last extension that call them.
but after update, all the incoming are going to the IVR and looks like the code is not active!
You’ll still need to provide the log of a call attempt if you’d like assistance with it. It’ll be hard for anyone here to guess what’s going on without a call log example.
For the record, I found the issue and it wasn’t related to the Asterisk version. the config for the trunk was removed from the trunk.
I just added context=check-agent to the related trunk and it`s working fine now :))