Because you have configured the conference bridge to record?
Most probably, these two threads ( mixmonitor & my own recording module ) are in deadlock state… Because, I use channel while making vox disabled call recording. And there is no problem in that scenario …
According to the link you provided above, I re-compiled and re-started Asterisk after changing compiler flags as required. But the problem is that ;
I can not apply my scenario, and can not make call any call. When I start the call, asterisks ends itself… @jcolp, Do you have any idea about it ?
I narrowed the area where deadlock has occured. There is a method which created rtsp_session before sending voice to the servers.
AST_LIST_HEAD_STATIC(seslist, rtsp_session);
AST_LIST_LOCK(&seslist);
if (!AST_LIST_EMPTY(&seslist)) {
FD_ZERO(&fdsr);
FD_ZERO(&fdsw);
AST_LIST_TRAVERSE(&seslist, s, list) {
//There are socket specific codes here
}
}
}
AST_LIST_UNLOCK(&seslist);
When I remove the AST_LIST_LOCK, AST_LIST_UNLOCK while making call via Confbridge, there is no deadlock problem… But, If I remove these declarations, there can be other type of problems. Is there anything wrong about the usage of these methods ?
There is nothing inherently wrong with that. It likely depends on other usage and code in your custom module.
Hi @jcolp,
As I guess at the beginning, the problem is clearly because of AMI Hook which I used to watch talking status. Here is the ami hook impl ;
static int amihook_helper(int category, const char *event, char *content)
{
ast_log(LOG_DEBUG, " AMI Event: \nCategory: %d Event: %s\n%s\n", category, event, content);
char *found;
char *event_content = content;
const char *talking_status = "TalkingStatus";
char *result = strstr( event_content, talking_status );
//Check if the event content contains keyword we looking for.
found = strstr(event_content, talking_status);
struct rtsp_session *session;
struct ast_channel *chan = ast_channel_get_by_name(chan_uniqueid);
session = get_rtsp_session_by_name_locked(session_name);
if( found != NULL)
{
if (ast_channel_recording( chan ))
{
int position = 15;
char *substr = substring( found, position,4);
substr = trim_space( substr );
ast_log(LOG_DEBUG,"\n amihook_helper::substring=%s, length=%d, Session state=%d \n\n", substr, strlen(substr), session->state);
//Client is talking
if( !strcmp(substr, "on") )
{
//Start recordig
**ast_channel_recording( chan )->start(chan);**
}
//Client is NOT talking
else if( !strcmp(substr, "off") )
{
//Stop recording
**rtsp_pause( session );**
}
}
}
return 0;
}
When I catch the states of client talking/not talking, I start /stop recordings. This is the cause of problem. When I do not call methods which start/stop recordings, I can make calls recurrently… Although I detect the cause of non working case, nothing comes to mind to solve it… Do you have any suggestion ?
Just guessing based on things, but you retrieve an RTSP session and it is locked on return. I see nowhere in your hook that you unlock it, so the next time it would be used it would likely deadlock and go nowhere.