[SIP Beyond VoIP] Embedding sipsimple in a MacOS application

Saúl Ibarra Corretgé saul at ag-projects.com
Mon Nov 14 18:36:03 CET 2011


On Nov 14, 2011, at 3:33 PM, Mihai Richard wrote:

> Hello,
> I have an update regarding the problem I'm experiencing.
> I managed to get the SIP SIMPLE engine going and I receive notifications and
> I also managed to register to the sip server. What I did is added a dummy
> function to the SIPManager class(in python) and made it run on twisted
> thread using that decorator and from the C++ code I call that periodically,
> every few milliseconds.
> However this is not a solution since registration takes longer than running
> the code from the interpreter in terminal and there must be another solution
> to make the SIP SIMPLE event loop work.
> So the question is the same from my previous email: how do I make the SIP
> SIMPLE engine run on twisted thread?

I'm not sure about how different it is to start the GUI event loop from C++ that it is to do it from Python as we do it, but SIP SIMPLE already runs in a different thread. You can check sipsimple/application.py, there is a function called _run_reactor which will run the Twisted reactor on a new Python thread.

Since you are running code on ObjC maybe you need to spawn a new thread where the Python interpreter is run, but I'm not sure since I haven't done that before...  Seems to me that when you run the Python interpreter in the ObjC code it's executed on the main thread, so that probably gets on your way. In our case we launch the event loop from Python, that's why we don't run into such issues.

I may be wrong, but give that option a chance :-)


Saúl Ibarra Corretgé
AG Projects

More information about the SIPBeyondVoIP mailing list