|
|
@@ -80,7 +80,7 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
|
for _, caller := range resCaller.Entrys {
|
|
|
lfshook.NewLogger().Infof("===QueueStatus=entry=%+v", caller)
|
|
|
- time.Sleep(time.Microsecond * 100)
|
|
|
+ time.Sleep(time.Millisecond * 100)
|
|
|
RedirectInQueue(caller.CallerIDNum, "0300", "queues-icp-redirect", caller.CallerIDNum) // redirect All PAD redirect to ICP queue
|
|
|
}
|
|
|
|
|
|
@@ -113,7 +113,7 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
number := strings.Split(strings.Split(ret.Channel, "-")[0], "/")[1]
|
|
|
active.NotifyPaiu(number, "hold")
|
|
|
- HangupAllLocalChan()
|
|
|
+ //HangupAllLocalChan()
|
|
|
|
|
|
} else if utils.IsPAIU(ret.CallerIDNum) && ret.ChannelStateDesc == "Up" && utils.IsICP(ret.ConnectedLineNum) {
|
|
|
lfshook.NewLogger().Infof("===Hangup=Chan===%+v==== ", ret.Channel)
|
|
|
@@ -123,7 +123,9 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
|
priority.InterruptedPad = priority.RunningType
|
|
|
HangupAllLocalChan()
|
|
|
- Hangup(priority.RunningPATaskChan)
|
|
|
+ if !strings.Contains(priority.RunningPATaskChan, "0502@default") {
|
|
|
+ Hangup(priority.RunningPATaskChan)
|
|
|
+ }
|
|
|
priority.CleanPriorityTag()
|
|
|
//HangupRunningTask("C2C")
|
|
|
} else if priority.RunningType == "PAD-OCC" {
|
|
|
@@ -138,14 +140,16 @@ func HandleAMI(event map[string]string) {
|
|
|
if event["UserEvent"] == "CallType" && (event["Type"] == "PA" || event["Type"] == "CPA") { //PA start; check manual PA priority
|
|
|
//PA & CPA interrupt others
|
|
|
if utils.IsICP(event["CallerIDNum"]) {
|
|
|
- //priority.PAStart = 1
|
|
|
+
|
|
|
if active.ActivedCab == "" { //No active Signal on both side,Hangup caller
|
|
|
Hangup(event["CallerIDNum"])
|
|
|
}
|
|
|
|
|
|
if priority.CheckPriority("ManuPa") {
|
|
|
//hangup others if priority is higher
|
|
|
+ lfshook.NewLogger().Infof("=====UserEvent===event======PA start=======")
|
|
|
HangupRunningTask("PA") //PA interrupt other
|
|
|
+ priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.ManuPa)
|
|
|
} else {
|
|
|
Hangup(event["CallerIDNum"]) //lowwer priority ,hangup caller
|
|
|
}
|
|
|
@@ -178,7 +182,6 @@ func HandleAMI(event map[string]string) {
|
|
|
if priority.RunningType == "PAD-ICP" || priority.RunningType == "PAD-TMS" || priority.RunningType == "PA" {
|
|
|
HangupRunningTask("C2C")
|
|
|
//Hangup the other ICP
|
|
|
-
|
|
|
} else {
|
|
|
lfshook.NewLogger().Infof("========CabCab hangup other one====caller %s", event["CallerIDNum"])
|
|
|
if event["CallerIDNum"] == "2311" {
|
|
|
@@ -187,6 +190,7 @@ func HandleAMI(event map[string]string) {
|
|
|
Hangup("2311")
|
|
|
}
|
|
|
}
|
|
|
+ priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.CabCab)
|
|
|
} else { // hangup caller; C2C start failed
|
|
|
lfshook.NewLogger().Infof("========CabCab hangup caller====%s", event["CallerIDNum"])
|
|
|
Hangup(event["CallerIDNum"])
|
|
|
@@ -295,13 +299,14 @@ func HandleAMI(event map[string]string) {
|
|
|
case "Hangup":
|
|
|
|
|
|
lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
|
-
|
|
|
//OCC answer PAD, hangup, redirect the next PAD to OCC
|
|
|
if utils.IsIO(event["CallerIDNum"]) && (event["ConnectedLineNum"] == "ano1" || event["ConnectedLineNum"] == "ano8") && event["Context"] == "default" {
|
|
|
lfshook.NewLogger().Infof("====Hangup OCC-PAD=====%+v", event)
|
|
|
// OCC hangup detected, hangup other running channels
|
|
|
HangupAllLocalChan()
|
|
|
- Hangup(priority.RunningPATaskChan)
|
|
|
+ if !strings.Contains(priority.RunningPATaskChan, "0502@default") {
|
|
|
+ Hangup(priority.RunningPATaskChan)
|
|
|
+ }
|
|
|
|
|
|
res, _ := QueueStatus("0301", "") // check OCC queue ,if empty PAD end
|
|
|
if res.Calls == "0" { //OCC queue is empty
|
|
|
@@ -310,13 +315,25 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.OCCAnswer = 0
|
|
|
priority.PADOccStart = 0
|
|
|
|
|
|
- if priority.ResumeEmgPara.FileName != "" {
|
|
|
- time.Sleep(time.Second)
|
|
|
- CheckEmgResume()
|
|
|
+ if active.EMGCONFID != "" {
|
|
|
+ priority.RunningType = "EMG"
|
|
|
+ priority.RunningTypePriority = active.InfoEMG.Priority
|
|
|
+ priority.RunningPATaskChan = active.InfoEMG.RunChannel
|
|
|
+
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
+ active.ICPCONBID = active.EMGCONFID
|
|
|
+ EMGConfbridgeReinvite(active.EMGCONFID)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if active.ICPCONBID != "" {
|
|
|
+ ConfbridgeKick(active.ICPCONBID, "all")
|
|
|
+ active.ICPCONBID = ""
|
|
|
}
|
|
|
break
|
|
|
} else { //OCC queue is not empty
|
|
|
// HangupAllLocalChan()
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
lfshook.NewLogger().Infof("====Start OCC-PAD===next==%+v", res)
|
|
|
if active.ActivedCab == "1" && ExtenStatus("1411") == "Idle" { //check active and OCC status
|
|
|
time.Sleep(time.Second)
|
|
|
@@ -386,14 +403,21 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.PADStart = 0
|
|
|
|
|
|
priority.CleanPriorityTag()
|
|
|
-
|
|
|
- if active.CONBID != "" {
|
|
|
- ConfbridgeKick(active.CONBID, "all")
|
|
|
+ if active.EMGCONFID != "" {
|
|
|
+ priority.RunningType = "EMG"
|
|
|
+ priority.RunningTypePriority = active.InfoEMG.Priority
|
|
|
+ priority.RunningPATaskChan = active.InfoEMG.RunChannel
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
+ active.ICPCONBID = active.EMGCONFID
|
|
|
+ EMGConfbridgeReinvite(active.EMGCONFID)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if active.ICPCONBID != "" {
|
|
|
+ ConfbridgeKick(active.ICPCONBID, "all")
|
|
|
+ active.ICPCONBID = ""
|
|
|
}
|
|
|
}
|
|
|
- /*if priority.ResumeEmgPara.FileName != "" {
|
|
|
- CheckEmgResume()
|
|
|
- }*/
|
|
|
+
|
|
|
priority.ICPAnswer = 0
|
|
|
priority.OCCAnswer = 0
|
|
|
break
|
|
|
@@ -419,7 +443,7 @@ func HandleAMI(event map[string]string) {
|
|
|
}
|
|
|
|
|
|
if priority.ICPAnswer == 0 && ICPQueue.Calls == "1" { //ICP did not answer any first call to the ICP queue ; Ready to Set Occ Queue Timer
|
|
|
- toRunpriority, _ := strconv.Atoi(priority.GetPriorityByKey("PAD-ICP"))
|
|
|
+ toRunpriority := priority.GetPriorityByKey("PAD-ICP")
|
|
|
|
|
|
//PAD press key
|
|
|
lfshook.NewLogger().Infof("===QueueCallerJoin===runing:%d=====toRun:=%d==Status:%s", priority.RunningTypePriority, toRunpriority, event["ChannelStateDesc"])
|
|
|
@@ -449,7 +473,7 @@ func HandleAMI(event map[string]string) {
|
|
|
lfshook.NewLogger().Infof("====Redirect to 0301 entry:%s=Pos:%s==", caller.CallerIDNum, caller.Position)
|
|
|
//order by pos
|
|
|
RedirectInQueue(caller.CallerIDNum, "0301", "queues-occ", caller.CallerIDNum) // redirect All ICP-PAD redirect to OCC queue
|
|
|
- time.Sleep(time.Microsecond * 500) //200 ms delay
|
|
|
+ time.Sleep(time.Millisecond * 100) //200 ms delay
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
@@ -468,7 +492,8 @@ func HandleAMI(event map[string]string) {
|
|
|
HangupRunningTask("PAD-OCC") //PAD-OCC interrupt other
|
|
|
priority.OCCAnswer = 1
|
|
|
|
|
|
- if active.ActivedCab == "1" /* && ExtenStatus("1411") == "Idle" */ { //check active and OCC status
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
+ if active.ActivedCab == "1" && ExtenStatus("1411") == "Idle" { //check active and OCC status
|
|
|
/*if priority.PADOccStart == 0 {
|
|
|
alstatus.OccPad("start")
|
|
|
priority.PADOccStart = 1
|
|
|
@@ -482,7 +507,7 @@ func HandleAMI(event map[string]string) {
|
|
|
go RedirectInQueue(event["Channel"], "1411", "pad-page-occ-icp", event["CallerIDNum"]) //PAD Page(OCC+ICPs)
|
|
|
go Dial("0401", "0512", "pad-rule-pacus-occ", "ano1", "ano1", "1") // PACUs dial OCC1
|
|
|
|
|
|
- } else if active.ActivedCab == "8" /*&& ExtenStatus("1481") == "Idle" */ {
|
|
|
+ } else if active.ActivedCab == "8" && ExtenStatus("1481") == "Idle" {
|
|
|
/*if priority.PADOccStart == 0 {
|
|
|
alstatus.OccPad("start")
|
|
|
priority.PADOccStart = 1
|
|
|
@@ -512,7 +537,14 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "EMG"
|
|
|
//Pa status report
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.EMG)
|
|
|
- active.CONBID = event["Conference"]
|
|
|
+ //active.ICPCONBID = event["Conference"]
|
|
|
+ //active.ICPCONBTYP = "EMG"
|
|
|
+ active.EMGCONFID = event["Conference"]
|
|
|
+ //================================
|
|
|
+ active.InfoEMG.RunChannel = event["Channel"]
|
|
|
+ active.InfoEMG.Priority = priority.RunningTypePriority
|
|
|
+ active.InfoEMG.RunType = "EMG"
|
|
|
+
|
|
|
alstatus.PaStatus("", "EMG", "start")
|
|
|
return
|
|
|
}
|
|
|
@@ -522,7 +554,8 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "SPC"
|
|
|
//Pa status report
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.SPC)
|
|
|
- active.CONBID = event["Conference"]
|
|
|
+ active.ICPCONBID = event["Conference"]
|
|
|
+ active.ICPCONBTYP = "SPC"
|
|
|
alstatus.PaStatus("", "SPC", "start")
|
|
|
return
|
|
|
}
|
|
|
@@ -532,7 +565,8 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "DCS"
|
|
|
//Pa status report
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.DCS)
|
|
|
- active.CONBID = event["Conference"]
|
|
|
+ active.ICPCONBID = event["Conference"]
|
|
|
+ active.ICPCONBTYP = "DCS"
|
|
|
alstatus.PaStatus("", "DCS", "start")
|
|
|
return
|
|
|
}
|
|
|
@@ -542,7 +576,8 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "STN"
|
|
|
//Pa status report
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.STN)
|
|
|
- active.CONBID = event["Conference"]
|
|
|
+ active.ICPCONBID = event["Conference"]
|
|
|
+ active.ICPCONBTYP = "STN"
|
|
|
alstatus.PaStatus("", "STN", "start")
|
|
|
return
|
|
|
}
|
|
|
@@ -552,7 +587,8 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "CHK"
|
|
|
//Pa status report
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.CHK)
|
|
|
- active.CONBID = event["Conference"]
|
|
|
+ active.ICPCONBID = event["Conference"]
|
|
|
+ active.ICPCONBTYP = "CHK"
|
|
|
alstatus.PaStatus("", "CHK", "start")
|
|
|
return
|
|
|
}
|
|
|
@@ -562,7 +598,8 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "VOL"
|
|
|
//Pa status report
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.VOL)
|
|
|
- active.CONBID = event["Conference"]
|
|
|
+ active.ICPCONBID = event["Conference"]
|
|
|
+ active.ICPCONBTYP = "VOL"
|
|
|
alstatus.PaStatus("", "VOL", "start")
|
|
|
return
|
|
|
}
|
|
|
@@ -570,25 +607,34 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
//get confbridge id for join back to confbridge
|
|
|
if event["Context"] == "pad-page-occ-icp" && utils.IsPAIU(event["CallerIDNum"]) {
|
|
|
- active.CONBID = event["Conference"]
|
|
|
- } else if event["Context"] == "cpa-rule" && utils.IsIO(event["CallerIDNum"]) {
|
|
|
- active.CONBID = event["Conference"]
|
|
|
+ active.ICPCONBID = event["Conference"] //pad-occ
|
|
|
}
|
|
|
|
|
|
//Send PA start msg to STC
|
|
|
if utils.IsICP(event["CallerIDNum"]) && event["Exten"] == "0500" { // PA start
|
|
|
- lfshook.NewLogger().Infof("====PA status:%s=====", "start")
|
|
|
+
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.ManuPa)
|
|
|
alstatus.PaStatus(event["CallerIDNum"], "PA", "start")
|
|
|
priority.RunningPATaskChan = event["Channel"]
|
|
|
priority.RunningType = "PA"
|
|
|
+ active.ICPCONBID = event["Conference"] //cpa
|
|
|
+ active.ICPCONBTYP = "PA"
|
|
|
break
|
|
|
} else if utils.IsIO(event["CallerIDNum"]) && event["Exten"] == "0501" { //CPA start
|
|
|
- lfshook.NewLogger().Infof("====CPA status:%s=====", "start")
|
|
|
+
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.CPA)
|
|
|
alstatus.PaStatus(event["CallerIDNum"], "CPA", "start")
|
|
|
priority.RunningPATaskChan = event["Channel"]
|
|
|
priority.RunningType = "CPA"
|
|
|
+ //active.ICPCONBID = event["Conference"] //cpa icp
|
|
|
+ //active.ICPCONBTYP = "CPA"
|
|
|
+ active.CPACONFID = event["Conference"] //cpa
|
|
|
+
|
|
|
+ //=====================================
|
|
|
+ active.InfoCPA.RunChannel = event["Channel"]
|
|
|
+ active.InfoCPA.Priority = priority.RunningTypePriority
|
|
|
+ active.InfoCPA.RunType = "CPA"
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|
|
|
@@ -636,85 +682,148 @@ func HandleAMI(event map[string]string) {
|
|
|
case "ConfbridgeLeave":
|
|
|
lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
|
if utils.IsICP(event["CallerIDNum"]) && event["Exten"] == "0500" { // PA end
|
|
|
+
|
|
|
SetPadTimer()
|
|
|
- lfshook.NewLogger().Infof("====PA status =====%s", "end")
|
|
|
priority.CleanPriorityTag()
|
|
|
alstatus.PaStatus(event["CallerIDNum"], "PA", "end")
|
|
|
- if priority.ResumeEmgPara.FileName != "" {
|
|
|
- CheckEmgResume()
|
|
|
+
|
|
|
+ lfshook.NewLogger().Infof("====active.EMGCONFID:%s ====active.ICPCONBID:=%s", active.EMGCONFID, active.ICPCONBID)
|
|
|
+
|
|
|
+ if active.EMGCONFID != "" {
|
|
|
+ priority.RunningType = "EMG"
|
|
|
+ priority.RunningTypePriority = active.InfoEMG.Priority
|
|
|
+ priority.RunningPATaskChan = active.InfoEMG.RunChannel
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
+ active.ICPCONBID = active.EMGCONFID
|
|
|
+ EMGConfbridgeReinvite(active.EMGCONFID)
|
|
|
+ return
|
|
|
}
|
|
|
- if active.CONBID != "" {
|
|
|
- ConfbridgeKick(active.CONBID, "all")
|
|
|
+
|
|
|
+ if active.ICPCONBID != "" {
|
|
|
+ ConfbridgeKick(active.ICPCONBID, "all")
|
|
|
+ active.ICPCONBID = ""
|
|
|
}
|
|
|
} else if utils.IsIO(event["CallerIDNum"]) && event["Exten"] == "0501" { //CPA end
|
|
|
- lfshook.NewLogger().Infof("====CPA status =====%s", "end")
|
|
|
+
|
|
|
SetPadTimer()
|
|
|
priority.CleanPriorityTag()
|
|
|
alstatus.PaStatus(event["CallerIDNum"], "CPA", "end")
|
|
|
- if priority.ResumeEmgPara.FileName != "" {
|
|
|
- CheckEmgResume()
|
|
|
+
|
|
|
+ if active.EMGCONFID != "" {
|
|
|
+ priority.RunningType = "EMG"
|
|
|
+ priority.RunningTypePriority = active.InfoEMG.Priority
|
|
|
+ priority.RunningPATaskChan = active.InfoEMG.RunChannel
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
+
|
|
|
+ active.ICPCONBID = active.EMGCONFID
|
|
|
+ EMGConfbridgeReinvite(active.EMGCONFID)
|
|
|
+ return
|
|
|
}
|
|
|
- if active.CONBID != "" {
|
|
|
- ConfbridgeKick(active.CONBID, "all")
|
|
|
+ if active.ICPCONBID != "" {
|
|
|
+ ConfbridgeKick(active.ICPCONBID, "all")
|
|
|
+ active.ICPCONBID = ""
|
|
|
}
|
|
|
//lfshook.NewLogger().Infof("=========%s", event["Event"])
|
|
|
} else if event["CallerIDName"] == "EMG" && event["Exten"] == "0502" { // EMG broadcast hangup
|
|
|
+
|
|
|
SetPadTimer()
|
|
|
priority.CleanPriorityTag()
|
|
|
alstatus.PaStatus(event["CallerIDName"], "EMG", "end")
|
|
|
- priority.ResumeEmgPara = priority.BroadcastResumeParas{}
|
|
|
- if active.CONBID != "" {
|
|
|
- ConfbridgeKick(active.CONBID, "all")
|
|
|
- }
|
|
|
+
|
|
|
} else if event["CallerIDName"] == "STN" && event["Exten"] == "0503" {
|
|
|
+
|
|
|
SetPadTimer()
|
|
|
priority.CleanPriorityTag()
|
|
|
alstatus.PaStatus(event["CallerIDName"], "STN", "end")
|
|
|
- if priority.ResumeEmgPara.FileName != "" {
|
|
|
- CheckEmgResume()
|
|
|
+
|
|
|
+ if active.EMGCONFID != "" {
|
|
|
+ priority.RunningType = "EMG"
|
|
|
+ priority.RunningTypePriority = active.InfoEMG.Priority
|
|
|
+ priority.RunningPATaskChan = active.InfoEMG.RunChannel
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
+ active.ICPCONBID = active.EMGCONFID
|
|
|
+ EMGConfbridgeReinvite(active.EMGCONFID)
|
|
|
+ return
|
|
|
}
|
|
|
- if active.CONBID != "" {
|
|
|
- ConfbridgeKick(active.CONBID, "all")
|
|
|
+ if active.ICPCONBID != "" {
|
|
|
+ ConfbridgeKick(active.ICPCONBID, "all")
|
|
|
+ active.ICPCONBID = ""
|
|
|
}
|
|
|
} else if event["CallerIDName"] == "DCS" && event["Exten"] == "0504" {
|
|
|
+
|
|
|
SetPadTimer()
|
|
|
priority.CleanPriorityTag()
|
|
|
alstatus.PaStatus(event["CallerIDName"], "DCS", "end")
|
|
|
- if priority.ResumeEmgPara.FileName != "" {
|
|
|
- CheckEmgResume()
|
|
|
+
|
|
|
+ if active.EMGCONFID != "" {
|
|
|
+ priority.RunningType = "EMG"
|
|
|
+ priority.RunningTypePriority = active.InfoEMG.Priority
|
|
|
+ priority.RunningPATaskChan = active.InfoEMG.RunChannel
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
+ active.ICPCONBID = active.EMGCONFID
|
|
|
+ EMGConfbridgeReinvite(active.EMGCONFID)
|
|
|
+ return
|
|
|
}
|
|
|
- if active.CONBID != "" {
|
|
|
- ConfbridgeKick(active.CONBID, "all")
|
|
|
+ if active.ICPCONBID != "" {
|
|
|
+ ConfbridgeKick(active.ICPCONBID, "all")
|
|
|
+ active.ICPCONBID = ""
|
|
|
}
|
|
|
} else if event["CallerIDName"] == "SPC" && event["Exten"] == "0505" {
|
|
|
+
|
|
|
SetPadTimer()
|
|
|
priority.CleanPriorityTag()
|
|
|
alstatus.PaStatus(event["CallerIDName"], "SPC", "end")
|
|
|
- if priority.ResumeEmgPara.FileName != "" {
|
|
|
- CheckEmgResume()
|
|
|
+
|
|
|
+ if active.EMGCONFID != "" {
|
|
|
+ priority.RunningType = "EMG"
|
|
|
+ priority.RunningTypePriority = active.InfoEMG.Priority
|
|
|
+ priority.RunningPATaskChan = active.InfoEMG.RunChannel
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
+ active.ICPCONBID = active.EMGCONFID
|
|
|
+ EMGConfbridgeReinvite(active.EMGCONFID)
|
|
|
+ return
|
|
|
}
|
|
|
- if active.CONBID != "" {
|
|
|
- ConfbridgeKick(active.CONBID, "all")
|
|
|
+ if active.ICPCONBID != "" {
|
|
|
+ ConfbridgeKick(active.ICPCONBID, "all")
|
|
|
+ active.ICPCONBID = ""
|
|
|
}
|
|
|
} else if event["CallerIDName"] == "CHK" && event["Exten"] == "0510" {
|
|
|
SetPadTimer()
|
|
|
priority.CleanPriorityTag()
|
|
|
alstatus.PaStatus(event["CallerIDName"], "CHK", "end")
|
|
|
- if priority.ResumeEmgPara.FileName != "" {
|
|
|
- CheckEmgResume()
|
|
|
+
|
|
|
+ if active.EMGCONFID != "" {
|
|
|
+ priority.RunningType = "EMG"
|
|
|
+ priority.RunningTypePriority = active.InfoEMG.Priority
|
|
|
+ priority.RunningPATaskChan = active.InfoEMG.RunChannel
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
+ active.ICPCONBID = active.EMGCONFID
|
|
|
+ EMGConfbridgeReinvite(active.EMGCONFID)
|
|
|
+ return
|
|
|
}
|
|
|
- if active.CONBID != "" {
|
|
|
- ConfbridgeKick(active.CONBID, "all")
|
|
|
+
|
|
|
+ if active.ICPCONBID != "" {
|
|
|
+ ConfbridgeKick(active.ICPCONBID, "all")
|
|
|
+ active.ICPCONBID = ""
|
|
|
}
|
|
|
} else if event["CallerIDName"] == "VOL" && event["Exten"] == "0513" {
|
|
|
SetPadTimer()
|
|
|
priority.CleanPriorityTag()
|
|
|
alstatus.PaStatus(event["CallerIDName"], "VOL", "end")
|
|
|
- if priority.ResumeEmgPara.FileName != "" {
|
|
|
- CheckEmgResume()
|
|
|
+
|
|
|
+ if active.EMGCONFID != "" {
|
|
|
+ priority.RunningType = "EMG"
|
|
|
+ priority.RunningTypePriority = active.InfoEMG.Priority
|
|
|
+ priority.RunningPATaskChan = active.InfoEMG.RunChannel
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
+ active.ICPCONBID = active.EMGCONFID
|
|
|
+ EMGConfbridgeReinvite(active.EMGCONFID)
|
|
|
+ return
|
|
|
}
|
|
|
- if active.CONBID != "" {
|
|
|
- ConfbridgeKick(active.CONBID, "all")
|
|
|
+
|
|
|
+ if active.ICPCONBID != "" {
|
|
|
+ ConfbridgeKick(active.ICPCONBID, "all")
|
|
|
+ active.ICPCONBID = ""
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -734,31 +843,67 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
lfshook.NewLogger().Infof("===%s======%s", event["Event"], priority.RunningType)
|
|
|
//ICPs go back to confbridge
|
|
|
- switch priority.RunningType {
|
|
|
- case "PAD-OCC":
|
|
|
- go DialICP("8", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("8", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "CPA":
|
|
|
- go DialICP("2", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("2", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "EMG":
|
|
|
- go DialICP("3", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("3", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "SPC":
|
|
|
- go DialICP("6", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("6", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "STN":
|
|
|
- go DialICP("4", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("4", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "DCS":
|
|
|
- go DialICP("5", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("5", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "CHK":
|
|
|
- go DialICP("10", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("10", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "VOL":
|
|
|
- go DialICP("11", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("11", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
+ //ICPConfbridgeReinvite(active.ICPCONBID, active.ICPCONBTYP)
|
|
|
+
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
+ //check cpa & emg & opa confbridge
|
|
|
+ if active.CPACONFID != "" && active.EMGCONFID != "" && priority.RunningTypePriority != 0 {
|
|
|
+ if priority.GetPriorityByKey("CPA") < priority.GetPriorityByKey("EMG") && priority.GetPriorityByKey("CPA") < priority.RunningTypePriority {
|
|
|
+ ICPConfbridgeReinvite(active.CPACONFID, "CPA")
|
|
|
+ active.CPACONFID = ""
|
|
|
+ } else if priority.GetPriorityByKey("EMG") < priority.GetPriorityByKey("CPA") && priority.GetPriorityByKey("EMG") < priority.RunningTypePriority {
|
|
|
+ ICPConfbridgeReinvite(active.EMGCONFID, "EMG")
|
|
|
+ active.EMGCONFID = ""
|
|
|
+ } else if priority.RunningTypePriority < priority.GetPriorityByKey("EMG") && priority.GetPriorityByKey("CPA") > priority.RunningTypePriority {
|
|
|
+ ICPConfbridgeReinvite(active.ICPCONBID, priority.RunningType)
|
|
|
+ active.ICPCONBID = ""
|
|
|
+ active.ICPCONBTYP = ""
|
|
|
+ }
|
|
|
+
|
|
|
+ //check cpa & emg confbridge
|
|
|
+ } else if active.CPACONFID != "" && active.EMGCONFID != "" {
|
|
|
+ if priority.GetPriorityByKey("CPA") < priority.GetPriorityByKey("EMG") {
|
|
|
+ ICPConfbridgeReinvite(active.CPACONFID, "CPA")
|
|
|
+ active.CPACONFID = ""
|
|
|
+ } else {
|
|
|
+ ICPConfbridgeReinvite(active.EMGCONFID, "EMG")
|
|
|
+ active.EMGCONFID = ""
|
|
|
+ }
|
|
|
+
|
|
|
+ //check emg & opa confbridge
|
|
|
+ } else if active.EMGCONFID != "" && priority.RunningTypePriority != 0 {
|
|
|
+ if priority.GetPriorityByKey("EMG") < priority.RunningTypePriority {
|
|
|
+ ICPConfbridgeReinvite(active.EMGCONFID, "EMG")
|
|
|
+ active.EMGCONFID = ""
|
|
|
+ } else {
|
|
|
+ ICPConfbridgeReinvite(active.ICPCONBID, priority.RunningType)
|
|
|
+ active.ICPCONBID = ""
|
|
|
+ active.ICPCONBTYP = ""
|
|
|
+ }
|
|
|
+
|
|
|
+ //check cpa & opa confbridge
|
|
|
+ } else if active.CPACONFID != "" && priority.RunningTypePriority != 0 {
|
|
|
+ if priority.GetPriorityByKey("CPA") < priority.RunningTypePriority {
|
|
|
+ ICPConfbridgeReinvite(active.CPACONFID, "CPA")
|
|
|
+ active.CPACONFID = ""
|
|
|
+ } else {
|
|
|
+ ICPConfbridgeReinvite(active.ICPCONBID, priority.RunningType)
|
|
|
+ active.ICPCONBID = ""
|
|
|
+ active.ICPCONBTYP = ""
|
|
|
+ }
|
|
|
+ } else if active.CPACONFID != "" {
|
|
|
+
|
|
|
+ ICPConfbridgeReinvite(active.CPACONFID, "CPA")
|
|
|
+ active.CPACONFID = ""
|
|
|
+ } else if active.EMGCONFID != "" {
|
|
|
+
|
|
|
+ ICPConfbridgeReinvite(active.EMGCONFID, "EMG")
|
|
|
+ active.EMGCONFID = ""
|
|
|
+ } else if priority.RunningTypePriority != 0 {
|
|
|
+
|
|
|
+ ICPConfbridgeReinvite(active.ICPCONBID, priority.RunningType)
|
|
|
+ active.ICPCONBID = ""
|
|
|
+ active.ICPCONBTYP = ""
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -767,42 +912,76 @@ func HandleAMI(event map[string]string) {
|
|
|
//Cab Cab end
|
|
|
if utils.IsICP(event["CallerIDNum"]) && utils.IsICP(event["ConnectedLineNum"]) && event["Exten"] == "0400" {
|
|
|
SetPadTimer()
|
|
|
-
|
|
|
+ alstatus.PaStatus(event["CallerIDNum"], "C2C", "end")
|
|
|
priority.RunningTypePriority = priority.TmpRunningTypePriority
|
|
|
- priority.TmpRunningTypePriority = 0
|
|
|
priority.RunningType = priority.TmpRunningType
|
|
|
|
|
|
- //ICPs go back to confbridge
|
|
|
- switch priority.TmpRunningType {
|
|
|
- case "PAD-OCC":
|
|
|
- go DialICP("8", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("8", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "CPA":
|
|
|
- go DialICP("2", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("2", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "EMG":
|
|
|
- go DialICP("3", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("3", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "SPC":
|
|
|
- go DialICP("6", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("6", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "STN":
|
|
|
- go DialICP("4", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("4", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "DCS":
|
|
|
- go DialICP("5", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("5", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "CHK":
|
|
|
- go DialICP("10", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("10", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
- case "VOL":
|
|
|
- go DialICP("11", "2311", "confbridge-join", active.CONBID, "1") //ICP1---call
|
|
|
- go DialICP("11", "2381", "confbridge-join", active.CONBID, "8") //ICP8---call
|
|
|
+ time.Sleep(time.Millisecond * 300)
|
|
|
+ //check cpa & emg & opa confbridge
|
|
|
+ if active.CPACONFID != "" && active.EMGCONFID != "" && priority.RunningTypePriority != 0 {
|
|
|
+ if priority.GetPriorityByKey("CPA") < priority.GetPriorityByKey("EMG") && priority.GetPriorityByKey("CPA") < priority.RunningTypePriority {
|
|
|
+ ICPConfbridgeReinvite(active.CPACONFID, "CPA")
|
|
|
+ active.CPACONFID = ""
|
|
|
+ } else if priority.GetPriorityByKey("EMG") < priority.GetPriorityByKey("CPA") && priority.GetPriorityByKey("EMG") < priority.RunningTypePriority {
|
|
|
+ ICPConfbridgeReinvite(active.EMGCONFID, "EMG")
|
|
|
+ active.EMGCONFID = ""
|
|
|
+ } else if priority.RunningTypePriority < priority.GetPriorityByKey("EMG") && priority.GetPriorityByKey("CPA") > priority.RunningTypePriority {
|
|
|
+ ICPConfbridgeReinvite(active.ICPCONBID, priority.RunningType)
|
|
|
+ active.ICPCONBID = ""
|
|
|
+ active.ICPCONBTYP = ""
|
|
|
+ }
|
|
|
+
|
|
|
+ //check cpa & emg confbridge
|
|
|
+ } else if active.CPACONFID != "" && active.EMGCONFID != "" {
|
|
|
+ if priority.GetPriorityByKey("CPA") < priority.GetPriorityByKey("EMG") {
|
|
|
+ ICPConfbridgeReinvite(active.CPACONFID, "CPA")
|
|
|
+ active.CPACONFID = ""
|
|
|
+ } else {
|
|
|
+ ICPConfbridgeReinvite(active.EMGCONFID, "EMG")
|
|
|
+ active.EMGCONFID = ""
|
|
|
+ }
|
|
|
+
|
|
|
+ //check emg & opa confbridge
|
|
|
+ } else if active.EMGCONFID != "" && priority.RunningTypePriority != 0 {
|
|
|
+ if priority.GetPriorityByKey("EMG") < priority.RunningTypePriority {
|
|
|
+ ICPConfbridgeReinvite(active.EMGCONFID, "EMG")
|
|
|
+ active.EMGCONFID = ""
|
|
|
+ } else {
|
|
|
+ ICPConfbridgeReinvite(active.ICPCONBID, priority.RunningType)
|
|
|
+ active.ICPCONBID = ""
|
|
|
+ active.ICPCONBTYP = ""
|
|
|
+ }
|
|
|
+
|
|
|
+ //check cpa & opa confbridge
|
|
|
+ } else if active.CPACONFID != "" && priority.RunningTypePriority != 0 {
|
|
|
+ if priority.GetPriorityByKey("CPA") < priority.RunningTypePriority {
|
|
|
+ ICPConfbridgeReinvite(active.CPACONFID, "CPA")
|
|
|
+ active.CPACONFID = ""
|
|
|
+ } else {
|
|
|
+ ICPConfbridgeReinvite(active.ICPCONBID, priority.RunningType)
|
|
|
+ active.ICPCONBID = ""
|
|
|
+ active.ICPCONBTYP = ""
|
|
|
+ }
|
|
|
+ } else if active.CPACONFID != "" {
|
|
|
+
|
|
|
+ ICPConfbridgeReinvite(active.CPACONFID, "CPA")
|
|
|
+ active.CPACONFID = ""
|
|
|
+ } else if active.EMGCONFID != "" {
|
|
|
+
|
|
|
+ ICPConfbridgeReinvite(active.EMGCONFID, "EMG")
|
|
|
+ active.EMGCONFID = ""
|
|
|
+ } else if priority.RunningTypePriority != 0 {
|
|
|
+
|
|
|
+ ICPConfbridgeReinvite(active.ICPCONBID, priority.RunningType)
|
|
|
+ active.ICPCONBID = ""
|
|
|
+ active.ICPCONBTYP = ""
|
|
|
}
|
|
|
|
|
|
+ //check other broadcast confbridge
|
|
|
+ //ICPs go back to confbridge
|
|
|
priority.TmpRunningType = ""
|
|
|
+ priority.TmpRunningTypePriority = 0
|
|
|
|
|
|
- alstatus.PaStatus(event["CallerIDNum"], "C2C", "end")
|
|
|
}
|
|
|
|
|
|
case "ExtensionStatus":
|