[Asterisk-Dev] Newbie question about thread blocking/choppy sound in meetme

Steve Edwards asterisk.org at sedwards.com
Mon Aug 8 12:51:57 MST 2005


This is my first foray into making changes to the sources, so if the question 
or solution is obvious, please be kind :)

I want to change the enter and leave sounds to files that can be specified in 
the conf file. Further, I only want the files played to users with the admin 
bit set.

I've hacked up conf_play() so that it is somewhat working, but I'm getting a 
bunch of WARNING messages that tell me I need to understand what is happening a 
bit better. Also, the resulting sound is very choppy.

The messages are:

Aug  8 12:17:41 WARNING[22766]: channel.c:1901 ast_write: Thread
139276 Blocking 'SIP/super1-93e9', already blocked by thread 90123 in
procedure ast_waitfor_nandfds
     -- Playing 'group/grpbegin' (language 'en')
Aug  8 12:17:41 WARNING[22747]: channel.c:1901 ast_write: Thread 90123
Blocking 'SIP/super1-93e9', already blocked by thread 139276 in
procedure ast_waitfor_nandfds
Aug  8 12:17:41 WARNING[22747]: channel.c:1251 ast_waitfor_nandfds:
Thread 90123 Blocking 'SIP/super1-93e9', already blocked by thread
90123 in procedure ast_waitfor_nandfds
Aug  8 12:17:42 WARNING[22747]: channel.c:1251 ast_waitfor_nandfds:
Thread 90123 Blocking 'SIP/super1-93e9', already blocked by thread
90123 in procedure ast_waitfor_nandfds
Aug  8 12:17:42 WARNING[22747]: channel.c:1901 ast_write: Thread 90123
Blocking 'SIP/super1-93e9', already blocked by thread 139276 in
procedure ast_waitfor_nandfds
Aug  8 12:17:42 WARNING[22747]: channel.c:1251 ast_waitfor_nandfds:
Thread 90123 Blocking 'SIP/super1-93e9', already blocked by thread
90123 in procedure ast_waitfor_nandfds
Aug  8 12:17:42 WARNING[22766]: channel.c:1251 ast_waitfor_nandfds:
Thread 139276 Blocking 'SIP/super1-93e9', already blocked by thread
139276 in procedure ast_waitfor_nandfds
Aug  8 12:17:42 WARNING[22747]: channel.c:1251 ast_waitfor_nandfds:
Thread 90123 Blocking 'SIP/super1-93e9', already blocked by thread
90123 in procedure ast_waitfor_nandfds
Aug  8 12:17:42 WARNING[22747]: channel.c:1251 ast_waitfor_nandfds:
Thread 90123 Blocking 'SIP/super1-93e9', already blocked by thread
90123 in procedure ast_waitfor_nandfds
Aug  8 12:17:42 WARNING[22747]: channel.c:1901 ast_write: Thread 90123
Blocking 'SIP/super1-93e9', already blocked by thread 139276 in
procedure ast_waitfor_nandfds
Aug  8 12:17:42 WARNING[22747]: channel.c:1251 ast_waitfor_nandfds:
Thread 90123 Blocking 'SIP/super1-93e9', already blocked by thread
139276 in procedure ast_waitfor_nandfds
Aug  8 12:17:42 NOTICE[22766]: channel.c:1545 ast_read: No/unknown
event '0' on timer for 'SIP/super1-93e9'?

This is what my code looks like:

static void conf_play(struct ast_channel *chan, struct ast_conference *conf, 
int sound)
{
 	unsigned char *data;
 	int len;
 	int res=-1;

 	auto	struct ast_conf_user	*user_pointer;
 	auto	char			filename[256];

 	if (!chan->_softhangup)
 		res = ast_autoservice_start(chan);
 	ast_mutex_lock(&conflock);

// default to leave
 	strcpy(filename, "group/leave");
 	if	(ENTER == sound)
 		{
 		strcpy(filename, "group/grpbegin");
 		}

// look for admins
 	for	(user_pointer = conf->firstuser
 		; user_pointer
 		; user_pointer = user_pointer->nextuser)
 		{
 		if	(CONFFLAG_ADMIN & user_pointer->userflags)
 			{
// play the file
 			ast_stopstream(user_pointer->chan);
 			res = ast_streamfile(
 				  user_pointer->chan
 				, filename
 				, user_pointer->chan->language
 				);
 			res = ast_waitstream(user_pointer->chan
 				, AST_DIGIT_ANY
 				);
 			ast_stopstream(user_pointer->chan);
 			}
 		}

 	ast_mutex_unlock(&conflock);
 	if (!res)
 		ast_autoservice_stop(chan);
}

Any clues or suggestions will be greatly appreciated.

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline           pagesteve at sedwards.com            Fax: +1-760-731-3000



More information about the asterisk-dev mailing list