PJSIP multi-thread

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

 



Hello,

I'm creating a automated call machine using PJSIP. For callbacks
treatment, I try to use another thread. But when I call a pjsip function
from this thread, my app crashes.

The threaded function is this one:

static void *destroy_players(void *args)
{
	void *msg;
	pj_thread_t *pj_thread;
	pj_thread_desc desc;
	pj_status_t status;
	status = pj_thread_register("Destroy thread", desc, &pj_thread);
	if(status == PJ_SUCCESS){
		printf("********************************Registration succeed\n");
	} else {
		printf("********************************Registration failed\n");
	}
	while(1)
	{
		sem_wait(&wait_destroy_player);
		//Remove the message from a queue
		remove_element(msg);
    	struct pjsua_player_eof_data *eof_data = (struct
pjsua_player_eof_data *)msg;
		status = pjsua_call_hangup(eof_data->call_id, 0, NULL, NULL);
    	status = pjsua_player_destroy(eof_data->player_id);

    	pj_pool_release(eof_data->pool);
	}
}

Did I forget something? Did I need to do somthing before creating the
thread? I'm creating the thread with the pthread API.

Regards,
Luis Domingues




[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