|
|
@@ -38,7 +38,7 @@ func CallClicktodialerror(event map[string]string) {
|
|
|
if ExtenStatus[1] == "NOANSWER" && slices.Contains(ZohoExtenList, event["ConnectedLineNum"]) { //坐席未接听,通过ExtenStatus判断挂断原因,slices.Contains(ZohoExtenList, event["ConnectedLineNum"])判断主叫是否时zoho用户分机(坐席)
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/clicktodialerror?code=noanswer&from=%s&to=%s", ZOHO_URL, event["ConnectedLineNum"], event["CallerIDNum"])
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
return
|
|
|
} else if ExtenStatus[1] == "BUSY" { //坐席不可用
|
|
|
@@ -47,7 +47,7 @@ func CallClicktodialerror(event map[string]string) {
|
|
|
if slices.Contains(ZohoExtenList, ChannelStatus2[1]) {
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/clicktodialerror?code=notavailble&from=%s&to=%s&message=agentunavailable", ZOHO_URL, ChannelStatus2[1], event["CallerIDNum"])
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
return
|
|
|
}
|
|
|
@@ -55,7 +55,7 @@ func CallClicktodialerror(event map[string]string) {
|
|
|
} else if ExtenStatus[1] == "CHANUNAVAIL" && slices.Contains(ZohoExtenList, event["ConnectedLineNum"]) { //坐席拒接
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/clicktodialerror?code=rejected&from=%s&to=%s", ZOHO_URL, event["ConnectedLineNum"], event["CallerIDNum"])
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
return
|
|
|
}
|
|
|
@@ -65,7 +65,7 @@ func CallClicktodialerror(event map[string]string) {
|
|
|
if (event["Context"] == "macro-stdexten" || event["Context"] == "macro-stdexten-withoutvm") && event["DialStatus"] == "CANCEL" && slices.Contains(ZohoExtenList, event["ConnectedLineNum"]) && Channel[0] == "Local" {
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/clicktodialerror?code=noanswer&from=%s&to=%s", ZOHO_URL, event["ConnectedLineNum"], event["CallerIDNum"])
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
return
|
|
|
}
|
|
|
@@ -88,7 +88,7 @@ func CallNotify(event map[string]string) {
|
|
|
// https://www.zohoapis.com/phonebridge/v3/callnotify?type=dialed&state=ringing&id=10031&from=123456789&to=12300000001
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=dialed&state=ringing&id=%s&from=%s&to=%s", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["DestCallerIDNum"])
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
|
|
|
// Incoming Call - Ringing
|
|
|
@@ -99,7 +99,7 @@ func CallNotify(event map[string]string) {
|
|
|
// getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ringing&id=%s&from=%s&to=%s", ZOHO_URL, callId, event["Exten"], callDest) // 取得from to 可能不准
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ringing&id=%s&from=%s&to=%s", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["DestCallerIDNum"])
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
|
|
|
} else if (strings.HasPrefix(event["Context"], "department") || strings.HasSuffix(event["Context"], "queue")) && slices.Contains(ZohoExtenList, event["DestCallerIDNum"]) { //队列和部门判断
|
|
|
@@ -107,7 +107,7 @@ func CallNotify(event map[string]string) {
|
|
|
StartTimeList[event["Linkedid"]] = time.Now().Add(-8 * time.Hour)
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ringing&id=%s&from=%s&to=%s", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["DestCallerIDNum"])
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
}
|
|
|
|
|
|
@@ -123,7 +123,7 @@ func CallNotify(event map[string]string) {
|
|
|
// https://www.zohoapis.com/phonebridge/v3/callnotify?type=dialed&state=busy&id=10025&from=123456789&to=12300000001&start_time=2024-12-04 15:09:10
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=dialed&state=busy&id=%s&from=%s&to=%s&start_time=%s", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["DestCallerIDNum"], startTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
delete(StartTimeList, event["Linkedid"])
|
|
|
// Incoming Call - Missed
|
|
|
@@ -134,7 +134,7 @@ func CallNotify(event map[string]string) {
|
|
|
// https://www.zohoapis.com/phonebridge/v3/callnotify?type=dialed&state=busy&id=10025&from=123456789&to=12300000001&start_time=2024-12-04 15:09:10
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=dialed&state=noanswer&id=%s&from=%s&to=%s&start_time=%s", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["DestCallerIDNum"], startTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
delete(StartTimeList, event["Linkedid"])
|
|
|
// Incoming Call - Missed
|
|
|
@@ -145,7 +145,7 @@ func CallNotify(event map[string]string) {
|
|
|
// https://www.zohoapis.com/phonebridge/v3/callnotify?type=dialed&state=busy&id=10025&from=123456789&to=12300000001&start_time=2024-12-04 15:09:10
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=dialed&state=rejected&id=%s&from=%s&to=%s&start_time=%s", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["DestCallerIDNum"], startTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
delete(StartTimeList, event["Linkedid"])
|
|
|
// Incoming Call - Missed
|
|
|
@@ -155,7 +155,7 @@ func CallNotify(event map[string]string) {
|
|
|
startTime := startTimeutc.Format(time.RFC3339)
|
|
|
// https://www.zohoapis.com/phonebridge/v3/callnotify?type=received&state=missed&id=10005&from=12300000001&to=123456789&start_time=2024-12-04 15:09:10
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=missed&id=%s&from=%s&to=%s&start_time=%s", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["DestCallerIDNum"], startTime)
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
delete(StartTimeList, event["Linkedid"])
|
|
|
} else if (strings.HasPrefix(event["Context"], "department") || strings.HasSuffix(event["Context"], "queue")) && event["DialStatus"] != "ANSWER" && TimetimesList[event["Linkedid"]] < 2 && TimetimesList[event["Linkedid"]] > 0 && slices.Contains(ZohoExtenList, event["DestCallerIDNum"]) { //呼入队列或部门成员未接听(一个)
|
|
|
@@ -164,7 +164,7 @@ func CallNotify(event map[string]string) {
|
|
|
startTime := startTimeutc.Format(time.RFC3339)
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=missed&id=%s&from=%s&to=%s&start_time=%s", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["DestCallerIDNum"], startTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
delete(TimetimesList, event["Linkedid"])
|
|
|
delete(StartTimeList, event["Linkedid"])
|
|
|
@@ -176,7 +176,7 @@ func CallNotify(event map[string]string) {
|
|
|
startTime := startTimeutc.Format(time.RFC3339)
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=missed&id=%s&from=%s&to=%s&start_time=%s", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["DestCallerIDNum"], startTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
delete(TimetimesList, event["Linkedid"])
|
|
|
delete(StartTimeList, event["Linkedid"])
|
|
|
@@ -201,7 +201,7 @@ func CallNotify(event map[string]string) {
|
|
|
// getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=dialed&state=answered&id=%s&from=%s&to=%s", ZOHO_URL, callId, event["CallerIDNum"], event["ConnectedLineNum"])
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=dialed&state=answered&id=%s&from=%s&to=%s", ZOHO_URL, event["Linkedid"], event["ConnectedLineNum"], event["CallerIDNum"])
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
|
|
|
// Incoming Call - Answered
|
|
|
@@ -213,7 +213,7 @@ func CallNotify(event map[string]string) {
|
|
|
// https://www.zohoapis.com/phonebridge/v3/callnotify?type=received&state=answered&id=10023&from=12300000001&to=123456789
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=answered&id=%s&from=%s&to=%s", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["ConnectedLineNum"])
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
|
|
|
} else if (strings.HasPrefix(event["Context"], "department") && event["Priority"] == "1" && event["SwapUniqueid"] == "") || (strings.HasSuffix(event["Context"], "queue") && event["SwapUniqueid"] == "") { //部门或队列成员接听
|
|
|
@@ -225,12 +225,12 @@ func CallNotify(event map[string]string) {
|
|
|
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=answered&id=%s&from=%s&to=%s", ZOHO_URL, event["Linkedid"], event["ConnectedLineNum"], event["CallerIDNum"])
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
} else if slices.Contains(ZohoExtenList, event["ConnectedLineNum"]) {
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=answered&id=%s&from=%s&to=%s", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["ConnectedLineNum"])
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
}
|
|
|
delete(TimetimesList, event["Linkedid"])
|
|
|
@@ -262,14 +262,14 @@ func CallNotify(event map[string]string) {
|
|
|
// getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=dailed&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, callId, event["CallerIDNum"], event["ConnectedLineNum"], startTime, durationTime)
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=dailed&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, event["Linkedid"], event["ConnectedLineNum"], event["CallerIDNum"], startTime, durationTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
} else if slices.Contains(ZohoExtenList, event["CallerIDNum"]) {
|
|
|
// https://www.zohoapis.com/phonebridge/v3/callnotify?type=dailed&state=ended&id=10030&from=123456789&to=12300000001&start_time=2024-12-04 11:32:15&duration=325
|
|
|
// getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=dailed&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, callId, event["CallerIDNum"], event["ConnectedLineNum"], startTime, durationTime)
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=dailed&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["ConnectedLineNum"], startTime, durationTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
}
|
|
|
}
|
|
|
@@ -288,13 +288,13 @@ func CallNotify(event map[string]string) {
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, event["Linkedid"], event["ConnectedLineNum"], event["CallerIDNum"], startTime, durationTime)
|
|
|
// getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, callId, event["ConnectedLineNum"], event["CallerIDName"], startTime, durationTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
} else if slices.Contains(ZohoExtenList, event["ConnectedLineNum"]) {
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["ConnectedLineNum"], startTime, durationTime)
|
|
|
// getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, callId, event["ConnectedLineNum"], event["CallerIDName"], startTime, durationTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
}
|
|
|
|
|
|
@@ -311,13 +311,13 @@ func CallNotify(event map[string]string) {
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, event["Linkedid"], event["ConnectedLineNum"], event["CallerIDNum"], startTime, durationTime)
|
|
|
// getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, callId, event["ConnectedLineNum"], event["CallerIDName"], startTime, durationTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
} else if slices.Contains(ZohoExtenList, event["ConnectedLineNum"]) {
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], event["ConnectedLineNum"], startTime, durationTime)
|
|
|
// getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, callId, event["ConnectedLineNum"], event["CallerIDName"], startTime, durationTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
}
|
|
|
AttendedSecondTransferList[event["Linkedid"]] = AttendedTransferList[event["Linkedid"]] //创建转移后通话的初始时间戳
|
|
|
@@ -334,13 +334,13 @@ func CallNotify(event map[string]string) {
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, AttendedSecondTransferList[event["Linkedid"]], event["ConnectedLineNum"], event["CallerIDNum"], startTime, durationTime)
|
|
|
// getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, callId, event["ConnectedLineNum"], event["CallerIDName"], startTime, durationTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
} else if slices.Contains(ZohoExtenList, event["ConnectedLineNum"]) {
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, AttendedSecondTransferList[event["Linkedid"]], event["CallerIDNum"], event["ConnectedLineNum"], startTime, durationTime)
|
|
|
// getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=ended&id=%s&from=%s&to=%s&start_time=%s&duration=%d", ZOHO_URL, callId, event["ConnectedLineNum"], event["CallerIDName"], startTime, durationTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
}
|
|
|
delete(StartTimeList, AttendedSecondTransferList[event["Linkedid"]])
|
|
|
@@ -365,7 +365,7 @@ func CallNotify(event map[string]string) {
|
|
|
ConnectedLineNum := strings.Split(strings.Split(event["ConnectedLineNum"], "<")[1], ">")[0]
|
|
|
getURL := fmt.Sprintf("%s/phonebridge/v3/callnotify?type=received&state=missed&id=%s&from=%s&to=%s&start_time=%s", ZOHO_URL, event["Linkedid"], event["CallerIDNum"], ConnectedLineNum, startTime)
|
|
|
|
|
|
- fmt.Println("getURL = ", getURL)
|
|
|
+ // fmt.Println("getURL = ", getURL)
|
|
|
go httpclient.ZohoGet(getURL)
|
|
|
}
|
|
|
|