Velthoen, Arie
2007-07-23 15:40:27 UTC
Hi all,
I am working on an application based on simple_pjsua.c.that plays
announcements.
The application answers a call, plays a wav-file, and at end of the
wav-file it hangs-up the call.
However when handling more than one call simultaneously it runs into a
deadlock.
Can you give me some guidance how to use the wav-player-EOF callback
(set with
pjmedia_wav_player_set_eof_cb) without the risk of running into a
deadlock?
Details are as follows:
With pjmedia_wav_player_set_eof_cb callback AnnouncementStopped has been
registered.
At EOF AnnouncementStopped is called which calls
- pjsua_player_destroy
- pjsua_call_hangup.
Now when I use PJSUA to make SIP-calls to this announcement-application
with 2 (or more) calls simultaneously, a deadlock occurs when
- Call 0: 200-OK response is received on the BYE, handled by thread
pjsua
- Call 1: EOF is reached, handled by thread clock.
Thread pjsua (handling the 200-OK response on BYE for call 0), has mutex
"pjsua",
but remains waiting for mutex "conf" with the following call stack:
- pjmedia_conf_remove_port
- call_destroy_media
- pjsua_call_on_state_changed
- inv_set_state
- inv_handle_bye_response
- inv_on_state_confirmed
- mod_inv_on_tsx_state
- pjsip_dlg_on_tsx_state
- mod_ua_on_tsx_state
- tsx_set_state
- tsx_on_state_proceeding_uac
- tsx_on_state_calling
- pjsip_tsx_recv_msg
- mod_tsx_layer_on_rx_response
- endpt_on_rx_msg
- pjsip_tpmgr_receive_packet
- on_read_complete
- ioqueue_dispatch_read_event
- pj_ioqueue_poll
- pjsip_endpt_handle_events2
- pjsua_handle_events
- worker_thread
- thread_main
Thread clock (handling the EOF for call 1) has mutex "conf", but remains
waiting for mutex "pjsua" with the following call stack:
- acquire_call
- pjsua_call_hangup
- AnnouncementStopped
- fill_buffer
- file_get_frame
- pjmedia_port_get_frame
- read_port
- get_frame
- pjmedia_port_get_frame
- clock_callback
- clock_thread
- thread_main
Best regards,
Arie Velthoen
I am working on an application based on simple_pjsua.c.that plays
announcements.
The application answers a call, plays a wav-file, and at end of the
wav-file it hangs-up the call.
However when handling more than one call simultaneously it runs into a
deadlock.
Can you give me some guidance how to use the wav-player-EOF callback
(set with
pjmedia_wav_player_set_eof_cb) without the risk of running into a
deadlock?
Details are as follows:
With pjmedia_wav_player_set_eof_cb callback AnnouncementStopped has been
registered.
At EOF AnnouncementStopped is called which calls
- pjsua_player_destroy
- pjsua_call_hangup.
Now when I use PJSUA to make SIP-calls to this announcement-application
with 2 (or more) calls simultaneously, a deadlock occurs when
- Call 0: 200-OK response is received on the BYE, handled by thread
pjsua
- Call 1: EOF is reached, handled by thread clock.
Thread pjsua (handling the 200-OK response on BYE for call 0), has mutex
"pjsua",
but remains waiting for mutex "conf" with the following call stack:
- pjmedia_conf_remove_port
- call_destroy_media
- pjsua_call_on_state_changed
- inv_set_state
- inv_handle_bye_response
- inv_on_state_confirmed
- mod_inv_on_tsx_state
- pjsip_dlg_on_tsx_state
- mod_ua_on_tsx_state
- tsx_set_state
- tsx_on_state_proceeding_uac
- tsx_on_state_calling
- pjsip_tsx_recv_msg
- mod_tsx_layer_on_rx_response
- endpt_on_rx_msg
- pjsip_tpmgr_receive_packet
- on_read_complete
- ioqueue_dispatch_read_event
- pj_ioqueue_poll
- pjsip_endpt_handle_events2
- pjsua_handle_events
- worker_thread
- thread_main
Thread clock (handling the EOF for call 1) has mutex "conf", but remains
waiting for mutex "pjsua" with the following call stack:
- acquire_call
- pjsua_call_hangup
- AnnouncementStopped
- fill_buffer
- file_get_frame
- pjmedia_port_get_frame
- read_port
- get_frame
- pjmedia_port_get_frame
- clock_callback
- clock_thread
- thread_main
Best regards,
Arie Velthoen