C ++ / TAPI2 / CallbackFunc问题 [英] C++ / TAPI2 / CallbackFunc problem

查看:51
本文介绍了C ++ / TAPI2 / CallbackFunc问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

 我已经开始用C ++编写TAPI控制台应用程序了。我希望收到来自PBX的活动并将其打印出来。 

  I have started writting a TAPI console application in C++. I would like to receive events from the PBX and simply print it out. 

  LineInitialize 返回0

  LineInitialize  Return 0

  LineNegotiateAPIVersion返回0

  LineNegotiateAPIVersion Return 0

  LineOpen返回0

  LineOpen Return 0

 我想返回零表示成功,但是,我的回调函数永远不会被调用(只是输出一条消息)。

  I guess return zero means that is successfully, however, my callbackfunction is never invoked (a simply outputting a message).

 这是我的行开:

  That is my lineOpen:

  lineOpen(myApplication,26,& LineHandles [26],dwAPIVersion,(DWORD)0,(DWORD)lineCallbackFunc,LINECALLPRIVILEGE_MONITOR | LINECALLPRIVILEGE_OWNER,LINEMEDIAMODE_DATAMODEM,NULL)

  lineOpen(myApplication, 26, &LineHandles[26], dwAPIVersion, (DWORD)0, (DWORD)lineCallbackFunc, LINECALLPRIVILEGE_MONITOR | LINECALLPRIVILEGE_OWNER, LINEMEDIAMODE_DATAMODEM, NULL)

// myApplication =我的应用程序名称/行

//myApplication = my application name/ line

// 26是我要打开的行,并有一个数组句柄

//26 is the line i would like to open, and have a array handle

//从LineNegotiateAPIVersion收到APIVersion,但是,当我打印出来时,它是65540

//APIVersion is received from LineNegotiateAPIVersion, however, when I print it out, it is 65540

//扩展版本0

//我定义的行回调函数

//my defined line Call back func

//想要监听来电和去电。

// want to monitor both incoming and outgoing call.

 

之后,我的主要功能只是进入一个循环而且什么都不做

After that, my main functions just go into a loop and do nothing

while(true)

while (true)

{}

 

我的LineCallBackFunc定义:

my LineCallBackFunc Defines:

VOID FAR PASCAL lineCallbackFunc(DWORD hDevice,DWORD dwMsg,  DWORD dwParam1,DWORD dwParam2,DWORD dwParam3)

VOID FAR PASCAL lineCallbackFunc(DWORD hDevice, DWORD dwMsg,  DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)

{

cout<< "Line Call Back Func !!!" << endl;

cout << "Line Call Back Func !!!" << endl;

}

 

我是否需要注册任何机制来接收CallBackFunc ?

does I need to register with any mechanism to receive the CallBackFunc?

 

谢谢。

 

 

推荐答案

(以下链接基于TAPI,但答案仍然有效,只是lineInitialize在TAPI2中已过时。 )

(The following links are based on TAPI, but the answer remains valid except that lineInitialize is obsolete in TAPI2.)

您需要将callbackFunc的地址作为参数传递给
lineInitialize
 (或
lineInitializeEx
)。

You need to pass the address of the callbackFunc as an argument to lineInitialize (or lineInitializeEx).


lineOpen
是传递给
lineCallbackFunc
在其 dwCallbackInstance 参数中,可以是任何参数你的应用程序找到方便的值(castable-to-DWORD),但回调函数本身的地址可能不是一个有用的值!

The sixth argument of lineOpen is what gets passed to lineCallbackFunc in its dwCallbackInstance parameter and can be any (castable-to-DWORD) value your application finds convenient, but the address of the callback function itself is probably not a useful value!


这篇关于C ++ / TAPI2 / CallbackFunc问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆