Dear Asterisk users,
I have been writing an interface to allow Guard Duty records for each department in my company.
I am using DBQuery module for that, but I have a problem concerning a variable in the dialplan !
Let me explain how I work :
Each department has a emergency number assigned :
2020 = NGN
2021 = TEL
2022 = IT
The engineer that is on call logs in the queue/agent of his department extension.
Example : XXX is on call for NGN : he calls AgentCallBackLogin, logs in extension 2020 with his mobile phone.
When our NOC wants to reach the on call engineer, he just needs to dial 2020 or public number going to 2020 and call is directly queued to the mobile phone of the logged in engineer.
Dialplan :
[restricted]
;GUARDUTY ADDON : incoming calls sent to [guarduty]
[color=red]exten => _202[0-2],1,Goto(guarduty,${EXTEN},1)[/color]
[guarduty]
; Call following, selecting database where to record the call
exten => _202[0-2],1,ExecIf($[${EXTEN}=2020]|Set|GLOBAL(table)=“guarduty-ngn”)
exten => _202[0-2],2,ExecIf($[${EXTEN}=2021]|Set|GLOBAL(table)=“guarduty-tel”)
exten => _202[0-2],3,ExecIf($[${EXTEN}=2022]|Set|GLOBAL(table)=“guarduty-it”)
[color=red]exten => _202[0-2],4,Queue(${EXTEN},r)[/color]
exten => _202[0-2],5,Hangup()
; Call recording to database on Hangup(), then clearing engineer variable
exten => h,1,DBQuery(${table},(${CDR(clid)},${CDR(src)},${CDR(dst)},[color=red]${engineer}[/color],${CDR(disposition)}))
exten => h,2,Set(GLOBAL(engineer)="")
[queuerelay]
include => queuelondon
[color=red]exten => 202[0-2],1,Set(GLOBAL(engineer)=${EXTEN})[/color]
exten => 202[0-2],2,Dial(SIP/${EXTEN},rt)
exten => 202[0-2],3,Hangup()
in QUEUERELAY I set the global variable ENGINEER to the extension logged in the 2020 (so, a mobile number). This is to assign the calls by number, to each engineer. Here is my problem, sometimes the variable is filled with the good data, sometimes when the engineer hangup, the variable is filled with something else, maybe because it’s global ?
In GUARDUTY, I just set the table name for the database writing, just here for your information.
How could I take care of this to be sure that each variable is linked to a call and cannot be modified if another call is done during the first call… ?
If I call 2020 :
– Executing [h@guarduty:1] DBQuery(“SIP/2069-a3554f28”, “guarduty-ngn|(”—" <3271XX2069>|3271XX2069|2020[color=red]||[/color]ANSWERED)") in new stack
– Executing [h@guarduty:2] Set(“SIP/2069-a3554f28”, “GLOBAL(engineer)=”"") in new stack
Between the two red | | , there should be the $engineer variable displayed.
[ul]Is it a way to use variable that are linked for each call (such as CDR variables) ?
Is there a variable, in CDR variables, that can be used to get the number of an agent logged in a queue ?[/ul]
Thank you very much for your assistance.