FOP2 + dynamic agents

Hello,

first of all, allow me to thank you for the great product you've provided.

However, we have a slight problem using new version of FOP2 with our dynamic agents login/logout script. Script is supposed to log in user to device (deviceandusermode enabled in freepbx) and add agent to the queues. Most of the time everything works perfectly - only sometimes, when agent logs out of the queue, the agent's button in FOP2 stays busy forever. Line on the physical phone is not busy, user can login and logout again, he can take calls, reseting the phone doesn't help either. Problem goes away if i restart fop2 service.

Screenshot:
http://www.grom.si/download/annoyance.jpg


We're using:
- Asterisk 1.4.40
- Freepbx 2.8.1.4
- Fop2 2.20
- I've added custom dialplans to extensions_override_freepbx.conf

Dialplan for logging in /out users to device and adding / removing agents from the queues:

[macro-agent-management-sso]
exten => s,1,Wait(1)
exten => s,n,Set(DEVICEUSER=${DB(DEVICE/${CALLERID(number)}/user)})
exten => s,n,Set(CID=${CALLERID(number)})
exten => s,n,Macro(user-callerid,SKIPTTL)
exten => s,n,Set(CALLBACKNUM=${CALLERID(number)})
exten => s,n,Set(AGENT_IP=${SIPCHANINFO(peerip)})
exten => s,n,NoOp(${AGENT_IP})
exten => s,n,GoToIf($[${DB_EXISTS(agent_location/${CID})}]?go)
exten => s,n(get_user),Read(PROMPT,agent-user,8);
exten => s,n,Set(CALLBACKNUM=${PROMPT})
exten => s,n,Set(DB(agent_location/${CID})=${PROMPT})
exten => s,n,Set(CALLBACKNUM=${DB(agent_location/${CID})})
exten => s,n(go),AGI(agent.pl)
exten => s,n,GotoIf($["${AGENT_ACTION}" = "logout"]?logout)
; Login
exten => s,n,UserEvent(Agentlogin,Agent: ${CALLBACKNUM})
exten => s,n,AGI(user_login_out.agi,login,${CALLERID(number)},${CALLBACKNUM})
exten => s,n,System(/var/lib/asterisk/agi-bin/notify.pl ${CID} ${AGENT_IP} ${AGENT_ACTION})
exten => s,n,Playback(agent-loginok)
exten => s,n,SayDigits(${CALLBACKNUM})
exten => s,n,Goto(end)
; Logout
exten => s,n(logout),UserEvent(RefreshQueue)
exten => s,n,NoOp("Before Execif")
;exten => s,n,ExecIf(${DB_EXISTS(agent_location/${CID})}?Set,CALLBACKNUM=${DB_DELETE(agent_location/${CID})})
exten => s,n,Set(CALLBACKNUM=${DB_DELETE(agent_location/${CID})})
exten => s,n,NoOp("After Execif/ Before AGI")
exten => s,n,AGI(user_login_out.agi|logout|${CID})
exten => s,n,NoOp("After AGI")
exten => s,n,System(/var/lib/asterisk/agi-bin/notify.pl ${CID} ${AGENT_IP} ${AGENT_ACTION})
exten => s,n,Playback(agent-loggedoff)
exten => s,n(end),Hangup
exten => s,n,MacroExit()

I set up fop2 using fop2 module in freepbx. Can anyone see something obviously wrong?

Thanks for your help
Andrej

Comments

  • Hi,

    It is really hard to see anything right or wrong on a custom context like that. Unfortunately fixing this will not be easy at all. You will need to see if the users in fop2 are being generated as USER/XXXX (you can run /usr/local/fop2/autoconfig-users-freepbx.sh and look at the output). User & device mode complicates things further.

    If this happens ALWAYS, then it is easy to replicate. In that case you can start fop2_server in debug level 1 and capture the output:
    service fop2 stop
    cd /usr/local/fop2
    script capture.log
    ./fop2_server -X 1
    

    ..then log the user to trigger the problem, verify that in the fop2 screen you see it stuck, and then stop fop2_server and the capture.
    ctrl-C
    exit
    

    Then send me all relevant information via email and I might *try* to look into it. The relevant pieces are the output from autoconfig-buttons-freepbx.sh and the captured log, compressed to save some space.
  • Problem was solved by correcting the dialplan (adding sanity checks for login attempts) - Users were able to login with blank extensions (it happened sometimes by mistake). When they corrected their error and logged in properly, it caused strange results.

    Bottom line: all solved. Thanks for taking time & looking into it, Nicolas. Keep up the good work.
Sign In or Register to comment.