Tapi 3.0

ObiWanObiWan Member Posts: 21
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! :D

Comments

  • JedrzejTJedrzejT Member Posts: 267
    Hi

    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);
  • ObiWanObiWan Member Posts: 21
    Maybe I was a bit unclear about what I was trying to do.
    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.

    :lol:
  • JedrzejTJedrzejT Member Posts: 267
    :oops: sorry.. i quickly read your post

    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...
  • markvandermeijmarkvandermeij Member Posts: 26
    You will not be able to capture incoming calls directly, because of the fact that you can't capture Windows events, in Navision (Dynamic Solutions NAV). To capure incoming calls you will need a TAPI interface developped in a 3GL language (eg. C#, C++ , Delphi etc.).
    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)
  • kinekine Member Posts: 12,562
    You will not be able to capture incoming calls directly, because of the fact that you can't capture Windows events, in Navision (Dynamic Solutions NAV).

    It is not true. If you have some Automation with event, you can catch this events in Navision in some Singleinstance codeunit for example... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • markvandermeijmarkvandermeij Member Posts: 26
    of course you can capture an (windows) event, but it won't be captured automatically -> event happens, navision windows pop up. You have to check if an event has happened. That's what I meant with you will not be able to capture an external event directly in Navision...if you can capture it automatically, I would like to know how....
  • ObiWanObiWan Member Posts: 21
    Hi, the cdu is a SingleInstance and the Tapi automation is set to be WithEvents.
    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 :D
  • markvandermeijmarkvandermeij Member Posts: 26
    ...I was wrong :oops: out of ignorance..
    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....
  • ObiWanObiWan Member Posts: 21
    Hi Mark!

    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 :mrgreen:
  • markvandermeijmarkvandermeij Member Posts: 26
    That would be great!
    You can send it to mvandermeij@casema.nl
  • lzrlzr Member Posts: 264
    ObiWan wrote:
    Hi Mark!

    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 :mrgreen:

    Any chance you can send it to me as well? :D

    lzr@home.se
    Navision developer
  • mkhanmkhan Member Posts: 1
    JedrzejT wrote:
    :oops: sorry.. i quickly read your post

    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 am looking for this program - please can you provide a link. Thanks!
  • ara3nara3n Member Posts: 9,256
    Any update on whether you were sucessful at implementing this?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • WaldoWaldo Member Posts: 3,412
    Since you guys are sharing ... may be put it as download on Mibuso :wink:?

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • ObiWanObiWan Member Posts: 21
    Hi, sorry for the "delay"..

    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
  • primeapprimeap Member Posts: 37
    ObiWan wrote:
    Hi, does anybody have any exp. with using TAPI 3.0 inside Navision?

    I have even created a dll in C# that creates an Enum filter, but nothing ever happens in the EventTrigger.


    Anybody got a clue?

    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."
  • ObiWanObiWan Member Posts: 21
    I believe I tried that too...

    Hope I don`t have to give it a shoot again :shock:


    Best regards
    ObiWan
  • primeapprimeap Member Posts: 37
    ok, this is the order to finally get the phone no thru tapi 3.0 (of course you need to adapt f.e. the ITAddress to your TAPI provider)
    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
  • wwestendorpwwestendorp Member Posts: 178
    Does anyone haves an Update on the Navision possibillities of retrieving Phone Number of incomming calls via TAPI Automation 3.0?
    Just using the standard Automations?
  • ara3nara3n Member Posts: 9,256
    I've done this for a client but did not use TAPI. It was a simple ip socket communication with the phone server.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.