|
|
@@ -150,8 +150,25 @@ func InterruptRunningTask(toRunTask string) string {
|
|
|
return ""
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /*if toRunTask == "C2C" { //当司机对讲打断业务为PA/PAD-ICP/PAD-TMS时,检测是否有EMG和CPA存在,存在则恢复播放
|
|
|
+ if taskName == "PA" || taskName == "PAD-ICP" || taskName == "PAD-TMS" {
|
|
|
+ //check resume
|
|
|
+ taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
+ if ok {
|
|
|
+ if taskName == "EMG" {
|
|
|
+ EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
+ } else if taskName == "CPA" {
|
|
|
+ if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
+ alstatus.PaStatus("", "CPA", "start")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
utils.LoggerDebug.Printf("InterruptRunningTask RunningTask:%+v", taskName)
|
|
|
- lfshook.NewLogger().Infof("InterruptRunningTask RunningTask:%+v ", task)
|
|
|
+ //lfshook.NewLogger().Infof("InterruptRunningTask RunningTask:%+v ", task)
|
|
|
//same type return
|
|
|
if toRunTask == taskName {
|
|
|
if toRunTask == "PAD-ICP" || toRunTask == "PAD-TMS" || toRunTask == "PAD-OCC" {
|
|
|
@@ -251,7 +268,7 @@ func InterruptRunningTask(toRunTask string) string {
|
|
|
|
|
|
priority.InterruptedPad = "PAD-ICP"
|
|
|
|
|
|
- lfshook.NewLogger().Infof("InterruptRunningTask interrupt PAD-ICP/PAD-TMS ,Running type :%s !", task.RunType)
|
|
|
+ //lfshook.NewLogger().Infof("InterruptRunningTask interrupt PAD-ICP/PAD-TMS ,Running type :%s !", task.RunType)
|
|
|
|
|
|
chans, err := CoreShowChannels()
|
|
|
if err != nil {
|
|
|
@@ -263,7 +280,7 @@ func InterruptRunningTask(toRunTask string) string {
|
|
|
for _, ret := range chans {
|
|
|
// Redirect the connected PAD to 0300
|
|
|
if utils.IsPAIU(ret.CallerIDNum) {
|
|
|
- lfshook.NewLogger().Infof("====interrupt PAD ==== %+v ", ret)
|
|
|
+ //lfshook.NewLogger().Infof("====interrupt PAD ==== %+v ", ret)
|
|
|
|
|
|
if ret.ConnectedLineNum == "<unknown>" { //redirect pad chanspy channel
|
|
|
err := Redirect(ret.Channel, "0300", "queues-icp-redirect", "", "PAD")
|
|
|
@@ -271,7 +288,7 @@ func InterruptRunningTask(toRunTask string) string {
|
|
|
lfshook.NewLogger().Infof("InterruptRunningTask Redirect err:%+v", err)
|
|
|
return taskName
|
|
|
}
|
|
|
- lfshook.NewLogger().Infof("====interrupt PAD =1111=== %+v ", ret)
|
|
|
+ //lfshook.NewLogger().Infof("====interrupt PAD =1111=== %+v ", ret)
|
|
|
number := strings.Split(strings.Split(ret.Channel, "-")[0], "/")[1]
|
|
|
active.NotifyPaiu(number, "hold")
|
|
|
//HangupAllLocalChan()
|
|
|
@@ -283,12 +300,12 @@ func InterruptRunningTask(toRunTask string) string {
|
|
|
//hangup pad call ICP channel
|
|
|
if utils.IsPAIU(ret.CallerIDNum) {
|
|
|
if utils.IsPAIU(ret.CallerIDNum) && ret.ChannelStateDesc == "Up" && utils.IsICP(ret.ConnectedLineNum) {
|
|
|
- lfshook.NewLogger().Infof("Hangup PAD Channel :%+v", ret.Channel)
|
|
|
+ //lfshook.NewLogger().Infof("Hangup PAD Channel :%+v", ret.Channel)
|
|
|
Hangup(ret.Channel)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ alstatus.PaStatus("", "PAD", "end")
|
|
|
priority.RegistryTask.StopAndUnregister("PAD-ICP")
|
|
|
priority.RegistryTask.StopAndUnregister("PAD-TMS")
|
|
|
//2. hangup task channel (ICP + PACU)
|
|
|
@@ -296,25 +313,6 @@ func InterruptRunningTask(toRunTask string) string {
|
|
|
HangupAllLocalChan()
|
|
|
HangupICP()
|
|
|
|
|
|
- //pad end
|
|
|
- if priority.PADStart == 1 {
|
|
|
- alstatus.PaStatus("", "PAD", "end")
|
|
|
- priority.PADStart = 0
|
|
|
-
|
|
|
- //check resume
|
|
|
- taskName, task, ok := priority.RegistryTask.HighestPriorityRunningTask1()
|
|
|
- if ok {
|
|
|
- if taskName == "EMG" {
|
|
|
- EMGConfbridgeReinvite(task.ConfbridgeID)
|
|
|
- //alstatus.PaStatus("", "EMG", "start")
|
|
|
- } else if taskName == "CPA" {
|
|
|
- if CPAConfbridgeReinvite(task.ConfbridgeID) {
|
|
|
- alstatus.PaStatus("", "CPA", "start")
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
case "PAD-OCC": // Interrupt PAD-OCC task running,
|
|
|
|
|
|
if toRunTask == "C2C" {
|
|
|
@@ -356,9 +354,10 @@ func InterruptRunningTask(toRunTask string) string {
|
|
|
//occ pad end
|
|
|
if priority.PADOccStart == 1 {
|
|
|
alstatus.OccPad("end")
|
|
|
+ alstatus.PaStatus("", "PAD", "end")
|
|
|
priority.PADOccStart = 0
|
|
|
+ priority.OCCAnswer = 0
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
default:
|
|
|
@@ -573,18 +572,18 @@ func Redirect(channel, dst, dialrule, callerID, callerName string) (err error) {
|
|
|
|
|
|
func SetPadTimer() {
|
|
|
|
|
|
- toRunPadpriority := priority.GetPriorityByKey(priority.InterruptedPad) //Get PAD priori 获取之前打断的报警优先级
|
|
|
- //toRunpriority := priority.GetPriorityByKey("PAD-ICP")
|
|
|
-
|
|
|
+ //toRunPadpriority := priority.GetPriorityByKey(priority.InterruptedPad) //Get PAD priori 获取之前打断的报警优先级
|
|
|
+ toRunPadpriority := priority.GetPriorityByKey("PAD-ICP")
|
|
|
_, taskTmp, ok := priority.RegistryTask.HighestPriorityRunningTask()
|
|
|
if ok {
|
|
|
- lfshook.NewLogger().Infof("PAD SetPadTimer runing priority:%d toRun priority:%d", taskTmp.Priority, toRunPadpriority)
|
|
|
if taskTmp.Priority < toRunPadpriority { //higher priority task running ,do not set timer
|
|
|
+ utils.LoggerDebug.Printf("PAD SetPadTimer runing priority:%d toRun priority:%d , return !", taskTmp.Priority, toRunPadpriority)
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- res, err := QueueStatus("0300", "") // check OCC queue , if empty OCC-PAD start
|
|
|
+ utils.LoggerDebug.Printf("PAD SetPadTimer check 0300")
|
|
|
+ res, err := QueueStatus("0300", "")
|
|
|
if err != nil {
|
|
|
lfshook.NewLogger().Infof("QueueStatus err%+v", err)
|
|
|
return
|
|
|
@@ -594,7 +593,7 @@ func SetPadTimer() {
|
|
|
}
|
|
|
if res.Calls != "0" {
|
|
|
|
|
|
- lfshook.NewLogger().Infof("PAD SetPadTimer Set QueueTimer timeout 30s !")
|
|
|
+ utils.LoggerDebug.Printf("PAD SetPadTimer Set QueueTimer timeout 30s !")
|
|
|
//active.SetTimer = true
|
|
|
//lfshook.NewLogger().Logger.Infof("=========Start PAD timer !=============")
|
|
|
if active.QueueTimer != nil {
|
|
|
@@ -700,24 +699,47 @@ func CPAConfbridgeKick(confnum string) (res map[string]string, err error) {
|
|
|
}
|
|
|
|
|
|
func CPAConfbridgeReinvite(confID string) bool {
|
|
|
-
|
|
|
+ time.Sleep(time.Millisecond * 100)
|
|
|
utils.LoggerDebug.Printf("CPA CPAConfbridgeReinvite , resume CPA .")
|
|
|
|
|
|
- if priority.PAInterrupt == 1 {
|
|
|
- utils.LoggerDebug.Printf("CPA CPAConfbridgeReinvite , Get PA Interrupt PAInterrupt == 1 return !")
|
|
|
+ /*if priority.TaskCreating == "" || priority.CABInterrupt == 1 { //高优先级被cabcab打断,或者高优先级直接挂断
|
|
|
+
|
|
|
+ for _, ext := range Speakers {
|
|
|
+ if utils.IsICP(ext) {
|
|
|
+ if priority.CABInterrupt == 0 {
|
|
|
+ utils.LoggerDebug.Printf("CPA CPAConfbridgeReinvite , Get CABCAB Interrupt resume CPA , ignore %s continue .", ext)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ConfbridgeReinvite(ext, "call-speakers-cpa", confID)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ utils.LoggerDebug.Printf("CPA CPAConfbridgeReinvite , Interrupt by other ,return !")
|
|
|
return false
|
|
|
}
|
|
|
+ return true*/
|
|
|
|
|
|
- time.Sleep(time.Millisecond * 100)
|
|
|
- for _, ext := range Speakers {
|
|
|
- if utils.IsICP(ext) {
|
|
|
- if priority.CABInterrupt == 1 {
|
|
|
- utils.LoggerDebug.Printf("CPA CPAConfbridgeReinvite , Get PA/CABCAB Interrupt resume CPA , ignore %s continue .", ext)
|
|
|
- continue
|
|
|
+ if priority.PAInterrupt == 1 { // PA 打断标签判断
|
|
|
+ utils.LoggerDebug.Printf("CPA ConfbridgeReinvite , PA ready to go , return !")
|
|
|
+ return false
|
|
|
+ } else if priority.CABInterrupt == 1 { //CABCAB 打断标签判断
|
|
|
+ for _, ext := range Speakers { //高优先级被cabcab打断,或者高优先级直接挂断
|
|
|
+ if utils.IsICP(ext) {
|
|
|
+ if priority.CABInterrupt == 1 {
|
|
|
+ utils.LoggerDebug.Printf("CPA ConfbridgeReinvite , Get CABCAB Interrupt resume CPA , ignore %s continue .", ext)
|
|
|
+ continue
|
|
|
+ }
|
|
|
}
|
|
|
+ ConfbridgeReinvite(ext, "call-speakers-cpa", confID)
|
|
|
+ }
|
|
|
+ } else if priority.TaskCreating != "" {
|
|
|
+ utils.LoggerDebug.Printf("CPA ConfbridgeReinvite , other PA ready to go , return !")
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ for _, ext := range Speakers {
|
|
|
+ ConfbridgeReinvite(ext, "call-speakers-cpa", confID)
|
|
|
}
|
|
|
-
|
|
|
- ConfbridgeReinvite(ext, "call-speakers-cpa", confID)
|
|
|
}
|
|
|
return true
|
|
|
}
|
|
|
@@ -738,24 +760,29 @@ func EMGConfbridgeKick(confnum string) (res map[string]string, err error) {
|
|
|
}
|
|
|
|
|
|
func EMGConfbridgeReinvite(confID string) {
|
|
|
-
|
|
|
+ time.Sleep(time.Millisecond * 100)
|
|
|
utils.LoggerDebug.Printf("EMG ConfbridgeReinvite , resume EMG .")
|
|
|
|
|
|
- if priority.PAInterrupt == 1 {
|
|
|
- utils.LoggerDebug.Printf("EMG ConfbridgeReinvite , Get PA Interrupt PAInterrupt == 1 return !")
|
|
|
+ if priority.PAInterrupt == 1 { // PA 打断标签判断
|
|
|
+ utils.LoggerDebug.Printf("EMG ConfbridgeReinvite , PA ready to go , return !")
|
|
|
return
|
|
|
- }
|
|
|
-
|
|
|
- time.Sleep(time.Millisecond * 100)
|
|
|
- for _, ext := range Speakers {
|
|
|
- if utils.IsICP(ext) {
|
|
|
- if priority.CABInterrupt == 1 {
|
|
|
- utils.LoggerDebug.Printf("EMG ConfbridgeReinvite , Get CABCAB Interrupt resume EMG , ignore %s continue .", ext)
|
|
|
- continue
|
|
|
+ } else if priority.CABInterrupt == 1 { //CABCAB 打断标签判断
|
|
|
+ for _, ext := range Speakers { //高优先级被cabcab打断,或者高优先级直接挂断
|
|
|
+ if utils.IsICP(ext) {
|
|
|
+ if priority.CABInterrupt == 1 {
|
|
|
+ utils.LoggerDebug.Printf("EMG ConfbridgeReinvite , Get CABCAB Interrupt resume EMG , ignore %s continue .", ext)
|
|
|
+ continue
|
|
|
+ }
|
|
|
}
|
|
|
+ ConfbridgeReinvite(ext, "call-speakers-emg", confID)
|
|
|
+ }
|
|
|
+ } else if priority.TaskCreating != "" {
|
|
|
+ utils.LoggerDebug.Printf("EMG ConfbridgeReinvite , other PA ready to go , return !")
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ for _, ext := range Speakers {
|
|
|
+ ConfbridgeReinvite(ext, "call-speakers-emg", confID)
|
|
|
}
|
|
|
-
|
|
|
- ConfbridgeReinvite(ext, "call-speakers-emg", confID)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -812,7 +839,7 @@ func ConfbridgeReinvite(src, context, confID string) {
|
|
|
|
|
|
func ICPConfbridgeReinvite(confID, paType string) {
|
|
|
|
|
|
- if priority.CABInterrupt == 1 || priority.PAInterrupt == 1 {
|
|
|
+ if priority.CABInterrupt == 1 || priority.CABInterrupt == 1 {
|
|
|
utils.LoggerDebug.Printf("ICPConfbridgeReinvite, Get PA/CABCAB Interrupt resume %s faild .", paType)
|
|
|
return
|
|
|
}
|