超级难问题,在网页中实现点击某一电话号码后拨通ip电话

glassch 2004-05-09 08:32:32
现有一内网网站,客户想实现通过从数据库中查询出电话号码点击则拨通ip电话,一点相关东西也没有,点滴提示均有分相赠,
...全文
113 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
glassch 2004-05-11
  • 打赏
  • 举报
回复
谢谢,我学习中.
sn12345678 2004-05-11
  • 打赏
  • 举报
回复
高手,up一下
椅子 2004-05-11
  • 打赏
  • 举报
回复
先别谢谢,我没贴完,不让贴了,你把http://www.sinodigital.com.cn/about/call.htm下载下去
椅子 2004-05-10
  • 打赏
  • 举报
回复


Sub PressConnect
On Error Resume Next
DIM iAddressType
DIM pConnectTo
DIM addressFrom
DIM selStr

If not IsEmpty(spITCall) Then
MsgBox "您正在通话中,请先挂断",0,"连接"
Exit Sub
End If


If txtAddress.value = "" Then
MsgBox "呼叫地址不能为空",0,"连接"
Exit Sub
End If


if sCurrentAddressType < 0 Then
MsgBox "您没有正确选择地址类型",0,"连接"
Exit Sub
End If


iAddressType = CInt(sCurrentAddressType)

pConnectTo = txtAddress.value


For i = 0 to selAddress.length - 1
If selAddress.options(i).selected = True Then
addressFrom = selAddress.options(i).value
Exit For
End If
Next

If addressFrom = "" Then
MsgBox "你的号码不存在",0,"连接"
Exit Sub
End If

Call Connect(pConnectTo,iAddressType,addressFrom,checkAOnly.value="on" or checkAOnly.disabled,checkNoOutgoingVideo.value="on" or checkNoOutgoingVideo.disabled)

End Sub

'******************************************************************
'******************************************************************
'******************************************************************
' 连接
Sub Connect(pConnectTo,iAddressType,addressFrom,blnAOnly,blnNoOutVideo)
On Error resume Next

sUnableToComplete = False

ConnANN.innerHTML = "正在连接 " & pConnectTo & "..."

window.status = "正在创建"




DIM pITAddress_Connect
DIM blnFoundAddress
blnFoundAddress = False
DIM pITAddress

For Each pITAddress in TAPIOBJ.Addresses
if pITAddress.AddressName = addressFrom Then

DIM pITMediaSupport
Set pITMediaSupport = MAPPER.QueryDispatchInterface(_
IID_String_ITMediaSupport,pITAddress)

call CheckError("connect:Query ITAddress for ITMediaSupport" )


bSupportVideo = _
pITMediaSupport.QueryMediaType(TAPIMEDIAMODE_VIDEO)

call CheckError("connect:ITMediaSupport.QueryMediaType" )
blnFoundAddress = True
Set pITAddress_Connect = pITAddress
Exit For
End If
Next

Set pITAddress = Nothing

if not blnFoundAddress Then
MsgBox "对不起,您的号码 " & addressFrom & "不存在",0,"连接"
ConnANN.innerHTML = "呼叫 "& pConnectTo & " 失败"
Exit Sub
End If


Call CreateCallWindow(pITAddress_Connect,blnAOnly or not bSupportVideo,blnNoOutVideo or not bSupportVideo)
Call CheckError("Connect: after CreateCallWindow")


DIM pITTerminalSupport

Set pITTerminalSupport = MAPPER.QueryDispatchInterface(_
IID_String_ITTerminalSupport,pITAddress_Connect)

call CheckError("connect:Query ITAddress for ITTerminalSuport" )


DIM MediaTypes

If not bSupportVideo or blnAOnly Then
MediaTypes = TAPIMEDIAMODE_AUDIO
Else
MediaTypes = S_MEDIA_AUDIOVIDEO
End If

Set pCall = pITAddress_Connect.CreateCall(pConnectTo,iAddressType,MediaTypes)

call CheckError("connect:CreateCall" )

Set spITCall = pCall

window.status = "配置结束"
Call AssignTerminals(pCall,blnAOnly,blnNoOutVideo,True)
call CheckError("connect:after AssignTerminals" )

if sUnableToComplete Then
Call DisconnectCall(1)
window.status = ""
ConnANN.innerHTML = "呼叫 "& pConnectTo & " 失败"
window.status = "完成"
Exit Sub
End If


window.status = "连接中"

Call pCall.Connect(false)


if Err.Number = &H8004000C Then
Err.Clear
Call DisconnectCall(1)
ConnANN.innerHTML = "呼叫 "& pConnectTo & " 失败:地址使用中"
window.status="完成"
Set pCall = Nothing

Else
if not Err.Number = 0 Then
Err.Clear
Call DisconnectCall(1)
ConnANN.innerHTML = "呼叫 "& pConnectTo & " 失败 " & Hex(Err.number)
window.status="完成"
Set pCall = Nothing
Else
Set spITCall = pCall
End if

End If

call CheckError("connect:main connect" )

Set pCall = Nothing

End Sub


Sub AssignTerminals(pCall, is_no_video, is_no_render,bSetQOS)
On Error Resume Next
DIM pITCallInfo
Set pITCallInfo = MAPPER.QueryDispatchInterface( _
IID_String_ITCallInfo, pCall)

Call CheckError("AssignTerminals:query for pITCallInfo")

DIM pITAddress
Set pITAddress = pITCallInfo.Address

Call CheckError("AssignTerminals:pITCallInfo.Address")

DIM pITTerminalSupport

Set pITTerminalSupport = MAPPER.QueryDispatchInterface(_
IID_String_ITTerminalSupport,pITAddress)

Call CheckError("AssignTerminals:query for pITTerminalSupport")


DIM pITStreamControl
Set pITStreamControl = MAPPER.QueryDispatchInterface(_
IID_String_ITStreamControl,pCall)

call CheckError("AssignTerminals:Query ITCall for ITStreamControl" )

DIM pITStream
DIM lMediaType
DIM lDirection



For Each pITStream in pITStreamControl.Streams
lMediaType = pITStream.MediaType
lDirection = pITStream.Direction


if not ((is_no_video and lMediaType = TAPIMEDIAMODE_VIDEO) or _
(is_no_render and lMediaType = TAPIMEDIAMODE_VIDEO and lDirection=TD_CAPTURE) ) Then

if (lMediaType = TAPIMEDIAMODE_VIDEO) and (lDirection=TD_RENDER) Then
is_error = false
Else

Set pITTerminal = pITTerminalSupport.GetDefaultStaticTerminal(lMediaType,lDirection)

if not (Err.number = 0) Then
is_error = True
Err.Clear
Else
is_error = False
pITStream.SelectTerminal(pITTerminal)
End if

call CheckError("AssignTerminals:SelectTerminal" )
End If


if is_error Then 'Maybe unnecessary

if (lMediaType = TAPIMEDIAMODE_VIDEO and lDirection=TD_CAPTURE) Then
MsgBox "Unable to find video capture device: attach video receive only"
Else
if (lMediaType = TAPIMEDIAMODE_AUDIO and lDirection=TD_CAPTURE) Then
MsgBox "Unable to find audio recording device: attach audio receive only"
Else
MsgBox "Unable to find audio playback device."
Err.Clear
sUnableToComplete = True
Exit Sub
End If
End if

Else



if (lMediaType = TAPIMEDIAMODE_VIDEO ) Then


if lDirection = 0 Then

pITStream.SelectTerminal(pVideoWindow2)
call CheckError("AssignTerminals: SelectTerminalStream")


Dim pIVideoWindow2
Set pIVideoWindow2 = MAPPER.QueryDispatchInterface(IID_String_IVideoWindow, pVideoWindow2)
call CheckError("AssignTerminals: query for IVideoWindow")
pIVideoWindow2.AutoShow = True
call CheckError("AssignTerminals: set visibility")


End If

if lDirection = 1 Then

pITStream.SelectTerminal(pVideoWindow1)

call CheckError("AssignTerminals: SelectTerminalStream")


Dim pIVideoWindow1
Set pIVideoWindow1 = MAPPER.QueryDispatchInterface(IID_String_IVideoWindow, pVideoWindow1)
call CheckError("AssignTerminals: query for IVideoWindow")
pIVideoWindow1.AutoShow = True
call CheckError("AssignTerminals: set visibility")


End If

call CheckError("AssignTerminals: SelectTerminalStream")

End If
End if

End if

call CheckError("AssignTerminals:GeneralChecking1" )

Next


call CheckError("AssignTerminals:Streams cycle problems" )


if bSetQOS Then

if not is_no_video Then
call pCall.SetQOS(TAPIMEDIAMODE_VIDEO,QSL_NEEDED)
call CheckError("AssignTerminals:set QOS_REQUIRED for Video" )
End If

call pCall.SetQOS(TAPIMEDIAMODE_AUDIO,QSL_NEEDED)
call CheckError("AssignTerminals:set QOS_REQUIRED for Audio" )
End IF

End Sub
椅子 2004-05-10
  • 打赏
  • 举报
回复
<!--

--------------------------------------------------------------------------

该页面可以让使用者呼叫指定的地址和接受呼叫。
电话操作有:创建、连接、应答、挂机
在收到打入电话振铃的时候,可以设置电话的优先权
QOS保证(QoS一般从呼叫建立时间、丢包率、抖动(延迟变化)、MOS值和端到端时延几个方面来评价。)
管理视频需要用到tapi控件的IVideoWindow属性,而在vbscript中获取不到window的handle,所以视频是不可以调用的。
注意:调用IVideoWindow属性只能在"stream active"事件发生时
--------------------------------------------------------------------------

-->

<html>
<head>
<meta content="text/html; charset=gb2312" http-equiv="Content-Type">
<title>sinodigital</title>

<SCRIPT LANGUAGE="JavaScript"><!--

var ua = navigator.userAgent;
var an = navigator.appName;

// Is it IE?
bMSIE = (ua.indexOf("MSIE")>=1);
if (! bMSIE)
{
alert("只能在ie中运行");
window.close;
}
//-->
</SCRIPT>


<script LANGUAGE="VbScript">


'下列常量从tapi3if.idl中拷贝
Const TAPIMEDIAMODE_AUDIO = &H08&
Const TAPIMEDIAMODE_VIDEO = &H8000&
Const S_MEDIA_AUDIOVIDEO = &H8008&
Const TD_CAPTURE = 0
Const TD_RENDER = 1
Const QSL_NEEDED = 1
Const AS_INSERVICE = 0
Const DC_NORMAL = 0
Const TE_CALLSTATE = 8
Const TE_CALLNOTIFICATION = 4
Const CS_DISCONNECTED = 3
Const CS_IDLE = 0
Const CS_OFFERING = 4
Const CS_CONNECTED = 2
Const CNE_OWNER = 0
Const CIS_CALLERIDNAME = 0
'IDs接口
'可以在tapi3.idl, tapi3if.idl, rend.idl中找到

Const IID_String_ITMediaSupport = "{B1EFC384-9355-11D0-835C-00AA003CCABD}"
Const IID_String_ITTerminalSupport="{B1EFC385-9355-11D0-835C-00AA003CCABD}"
Const IID_String_ITBasicCallControl = "{B1EFC389-9355-11D0-835C-00AA003CCABD}"

'Const IID_String_ITCallInfo = "{B1EFC390-9355-11d0-835C-00AA003CCABD}"

Const IID_String_ITCallInfo = "{350F85D1-1227-11D3-83D4-00C04FB6809F}"
Const IID_String_ITStreamControl= "{EE3BD604-3868-11D2-A045-00C04FB6809F}"
Const IID_String_ITDirectoryObjectConference= "{F1029E5D-CB5B-11D0-8D59-00C04FD91AC0}"
Const IID_String_ITCallStateEvent = "{62F47097-95C9-11d0-835D-00AA003CCABD}"
Const IID_String_ITCallNotificationEvent = "{895801DF-3DD6-11d1-8F30-00C04FB6809F}"


Const IID_String_IVideoWindow = "{56A868B4-0AD4-11CE-B03A-0020AF0BA770}"

'下面这个CLSID tapi3.h 的定义

Const CLSID_String_VideoWindowTerm = "{F7438990-D6EB-11d0-82A6-00AA00B5CA1B}"


'****************************************************************************
'全局变量
'****************************************************************************
'设置成true,可以在不能完成连接的时候跳过

DIM sUnableToComplete
DIM sbNeedToExit
sUnableToComplete = False
sbNeedToExit = False


DIM pRegisteredCallNotification(50)
DIM pRegisteredName(50)
DIM iQtaRegistered
iQtaRegistered = 0



DIM sCurrentAddressType
sCurrentAddressType = -1

DIM spITCall
spITCall = Empty


DIm pVideoWindow1
DIm pVideoWindow2

</script>


<script ID="clientEventHandlersVBS" LANGUAGE="vbscript">

'错误处理
Sub CheckError(strMsg)
if not Err.number = 0 Then
MsgBox strMsg & ":" & Err.number & ";"&Err.description
sbNeedToExit = True
Err.Clear
End If

End Sub

'********************************************************************
'********************************************************************
'********************************************************************
'********************************************************************
' 枚举拨入电话,并现实在list中
Sub window_onload
On Error Resume Next

'如果Tapi控件没有初试化就退出
If sUnableToComplete = True Then
Exit Sub
End If

'监听所有地址
DIM intTmp
intTmp = Find_Address_And_Register()

If sbNeedToExit Then
Exit Sub
End If

If intTmp = 0 Then
MsgBox "不能找到任何可用ip地址",0,"初试化中"
Exit Sub
End If

' 选择第一个ip地址(如果存在多个ip地址)
selAddress.options(0).selected = True

call changeOptionsState()

window.status = "完成"

End Sub

'********************************************************************
'********************************************************************
'********************************************************************
'********************************************************************

'如果已经启动服务则查找所有地址,计算机必需至少有一个音频设备,并注册所有地址,注册完毕后返回注册地址的数量

Function Find_Address_And_Register()
On Error Resume Next
DIM bUsefulAddress
DIM bSupportVideoOrAudio
DIM bSupportVideo

Find_Address_And_Register = 0
For Each pITAddress in TAPIOBJ.Addresses

bUsefulAddress = False

if pITAddress.State = AS_INSERVICE Then

DIM pITMediaSupport

Set pITMediaSupport = MAPPER.QueryDispatchInterface(_
IID_String_ITMediaSupport,pITAddress)


if not Err.number = 0 Then
Err.Clear
Else


bSupportVideo = pITMediaSupport.QueryMediaType(TAPIMEDIAMODE_VIDEO)

bSupportVideoOrAudio = _
pITMediaSupport.QueryMediaType(TAPIMEDIAMODE_AUDIO) or bSupportVideo

call CheckError("Find_Address_And_Register:ITMediaSupport.QueryMediaType" )

bUsefulAddress = bSupportVideoOrAudio
End If
End If

if bUsefulAddress Then

iQtaRegistered = iQtaRegistered + 1

if bSupportVideo Then
modes = S_MEDIA_AUDIOVIDEO
Else
modes = TAPIMEDIAMODE_AUDIO
End If

pRegisteredCallNotification(iQtaRegistered) = TAPIOBJ.RegisterCallNotifications(pITAddress,True,True,modes,0)
pRegisteredName(iQtaRegistered) = pITAddress.AddressName

if not Err.number = 0 Then 'Probably this address does not support incoming calls
iQtaRegistered = iQtaRegistered - 1
Err.Clear
Else
Find_Address_And_Register = Find_Address_And_Register + 1
End If


DIM oOption
Set oOption = document.createElement("OPTION")
oOption.text = pITAddress.AddressName
oOption.value = pITAddress.AddressName
selAddress.add(oOption)

Set oOption = Nothing
End IF
Next

call TAPIOBJ.SetApplicationPriority("IEXPLORE.EXE",TAPIMEDIAMODE_AUDIO,TRUE)
call TAPIOBJ.SetApplicationPriority("IEXPLORE.EXE",TAPIMEDIAMODE_VIDEO,TRUE)

End Function



Sub changeOptionsState
On Error Resume Next


Selstr = ""

bSupportVideo = false
For i = 0 to selAddress.length - 1
If selAddress.options(i).selected = True Then
selstr = selAddress.options(i).value
Exit For
End If
Next


For Each pITAddress in TAPIOBJ.Addresses

if pITAddress.AddressName =SelStr Then

DIM pITMediaSupport

Set pITMediaSupport = MAPPER.QueryDispatchInterface(_
IID_String_ITMediaSupport,pITAddress)

call CheckError("changeOptionsState:Query ITAddress for ITMediaSupport" )

bSupportVideo = _
pITMediaSupport.QueryMediaType(TAPIMEDIAMODE_VIDEO)

call CheckError("changeOptionsState:ITMediaSupport.QueryMediaType" )
Set pITMediaSupport = Nothing

Exit For
End If
Next
call CheckError("changeOptionsState:After enumerating the Addresses")
checkAOnly.disabled = not bSupportVideo
checkNoOutgoingVideo.disabled = not bSupportVideo

End Sub
sfar 2004-05-09
  • 打赏
  • 举报
回复
拨通电话的功能程序只能用服务商提供的,Web上所要做的是调用该Com组件,呵呵,就看这种组件提供的接口了。
bananasmiling 2004-05-09
  • 打赏
  • 举报
回复
还要有接口..不过这种接口在电信局.
yangzixp 2004-05-09
  • 打赏
  • 举报
回复
必须电话的组件
bananasmiling 2004-05-09
  • 打赏
  • 举报
回复
需要有专门拨打电话的com组件,然后就可以使用页面的onclick事件调用
xieyj 2004-05-09
  • 打赏
  • 举报
回复
需要有专门拨打电话的com组件,然后就可以使用页面的onclick事件调用
liuyangxuan 2004-05-09
  • 打赏
  • 举报
回复
楼主应该查一下拨IP电话的相关软件,然后根本IP击活该软件,当然如果有该软件的源码可以做成COM供调用更好了!没有做过,只是个人想法而以·
postfix2 2004-05-09
  • 打赏
  • 举报
回复
up~不会
椅子 2004-05-09
  • 打赏
  • 举报
回复
客户端必需安装ip电话的控件
你可以在网页中以<object codebase="http://192.168.0.1/2.cab" .......>来让客户端安装控件
如果客户端都是在局域网里拨打ip电话,并且都是windows操作系统,可以使用windows自带的tapi来实现ip电话拨打,通过h323线路
如果你要通过tapi控件,可以找我要范例
BlueDestiny 2004-05-09
  • 打赏
  • 举报
回复
有谁有具体的步骤和源码?
帮顶一下!

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧