|
|
@@ -23,19 +23,24 @@ func HandleAMI(event map[string]string) {
|
|
|
//lfshook.NewLogger().Infof("===start======%s", event["Event"]
|
|
|
|
|
|
switch event["Event"] {
|
|
|
- case "DTMFBegin":
|
|
|
+
|
|
|
+ case "DTMFBegin": //ICP interrupt PAD
|
|
|
if utils.IsICP(event["CallerIDNum"]) {
|
|
|
- exten := strings.Split(strings.Split(event["Channel"], "/")[1], "-")[0]
|
|
|
+ exten := strings.Split(strings.Split(event["Channel"], "/")[1], "-")[0] //get ICP exten number
|
|
|
if utils.IsICP(exten) {
|
|
|
chans, err := CoreShowChannels()
|
|
|
if err != nil {
|
|
|
lfshook.NewLogger().Errorf("CoreShowChannels %+v", err)
|
|
|
}
|
|
|
- lfshook.NewLogger().Infof("===HangupRunningTask=PAD1=======%+v==== ", chans)
|
|
|
+
|
|
|
//1. Redirect the connected PAD to 0300
|
|
|
for _, ret := range chans {
|
|
|
-
|
|
|
- if utils.IsPAIU(ret.CallerIDNum) && ret.ChannelStateDesc == "Up" && utils.IsPAIU(exten) {
|
|
|
+ //lfshook.NewLogger().Infof("===HangupRunningTask=PAD1====Chans-ret===%+v==== ", ret)
|
|
|
+ if utils.IsPAIU(ret.CallerIDNum) && ret.ChannelStateDesc == "Up" && utils.IsICP(ret.ConnectedLineNum) { //hangup pad call ICP channel
|
|
|
+ //lfshook.NewLogger().Infof("===Hangup=Chan===%+v==== ", ret.Channel)
|
|
|
+ Hangup(ret.Channel)
|
|
|
+ } else if ret.ConnectedLineNum == "<unknown>" { //redirect pad chanspy channel
|
|
|
+ //lfshook.NewLogger().Infof("===Redirect=Chan===%+v==== ", ret.Channel)
|
|
|
err := Redirect(ret.Channel, "0300", "default", exten, "PAD")
|
|
|
if err != nil {
|
|
|
lfshook.NewLogger().Errorf("Redirect %+v", err)
|
|
|
@@ -228,7 +233,6 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
active.QueueTimer = time.AfterFunc(30*time.Second, func() { // check the PAD 30s timeout
|
|
|
|
|
|
- //lfshook.NewLogger().Infof("==Afterfunc to=OCC-QueueStatus=")
|
|
|
res, err := QueueStatus("0301", "") // check OCC queue , if empty OCC-PAD start
|
|
|
if err != nil {
|
|
|
lfshook.NewLogger().Infof("===OCC-QueueStatus==%+v", err)
|
|
|
@@ -278,33 +282,9 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /*res, err := QueueStatus("0301", "") // check OCC queue , if empty OCC-PAD start
|
|
|
- if err != nil {
|
|
|
- lfshook.NewLogger().Infof("===OCC-QueueStatus==%+v", err)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- lfshook.NewLogger().Infof("===OCC-QueueStatus= res=%+v", res)
|
|
|
-
|
|
|
- PADChan := ""
|
|
|
- for _, chanEntry := range res.Entrys {
|
|
|
- lfshook.NewLogger().Infof("====PAD answered by OCC1 pos:%s===chan:%s=", chanEntry.Position, chanEntry.Channel)
|
|
|
- if chanEntry.Position == "1" {
|
|
|
- PADChan = chanEntry.Channel
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- */
|
|
|
- //if PADChan != "" {
|
|
|
- //alstatus.AlarmStatus(strings.Split(strings.Split(res.Entrys[0].Channel, "/")[1], "-")[0], "connect")
|
|
|
alstatus.AlarmStatus(event["CallerIDNum"], "connect")
|
|
|
go RedirectInQueue(event["Channel"], "1411", "pad-page-occ-icp", "1") //PAD Page(OCC+ICPs)
|
|
|
- //go RedirectInQueue(PADChan, "1411", "pad-page-occ-icp", "1") //PAD Page(OCC+ICPs)
|
|
|
-
|
|
|
- go Dial("0401", "0512", "pad-rule-pacus-occ", "ano1", "ano1", "1") // PACUs dial OCC1
|
|
|
- // } else {
|
|
|
- // lfshook.NewLogger().Infof("===OCC-QueueStatus==PADCchan NULL")
|
|
|
- //}
|
|
|
+ go Dial("0401", "0512", "pad-rule-pacus-occ", "ano1", "ano1", "1") // PACUs dial OCC1
|
|
|
|
|
|
} else if active.ActivedCab == "8" /*&& ExtenStatus("1481") == "Idle" */ {
|
|
|
if priority.PADOccStart == 0 {
|
|
|
@@ -315,29 +295,10 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.PADStart = 1
|
|
|
}
|
|
|
}
|
|
|
- /* res, err := QueueStatus("0301", "") // check OCC queue , if empty OCC-PAD start
|
|
|
- if err != nil {
|
|
|
- lfshook.NewLogger().Infof("===OCC-QueueStatus==%+v", err)
|
|
|
- return
|
|
|
- }
|
|
|
- PADChan := ""
|
|
|
- for _, chanEntry := range res.Entrys {
|
|
|
- lfshook.NewLogger().Infof("====PAD answered by OCC1 pos:%s===chan:%s=", chanEntry.Position, chanEntry.Channel)
|
|
|
- if chanEntry.Position == "1" {
|
|
|
- PADChan = chanEntry.Channel
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- */
|
|
|
- //if PADChan != "" {
|
|
|
- //alstatus.AlarmStatus(strings.Split(strings.Split(res.Entrys[0].Channel, "/")[1], "-")[0], "connect")
|
|
|
- //go RedirectInQueue(PADChan, "1481", "pad-page-occ-icp", "8") //PAD Page(OCC+ICPs);goto confbrdigeIoin
|
|
|
+
|
|
|
alstatus.AlarmStatus(event["CallerIDNum"], "connect")
|
|
|
go RedirectInQueue(event["Channel"], "1411", "pad-page-occ-icp", "1") //PAD Page(OCC+ICPs)
|
|
|
- go Dial("0401", "0512", "pad-rule-pacus-occ", "ano8", "ano8", "8") // PACUs dial OCC1
|
|
|
- //} else {
|
|
|
- // lfshook.NewLogger().Infof("===OCC-QueueStatus==PADCchan NULL")
|
|
|
- //}
|
|
|
+ go Dial("0401", "0512", "pad-rule-pacus-occ", "ano8", "ano8", "8") // PACUs dial OCC8
|
|
|
}
|
|
|
} else {
|
|
|
lfshook.NewLogger().Infof("====PAD-OCC Priority false===")
|
|
|
@@ -460,12 +421,6 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.PADOCC)
|
|
|
break
|
|
|
}
|
|
|
- case "ChanSpyStart":
|
|
|
- lfshook.NewLogger().Infof("=========event:%s callerid:%s SpyeeConnectedLineName:%s SpyerExten:%s", event["Event"], event["CallerIDNum"], event["SpyeeConnectedLineName"], event["SpyerExten"])
|
|
|
- //PAD answered by OCC; ICPs chanspy PAD
|
|
|
- //if utils.IsPAIU(event["SpyeeConnectedLineName"]) && utils.IsIO(event["SpyerExten"]) { // check if it is PAD whisper IO/OCC
|
|
|
- //go Dial("0404", event["SpyeeConnectedLineName"], "chanspy-rule", "ano", "ano", "") //ICPs chanspy PAD
|
|
|
- //}
|
|
|
|
|
|
case "ConfbridgeLeave":
|
|
|
lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
|
@@ -567,10 +522,10 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.PADTMS)
|
|
|
if active.ActivedCab == "1" {
|
|
|
go RedirectInQueue(event["CallerIDName"], "2311", "chanspy-rule-whisper", "") //PAD chanspy(EqW) ICP1
|
|
|
- go Dial("0403", event["CallerIDName"], "call-pad-rule", "2381", "2381", "8") //ICP8---call----PAD
|
|
|
+ go Dial("0403", event["CallerIDName"], "call-pad-rule", "2381", "2381", "8") //ICP8---call----PAD
|
|
|
} else if active.ActivedCab == "8" {
|
|
|
go RedirectInQueue(event["CallerIDName"], "2381", "chanspy-rule-whisper", "") //PAD chanspy(EqW) ICP8
|
|
|
- go Dial("0403", event["CallerIDName"], "call-pad-rule", "2311", "2311", "1") //ICP1---call----PAD
|
|
|
+ go Dial("0403", event["CallerIDName"], "call-pad-rule", "2311", "2311", "1") //ICP1---call----PAD
|
|
|
}
|
|
|
} else if utils.IsPAIU(event["CallerIDNum"]) && event["Exten"] == "0405" { // PAD connect ICP-TMS;PACU not available
|
|
|
|