Login logout Agents

From Wildix

Jump to: navigation, search

Contents

Login Logout Script


What does this script provide

This scripts permit to login logout dynamic agents in a smart way with the same code for both login and logout. It does several important check:

loginlogout script behaviour:

  1. Check if the agent is already logged on that handset. If true logout it
  2. Check if the agent is not logged on that phonenumber then login and play agent-loginok
  3. Check if the agent is already logged on another phone. In this case play "agent_already_logged_onanother_phone"
  4. if phone is already used by an agent then play phone_number_already_used_byagents.gsm
  5. if for any reason login exit with error play error_agent_not_logged

How to use it

A) Add to your WMS the following sounds (you have to record them in mp3 or wav then upload from sounds menu):

  1. phone_number_already_used_byagents.gsm
  2. error_agent_not_logged.gsm
  3. agent_already_logged_onanother_phone.gsm


B)If you have agents from 900 to 999 then in context user write something like _9XX,1,goto(loginlogout|${EXTEN}1) If you have agents in another range you have to substitute 9XX in the code with your range (Ex 8XX for agents from 800-899 ecc.)

C) create a context loginlogout and copy there the script.

the loginlogout script

;variables to provide biunique relation between         agents <--> phones
;{AGENTBYCALLERID_${CALLERID(num)}-->  agentbycallerid_phonenumber=agentnumber  ;( 0 if no agents)
; AGENT_${EXTEN}-->  agent_agentnumber=phonenumber  ( 0 if no phones)
;EXTEN --> agent number dialed from the user
;CALLERID(num)--> the phonenumber  to login to   (or  logout  from)
;
_9XX,1,Noop(${DB(/Agents/900)})
; Verify if phonenumber is logged or not
_9XX,2,gotoif($[${AGENTBYCALLERID_${CALLERID(num)}}>0]?20:3)
;Verify if agent EXTEN is logged or not
;
_9XX,3,GotoIf($[0${DB(/Agents/${EXTEN})}=0]?4:30)
;_9XX,3,gotoif($[${AGENT_${EXTEN}}>0]?30:4)
;login agent on that phone_number
_9XX,4,AgentcallBacklogin(${EXTEN}|s|${CALLERID(num)}@users)
;Verify if agent EXTEN is now logged
_9XX,5,gotoif($[${AGENTBYCALLERID_${CALLERID(num)}}=${EXTEN}]?6:40)
;I write that agent EXTEN is now loged on that phone_number
;_9XX,6,Setglobalvar(AGENT_${EXTEN}=${CALLERID(num)})
_9XX,6,noop()
_9XX,7,playback(agent-loginok)
_9XX,8,HangUp()
;
;Phone_number is already associated with an agent. Verify  if agent_number associated is equal or different to EXTEN
_9XX,20,gotoif($[${AGENTBYCALLERID_${CALLERID(num)}}=${EXTEN}]?21:25)
;Agent logged is EXTEN. Then I logout it
_9XX,21,System(asterisk -rx "agent logoff Agent/${EXTEN}")
;
;I write on AGENT variable that agent is no more logged
;_9XX,22,Setglobalvar(AGENT_${EXTEN}=0)
_9XX,22,noop()
_9XX,23,Playback(agent-loggedoff)
_9XX,24,HangUp()
;
;phonenumber CALLERID(num) is already logged but with another agent
_9XX,25,PlayBack(phone_number_already_used_byagents)
_9XX,26,HangUp()
;
;agent EXTEN is already logged on another phone_number
_9XX,30,Playback(agent_already_logged_onanother_phone)
_9XX,31,HangUp()
;
;For some reasons (ex. incorrect password,agent doesnt exist ecc.) agent has not been logged in
_9XX,40,Playback(error_agent_not_logged)
_9XX,41,HangUp()
Personal tools
VoIP operators
System services: