Subject: [E3-hacking] [PATCH] chan_alsa: fix channel signalling

From: Janusz Krzysztofik <[email-masked]>
Date: Tue, 18 Aug 2009 19:47:01 +0200

Hi,

I am one of those probably few Asterisk users who decided to give it a try as
a soft phone. I have installed it on my ARM/OMAP based Amstrad E3 (Delta)
videophone and get quite good results. For now I use 1.4.26, since I was not
yet able to build 1.6 with OpenEmbedded.

My sound driver is ALSA, so I started with chan_alsa. It's behaviour was not
very bad, but there were random problems with incorrect signalling, not
acceptable for a common user.

After switching to chan_oss, I found that during some operations it was
consuming all processor power. So it appeared not to be an option either.

I got back to chan_alsa, investigated the problem and found a solution that
works for me. In fact, I have followed corresponding bits from chan_oss to get
it working.

Created and tested against asterisk-1.4.26.

Signed-off-by: Janusz Krzysztofik <[email-masked]>

---
--- asterisk-1.4.26/channels/chan_alsa.c.orig	2009-03-18 03:09:13.000000000 +0100
+++ asterisk-1.4.26/channels/chan_alsa.c	2009-08-14 23:09:04.000000000 +0200
@@ -750,7 +750,7 @@ static int alsa_fixup(struct ast_channel
 
 static int alsa_indicate(struct ast_channel *chan, int cond, const void *data, size_t datalen)
 {
-	int res = 0;
+	int res = -1;
 
 	ast_mutex_lock(&alsalock);
 
@@ -763,6 +763,7 @@ static int alsa_indicate(struct ast_chan
 		break;
 	case AST_CONTROL_RINGING:
 	case AST_CONTROL_PROGRESS:
+		res = 0;
 		break;
 	case -1:
 		res = -1;