|
|
@@ -48,7 +48,7 @@ func HandleAMI(event map[string]string) {
|
|
|
//hangup pad call ICP channel
|
|
|
if utils.IsPAIU(ret.CallerIDNum) {
|
|
|
if ret.ConnectedLineNum == "<unknown>" { //redirect pad chanspy channel
|
|
|
- err := Redirect(ret.Channel, "0300", "default", "", "PAD")
|
|
|
+ err := Redirect(ret.Channel, "0300", "queues-icp-redirect", "", "PAD")
|
|
|
if err != nil {
|
|
|
lfshook.NewLogger().Errorf("Redirect %+v", err)
|
|
|
}
|
|
|
@@ -81,7 +81,7 @@ func HandleAMI(event map[string]string) {
|
|
|
for _, caller := range resCaller.Entrys {
|
|
|
lfshook.NewLogger().Infof("===QueueStatus=entry=%+v", caller)
|
|
|
time.Sleep(time.Microsecond * 100)
|
|
|
- RedirectInQueue(caller.CallerIDNum, "0300", "default", caller.CallerIDNum) // redirect All PAD redirect to ICP queue
|
|
|
+ RedirectInQueue(caller.CallerIDNum, "0300", "queues-icp-redirect", caller.CallerIDNum) // redirect All PAD redirect to ICP queue
|
|
|
}
|
|
|
|
|
|
/* for _, ret := range chans {
|
|
|
@@ -106,7 +106,7 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
if utils.IsPAIU(ret.CallerIDNum) {
|
|
|
if ret.ConnectedLineNum == "<unknown>" && ret.ChannelStateDesc == "Up" { //redirect pad chanspy channel
|
|
|
- err := Redirect(ret.Channel, "0300", "default", "", "PAD")
|
|
|
+ err := Redirect(ret.Channel, "0300", "queues-icp-redirect", "", "PAD")
|
|
|
if err != nil {
|
|
|
lfshook.NewLogger().Errorf("Redirect %+v", err)
|
|
|
}
|
|
|
@@ -175,22 +175,17 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
if priority.CheckPriority("CabCab") { // interrupt OCC-PAD
|
|
|
//C2C start PAD interrupt
|
|
|
- if priority.RunningType == "PAD-OCC" {
|
|
|
-
|
|
|
+ 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"])
|
|
|
- //HangupICP()
|
|
|
if event["CallerIDNum"] == "2311" {
|
|
|
Hangup("2381")
|
|
|
} else {
|
|
|
Hangup("2311")
|
|
|
}
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- lfshook.NewLogger().Infof("=======HangupRunningTask====%s", event["CallerIDNum"])
|
|
|
- HangupRunningTask("C2C") //C2C interrupt other
|
|
|
-
|
|
|
}
|
|
|
} else { // hangup caller; C2C start failed
|
|
|
lfshook.NewLogger().Infof("========CabCab hangup caller====%s", event["CallerIDNum"])
|
|
|
@@ -391,6 +386,10 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.PADStart = 0
|
|
|
|
|
|
priority.CleanPriorityTag()
|
|
|
+
|
|
|
+ if active.CONBID != "" {
|
|
|
+ ConfbridgeKick(active.CONBID, "all")
|
|
|
+ }
|
|
|
}
|
|
|
/*if priority.ResumeEmgPara.FileName != "" {
|
|
|
CheckEmgResume()
|
|
|
@@ -513,6 +512,7 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "EMG"
|
|
|
//Pa status report
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.EMG)
|
|
|
+ active.CONBID = event["Conference"]
|
|
|
alstatus.PaStatus("", "EMG", "start")
|
|
|
return
|
|
|
}
|
|
|
@@ -522,6 +522,7 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "SPC"
|
|
|
//Pa status report
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.SPC)
|
|
|
+ active.CONBID = event["Conference"]
|
|
|
alstatus.PaStatus("", "SPC", "start")
|
|
|
return
|
|
|
}
|
|
|
@@ -531,6 +532,7 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "DCS"
|
|
|
//Pa status report
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.DCS)
|
|
|
+ active.CONBID = event["Conference"]
|
|
|
alstatus.PaStatus("", "DCS", "start")
|
|
|
return
|
|
|
}
|
|
|
@@ -540,6 +542,7 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "STN"
|
|
|
//Pa status report
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.STN)
|
|
|
+ active.CONBID = event["Conference"]
|
|
|
alstatus.PaStatus("", "STN", "start")
|
|
|
return
|
|
|
}
|
|
|
@@ -549,6 +552,7 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "CHK"
|
|
|
//Pa status report
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.CHK)
|
|
|
+ active.CONBID = event["Conference"]
|
|
|
alstatus.PaStatus("", "CHK", "start")
|
|
|
return
|
|
|
}
|
|
|
@@ -558,11 +562,19 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "VOL"
|
|
|
//Pa status report
|
|
|
priority.RunningTypePriority, _ = strconv.Atoi(priority.Priority.VOL)
|
|
|
+ active.CONBID = event["Conference"]
|
|
|
alstatus.PaStatus("", "VOL", "start")
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //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"]
|
|
|
+ }
|
|
|
+
|
|
|
//Send PA start msg to STC
|
|
|
if utils.IsICP(event["CallerIDNum"]) && event["Exten"] == "0500" { // PA start
|
|
|
lfshook.NewLogger().Infof("====PA status:%s=====", "start")
|
|
|
@@ -631,7 +643,9 @@ func HandleAMI(event map[string]string) {
|
|
|
if priority.ResumeEmgPara.FileName != "" {
|
|
|
CheckEmgResume()
|
|
|
}
|
|
|
-
|
|
|
+ if active.CONBID != "" {
|
|
|
+ ConfbridgeKick(active.CONBID, "all")
|
|
|
+ }
|
|
|
} else if utils.IsIO(event["CallerIDNum"]) && event["Exten"] == "0501" { //CPA end
|
|
|
lfshook.NewLogger().Infof("====CPA status =====%s", "end")
|
|
|
SetPadTimer()
|
|
|
@@ -640,14 +654,18 @@ func HandleAMI(event map[string]string) {
|
|
|
if priority.ResumeEmgPara.FileName != "" {
|
|
|
CheckEmgResume()
|
|
|
}
|
|
|
-
|
|
|
+ if active.CONBID != "" {
|
|
|
+ ConfbridgeKick(active.CONBID, "all")
|
|
|
+ }
|
|
|
//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()
|
|
|
@@ -655,7 +673,9 @@ func HandleAMI(event map[string]string) {
|
|
|
if priority.ResumeEmgPara.FileName != "" {
|
|
|
CheckEmgResume()
|
|
|
}
|
|
|
-
|
|
|
+ if active.CONBID != "" {
|
|
|
+ ConfbridgeKick(active.CONBID, "all")
|
|
|
+ }
|
|
|
} else if event["CallerIDName"] == "DCS" && event["Exten"] == "0504" {
|
|
|
SetPadTimer()
|
|
|
priority.CleanPriorityTag()
|
|
|
@@ -663,7 +683,9 @@ func HandleAMI(event map[string]string) {
|
|
|
if priority.ResumeEmgPara.FileName != "" {
|
|
|
CheckEmgResume()
|
|
|
}
|
|
|
-
|
|
|
+ if active.CONBID != "" {
|
|
|
+ ConfbridgeKick(active.CONBID, "all")
|
|
|
+ }
|
|
|
} else if event["CallerIDName"] == "SPC" && event["Exten"] == "0505" {
|
|
|
SetPadTimer()
|
|
|
priority.CleanPriorityTag()
|
|
|
@@ -671,7 +693,9 @@ func HandleAMI(event map[string]string) {
|
|
|
if priority.ResumeEmgPara.FileName != "" {
|
|
|
CheckEmgResume()
|
|
|
}
|
|
|
-
|
|
|
+ if active.CONBID != "" {
|
|
|
+ ConfbridgeKick(active.CONBID, "all")
|
|
|
+ }
|
|
|
} else if event["CallerIDName"] == "CHK" && event["Exten"] == "0510" {
|
|
|
SetPadTimer()
|
|
|
priority.CleanPriorityTag()
|
|
|
@@ -679,7 +703,9 @@ func HandleAMI(event map[string]string) {
|
|
|
if priority.ResumeEmgPara.FileName != "" {
|
|
|
CheckEmgResume()
|
|
|
}
|
|
|
-
|
|
|
+ if active.CONBID != "" {
|
|
|
+ ConfbridgeKick(active.CONBID, "all")
|
|
|
+ }
|
|
|
} else if event["CallerIDName"] == "VOL" && event["Exten"] == "0513" {
|
|
|
SetPadTimer()
|
|
|
priority.CleanPriorityTag()
|
|
|
@@ -687,6 +713,9 @@ func HandleAMI(event map[string]string) {
|
|
|
if priority.ResumeEmgPara.FileName != "" {
|
|
|
CheckEmgResume()
|
|
|
}
|
|
|
+ if active.CONBID != "" {
|
|
|
+ ConfbridgeKick(active.CONBID, "all")
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
case "DialEnd":
|
|
|
@@ -701,6 +730,36 @@ func HandleAMI(event map[string]string) {
|
|
|
priority.RunningType = "C2C"
|
|
|
|
|
|
alstatus.PaStatus(event["CallerIDNum"], "C2C", "start")
|
|
|
+ } else if utils.IsICP(event["CallerIDNum"]) && utils.IsICP(event["ConnectedLineNum"]) && event["DialStatus"] == "NOANSWER" {
|
|
|
+
|
|
|
+ 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
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
case "BridgeLeave":
|
|
|
@@ -711,8 +770,36 @@ func HandleAMI(event map[string]string) {
|
|
|
|
|
|
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
|
|
|
+ }
|
|
|
+
|
|
|
priority.TmpRunningType = ""
|
|
|
|
|
|
alstatus.PaStatus(event["CallerIDNum"], "C2C", "end")
|