[SIP Beyond VoIP] Embedding sipsimple in a MacOS application

Mihai Richard mihai.richard at softvision.ro
Fri Nov 11 19:14:47 CET 2011


I¹m running the sipsimple engine inside a MacOS application in a similar
manner to what Blink is doing except that this application has much of the
driving code written in objective-c unlike Blink client who has little C
code(used only for initialization). The problem that I¹m experiencing is
more of  a Python embedding in C rather than a sipsimple problem but I
believe that you still may be able to answer/give me a hint.

So...problem is something like this. If I start the application¹s event loop
using the NSApplicationMain() function and initalize sipsimple objects using
the PyRun_SimpleString() I do not receive the SIPApplicationWillStart,
DidStart, etc or any other notification from the NotificationCenter. On the
other hand if I start the event loop using
PyRun_SimpleString(³AppHelper.runEventLoop(argv=[])²) than I am able to
receive all the notifications and sipsimple seems to work. However the
PyRun_SimpleString() call does not exit since it holds the event loop and
another call of PyRun_SimpleString inside this call of the same function
crashes the application. I have tried changing PyRun_SimpleString with
PyEval_CallObject() but I get the same results, application crashes for
nested calls.

My question is how could I make sipsimple objects(from python code) receive
notifications from NotificationCenter and have the main loop started using
NSApplicationMain()(to avoid nested python embedding in c API calls)?

The python code that uses the sipsimple API works fine if it is run in the
interpretor, not embedded in a C application.

Thank you,
Mihai Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ag-projects.com/pipermail/sipbeyondvoip/attachments/20111111/7ce5bfbb/attachment.html>

More information about the SIPBeyondVoIP mailing list