conference call - deadlock??

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

 



hello

I want create conference call with conference bridge and i want connect
conference ports in callback "on_call_media_state" because i think this is 
best point where i can do this. or exist better point?

Therefore i need know if member "remote_info" in struct "pjsua_call_info" 
(pjsua_call_info::remote_info) have same value as argument "dst_uri" in metod 
"pjsua_call_make_call" because i can't use call ID for this:

I get call ID after calling method "pjsua_call_make_call". But after calling 
this method in other thread is calling callback "on_call_media_state" and if i 
want be thread safe i have to use mutex for method "on_call_media_state" where 
i check if call ID belong to conference...(not every call must be in 
conference) and second point where i have to use mutex is in loop where i 
calling method "pjsua_call_make_call" where i insert each call ID to "my" 
conference list (it's vector)..and other mutex where i delete conference..but 
this is not essential for this purpose...

here is pseudo-code for better understanding:

//uri_vector contains all uri for conference call
CreateConfCall( uri_vector )
{

   //cycle through all uri's
  mutex.lock()
  for () {
	id = pjsua_call_make_call( uri )
	my_vector_conf_call.push_back( id )
  }
  mutex.unlock()
}

i can't do this
for () {
	id = pjsua_call_make_call( uri )
	mutex.lock()
	my_vector_conf_call.push_back( )
	mutex.unlock()
}
because if "on_call_media_state" occured first call ID will not be in my vector 
and method which check if call belong to conference call return false...
then call will be not connect to conference..


on_call_media_state( call_id)
{
	ci = pjsua_call_get_info( call_id )

	//check if media is active
	if (ci.media_status == PJSUA_CALL_MEDIA_ACTIVE) {

		 mutex.lock()

			//check if this call belong to conference call
			if (Check( call_id) == true ) {

				//connect to all active call
				//cycle through all active calls which belong to conference
				for() {
					pj_sua_conf_connect();
				}
			}

		 mutex.unlock()
	}
}


As you see deadlock occured when i second time call "pjsua_call_make_call" and 
other thread is waiting on mutex in "on_call_media_state" method.
i suppose this deadlock occured somewhere in pjsua library where is mutex  for 
"pjsua_call_make_call" thread and  for "on_call_media_state" thread.

Therefore i want know if member "remote_info" in struct "pjsua_call_info" 
(pjsua_call_info::remote_info) have same value as argument "dst_uri" in metod 
"pjsua_call_make_call". Then i can insert all calls to my vector before 
calling "pjsua_call_make_call" method...


thanks





















-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20100330/a109ef47/attachment-0001.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