CTI working, but with some POST 500 errors. Not opening user or ticket when accepting calls?

We also use a netphone and I had similar problems. I assume you are using the one call routing script someone posted a while back for the cti integration? We had to modify this script a bit to work as expected. You can see in your screenshot that one problem is the last bit of the event “answeringNumber=49” which is probably the extension of the agent. Your agents probably have their full phone number +49…+ Extension in their userprofile so Zammad doesn’t know who “49” is. We simply solved this by adding the full number to the answeringNumber parameter. This way you don’t need a notify-map at all.
Additionally we added that when the number of the caller is only 3 digits we also add the full number to it so internal callers can be identified correctly as well, you would have to change this to 2 if you use 2 digit extensions.
With these simple changes the script works perfectly for us with the generic CTI integration offered in Zammad.
Here is our script:

Function URLescape ( sURL )
	URLescape = sURL
	URLescape = Replace(URLescape ,"-","%2D")
	URLescape = Replace(URLescape ,"'","%27")
	URLescape = Replace(URLescape ,"""","%22")
End Function

Function SendData ( DataToSend )
	On Error Resume Next
 	Dim xml
	Set xml = PBXScript.CreateObject("Microsoft.XMLHTTP")
	PBXScript.OutputTrace "Call for Zammad: "	
	xml.Open "POST", "YOUR ZAMMAD CTI API URL HERE", False
	xml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
	xml.send DataToSend
	xml.Send
	Set xml = Nothing 
End Function
	
Sub NewCall
  	Dim DataToSend 
	If Len(PBXCall.CallingPartyNumber) = 3 Then
		PBXCall.CallingPartyNumber = "+49YOURNUMBERHERE" + PBXCall.CallingPartyNumber
	End If
	DataToSend = "event=newCall&from=" & PBXCall.CallingPartyNumber & "&to=" & PBXCall.DialedNumber & "&direction=in&callId=" & PBXCall.CallId & "&user[]="
	SendData DataToSend
End Sub

Sub CallAnswer
  	Dim DataToSend
	If Len(PBXCall.CallingPartyNumber) = 3 Then
		PBXCall.CallingPartyNumber = "+49YOURNUMBERHERE" + PBXCall.CallingPartyNumber
	End If
	DataToSend = "event=answer&from=" & PBXCall.CallingPartyNumber & "&to=" & PBXCall.DialedNumber & "&direction=in&callId=" & PBXCall.CallId & "&user[]=" & PBXCall.ConnectedName & "&answeringNumber=+49YOURNUMBERHERE" & PBXCall.ConnectedNumber
	SendData DataToSend
End Sub

Sub CloseCall
  	Dim DataToSend
	If Len(PBXCall.CallingPartyNumber) = 3 Then
		PBXCall.CallingPartyNumber = "+49YOURNUMBERHERE" + PBXCall.CallingPartyNumber
	End If
	DataToSend = "event=hangup&cause=normalClearing&from=" & PBXCall.CallingPartyNumber & "&to=" & PBXCall.DialedNumber & "&direction=in&callId=" & PBXCall.CallId & "&user[]=" & PBXCall.ConnectedName & "&answeringNumber=+49YOURNUMBERHERE" & PBXCall.ConnectedNumber
	SendData DataToSend
End Sub
1 Like