[out]
exten=>_X.,1,Answer()
exten=>_X.,n,Background(hello)
exten=>_X.,n,WaitExten(5)
exten=>1,1,Goto(check,s,1)
Audio menu are playing, but when I press 1, sound stop and after few second check command run. How to quickly respond to a user request?
You are doing begginer error which described in almost any asterisk book for beginer.
I recommend you read "Asterisk The Future of Telephony" by O'Relly.
This exact error is simple:
in your dialplan you have extension _X., which mean "any number starting with digit.
you ask asterisk waitfor extension selected in this context.
you are pressing digit, but acordinly to context you may want enter 1111(also fit you context). So asterisk wait upto TIMEOUT(digits) until you enter next digit.
your timeout is 5 second, so it go ext 1 in 5 second.
[Syntax]
BackGround(filename1[&filename2[&...]][,options[,langoverride[,context]]])
You can use other context for matching.
Related
Channel: $number
Application: Playback
Data: $outputfilename
When callee answers the phone, s/he misses the first one or two words. So I would like to wait untill s/he gives any response like "hello?' or "alo" and then start playback. Is there anyway to make it done in the call file?
If there is not at least I would like to wait 1 or 2 seconds. Does wait(2) works here?
Use
Channel: $number
Application: Playback
Data: beep&silence/2&$outputfilename
That way it will play beep, which probably will be not heared by human, but for sure will start rtp process. After that 2 second wait(silence file) which may be required for echocancel training or connection process. That way you message will go clear.
You can create new dialplan context. In it You add Wait application and then Palyback. In call file you can connect number to this new context by specifying it directly or dialing to it via Dial(Local/XXX#new-context)
http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out
The issue you're having is the RTP stream not being fully "up". Until the call is established, RTP (sound) isn't shipped. So, if you "start talking" right away, you loose words. This is a dialplan side problem, because it depends on both ends of the call being in the "shipping sound" phase.
Using Answer() ; Wait() will not always fix this issue on VoIP connections, because it doesn't actually get the audio stream moving. Wait() is more for cranky T1 lines with slow set-up speeds where you are literally waiting for the rest of the hardware to catch up.
You can get around this by just playing 1 or 2 seconds (1 works 80% of the time) of silence. Eg:
[answering_context]
exten => s,1,Verbose(2,Example of good audio discipline)
same => n, Playback(silence/1)
same => n, Playback(the_real_message_you_want_to_send)
"Silence" is technically "still sound", but the human can't tell if you are shedding packets or clipping words during "silence". By the time the the_real_message_you_want_to_send gets played, the audio stream will be fully stable.
Cheers!
I am using Putty to simulate my phone's modem connected via serial. When my phone receives a call it outputs 'RING' into putty but when the caller cancel the call Putty doesn't out put any response or result.
How would the modem know that the caller disconnect/cancelled the call, but not output it in putty?
Thanks
To detect missed calls you can try three things.
Check if there is a suitable AT+CIND indicator you can turn on. I do not think call will do since I assume it only goes to 1 when the call is answered. If your phone supports callsetup or something similar that should be what you need (you will have to implement logic to detect when a call does not go to state active).
For an example of enabling AT+CIND indicators, see chapter "8.57 Informative examples" in 27.007 for more explanation, and pay close attention to The subparameter order in the command is defined by the query command order, e.g.
if AT+CIND=? returns
+CIND: ("abc",(0-1)),("xyz",(0,1)),("call",(0,1))
then call is index 3, and for
+CIND: ("abc",(0-1)),("call",(0,1)),("xyz",(0,1))
call is index 2. Do not hard code any assumptions here, this should be parsed and checked run-time (one check at the beginning is enough).
Alternatively you can upon RING start polling call status with AT+CLCC until the call is no longer listed.
Or you could poll the MC phonebook storage and detect changes.
Most modems show the incoming phone number and a RING when a call is received and an END when the call is cancelled. To view the missed calls, you may use the following AT Commands.
AT+CPBS="MC"
AT+CPBR=1,99
First command tells the modem to look in the missed call phone book and the second command loads entries from 1 to 99. Note that this behavior is not standard. I was able to replicate this on a GSM module but not on my 3G modem. Try it on your modem and check if this works. All the best.
I forward incoming calls to external numbers.
I do this with Follow me module for each number.
Sometimes I use one more external number in follow-me list, to call the second ona if the first one is busy. Bu it is calling the first one and ringing. First one is busy and it is still ringing. I does not call the second number.
What i am doing wrong?
Your provider or ATA not recognize busy signal. Unfortanly no way say what exactly happens, info provided not enought
I am developing an java-asterisk application that is calling subscribers to deliver messages. At some moments during the call, I need to monitor whether the subscriber is talking or is silent. I need to monitor that for a fairly long time (1-3 seconds) but don't want to interrupt the flow of the outgoing message.
The way I am doing it now is as below
streamFile(*file A*);
exec("WaitForSilence","300,1,1");
waitStatus=getVariable("WAITSTATUS");
streamFile(*file B*);
This works fine but it is only a 300ms detect and a 1s timeout, so from the subscriber point of view the silence between file A and file B is almost unnoticeable. But if I want to listen for longer (say 3 seconds for example) then the subscriber's experience will be ruined.
What I would need is a function similar to "WaitForSilence" but that:
runs in parallel to the script;
delivers its outcome in a variable channel with a name that I define (as there might be several calls to the function, and I need to get all the results)
I've been looking for more than aweek now and couldn't find a way to do that. Any ideas?
Code you provided will do wait, after that will do playback.
There are no way do that simple in one application.
Posible ways:
1) create c/c++ application(asterisk guru skill required) for that.
2) create enother channel, mix it with ChanSpy and in that channel do silence detect. Complexity - expert in asterisk.
Both are not so short(more then 2-3 screens of code), so can't be described in this site.
You can also try use Background application, but i am afraid it will not work too.
The VXML application I mentioned in a previous question is now in testing. After allowing the user to record a message (max length 5 minutes) we go into a standard menu (submit, playback, re-record, etc).
One of our testers, bored as anything and tired of leaving a 5-minute message was reading an email we had sent, including the phone number. She said 'Two' just after the menu started, having heard only a split second of the menu.
Needless to say, she was very confused.
The right way to fix this, to me, seems to be to add a definitive stop to the recording, like the beep that begins it.
The record item has a beep property that beeps at the start of the recording, which we use. I can't find reference to any property that would beep when the user reaches max time.
How can I add an uninterruptible beep at the end of a when it has reached the maxtime?
Well, a bit more digging tells me that there's no property for it on the object.
But I did turn up a property on the resulting variable 'maxtime' that tells you if it ended due to a maximum time exceeded event.
By checking that in the section, but before sending them to the menu, I am able to use an block to play an audio file with bargein="false"
It's a bit more code than I'd like, but it seems to work.