Hello All, I noticed in one of your previous reply (below), you recommend delaying 500 milliseconds between mulitiple registrations. Why is this necessary?
I'm asking this because nua_create() is failing in the following scenario: 1) nua_create() (port 5061) 2) Register Line 3) Unregister Line 4) Shutdown Line 5) nua_create() (port 5061) .......... nua_create() returns zero................ 6) Re-register Line However, if I place a 500 millisecond delay between steps 4 and 5, then the process completes succesfully. Best Regards, Jerry -----Original Message----- From: Pekka Pessi [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 08, 2007 5:11 AM To: Jerry Richards Cc: sofia-sip-devel@lists.sourceforge.net Subject: Re: [Sofia-sip-devel] More On Multiple UAs In One Device 2007/5/7, Jerry Richards <[EMAIL PROTECTED]>: > I think I must be doing something wrong when attempting to create/register > multiple UAs. I am trying to register multiple UAs, but only the first UA > registers successfully. According to my Ethereal trace, the second UA does > not send the REGISTER message. It appears to me that the su_root_run() > might not be handling (or aware of the second UA)? The su_root_run() handles only the stuff inside one process. Just create all your nua objects in a single process and after that call su_root_run(). Perhaps you could also delay calling nua_register() for each UA with su_timer_t so all the UAs do not try to register themselves at the same time. Write a function calling nua_register(), give it to su_timer_create() with a pointer to a struct with a pointer to nua object and related data, then call su_timer_set() with suitable delay (give 500 milliseconds between registrations). If your media handling works better with separate processes, I think you have to fork before calling su_create_root(). You could also have a master process that wait()s for its children to die (and launches again all the failed kids, perhaps also with some kind of delay between fork()s and checks for a child process dying repeatedly.) --Pekka > Here is the sequence of calls to the sofia-sip APIs: > > 1. su_init(); > 2. su_home_init(appl->home); > 3. appl->root = su_create_root(NULL); > 4. su_root_threading(appl->root, 0); > 5. appl->nua[mk] = nua_create(appl->root, > ce_SipEventCb, > (nua_magic_t *)&mkData[mk], > NUTAG_URL("sip:192.168.72.191:5061"), > TAG_END()); > 6. handle = nua_handle(appl->nua[mk], > (nua_magic_t *)&mkData[mk], > NUTAG_URL("sip:[EMAIL PROTECTED]:5060"), > TAG_END()); > 7. nua_register(handle, TAG_NULL()); > 8. Here I fork a new process that calls su_root_run(appl->root) in an > infinite while loop. > 9. su_root_threading(appl->root, 0); > 10. appl->nua[mk] = nua_create(appl->root, > ce_SipEventCb, > (nua_magic_t *)&mkData[mk], > NUTAG_URL("sip:192.168.72.191:5062"), > TAG_END()); > 11. handle = nua_handle(appl->nua[mk], > (nua_magic_t *)&mkData[mk], > NUTAG_URL("sip:[EMAIL PROTECTED]:5060"), > TAG_END()); > 12. nua_register(handle, TAG_NULL()); > > The first UA is reflected in steps 4 - 7, above. The second UA is reflected > in steps 9 - 12, above. > > Below are the DEBUG logs from the sofia SIP stack for the second UA only: > > nua: nua_create: entering > incref(0x1001f020) by su_task_copy > incref(0x1001f020) by su_clone_start > incref(0x1001f020) by su_clone_start > 1024 at su_msg_create locking(0x1001f020)... ...1024 at su_msg_create > locked(0x1001f020)... ...1024 at su_msg_create unlocked(0x1001 > f020) > incref(0x1001f020) by su_msg_create > incref(0x1001f020) by su_msg_create > nua: nua_stack_init: entering > incref(0x1001f020) by su_task_copy > nua: nua_stack_set_params: entering > soa_create("default", 0x10022e20, 0x10025208) called > soa_set_params(static::0x10025558, ...) called > nta_agent_create: initialized hash tables > nta_agent_create: initialized transports > nta_agent_create: initialized random identifiers > incref(0x1001f020) by su_task_copy > nta_agent_create: initialized timer > incref(0x1001f020) by su_task_copy > nta_agent_create: initialized resolver > tport_create(): 0x100267e8 > incref(0x1001f020) by su_task_copy > nta: master transport created > tport_bind_server(0x100267e8) to */192.168.72.191:5062/sip > tport_bind_server(0x100267e8): calling tport_listen for udp > tport_alloc_primary(0x100267e8): new primary tport 0x10026be0 > tport_listen(0x10026be0): listening at udp/192.168.72.191:5062/sip > tport_bind_server(0x100267e8): calling tport_listen for tcp > tport_alloc_primary(0x100267e8): new primary tport 0x10026e78 > tport_listen(0x10026e78): listening at tcp/192.168.72.191:5062/sip > nta: bound to (192.168.72.191:5062;transport=*) > nta: agent_init_via: SIP/2.0/udp 192.168.72.191:5062 (sip) > nta: agent_init_via: SIP/2.0/tcp 192.168.72.191:5062 (sip) > nta: Via fields initialized > nta: Contact header created > nua_register: Adding contact URL '192.168.72.191' to list. > incref(0x1001f020) by su_task_copy > nua: nh_create_handle: entering > Returned from nua_handle(): handle=0x100274f0... > ce_AddLine: nua_handle for MK2 SUCCESS > nua: nua_register: entering > 1024 at su_msg_create locking(0x1001f020)... ...1024 at su_msg_create > locked(0x1001f020)... ...1024 at su_msg_create unlocked(0x1001 > f020) > incref(0x1001f020) by su_msg_create > 1024 at su_port_send locking(0x1001f020)... ...1024 at su_port_send > locked(0x1001f020)... ...1024 at su_port_send unlocked(0x1001f02 > 0) > nta: timer K fired, terminate REGISTER (9624888) > outgoing_reclaim_all((nil), (nil), 0x7f7ffb78) > nta_outgoing_timer: 0/0 resent, 0/0 tout, 1/1 term, 1/1 free > > Best Regards, > Jerry > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Sofia-sip-devel mailing list > Sofia-sip-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel > -- Pekka.Pessi mail at nokia.com ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Sofia-sip-devel mailing list Sofia-sip-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel