[Asterisk-java-users] Problems with concurrent java-threads answering incoming calls
Brought to you by:
srt
From: Johan S. <js...@sv...> - 2008-02-14 12:44:42
|
Hi dear users and experts J What about my problem, any clever ideas? I've got 10 phonelines with incoming calls, and DTMF-tones are coming too on these lines. I've written an answering AGI-javaprogram, to service() each call in parallel. Example of what happens during one call: Call 1 - answered by my java-class(via AGI-call), I'm sending some DTMF-tones to the caller (via my AsteriskChannel and obj.playDtmf)and I will shortly then receive a sequence of DTMF-tones as the answer from the caller. (using agiChannel.waitForDigit(waitDelay)) What happens is, when many channels are in progress simultaneously sending DTMF, and listening for DTMF-responses, each thread will not run often enough to get all incoming DTMF-tones. It could take like 10 seconds (looking at my log) before one thread sent the DTMF-question, till it calls the get-DTMF()-command, but then it's too late. The delay seems to be all other threads executing in between. It's the same situation for every Thread. I wonder, why is not every thread being switched more often? Like once every millisecond? It's more like once every second here. Surely something must be wrong... I must be a very bad programmer... J With just one CPU, multithreaded tasks need to switch thread very quick, to work. What have I done wrong? Help, opinions are appreciated. Sincerely, Johan __________________________________________________________________ Johan Sandgren Svep Design Center AB (www.svep.se<http://www.svep.se>) St. Lars väg 42A, SE-222 70 Lund Phone: 046-19 27 22 |