Jump to content

ObjEvent not executing function


Recommended Posts

I'm trying to receive events about incoming calls from a VoIP software (Mitel UC Advanced - in case somebody wants to know). There is a SDK available which consists of one DLL file (TelephonyProxy.dll).

The documentation of the DLL file says the following about the Offering event:


The Listener class captures the telephony events raised by Unified Communicator

[...]

When used as COM class, the class ID is CE21C9EE-6671-4B1C-8B01-D7AA4C52CB6C.

 

Visual Basic example:

Public Class Listener

Offering event in detail:


The Offering event is raised when Unified Communicator receives an incoming call.

 

Visual Basic example:

Public Event Offering As Listener.OfferingEventHandler

Delegation in Visual Basic:

Public Delegate Sub OfferingEventHandler ( _
    name As String, _
    number As String _
)

This is what I produced in AutoIt based on the documentation:

Local $oError = ObjEvent("AutoIt.Error", "nothing")

$oPhone = ObjCreate("{CE21C9EE-6671-4B1C-8B01-D7AA4C52CB6C}")
$oPhoneEvent = ObjEvent($oPhone,"_PhoneEvent_")

MsgBox(0,"isObj",IsObj($oPhone))

While 1
    Sleep(100)
WEnd

Func _PhoneEvent_Offering($name,$number)
    MsgBox(0,"",$name & " " & $number)
EndFunc

The problem is that the function '_PhoneEvent_Offering' is not executed on incoming calls. The object on the other hand is created (returns 1). The DLL's interface fullfills the requirements of AutoIt for working with it as far as I know. The 'oleviewer.exe' shows the IDispatch-interface under 'Telephony.Proxy' (see attached screenshot).

There are other API options in the DLL file, i.e. dialing a number. This works as desired so I bet I'm missing something with the ObjEvent stuff.

Any help is appreciated.

Thanks, Bastian

EDIT:

When using an object to fetch possible errors I always get this on the console:

err.number is:  -2147319785
err.windescription: Field name not defined in the record

post-17692-0-39831400-1369649683_thumb.p

Edited by Basti756
Link to comment
Share on other sites

Which version of AutoIt do you run?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Are you sure it shouldn't be _PhoneEvent_OnOffering?

No but it doesn't work either.

 

Anyway, find script called TLBViewer.au3 in examples and load it with your TelephonyProxy.dll and then post the output here.

There is just a message box popping up saying 'No MSFT Typelib inside this file!'.

Link to comment
Share on other sites

There is just a message box popping up saying 'No MSFT Typelib inside this file!'.

Then it's defined in some other file (TLB maybe). Try this code to get location:

$oPhone = ObjCreate("{CE21C9EE-6671-4B1C-8B01-D7AA4C52CB6C}")
$sLocation = ObjName($oPhone, 4)

ConsoleWrite($sLocation & @CRLF)
MsgBox(4096, '', $sLocation)

...and then use TLBViewer. You probably need newer AutoIt than 3.3.6.1 for that.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

I updated AutoIt to 3.3.8.1 yesterday. 3.3.6.1 was for testing only.

$sLocation returns an empty string. It seems like flag 4 is not supported by the object. Is there any other way to get this information?

EDIT: ObjName doesn't return an error and flag 1 is returning the object's name.

EDIT2: This is what is being returned by all flags of ObjName:

1: Listener
2:    
3: TelephonyProxy.Listener
4:         
5: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
6: {CE21C9EE-6671-4B1C-8B01-D7AA4C52CB6C}
7: {E0268CC5-7852-3125-8442-11F5A837E806}
Edited by Basti756
Link to comment
Share on other sites

Aha, that's .NET COM object. Typelib is generated at runtime.

Go back to ole/com object viewer and find definition of the sink object and then post that. In your previous attached picture you weren't  showing any sink method definition.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Any hint on what I should look for? I've never done anything like that...

EDIT: Maybe the attached screenshot helps altough it shows only slightly more than the previous one.

post-17692-0-25249000-1369731416_thumb.p

Edited by Basti756
Link to comment
Share on other sites

I didn't get that IsObj() is able to check for exisiting objects on ObjEvent(), altough ObjEvent() creates an object... anyways.

@error from ObjEvent is -2147319785 and (as a result) the object is not created.

-2147319785 means 'Field name not defined in the record'

Edited by Basti756
Link to comment
Share on other sites

I'm the author of that part of AutoIt in newer versions so I know when that's error value emitted. Your best shot is to specify third argument for ObjEvent():

$oPhoneEvent = ObjEvent($oPhone,"_PhoneEvent_", "_Listener")
;...

Though I'm not sure what that argument should be in your case. My guess is _Listener.

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...