Incoming events not received on ioqueue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I am trying to use pjSIP version 1.3 on Windows XP. The application I
have is multithreaded, and pjSIP is attached to the thread that
handles SIP communication. The application directly invokes core pjsip
APIs, and does not use pjsua-lib. The stack is initialized fine and I
am able to see SIP messages being sent out and responses received. My
problem is that incoming events are not received after a few seconds
of inactivity. I need to send some outgoing message, to be able to
receive the incoming event. Is there a way to leave the stack running
and receive incoming events even when there is no activity on the
client?

The thread function for the SIP communication thread periodically
calls the following function  to poll for incoming events. The rest of
the time the thread is listening for events from other threads and
processing those requests.
---------------------------
// Event listener on the pjSIP stack. This is just a wrapper for the
// pjsip_handle_events to listen for incoming SIP messages/events .
static void flush_pjsip_events(void * arg)
{
   pjsip_endpoint* endpt = static_cast<pjsip_endpoint *>(arg);

   if (!pj_thread_is_registered())
   {
       pj_status_t rc = PJ_SUCCESS;

       /* Test that pj_thread_register() works. */
       pj_thread_desc desc;
       pj_thread_t *this_thread;
       pj_bzero(desc, sizeof(desc));

       LogDebug("Register thread with sip stack");
       rc = pj_thread_register("thread", desc, &this_thread);
       if (rc != PJ_SUCCESS)
       {
           LogError("Error occured in pj_thread_register" << rc);
       }
   }

   pj_time_val stop_time;

   pj_gettimeofday(&stop_time);
   stop_time.msec += 500;
   pj_time_val_normalize(&stop_time);

   /* Process all events for the specified duration. */
   for (;;) {
       pj_time_val timeout = {0, 1}, now;

     pjsip_endpt_handle_events(endpt, &timeout);

       pj_gettimeofday(&now);
       if (PJ_TIME_VAL_GTE(now, stop_time))
           break;
   }
}
-----------------------------------

Could someone indicate what may be going wrong here, and how the same
can be fixed?

Thanks,
Sanghamitra.

-- 
Sanghamitra Bhattacharya
858.539.3561 (M)

sanghamitra.bhattacharya at gmail.com



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux