Hi, does anybody have any exp. with using TAPI 3.0 inside Navision?
This is what I've got so far: (Tapi is with events)
CREATE(tapi_TAPI);
tapi_TAPI.Initialize;
//Pick up the collection of Address objects
tapi_ITCollection := tapi_TAPI.Addresses;
b_Found := FALSE;
indexAdr := 8;
FOR indexAdr := 1 TO tapi_ITCollection.Count DO BEGIN
IF NOT b_Found THEN BEGIN
tapi_ITAdress := tapi_ITCollection.Item(indexAdr);
tapi_MediaSupport := tapi_ITAdress;
b_Found := tapi_MediaSupport.QueryMediaType(nSelectedType);
END;
END;
IF NOT b_Found THEN
ERROR('No Media address found/selected!');
tapi_ITAdress := tapi_ITCollection.Item(indexAdr);
//Set the EventFilter to accept all defined TAPI events
fOwner := TRUE;
fMonitor := FALSE;
lMediaTypes := 1;
lCallBackInstance := 1;
Token := tapi_TAPI.RegisterCallNotifications(tapi_ITAdress,fOwner,
fMonitor,lMediaTypes,lCallBackInstance);
tapi_TAPI.EventFilter := lCallBackInstance;
//This is where the Event should appear...
tapi_TAPI::Event(TapiEvent : Integer;pEvent : Automation "''.IDISPATCH")
//RECEIVE A CALL - Start
//Get the ITCallNotification interface.
tapi_ITCallNotificationEvent := pEvent;
//query ITCallInfo interface for the new call, and store it
tapi_ITCallInfo := tapi_ITCallNotificationEvent.Call;
//Get the ITBasicCallControl interface.
tapi_ITBasicCallControl := tapi_ITCallInfo;
//Create the required terminals for this call.
//See the Select a Terminal code example.
//Answer
tapi_ITBasicCallControl.Answer;
//RECEIVE A CALL - End
I have even created a dll in C# that creates an Enum filter, but nothing ever happens in the EventTrigger.
Anybody got a clue?
May the force be with u!
Comments
I do it long time ago. If i rememper it works. Maybe this will help you. This function don't check if dial succed
Change funciton Dial in CU 5053 (tapimgt)
Success:=YourFunc(PhoneNumber)
YourFunc::
gObjTapi Automation 'Microsoft TAPI 3.0 Type Library'.TAPI
ObjCallControl Automation 'Microsoft TAPI 3.0 Type Library'.ITBasicCallControl
GObjAddress Automation 'Microsoft TAPI 3.0 Type Library'.ITAddress
ObjCallAddresses Automation 'Microsoft TAPI 3.0 Type Library'.ITCollection
objMediaSupport Automation 'Microsoft TAPI 3.0 Type Library'.ITMediaSupport
IndexAddr Integer
BFound Boolean
ItState Automation 'Microsoft TAPI 3.0 Type
__________
CREATE(gObjTapi);
gObjTapi.Initialize;
ObjCallAddresses := gObjTapi.Addresses;
BFound := FALSE;
FOR IndexAddr:= 1 TO ObjCallAddresses.Count DO BEGIN
IF BFound=FALSE THEN BEGIN
objMediaSupport := ObjCallAddresses.Item(IndexAddr);
IF objMediaSupport.QueryMediaType(16) THEN
BFound := TRUE;
CLEAR(objMediaSupport);
END;
END;
GObjAddress := ObjCallAddresses.Item(IndexAddr);
ObjCallControl := GObjAddress.CreateCall(PhoneNo, 1, 16);
ObjCallControl.Connect(FALSE);
CLEAR(gObjTapi);
CLEAR(ObjCallControl);
CLEAR(GObjAddress);
CLEAR(ObjCallAddresses);
CLEAR(objMediaSupport);
CLEAR(ObjNotify);
EXIT(TRUE);
The idea is to get the Incoming Phonenumber, not to call out.
When the phone central get an incoming call the Tapi event should be fired and send som info. about which event has occured.
Call through it seems to be ok.
i do it in easy way (test app, don't have time for it)
for incoming calls we use external program (with ipcentral). When phone call, this prg. launch another ext. mini program (this save phonenumer in textfile). At the end navision popup contact card if user want it...
I've just finished creating such an interface, in combination with a (non-visible) form. The form pops-up when a call comes in and shows the relevant relations.
The interface I created is fairly simple and direct, it creates a text file with incoming number and the Navision form checks, using a timer, if the file has been created. Another option is creating an automation object which sets a flag, incoming call, and passes a memory address with the incoming phone number.
As you can understand, I'm not able to give you the TAPI interface for free, my boss wouldn't be happy with it. If you would like more information or would like to you use the TAPi interface we've created just contact me (mark.vandermeij@imtech.nl)
http://home.casema.nl/mvandermeij
It is not true. If you have some Automation with event, you can catch this events in Navision in some Singleinstance codeunit for example... ;-)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
http://home.casema.nl/mvandermeij
What do u mean Mark with "Navision can`t handle WindowsEvents?"
Is there any secrets regarding TAPI api?
I have earlier created similar stuff against msn Messenger, that piece of code trigged on everey event i specified in the API, like when people change their Status and so on..
May the force be with u
I wasn't aware of the fact you could use an automation object with events in Navision, so thanks to you guys I've learned a new feature.
So I'm going to try to change my TAPI handler (a wrapper for the original TAPI) to one with events and see if I'm able to capture them in Navision.
I will post my findings....
http://home.casema.nl/mvandermeij
If u would like I can send u my stuff. Maybe u can figure it out and provides a little start.
I have an CDU written and som C# code used to enumerate the TapiEventfilter.
Best regards ObiWan
You can send it to mvandermeij@casema.nl
http://home.casema.nl/mvandermeij
Any chance you can send it to me as well?
lzr@home.se
I am looking for this program - please can you provide a link. Thanks!
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
This solution i made is gone, it was installed on a customer computer (VS2005 and ProjectFiles)
and then they suddenly had moved to using thin clients (running RDP) so my project was lost.
Also my knowledge about C# programming was to low back then, so it was not stable.
Although it actually worked, but the EXE files needed to be restarted each time it was clicked... =D>
My exp with this was that it was too much stuff going on so the cheapest thing for all parts (customer and NSC) would be to go for a std. tool. (maby not so much fun but cheaper :roll: )
Best regards
ObiWan
Hi ObiWan
i found this on the msdn http://msdn.microsoft.com/en-us/library/ms726986(VS.85).aspx
in your example it misses obviously this:
"You must call the ITTAPI::put_EventFilter method to set the event filter mask and enable reception of events. If you do not call ITTAPI::put_EventFilter, your application will not receive any events."
Hope I don`t have to give it a shoot again :shock:
Best regards
ObiWan
I will try to transfer that now to nav...
:
ITTAPI.CreateInstance ITTAPI_1
returned hr = 0x00000000
ITTAPI_1.Initialize returned hr = 0x00000000
ITTAPI_1.EnumerateAddresses returned hr = 0x00000000
IEnumAddress_1
IEnumAddress_1.Next ITAddress2_1
returned hr = 0x00000000
IEnumAddress_1.Next ITAddress2_2
returned hr = 0x00000000
IEnumAddress_1.Next ITAddress2_3
returned hr = 0x00000000
IEnumAddress_1.Next ITAddress2_4
returned hr = 0x00000000
IEnumAddress_1.Next ITAddress2_5
returned hr = 0x00000000
IEnumAddress_1.Next ITAddress2_6
returned hr = 0x00000000
IEnumAddress_1.Next ITAddress2_7
returned hr = 0x00000000
ITTAPI_1.AdviseEventNotification returned hr = 0x00000000
cookie 990
ITTAPI_1.put_EventFilter
long plFilterMask : 4 (0x00000004)
returned hr = 0x00000000
ITTAPI_1.RegisterCallNotifications
ITAddress* pAddress : ITAddress2_6
VARIANT_BOOL fMonitor : 1
VARIANT_BOOL fOwner : 1
long lMediaTypes : 8 (0x00000008)
long lCallbackInstance : 990 (0x000003de)
returned hr = 0x00000000
long* plRegister = 956 (0x000003bc)
ITCallNotificationEvent_1
TAPI_EVENT const int TE_CALLNOTIFICATION
ITCallNotificationEvent_1.get_Call returned hr = 0x00000000
ITCallInfo** ppCall = ITCallInfo2_1
ITCallInfo2_1.get_CallInfoString
CALLINFO_STRING CallInfoString : 1
returned hr = 0x00000000
BSTR* ppCallInfoString = 78
Just using the standard Automations?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n