|
@@ -8,7 +8,6 @@ import (
|
|
|
alstatus "pbx-api-gin/internal/app/stc/sendstatus"
|
|
alstatus "pbx-api-gin/internal/app/stc/sendstatus"
|
|
|
"pbx-api-gin/pkg/lfshook"
|
|
"pbx-api-gin/pkg/lfshook"
|
|
|
"pbx-api-gin/pkg/utils"
|
|
"pbx-api-gin/pkg/utils"
|
|
|
- "sort"
|
|
|
|
|
"strings"
|
|
"strings"
|
|
|
"sync"
|
|
"sync"
|
|
|
"time"
|
|
"time"
|
|
@@ -151,22 +150,6 @@ func InterruptRunningTask(toRunTask string) string {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /*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)
|
|
utils.LoggerDebug.Printf("InterruptRunningTask RunningTask:%+v", taskName)
|
|
|
//lfshook.NewLogger().Infof("InterruptRunningTask RunningTask:%+v ", task)
|
|
//lfshook.NewLogger().Infof("InterruptRunningTask RunningTask:%+v ", task)
|
|
|
//same type return
|
|
//same type return
|
|
@@ -434,7 +417,7 @@ func Dial(src, dst, dialrule, callerID, callerName string, callType string) {
|
|
|
"Variable": fmt.Sprintf("CAB=%s", callType),
|
|
"Variable": fmt.Sprintf("CAB=%s", callType),
|
|
|
"async": "true",
|
|
"async": "true",
|
|
|
}
|
|
}
|
|
|
- lfshook.NewLogger().Infof("================dial action %+v", action)
|
|
|
|
|
|
|
+ //lfshook.NewLogger().Infof("================dial action %+v", action)
|
|
|
res, _, err := AminInstance.Send(action)
|
|
res, _, err := AminInstance.Send(action)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
lfshook.NewLogger().Errorf("%+v", err)
|
|
lfshook.NewLogger().Errorf("%+v", err)
|
|
@@ -593,7 +576,7 @@ func SetPadTimer() {
|
|
|
}
|
|
}
|
|
|
if res.Calls != "0" {
|
|
if res.Calls != "0" {
|
|
|
|
|
|
|
|
- utils.LoggerDebug.Printf("PAD SetPadTimer Set QueueTimer timeout 30s !")
|
|
|
|
|
|
|
+ utils.LoggerDebug.Printf("PAD SetPadTimer Set QueueTimer timeout %ds !", active.PADTimeout)
|
|
|
//active.SetTimer = true
|
|
//active.SetTimer = true
|
|
|
//lfshook.NewLogger().Logger.Infof("=========Start PAD timer !=============")
|
|
//lfshook.NewLogger().Logger.Infof("=========Start PAD timer !=============")
|
|
|
if active.QueueTimer != nil {
|
|
if active.QueueTimer != nil {
|
|
@@ -622,7 +605,7 @@ func SetPadTimer() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if res.Calls == "0" { // OCC queue empty
|
|
if res.Calls == "0" { // OCC queue empty
|
|
|
- resCaller, err := QueueStatus("0300", "") // check ICP queue, get entries
|
|
|
|
|
|
|
+ /*resCaller, err := QueueStatus("0300", "") // check ICP queue, get entries
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
lfshook.NewLogger().Infof("ICP QueueStatus err:%+v", err)
|
|
lfshook.NewLogger().Infof("ICP QueueStatus err:%+v", err)
|
|
|
return
|
|
return
|
|
@@ -635,26 +618,18 @@ func SetPadTimer() {
|
|
|
|
|
|
|
|
for _, caller := range resCaller.Entrys {
|
|
for _, caller := range resCaller.Entrys {
|
|
|
priority.ICPAnswer = 0
|
|
priority.ICPAnswer = 0
|
|
|
- //lfshook.NewLogger().Infof("====SetPadTimer==QueueTimer==2=")
|
|
|
|
|
- //lfshook.NewLogger().Infof("Q300==SetPadTimer==Redirect to 0301 entry:%s=Pos:%s==", caller.CallerIDNum, caller.Position)
|
|
|
|
|
//order by pos
|
|
//order by pos
|
|
|
RedirectInQueue(caller.CallerIDNum, "0301", "queues-occ", caller.CallerIDNum) // redirect All ICP-PAD redirect to OCC queue
|
|
RedirectInQueue(caller.CallerIDNum, "0301", "queues-occ", caller.CallerIDNum) // redirect All ICP-PAD redirect to OCC queue
|
|
|
time.Sleep(time.Millisecond * 100) //200 ms delay
|
|
time.Sleep(time.Millisecond * 100) //200 ms delay
|
|
|
}
|
|
}
|
|
|
|
|
+ }*/
|
|
|
|
|
+ for _, ret := range alstatus.PadQueues {
|
|
|
|
|
+ //utils.LoggerDebug.Printf("PAD to OCC exten:%s", ret.Exten)
|
|
|
|
|
+ priority.ICPAnswer = 0
|
|
|
|
|
+ //order by pos
|
|
|
|
|
+ RedirectInQueue(ret.Exten, "0301", "queues-occ", ret.Exten) // redirect All ICP-PAD redirect to OCC queue
|
|
|
|
|
+ time.Sleep(time.Millisecond * 100)
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- //==============test info =====================
|
|
|
|
|
- /*
|
|
|
|
|
- time.Sleep(2 * time.Second)
|
|
|
|
|
- occque, err1 := QueueStatus("0301", "") // check ICP queue, get entries
|
|
|
|
|
- if err1 != nil {
|
|
|
|
|
- lfshook.NewLogger().Infof("ICP QueueStatus err:%+v", err)
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- for _, caller := range occque.Entrys {
|
|
|
|
|
- lfshook.NewLogger().Infof("Q301==SetPadTimer==Redirect to 0301 entry:%s=Pos:%s==", caller.CallerIDNum, caller.Position)
|
|
|
|
|
- }*/
|
|
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|