6 Replies Last post: Jul 24, 2009 1:55 PM by sam  
Click to view sam's profile   19 posts since
Jul 20, 2009

Jul 22, 2009 4:03 PM

Using ATLSIP in Win32 C++ Application - Call Back Functions like OnLogSIPMessage()


Dear

We are implementing OpenSIPStack in our Win32 based C++ appliation.

We have created the the OpenSIPStackCtl Object with following line an can also access the member function like MakeCall().

CoCreateInstance(__uuidof(OpenSIPStackCtl), NULL, CLSCTX_INPROC_SERVER, __uuidof(IOpenSIPStackCtl), (LPVOID *)&pOpenSIPStackCtl);

So far so good. But haw to get access to the Call Back funktion like OnLogSIPMessage() or better said what do we have to do that SIPATL call our Call Back Function for this Event. We did have a look at dispinterface _IOpenSIPStackCtlEvents. But did not see what code is needed "to get this function called back".

Thanks for any help or coded snipped to see how we have to handle the Event from class _IOpenSIPStackCtlEvents, Samuel

Click to view joegen's profile   519 posts since
Apr 28, 2007
1. Jul 22, 2009 11:16 PM in response to: sam
Re: Using ATLSIP in Win32 C++ Application - Call Back Functions like OnLogSIPMessage()

1. I am not a COM developer so I apologize if I wont be of any help how to use ATLSIP in a C++ app.

2. If you are using C++, I do not see any reason why you wouldnt link to opensipstack directly and simply use SoftphoneInterface. ATLSIP is merely a wrapper for this class. (see MFC sample)

3. The forum is not very good in handling discussion that require access to source codes. I would advise that you bring this thread in opensipstack-devel sourceforge mailing list

Click to view joegen's profile   519 posts since
Apr 28, 2007
3. Jul 23, 2009 8:59 PM in response to: sam
Re: Using ATLSIP in Win32 C++ Application - Call Back Functions like OnLogSIPMessage()
in most cases, this can be safely ignored using /IGNORE:MULTIPLE linker flag. It seems that you application and opensipstack are linked to the runtime differently. If your application is linked to the runtime using "shared libs" then you must also link opensipstack to the runtime using shared. That should get rid of the multiple links.
Click to view joegen's profile   519 posts since
Apr 28, 2007
5. Jul 24, 2009 4:32 AM in response to: sam
Re: Using ATLSIP in Win32 C++ Application - Call Back Functions like OnLogSIPMessage()
{quote:title=sam wrote:}{quote}
Thanks. When using same link option () for application an OpenSIPStack the program can be linked successfully.

An other problem occurs. OpenSIPStack seem to deal with its own process class. It seems not to work when the win32 application has its own WinMain() entry point where the Application process is started.

You need to instantiate PProcess prior to any calls to opensipstack objects even if its only a dummy. In ATLSIP for example I have the following code to do this

PDECLARE_PROCESS( DummyPProcess, PProcess,"ATLSIP","ActiveSIPControl",MAJOR_VERSION,MINOR_VERSION,BUILD_TYPE,BUILD_NUMBER)
static DummyPProcess * process = new DummyPProcess();  // active for the life of the DLL
void DummyPProcess::Main(){};