|
|
@@ -48,16 +48,42 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
case "Hangup":
|
|
|
lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
|
- if utils.IsPAIU(event["CallerIDNum"]) && utils.IsICP(event["Exten"]) { // Alarm dial queue start; PAD dialing
|
|
|
+ if utils.IsPAIU(event["CallerIDNum"]) && utils.IsICP(event["Exten"]) { // PAD status , hangup
|
|
|
alstatus.PaStatus(event["CallerIDNum"], "PAD", "end")
|
|
|
}
|
|
|
|
|
|
case "QueueCallerJoin":
|
|
|
lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
|
- if utils.IsPAIU(event["CallerIDNum"]) { // Alarm join the queue, PAD in the queue
|
|
|
+ if utils.IsPAIU(event["CallerIDNum"]) && event["Queue"] == "0300" { // Alarm join the queue, PAD in the queue
|
|
|
alstatus.AlarmStatus(event["CallerIDNum"], "queue")
|
|
|
}
|
|
|
|
|
|
+ case "QueueCallerLeave": // Alarm timeout , redirect to OCC
|
|
|
+
|
|
|
+ if utils.IsPAIU(event["CallerIDNum"]) { // caller is PAD
|
|
|
+ var infoExt model.Extension
|
|
|
+ PacuNum := utils.GetPacuByPad(event["CallerIDNum"])
|
|
|
+
|
|
|
+ _, er := mysql.DBOrmInstance.Where("exten = ?", PacuNum).Get(&infoExt)
|
|
|
+ if er != nil {
|
|
|
+ lfshook.NewLogger().Logger.Infof("update special voice to exten err : %+v", er.Error())
|
|
|
+ }
|
|
|
+
|
|
|
+ if infoExt.Status == "Idle" { //check PACU status
|
|
|
+ if active.CabNum == "1" && active.Actived {
|
|
|
+ Dial("0401", PacuNum, "default", PacuNum, event["CallerIDNum"], "1") // PACU dial OCC1
|
|
|
+ } else if active.CabNum == "8" && active.Actived {
|
|
|
+ Dial("0401", PacuNum, "default", PacuNum, event["CallerIDNum"], "8") // PACU dial OCC8
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if active.CabNum == "1" && active.Actived {
|
|
|
+ RedirectInQueue(event["CallerIDNum"], "0401", "default", "1") // PAD dial OCC1
|
|
|
+ } else if active.CabNum == "8" && active.Actived {
|
|
|
+ RedirectInQueue(event["CallerIDNum"], "0401", "default", "8") // PAD dial OCC8
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
case "ConfbridgeJoin":
|
|
|
lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
|
if utils.IsICP(event["CallerIDNum"]) && event["Exten"] == "0500" { // PA start
|