Sign in to follow this  
Followers 0
Basti756

ObjEvent not executing function

16 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



Which version of AutoIt do you run?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I'm currently running 3.3.6.1 because I read something about changes within the COM handling after that version. Before I was using 3.3.8.1. I already tried the latest beta (3.3.9.4) as well.

Share this post


Link to post
Share on other sites

Are you sure it shouldn't be _PhoneEvent_OnOffering?

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


♡♡♡

.

eMyvnE

Share this post


Link to post
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!'.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

What's displayed for _Object?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Hope that helps

post-17692-0-48985100-1369734254_thumb.p

post-17692-0-41113600-1369734261_thumb.p

Share this post


Link to post
Share on other sites

Sorry for bumping this thread but I still can't figure out why my script isn't working

Share this post


Link to post
Share on other sites

You are still not providing enough info about interfaces.

...Check @error after ObjEvent() call and check if your $oPhoneEvent is object.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I'm working on that too. Did you get some evolution?

Edited by Steevegl

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0