[pjsip] How to do a periodic check?

Markus Vechiorno finalpfc at hotmail.com
Tue Apr 1 10:02:23 EDT 2008


Benny yesterday you told me:
> You can use pjsip_endpt_schedule_timer() to schedule a timer.
 
I has been trying to understand this function and how to use it bu I can´t make ir work fine. I use:
 
pjsip_endpt_schedule_timer (pjsua_get_pjsip_endpt(),         my_timer_entry,         my_timer); 
 
- The first argument of this function is the pjsip endpoint. So, I think "pjsua_get_pjsip_endpt()" is right here. Isn't it?
 
- The second argument must be a timer_entry pointer, so I define: 
                  struct pj_timer_entry* my_timer_entry;
                  my_timer_entry->id = 1;                  my_timer_entry->cb = &funcion_aux;                  my_timer_entry->_timer_value = my_timer_2; //I don't know the objective of this timer.
 
  Where :
                  struct pj_time_val my_timer_2;
                  my_timer_2.sec = 5; my_timer_2.msec=0;
                  
                  static void funcion_aux( pj_timer_heap_t *timer_heap,                         struct pj_timer_entry *entry)                       {                        PJ_UNUSED_ARG(timer_heap);                        PJ_UNUSED_ARG(entry);                        puts("MINE ----> Periodic call");                       }                  
  Is this right for the second argument?
 
- The third argument must be a time_val pointer, so I use:
                  struct pj_time_val* my_timer;                  my_timer->sec=5; my_timer->msec=0;
 
I don't know why it doesn't work. I think this code should make my application to show the message "MINE---> Periodic call" every 5 seconds but it doesn't do it.
 
Where am I wrong?
 
Thanks a lot, and sorry for the large mail.
 
 
 > Date: Mon, 31 Mar 2008 10:27:18 +0100> From: bennylp at pjsip.org> To: pjsip at lists.pjsip.org> Subject: Re: [pjsip] How to do a periodic check?> > On Mon, Mar 31, 2008 at 10:01 AM, Markus Vechiorno <finalpfc at hotmail.com> wrote:> > Hi,> >> > I want to make a check of some parameters every x seconds (periodically).> > Is there a way to call to a function periodically?> > I can use the functions implemented in "dq" in pjsua because what I need is> > to check the packet loss rate.> >> > I saw smth about pjmedia clock, but I need to know how to control it.> >> > For example, if I want to call pjsua_call_dump ecery 2 seconds what could> > be the way?> > You can use pjsip_endpt_schedule_timer() to schedule a timer. The> pjmedia clock probably is too heavy for this since it creates a worker> thread with real-time priority to wait for the timer (although you can> disable the priority boost). But you can use that, just set> samples_per_frame to N*clock_rate if you want the callback to be> called once every N seconds.> > Cheers> Benny> 
_________________________________________________________________
La vida de los famosos al desnudo en MSN Entretenimiento
http://entretenimiento.es.msn.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080401/4470a8b9/attachment.html>


More information about the pjsip mailing list