call.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. package action
  2. import (
  3. "errors"
  4. "fmt"
  5. "pbx-api-gin/internal/app/stc/active"
  6. "pbx-api-gin/internal/app/stc/priority"
  7. alstatus "pbx-api-gin/internal/app/stc/sendstatus"
  8. "pbx-api-gin/pkg/lfshook"
  9. "pbx-api-gin/pkg/utils"
  10. "sort"
  11. "strings"
  12. "time"
  13. )
  14. var Pads = []string{"2413", "2414", "2415", "2421", "2422", "2423", "2424", "2425", "2431", "2432", "2433", "2434", "2435", "2441", "2442", "2443", "2444",
  15. "2445", "2451", "2452", "2453", "2454", "2455", "2461", "2462", "2463", "2464", "2465", "2471", "2472", "2473", "2474", "2475", "2481", "2482", "2483",
  16. "2484", "2485", "2411", "2412"}
  17. var Pacus = []string{"2111", "2121", "2131", "2141", "2151", "2161", "2171", "2181"}
  18. var Speakers = []string{"2111", "2121", "2131", "2141", "2151", "2161", "2171", "2181", "2311", "2381"}
  19. // Function triggered before no cab occupied signal interrupt
  20. func InActiveHangup() {
  21. if active.ActivedCab == "" {
  22. HangupTask("PA")
  23. HangupTask("CPA")
  24. HangupTask("VOL")
  25. HangupTask("PAD-OCC")
  26. }
  27. }
  28. // Hangup 挂断指定分机或通道
  29. func Hangup(channel string) {
  30. lfshook.NewLogger().Infof("hangup extensions/channel %s", channel)
  31. if !utils.IsChannel(channel) {
  32. channel = fmt.Sprintf(`/^(PJ)?SIP\/%s-.*$/`, channel)
  33. }
  34. action := map[string]string{
  35. "Action": "hangup",
  36. "Channel": channel,
  37. }
  38. lfshook.NewLogger().Infof("hangup action %+v", action)
  39. if _, _, err := AminInstance.Send(action); err != nil {
  40. lfshook.NewLogger().Errorf("Hangup %+v", err)
  41. }
  42. }
  43. // Hangup 挂断所有分机,除指定分机和PAD
  44. func HangupAllExcept(caller string) {
  45. //all PACU
  46. for _, ret := range Pacus {
  47. Hangup(ret)
  48. }
  49. switch caller {
  50. case "2311":
  51. Hangup("1411") //IO1
  52. Hangup("1481") //IO8
  53. //Hangup("2311") //ICP1
  54. Hangup("2381") //ICP8
  55. case "2381":
  56. Hangup("1411") //IO1
  57. Hangup("1481") //IO8
  58. Hangup("2311") //ICP1
  59. //Hangup("2381") //ICP8
  60. case "1411":
  61. //Hangup("1411") //IO1
  62. Hangup("1481") //IO8
  63. Hangup("2311") //ICP1
  64. Hangup("2381") //ICP8
  65. case "1481":
  66. Hangup("1411") //IO1
  67. //Hangup("1481") //IO8
  68. Hangup("2311") //ICP1
  69. Hangup("2381") //ICP8
  70. case "":
  71. Hangup("1411") //IO1
  72. Hangup("1481") //IO8
  73. Hangup("2311") //ICP1
  74. Hangup("2381") //ICP8
  75. }
  76. }
  77. // Hangup task
  78. func HangupTask(TaskName string) {
  79. taskInfo, ok := priority.RegistryTask.Get(TaskName)
  80. if ok {
  81. HangupAllLocalChan()
  82. ConfbridgeKick(taskInfo.ConfbridgeID, "all")
  83. Hangup(taskInfo.RunChannel)
  84. }
  85. }
  86. // interrupt the running task
  87. func InterruptRunningTask(toRunTask string) {
  88. var task priority.TaskInfo
  89. var taskName string
  90. var ok bool
  91. if toRunTask != "PA" && toRunTask != "PAD-ICP" && toRunTask != "PAD-TMS" { // ignore C2C
  92. taskName, task, ok = priority.RegistryTask.HighestPriorityRunningTask1()
  93. if !ok {
  94. return
  95. }
  96. } else { // have to check C2C
  97. taskName, task, ok = priority.RegistryTask.HighestPriorityRunningTask()
  98. if !ok {
  99. return
  100. }
  101. }
  102. lfshook.NewLogger().Infof("===InterruptRunningTask=toRuntask=%s==RunningTask:%s===chan:%s", toRunTask, taskName, task.RunChannel)
  103. //same type return
  104. if toRunTask == taskName {
  105. if toRunTask == "PAD-ICP" || toRunTask == "PAD-TMS" || toRunTask == "PAD-OCC" {
  106. if toRunTask == "PAD-OCC" {
  107. Hangup(task.RunChannel) //pad
  108. HangupIO() //io
  109. lfshook.NewLogger().Infof("===InterruptRunningTask=ret==== ")
  110. }
  111. return
  112. }
  113. }
  114. //pad all reset
  115. if toRunTask == "AlarmHoldResetAll" {
  116. HangupAllLocalChan()
  117. return
  118. }
  119. switch task.RunType {
  120. case "CPA":
  121. //kick CPA members
  122. //taskTmp, ok := priority.RegistryTask.Get("CPA")
  123. //if ok {
  124. CPAConfbridgeKick(task.ConfbridgeID)
  125. //}
  126. case "EMG":
  127. //kick EMG members
  128. //taskTmp, ok := priority.RegistryTask.Get("EMG")
  129. //if ok {
  130. EMGConfbridgeKick(task.ConfbridgeID)
  131. //}
  132. case "C2C": // Interrupt C2C task running,
  133. if toRunTask == "PA" || toRunTask == "PAD-ICP" || toRunTask == "PAD-TMS" {
  134. HangupICP()
  135. return
  136. }
  137. case "PAD-ICP", "PAD-TMS": // Interrupt PAD task running,
  138. priority.InterruptedPad = "PAD-ICP"
  139. lfshook.NewLogger().Infof("===InterruptRunningTask==hangup===PAD-ICP==%s==== ", task.RunType)
  140. chans, err := CoreShowChannels()
  141. if err != nil {
  142. lfshook.NewLogger().Errorf("CoreShowChannels %+v", err)
  143. }
  144. //1. Redirect the connected PAD to 0300,hangup the other pad channel
  145. for _, ret := range chans {
  146. // Redirect the connected PAD to 0300
  147. if utils.IsPAIU(ret.CallerIDNum) {
  148. if ret.ConnectedLineNum == "<unknown>" { //redirect pad chanspy channel
  149. err := Redirect(ret.Channel, "0300", "queues-icp-redirect", "", "PAD")
  150. if err != nil {
  151. lfshook.NewLogger().Errorf("Redirect %+v", err)
  152. }
  153. number := strings.Split(strings.Split(ret.Channel, "-")[0], "/")[1]
  154. active.NotifyPaiu(number, "hold")
  155. //HangupAllLocalChan()
  156. }
  157. }
  158. }
  159. for _, ret := range chans {
  160. //hangup pad call ICP channel
  161. if utils.IsPAIU(ret.CallerIDNum) {
  162. if utils.IsPAIU(ret.CallerIDNum) && ret.ChannelStateDesc == "Up" && utils.IsICP(ret.ConnectedLineNum) {
  163. lfshook.NewLogger().Infof("===Hangup=Chan===%+v==== ", ret.Channel)
  164. Hangup(ret.Channel)
  165. }
  166. }
  167. }
  168. priority.RegistryTask.StopAndUnregister("PAD-ICP")
  169. priority.RegistryTask.StopAndUnregister("PAD-TMS")
  170. //2. hangup task channel (ICP + PACU)
  171. lfshook.NewLogger().Infof("===InterruptRunningTask=2. hangup task channel === ")
  172. HangupAllLocalChan()
  173. HangupICP()
  174. //pad end
  175. if priority.PADStart == 1 {
  176. alstatus.PaStatus("", "PAD", "end")
  177. priority.PADStart = 0
  178. }
  179. case "PAD-OCC": // Interrupt PAD-OCC task running,
  180. if toRunTask == "C2C" {
  181. HangupICP()
  182. break
  183. } else {
  184. priority.InterruptedPad = "PAD-OCC"
  185. priority.OCCAnswer = 0
  186. resCaller, err := QueueStatus("0301", "") // check OCC queue, get entries
  187. if err != nil {
  188. lfshook.NewLogger().Infof("===QueueStatus==%+v", err)
  189. }
  190. for _, caller := range resCaller.Entrys {
  191. lfshook.NewLogger().Infof("===QueueStatus=entry=%+v", caller)
  192. time.Sleep(time.Millisecond * 50)
  193. RedirectInQueue(caller.CallerIDNum, "0300", "queues-icp-redirect", caller.CallerIDNum) // redirect All PAD redirect to ICP queue
  194. }
  195. priority.RegistryTask.StopAndUnregister("PAD-OCC")
  196. //2. Hangup connected PAD
  197. lfshook.NewLogger().Infof("===InterruptRunningTask=Hangup connected PAD=== ")
  198. Hangup(task.RunChannel)
  199. //3. Hangup OI & ICP
  200. HangupIO()
  201. HangupAllLocalChan()
  202. //occ pad end
  203. if priority.PADOccStart == 1 {
  204. alstatus.OccPad("end")
  205. priority.PADOccStart = 0
  206. }
  207. }
  208. default:
  209. lfshook.NewLogger().Infof("===InterruptRunningTask=default=== ")
  210. //if !strings.Contains(priority.RunningPATaskChan, "0502@default") {
  211. // Hangup(priority.RunningPATaskChan)
  212. //}
  213. Hangup(task.RunChannel)
  214. ConfbridgeKick(task.ConfbridgeID, "all")
  215. }
  216. }
  217. // Hangup all ICP
  218. func HangupICP() {
  219. Hangup("2311") //ICP1
  220. Hangup("2381") //ICP8
  221. }
  222. // Hangup all IO
  223. func HangupIO() {
  224. Hangup("1411") //IO1
  225. Hangup("1481") //IO8
  226. }
  227. // Hangup all PACU
  228. func HangupAllPACU() {
  229. //all PACU
  230. for _, ret := range Pacus {
  231. Hangup(ret)
  232. }
  233. }
  234. func HangupAllLocalChan() {
  235. chans, err := CoreShowChannels()
  236. if err != nil {
  237. lfshook.NewLogger().Errorf("CoreShowChannels %+v", err)
  238. }
  239. for _, ret := range chans {
  240. if strings.Contains(ret.Channel, "Local") && !strings.Contains(ret.Channel, "0502@default") {
  241. lfshook.NewLogger().Infof("HangupAllLocalChan=====hangup========= %+v", ret)
  242. Hangup(ret.Channel)
  243. }
  244. }
  245. }
  246. // Hangup all PACU
  247. func HangupAllPAD() {
  248. //all PAD
  249. for _, ret := range Pads {
  250. Hangup(ret)
  251. }
  252. }
  253. // Hangup all calls
  254. func HangupAll() {
  255. utils.ExecCmdAsync("/usr/sbin/asterisk", "-rx", "hangup request all")
  256. }
  257. // Dial 拨打号码
  258. func Dial(src, dst, dialrule, callerID, callerName string, callType string) {
  259. chanel := fmt.Sprintf("%s/%s@default", "Local", src)
  260. action := map[string]string{
  261. "Action": "Originate",
  262. "Channel": chanel,
  263. "Exten": dst,
  264. "Context": dialrule,
  265. "CallerID": fmt.Sprintf("%s<%s>", callerName, callerID),
  266. "Priority": "1",
  267. "Variable": fmt.Sprintf("CAB=%s", callType),
  268. "async": "true",
  269. }
  270. lfshook.NewLogger().Infof("dial action %+v", action)
  271. res, _, err := AminInstance.Send(action)
  272. if err != nil {
  273. lfshook.NewLogger().Errorf("%+v", err)
  274. }
  275. lfshook.NewLogger().Info(res)
  276. }
  277. // Dial 拨打号码
  278. func DialICP(src, dst, dialrule, callerID, callerName string) {
  279. chanel := fmt.Sprintf("%s/%s@call-icp", "Local", src)
  280. action := map[string]string{
  281. "Action": "Originate",
  282. "Channel": chanel,
  283. "Exten": dst,
  284. "Context": dialrule,
  285. "CallerID": fmt.Sprintf("%s<%s>", callerName, callerID),
  286. "Priority": "1",
  287. "Variable": fmt.Sprintf("CBID=%s", callerID),
  288. "async": "true",
  289. }
  290. lfshook.NewLogger().Infof("dial action %+v", action)
  291. res, _, err := AminInstance.Send(action)
  292. if err != nil {
  293. lfshook.NewLogger().Errorf("%+v", err)
  294. }
  295. lfshook.NewLogger().Info(res)
  296. }
  297. // 获取分机状态
  298. func ExtenStatus(exten string) (Status string) {
  299. action := map[string]string{
  300. "Action": "ExtensionState",
  301. "Exten": exten,
  302. "Context": "default",
  303. }
  304. res, _, err := AminInstance.Send(action)
  305. if err != nil {
  306. lfshook.NewLogger().Errorf("%+v", err)
  307. return ""
  308. }
  309. //lfshook.NewLogger().Infof("================ExtensionState:res %+v", res)
  310. return res["StatusText"]
  311. }
  312. // PACU ChanSpy
  313. func ChanSpy(src, dst string, whisper, bargein bool) {
  314. lfshook.NewLogger().Infof("chan spy src:%s dst:%s", src, dst)
  315. //channel := fmt.Sprintf("%s/%s", utils.DialPrefix, dst)
  316. channel := fmt.Sprintf("Local/%s@aio-rule", dst)
  317. data := fmt.Sprintf("%s/%s,qBE", utils.DialPrefix, src)
  318. /*
  319. if whisper {
  320. data = fmt.Sprintf("%s,w", data)
  321. }
  322. if bargein {
  323. data = fmt.Sprintf("%s,B", data)
  324. }
  325. */
  326. action := map[string]string{
  327. "Action": "Originate",
  328. "Channel": channel, // 不存在的通话
  329. "Application": "ChanSpy",
  330. "Data": data, // 存在的通话
  331. "CallerID": dst,
  332. "Async": "true",
  333. }
  334. lfshook.NewLogger().Infof("PACU ChanSpy action %+v", action)
  335. _, _, err := AminInstance.Send(action)
  336. if err != nil {
  337. lfshook.NewLogger().Errorf("%+v", err)
  338. }
  339. }
  340. // Redirect 转接
  341. func RedirectInQueue(channel, dst, dialrule, callerID string) (err error) {
  342. //callerID := "redirect"
  343. lfshook.NewLogger().Infof("redirect src %s to dst %s", channel, dst)
  344. if !utils.IsChannel(channel) {
  345. //callerID = channel
  346. if channel, err = GetChannelByExtenNotBridged(channel); err != nil {
  347. return err
  348. }
  349. }
  350. action := map[string]string{
  351. "Action": "Redirect",
  352. "Channel": channel,
  353. "Exten": dst,
  354. "Context": dialrule,
  355. "CallerID": callerID,
  356. "Priority": "1",
  357. "async": "true",
  358. }
  359. lfshook.NewLogger().Infof("redirect %+v", action)
  360. res, _, err := AminInstance.Send(action)
  361. if err != nil {
  362. lfshook.NewLogger().Error(err)
  363. }
  364. lfshook.NewLogger().Info(res)
  365. return err
  366. }
  367. // Redirect 转接
  368. func Redirect(channel, dst, dialrule, callerID, callerName string) (err error) {
  369. //callerID := "redirect"
  370. lfshook.NewLogger().Infof("redirect src %s to dst %s", channel, dst)
  371. if !utils.IsChannel(channel) {
  372. callerID = channel
  373. if channel, err = GetChannelByExten(channel); err != nil {
  374. return err
  375. }
  376. }
  377. action := map[string]string{
  378. "Action": "Redirect",
  379. "Channel": channel,
  380. "Exten": dst,
  381. "Context": dialrule,
  382. "CallerID": fmt.Sprintf("%s<%s>", callerName, callerID),
  383. "Priority": "1",
  384. "async": "true",
  385. }
  386. lfshook.NewLogger().Infof("redirect %+v", action)
  387. res, _, err := AminInstance.Send(action)
  388. if err != nil {
  389. lfshook.NewLogger().Error(err)
  390. }
  391. lfshook.NewLogger().Info(res)
  392. return err
  393. }
  394. func SetPadTimer() {
  395. toRunPadpriority := priority.GetPriorityByKey(priority.InterruptedPad) // 获取之前打断的报警优先级
  396. //toRunpriority := priority.GetPriorityByKey("PAD-ICP")
  397. _, taskTmp, ok := priority.RegistryTask.HighestPriorityRunningTask()
  398. if ok {
  399. lfshook.NewLogger().Infof("==SetPadTimer====runing:%d==toRun:%d=", taskTmp.Priority, toRunPadpriority)
  400. if taskTmp.Priority < toRunPadpriority { //higher priority task running ,do not set timer
  401. return
  402. }
  403. }
  404. res, err := QueueStatus("0300", "") // check OCC queue , if empty OCC-PAD start
  405. if err != nil {
  406. lfshook.NewLogger().Infof("===OCC-QueueStatus==%+v", err)
  407. return
  408. }
  409. if res.Calls != "0" {
  410. lfshook.NewLogger().Infof("==SetPadTimer==QueueTimer===1====")
  411. active.SetTimer = true
  412. active.QueueTimer = time.AfterFunc(30*time.Second, func() { // check the PAD 30s timeout
  413. res, err := QueueStatus("0301", "") // check OCC queue , if empty OCC-PAD start
  414. if err != nil {
  415. lfshook.NewLogger().Infof("===OCC-QueueStatus==%+v", err)
  416. return
  417. }
  418. if res.Calls == "0" { // OCC queue empty
  419. resCaller, err := QueueStatus("0300", "") // check ICP queue, get entries
  420. if err != nil {
  421. lfshook.NewLogger().Infof("==ICP=QueueStatus==%+v", err)
  422. return
  423. }
  424. sort.Slice(resCaller.Entrys, func(i, j int) bool {
  425. return resCaller.Entrys[i].Position < resCaller.Entrys[j].Position
  426. })
  427. for _, caller := range resCaller.Entrys {
  428. priority.ICPAnswer = 0
  429. //lfshook.NewLogger().Infof("====SetPadTimer==QueueTimer==2=")
  430. lfshook.NewLogger().Infof("==SetPadTimer==Redirect to 0301 entry:%s=Pos:%s==", caller.CallerIDNum, caller.Position)
  431. //order by pos
  432. RedirectInQueue(caller.CallerIDNum, "0301", "queues-occ", caller.CallerIDNum) // redirect All ICP-PAD redirect to OCC queue
  433. time.Sleep(time.Millisecond * 100) //200 ms delay
  434. }
  435. }
  436. })
  437. }
  438. }
  439. func ConfbridgeKick(confnum, channel string) (res map[string]string, err error) {
  440. action := map[string]string{
  441. "Action": "ConfbridgeKick",
  442. "Conference": confnum,
  443. "Channel": channel,
  444. }
  445. res, _, err = AminInstance.Send(action)
  446. if err != nil {
  447. return nil, err
  448. }
  449. lfshook.NewLogger().Infof("=======ConfbridgeKick==%+v", res)
  450. if res["Response"] != "Success" {
  451. return nil, errors.New(res["Message"])
  452. }
  453. return res, nil
  454. }
  455. func CPAConfbridgeKick(confnum string) (res map[string]string, err error) {
  456. lfshook.NewLogger().Infof("=======CPAConfbridgeKick==%s", confnum)
  457. chans, err := ConfbridgeList(confnum)
  458. if err != nil {
  459. return nil, errors.New(res["Message"])
  460. }
  461. for _, confChan := range chans {
  462. lfshook.NewLogger().Infof("======CPAConfbridgeKick==1=%+v", confChan)
  463. if !strings.Contains(confChan, "PJSIP/1481") {
  464. ConfbridgeKick(confnum, confChan)
  465. }
  466. }
  467. return res, nil
  468. }
  469. func CPAConfbridgeReinvite(confID string) {
  470. lfshook.NewLogger().Infof("=====CPAConfbridgeReinvite==")
  471. time.Sleep(time.Millisecond * 500)
  472. for _, ext := range Speakers {
  473. ConfbridgeReinvite(ext, "call-speakers-cpa", confID)
  474. }
  475. }
  476. func EMGConfbridgeKick(confnum string) (res map[string]string, err error) {
  477. lfshook.NewLogger().Infof("=====EMGConfbridgeKick==%s", confnum)
  478. chans, err := ConfbridgeList(confnum)
  479. if err != nil {
  480. return nil, errors.New(res["Message"])
  481. }
  482. for _, confChan := range chans {
  483. lfshook.NewLogger().Infof("====EMGConfbridgeKick==1=%+v", confChan)
  484. if !strings.Contains(confChan, "0502@default") {
  485. ConfbridgeKick(confnum, confChan)
  486. }
  487. }
  488. return res, nil
  489. }
  490. func EMGConfbridgeReinvite(confID string) {
  491. lfshook.NewLogger().Infof("=======EMGConfbridgeReinvite==")
  492. time.Sleep(time.Millisecond * 500)
  493. for _, ext := range Speakers {
  494. lfshook.NewLogger().Infof("====1===EMGConfbridgeReinvite==")
  495. ConfbridgeReinvite(ext, "call-speakers-emg", confID)
  496. }
  497. }
  498. func ConfbridgeList(confnum string) (chans []string, err error) {
  499. action := map[string]string{
  500. "Action": "ConfbridgeList",
  501. "Conference": confnum,
  502. }
  503. res, events, err := AminInstance.Send(action)
  504. if err != nil {
  505. return nil, err
  506. }
  507. lfshook.NewLogger().Infof("===ConfbridgeList=res=%+v", res)
  508. if res["Response"] == "Success" {
  509. for _, event := range events {
  510. if event.Data["Event"] == "ConfbridgeList" {
  511. //lfshook.NewLogger().Infof("=======ConfbridgeList==%+v", event)
  512. chans = append(chans, event.Data["Channel"])
  513. }
  514. }
  515. return chans, nil
  516. } else {
  517. return nil, errors.New(res["Message"])
  518. }
  519. }
  520. func ConfbridgeReinvite(src, context, confID string) {
  521. lfshook.NewLogger().Infof("========ConfbridgeReinvite=======ext:%s==conf:%s===========", src, confID)
  522. if ExtenStatus(src) != "Idle" {
  523. //lfshook.NewLogger().Infof("===============ext:%s==!Idle===========", src)
  524. return
  525. }
  526. chanel := fmt.Sprintf("Local/%s@%s", src, context)
  527. action := map[string]string{
  528. "Action": "Originate",
  529. "Channel": chanel,
  530. "Exten": "000",
  531. "Context": "confbridge-join",
  532. "CallerID": fmt.Sprintf("%s<%s>", "", ""),
  533. "Priority": "1",
  534. "Variable": fmt.Sprintf("CBID=%s", confID),
  535. "async": "true",
  536. }
  537. lfshook.NewLogger().Infof("dial action %+v", action)
  538. res, _, err := AminInstance.Send(action)
  539. if err != nil {
  540. lfshook.NewLogger().Errorf("%+v", err)
  541. }
  542. lfshook.NewLogger().Info(res)
  543. }
  544. func ICPConfbridgeReinvite(confID, paType string) {
  545. switch paType {
  546. case "PAD-OCC":
  547. go DialICP("8", "2311", "confbridge-join", confID, "1") //ICP1---call
  548. go DialICP("8", "2381", "confbridge-join", confID, "8") //ICP8---call
  549. case "CPA":
  550. go DialICP("2", "2311", "confbridge-join", confID, "1") //ICP1---call
  551. go DialICP("2", "2381", "confbridge-join", confID, "8") //ICP8---call
  552. case "EMG":
  553. go DialICP("3", "2311", "confbridge-join", confID, "1") //ICP1---call
  554. go DialICP("3", "2381", "confbridge-join", confID, "8") //ICP8---call
  555. case "SPC":
  556. go DialICP("6", "2311", "confbridge-join", confID, "1") //ICP1---call
  557. go DialICP("6", "2381", "confbridge-join", confID, "8") //ICP8---call
  558. case "STN":
  559. go DialICP("4", "2311", "confbridge-join", confID, "1") //ICP1---call
  560. go DialICP("4", "2381", "confbridge-join", confID, "8") //ICP8---call
  561. case "DCS":
  562. go DialICP("5", "2311", "confbridge-join", confID, "1") //ICP1---call
  563. go DialICP("5", "2381", "confbridge-join", confID, "8") //ICP8---call
  564. case "CHK":
  565. go DialICP("10", "2311", "confbridge-join", confID, "1") //ICP1---call
  566. go DialICP("10", "2381", "confbridge-join", confID, "8") //ICP8---call
  567. case "VOL":
  568. go DialICP("11", "2311", "confbridge-join", confID, "1") //ICP1---call
  569. go DialICP("11", "2381", "confbridge-join", confID, "8") //ICP8---call
  570. }
  571. }