How to do a periodic check?

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

 



Try to declare the second argument 'pj_timer_entry entry' in a global scope.

  ----- Original Message ----- 
  From: Markus Vechiorno 
  To: pjsip list 
  Sent: Tuesday, April 01, 2008 10:02 PM
  Subject: Re: How to do a periodic check?


  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@xxxxxxxxx
  > To: pjsip at lists.pjsip.org
  > Subject: Re: 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
  > 



------------------------------------------------------------------------------
  Sigue los principales acontecimientos deportivos en directo. MSN Motor 


------------------------------------------------------------------------------


  _______________________________________________
  Visit our blog: http://blog.pjsip.org

  pjsip mailing list
  pjsip at lists.pjsip.org
  http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080401/d3ba4a93/attachment.html 


[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