求教如何用VB开发语音卡客户来电系统
我们公司要我开发一套基于梓博语音卡的客户来电显示系统,只要电话一接通就会自动弹出客户的资料信息,想请教各位如何实现啊,有没有思路介绍下。梓博提供了第三方开发说明,如下:
信息通过udp发送,目前采用的端口是1971(local)/1972(Client),
在VB里用Winsock控件,Bind 1971端口.
发送的信息格式为UDP样单:(第三方企业,只需读取78位的30位长度的来电号码就可以了)
<CRMV1 0005 2006-09-05 15:01:23 86110306
86110306 >
169.254.207.210 {RAWCID:[86112764]}
{DETAILDES:[]}
=========================================================================================
梓博POPUP来电处理源带码案例:(可做参考)
If Left(sCmd, 6) = "<CRMV1" Then '!100C01 '是否来电信息
strTime = Mid(strData, 31,19) '''时间 '31位开始,19位长度,
strChnl = Trim(Mid(strData, 23, 8)) '''通道
strLineNo = Trim(MyMidB(strData, 50, 28)) '''线路号码 '线路号码,(第50个字节,取28个字节
strCID = Trim(Mid(strData, 78, 30)) '''来电号码 '来电号码(78位开始,30位长度
strDes = Trim(MyMidB(strData, 113, 30)) '''描述
strSN = Trim(MyMidB(strData, 144, 10)) '''序号
strServerIp = Trim(MyMidB(strData, 154, 30)) '''服务器IP '服务器的IP地址
CID.IfBlackList = Trim(MyMidB(strData, 184, 10)) '''是否黑名单
strIfVip = Trim(MyMidB(strData, 194, 10)) ' '''是否VIP
CID.rawCID = GetTcpCmdPara(strData, "RAWCID") '''原始拨号
CID.strDetail = GetTcpCmdPara(strData, "DETAILDES")
CID.CallerID = strCID
CID.strTime = strTime
CID.strChnl = strChnl
CID.strLineNo = strLineNo
CID.strDes = strDes
CID.strSN = strSN
If strSN <> "" Then
If Left(strSN, 3) <> "SPB" Then
CID.SnType = "CUSTOMER"
Else
CID.SnType = "PHONEBOOK"
End If
End If
CID.strSN = FilterNoneNumber(strSN) '''过滤非数字的字符
CID.SN = Val(CID.strSN)
CID.IfVIP = strIfVip
'''-------------------------------------------------------------------------------
这个过程中用到的几个涵数
Function MyMidB(ByVal strIn As String, ByVal StartPos As Integer, ByVal DataLen As Integer) As String '!200b8
'计算中英文字串长度,1个中文=2个英文或数字
Dim tpStr As String
Dim i As Integer, S As String, C As Integer
Dim Sss As String
Dim Count As Integer
On Error GoTo Errdeal
Count = 0
For i = 1 To Len(strIn)
S = Mid(strIn, i, 1)
C = Asc(S)
If Abs(C) < 255 Then
Count = Count + 1
Else
Count = Count + 2
End If
If Count >= StartPos And Count <= (StartPos + DataLen - 1) Then
tpStr = tpStr + S
ElseIf Count > StartPos + DataLen - 1 Then
Exit For
End If
Next i
MyMidB = tpStr
Exit Function
Errdeal:
End Function
Function GetTcpCmdPara(ByVal strPara As String, ByVal ParaName As String) As String '!100A36
'功能: 取TCP指令函数
On Error GoTo Errdeal
Dim posPara As Integer, i As Integer
Dim thisChar As String
Dim bParaBegin As Boolean, Rslt As String
If strPara <> "" Then '参数存在
posPara = InStr(strPara, ParaName) '!remind要考虑前面有中文时这个位置就不准了.
If posPara <> 0 Then
For i = posPara + Len(ParaName) To Len(strPara)
'thisChar = MyMidB(strPara, i, 1)
thisChar = Mid(strPara, i, 1) '!100a57
If thisChar = "]" Then '参数结束
Exit For
End If
If bParaBegin = True Then '取参数
Rslt = Rslt + thisChar
End If
If thisChar = "[" Then '参数开始了
bParaBegin = True
End If
Next i
End If
End If
GetTcpCmdPara = Rslt
Exit Function
Errdeal:
Savelog "!GetTcpCmdPara " + Err.Description
End Function
'''-------------------------------------
--------------------编程问答-------------------- 看SDK文档 --------------------编程问答-------------------- 来电显示系统设计思路
1:服务器端,插板卡和放置数据库
2:客户端,登录系统,到数据库注册好PC的IP地址和分机号码,电话进来后,先到服务器,服务端程序提取出呼叫号码和分机号,然后找到对应的客户端,SOCKET通知客户端,弹出来电号码,到数据库找和这个号码对应的客户信息。
也可以把数据库和插板卡的服务器分开布置。 --------------------编程问答-------------------- 编程细则查看SDK和例子程序。一般这样的程序例子就有提供。 --------------------编程问答--------------------
补充:VB , 基础类