Good day,

I'm doing some personal research on developing for the iPhone and I've
been using Sofia to create a basic SIP UA for the iPhone.

I have a static Sofia SIP library compiled for the iPhone simulator and
my app successfully registers with a SIP server and I can receive SIP
MESSAGEs as shown by the debugger console for the simulator.  Everything
works as expected if I don't interact with the iPhone GUI.  I have a
button that will send a REGISTER to my SIP server and I can use the
sofsip_cli to connect to the same SIP server and send the iPhone UA SIP
MESSAGEs and I see them show up in the console.  The nua_i_message
callback fires just fine.

I seem to be having a problem with pop up alerts though on the iPhone
simulator and I don't know whether it's a threading problem, a timer
problem with Sofia, or some other problem related to the iPhone and was
wondering if someone could provide some assistance.

Once I add code in the event_callback function to show a UIAlertView
(basically a pop-up dialog on the iPhone), the dialog displays once and
once I click OK it disappears, however subsequent nua_i_message events
timeout with:

nta: timer J fired, terminate 200 response.

Am I missing something with threading?  My su_root_t runs in a POSIX
thread that I created when the application launched.  I'm using a
singleton object that has a pointer to a root as a property to be able
to pass the root object around (maybe not the RightThing to do?).
Here's some pseudo-code for how I run it in
applicationDidFinishLaunching (run after main() runs):

AppSingleton *myapp;
su_init()
su_home_t *tmp
tmp = su_home_new()
myapp->home = tmp;
su_home_init(myapp->home)
myapp->root = su_root_osx_runloop_create(*myapp)
nua_create(...)
su_root_release(myapp->root)
pthread_create(thread,NULL,root_thread,NULL)

void root_thread() {
  AppSingleton *myapp;
  su_root_obtain(myapp->root);
  su_root_osx_prepare_run(myapp->root);
  while (1) {
    su_root_run(myapp->root)
  }
  su_root_release)(myapp->root)
}

I'm thinking my problem is either with the UIAlertView and/or me not
understanding how I should be handle the threading of the root object.

This code is my first experience with pthreads so I'm probably doing
something wrong (maybe need mutexes?).

I'm going to post this question to the Apple Developer Forums as well
because I don't know where to go from here.

If anyone has more questions, please let me know.

Thanks for your help,
Andy.

Confidentiality Notice: This e-mail message including attachments, if any, is 
intended only for the person or entity to which it is addressed and may contain 
confidential and/or privileged material. Any unauthorized review, use, 
disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply e-mail and destroy all copies of 
the original message. If you are the intended recipient, but do not wish to 
receive communications through this medium, please so advise the sender 
immediately.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to