Threading on pjsua, or just timer

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

 



Hi,

Use something like this:

pj_time_val timeDelay;
pj_timer_entry timerEntry;

timeDelay.sec=5;
timeDelay.msec=0;
	
//initialize timer
pj_timer_entry_init(&timerEntry, 0, NULL, &timerCallback);

//set timer
pjsip_endpt_schedule_timer(pjsua_get_pjsip_endpt(), &timerEntry,
&timeDelay);


//timer operation
static void timerCallback(pj_timer_heap_t *timer_heap, pj_timer_entry
*entry)
{
    PJ_UNUSED_ARG(timer_heap);

	//some action

	//cancel timer
	pjsip_endpt_cancel_timer(pjsua_get_pjsip_endpt(), entry);
	//or start all over again
        //pjsip_endpt_schedule_timer(pjsua_get_pjsip_endpt(), entry,
        //&timeDelay);
}




Dnia 25 marca 2012 15:26 Andrzej Grzelak <andrew8666 at gmail.com> napisa?(a):

> I'm using sample pjsua code, and i need to do some threading or just
> set timer on action... Here is code:
> 
> /* Callback called by the library when call's state has changed */
> static void on_call_state(pjsua_call_id call_id, pjsip_event *e)
> {
>     pjsua_call_info ci;
> 
>     PJ_UNUSED_ARG(e);
>     pjsua_call_get_info(call_id, &ci);
>     PJ_LOG(2,(THIS_FILE, "Call %d state=%.*s", call_id,
> 			 (int)ci.state_text.slen,
> 			 ci.state_text.ptr));
> 	if(ci.state == PJSIP_INV_STATE_EARLY){
> 			//
> 			//
> 			//after 5 secs hangup call
> 			//
> 			//
> 	}
> 	if(ci.state == PJSIP_INV_STATE_DISCONNECTED ){
> 		PJ_LOG(2,(THIS_FILE, "Call %d reason: =%.*s (%d)", call_id,
> 			(int)ci.last_status_text.slen,
> 			 ci.last_status_text.ptr,
> 			 (int)ci.last_status));
> 	}
> }
> 
> 
> Can someone help me, and give just hints how to do it?
> 
> _______________________________________________
> 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
> 



[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