如何通过modem得到来电电话号码(急)(200分)

  • 主题发起人 主题发起人 lpzst002
  • 开始时间 开始时间
L

lpzst002

Unregistered / Unconfirmed
GUEST, unregistred user!
请大家帮帮忙啊!用没有这方面的资料啊!最好源代码啊!
 
不一定可以得到来电显示的号码。因为没有听说那个MODEM支持来电显示业务,
因为电话线上的是模拟信号,如果硬件不支持,是不可能得到的。
 
如果是modem支持,电信支持,那么有这方面的源代码吗???
 
这个我不太清楚,但是比如当MODEM拨通电话后,如果用户按键,MODEM会
直接收到按键的值,我想来电显示大概可以得到电话号码的值。这个问题
建议你到生产电话语音卡的厂家问一问,他们对电信的协议比较清除。
 
电信支持?
 
to 花儿:就是电信局开通来电显示.
to 楼主:这个问题可能生产电话机的厂家比较熟呢.
 
可以做到,使用TAPI编程即可.
这是一个VB的例子:
Imports TAPI3Lib
Public Class cTAPI

Dim gobjTapi As TAPI

Dim WithEvents gobjTapiWithEvents As TAPI

Dim glRegistrationToken As Long

Dim gobjReceivedCallInfo As ITCallInfo

Dim gbSupportedCall As Boolean

Const TAPI3_CALL_EVENTS = TAPI_EVENT.TE_CALLMEDIA Or
TAPI_EVENT.TE_CALLNOTIFICATION Or TAPI_EVENT.TE_CALLSTATE

Public Sub New()

gobjTapi = New TAPI()

Call gobjTapi.Initialize()

Dim gobjAddress As ITAddress

Dim objCollAddresses As ITCollection

Dim bfound As Boolean

Dim indexAddr As Integer

Dim objCrtAddress As ITAddress

Dim objMediaSupport As ITMediaSupport

Dim objAddressCapabilities As ITAddressCapabilities

objCollAddresses = gobjTapi.Addresses

bfound = False

For indexAddr = 1 To objCollAddresses.Count

objCrtAddress = objCollAddresses.Item(indexAddr)

objMediaSupport = objCrtAddress

objAddressCapabilities = objCrtAddress

If objMediaSupport.QueryMediaType(TapiConstants.TAPIMEDIATYPE_AUDIO)
Then

bfound = True

End If

objAddressCapabilities = Nothing

objMediaSupport = Nothing

objCrtAddress = Nothing

If bfound = True Then Exit For

Next indexAddr

'gobjAddress = objCollAddresses.Item(indexAddr)

'musste ich rausnehmen, da sonst gobjTapi.RegisterCallNotifications
(ca Line
57) abraucht - bei mir wird bei

'indexAddr = 1 = 7 = 8 bfound = true, aber nur bei indexAddr = 8 wird
der
Handler registriert

gobjAddress = objCollAddresses.Item(8)

gobjTapi.EventFilter = TAPI3_CALL_EVENTS

gobjTapiWithEvents = gobjTapi

Dim fOwner As Boolean, fMonitor As Boolean

Dim lMediaTypes As Long, lCallbackInstance As Long

fOwner = True

fMonitor = False

lMediaTypes = TapiConstants.TAPIMEDIATYPE_AUDIO

lCallbackInstance = 1

glRegistrationToken = gobjTapi.RegisterCallNotifications( _

gobjAddress, _

fMonitor, _

fOwner, _

lMediaTypes, _

lCallbackInstance)

End Sub

Public Sub InstallListener()

End Sub

Private Sub gobjTapiWithEvents_Event(ByVal TapiEvent As
TAPI3Lib.TAPI_EVENT,
ByVal pEvent As Object) Handles gobjTapiWithEvents.Event

If TapiEvent = TAPI_EVENT.TE_CALLNOTIFICATION Then

Dim objCallNotificationEvent As ITCallNotificationEvent

objCallNotificationEvent = pEvent

Dim gobjReceivedCallInfo As ITCallInfo

gobjReceivedCallInfo = objCallNotificationEvent.Call

Dim objCallControl As ITBasicCallControl

objCallControl = gobjReceivedCallInfo

objCallControl.Answer()

End If

End Sub

End Class

还有一个通过回调实现

VOID FAR PASCAL MessageCallback(DWORD hDevice, DWORD dwMsg,
DWORD dwCallbackInstance, DWORD dwParam1,
DWORD dwParam2, DWORD dwParam3)
{
bMessageCallBack = true;
printf("%u/t%u/t%u/n",dwMsg,dwCallbackInstance,dwParam1);

if (dwMsg == LINE_CALLINFO)
{
if (dwParam1 == LINECALLINFOSTATE_CALLERID)
{
LONG Res;
char *pCallInfo = new char[1024];
LINECALLINFO *CallInfo = reinterpret_cast<LINECALLINFO*>(pCallInfo);

CallInfo->dwTotalSize = 1024;

//Res = lineGetCallInfo(reinterpret_cast<HCALL>(hDevice), CallInfo);
Res = lineGetCallInfo((HCALL)hDevice, CallInfo);

char *CalledID = &amp;pCallInfo[CallInfo->dwCallerIDOffset];

printf("CallerID : %s/n",
&amp;pCallInfo[CallInfo->dwCallerIDOffset]);
delete[] CallInfo;
}
}
}

以上程序都是在TAPI3.0下做的。
 
谢谢了,不过谁能将上面的vb代码翻译一下啊!保证给分啊!
 
我有现成的源代码,Tapi实现,不过要Money喔
 
请到voiceangel.myetang.com去看看,那里的控件可以的,我曾经试验过!
 
来自http://wenjinshan.yeah.net或wenjinshan.mycool.net的
《Delphi串口及语音传真编程》已出版
 
var
t: ITCallInfo;
begin
t := CreateComObject(IID_ITCallInfo) as ITCallInfo;
end;
为什么说我的类未注册,在C#里都可以调用, 为什么在Delphi里不行
 
你必须申请了来电显示之后,使用modem获取电路信号,来获得来电号码!
 
后退
顶部