Summary:ASTERISK-03099: [patch] First digit lost or poorly played in SayDigit, mainly in spanish.
Reporter:lvazquez (lvazquez)Labels:
Date Opened:2004-12-27 09:58:49.000-0600Date Closed:2008-01-15 15:18:41.000-0600
Versions:Frequency of
Environment:Attachments:( 0) asterisk-say-nodigitslost.diff
( 1) asterisk-say-wait_nodigitlost.diff
( 2) pause.gsm
Description:When using SayDigit (or SayAlpha) to speel a number like "151" the first one is sometimes not clearly heard in english language and most of the time is allmost totally lost when using spanish language. The "5" and second "1" are heard perfectly. The same happens with SayNumber.


In order to fix it, I'm using an extra "sound" file called pause.gsm with only silence (or background comfort noise) approx 600ms long. This file is streamed before entering the loop of digits (or chars) streaming and someway lets the system reach stability before the first digit is played.
With this "hack" the SayDigit, SayAlpha and SayNumber applications works perfectly without first digit loose.
Comments:By: Clod Patry (junky) 2004-12-27 12:59:56.000-0600

Have you try to this:
exten => 3160,1,Answer();
exten => 3160,2,Wait(1);
exten => 3160,3,SayDigits(151);

you'll can heard you first 1 (one), really clearly.

and instead of pause.gsm. have you heard about silence files in asterisk-sounds package?

By: lvazquez (lvazquez) 2004-12-28 08:02:33.000-0600

Yes I have tried that and many other things (I'm not an asterisk newbie, working eight hours a day with this in a production environment since 10/2003).
Really, what I was using is something like this (to implement call forwarding in "no zap" channels).
exten => s,1,Wait(1)
exten => s,2,Playtones(425/100,0/200,425/100,0/200,425/100,0/1000)
exten => s,3,Wait(3)
exten => s,4,StopPlaytones()

;; SetCIDFromExtenis "custom" application to fix cid from db in sip clients
exten => _*751XX,1,SetCIDFromExten
exten => _*751XX,2,DBput(CFwdAll/${CALLERIDNUM}=${EXTEN:3})
exten => _*751XX,3,Answer()
exten => _*751XX,4,SetLanguage(es)
exten => _*751XX,5,Wait(1)
exten => _*751XX,6,SayNumber(${EXTEN:3})
exten => _*751XX,7,Macro(indication_confirm)
exten => _*751XX,8,Hangup

This "wait hack" fixed the problem for me in this case, but I submited the patch in order to try to help improve asterisk because I think applications like SayNumber (and SayDigit) should be independent and you shouldn't need to put waits everywear to hear what you are supposed to hear when you call the application.
One more point is that because of the granularity of Wait, when using the wait method you will "hear" a "silence hole" before the number. By playing a dummy "short background" audio stream approx. 500ms long (found by trial an error) before the first digit I'm able to hear the full number allways without any disturb.

Respect to your question "have you heard about silence files in asterisk-sounds package?":
No, I haven't heard about, and I haven't found any silence file even when I have searched under /var/lib/asterisk/sounds/:
# find . -name '*sil*'
# find . -name '*back*'
# find . -name '*paus*'
gives no output??? Could you give me a hint to find it among the more than 300 sound files?
In fact the name "silence.gsm" was the first I thought (and the one I'm using in my system) for this aux file, somehow when submiting the report I changed my mind to "pause.gsm" :|
Anyway, I guess the sound (or silence) file to use is not the point. In fact I'm sure there are many other methods to stabilize the application audio stream before streaming the first digit (that's the point), for example use something similar to a 500ms wait inside the application. I can try this If you find it better.

Best regards

By: Clod Patry (junky) 2004-12-28 09:53:08.000-0600

if you want to take a look on many silence files, you need to download asterisk-sounds package (cvs checkout asterisk-sounds).

And with respect, i work more then 8 hours/day with asterisk too. Many people in here do do that too. Isn't a question of finding a newbie or something, it's just trying the better way to improve asterisk.
You many many things to learn about asterisk, like me, and like everyone in asterisk world. Things are changing, everyone need to learn about all changes everywhere.

So take a look on these silence files and tell me what you think about all that.


By: lvazquez (lvazquez) 2004-12-28 11:39:24.000-0600

Hello junky
Unfortunately short and distant lines (more if not writen in your mother language) are very prone to misinterpretation.
I misinterpreted a sarcastic tone in you short initial message and you misinterpreted my intention in my response.
I didn't wanted to set me as an expert (I know I have a lot to learn about asterisk and I would like to be able to) and much more I didn't wanted to suggest anything about your asterisk knowledge or expertice.
My intention was only to give you the information that this is not "my first day with *" to clarify the level of the discusion we can have and that my intention was exactly as you said, find the "better way to improve asterisk", and not only bother with a dummy problem.
With that in mind, your second note is much more illustrative and constructive because you give me the information I didn't get from the first one.
I taked the care to download the last asterisk cvs before submiting, but asterisk-sounds is not something one downloads every week when you have a narrow band connections :(
Sorry by the misinterpretations ...  ;)
So lets work, comming back to the problem, I will take a look to your sounds of silence :) and by the while tell me what do you think of putting something like this before streaming the first digit in SayDigits, SayNumber, etc.

static int pausetime = 500;
ast_safe_sleep(chan, pausetime);

This would replicate the wait fixup but inside the applications so they will work OK without "external hacks".


By: Matthew Fredrickson (mattf) 2004-12-28 12:52:39.000-0600

BTW, are you having this problem on PRI-T1, or is it on lines that are provisioned for some other signalling type (e.g. fxoks, fxsks, e&m, etc)?

By: Tilghman Lesher (tilghman) 2004-12-28 13:41:48.000-0600

As an addendum to mattf, are you having these troubles at all with TDM phones or is this exclusive to VoIP phones?

By: lvazquez (lvazquez) 2004-12-28 14:32:07.000-0600

Hello  mattf and corydon,
This problem happens both with sip phones (gstream bt100 and planet vip150T) and with analog phones connected to TDM FXS modules.
Give me a couple of minutes (I must take out my patches) and I will check with  phones connected to a T100P through a CAC AB1 channel bank.

By: lvazquez (lvazquez) 2004-12-28 15:09:35.000-0600

Ok, I have checked carefully in the four technologies I'm using.
exten => 369,1,SetLanguage(es)
exten => 369,2,Answer()
exten => 369,3,SayNumber(151)
exten => 369,4,Hangup

For those who don't know spanish numbers, what I should hear is:
"ciento - cincuenta - y   -  uno "
 100.gsm - 50.gsm  - and.gsm - 1.gsm  

* SIP hardphones: The 100.gsm is allmost not heard. I basically hear:
"..mmm?" "cincuenta - y - uno"

* SIP softphone (KPhone): A little less delay so I'm able to hear something like:
" .mmnto - cincuena - y - uno "

* TDM FXS modules: even less delay, I hear:
"..iento - cincuenta - y - uno "
If the server is with no load, sometimes I even hear the full "ciento" even when the "c" is never clear

* FXS-channel bank-t100p: most of the time I hear the full "151", may be with the "c" a little shorter than it should be. With load (not to much load) I sometimes lose the "c". Very similar to TDM FXS modules.

I have tried the modification with "ast_safe_sleep(chan, 500);" and it works perfectly allways and without silence or pause files needed.
I will submit the patch next.

By: lvazquez (lvazquez) 2004-12-28 15:28:37.000-0600

[patch] New patch added with the waiting before playing the first digit (set to 500ms).
It seems to mostly fix the problem, even my subjective impresion is the solution with a "silence" file is heard better.

By: Clod Patry (junky) 2004-12-28 19:57:22.000-0600

I had nothing sarcastic lvazquez, sorry if it sounds like that.
btw, if you put a Wait(1) just after your Answer(), it should fix your problem, does that fix it?

By: Mark Spencer (markster) 2004-12-29 03:00:12.000-0600

I'd like to just confirm that this only occurs when you do it immediately following the answer, is that correct?

By: Mark Spencer (markster) 2004-12-29 07:56:06.000-0600

Nevermind, I read all the notes.  I've added an option to Answer which is a number of milliseconds to wait, so now you can do "Answer(500)" which would wait for 500 milliseconds if an answer was actually required.  Hopefully that will make it easier for you to implement your dialplan without extra Wait's!  Thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:18:41.000-0600

Repository: asterisk
Revision: 4586

U   trunk/pbx.c

r4586 | markster | 2008-01-15 15:18:40 -0600 (Tue, 15 Jan 2008) | 2 lines

Allow Answer(delay) to create delay after answering (bug ASTERISK-3099)