I developed an IVR which should call a number and recording until silence(2sec) and continue my code. I'm using python to send AGI command (based on this doc https://wiki.asterisk.org/wiki/display/AST/AGICommand_record+file) :
RECORD FILE "/var/asterisk_sound/mobile/temp" wav "" 20000 0 s=2
So when I'm calling IVR, I hear IVR playing audio and sending DTMF to me, it can record my speech and DTMF if i send with my phone. After I have a little file temp.wav like 50kB. Log :
09:57:31:-> RECORD FILE "/var/asterisk_sound/mobile/temp" wav "" 20000 0 s=2
09:57:46:<- 200 result=4852 (timeout) endpos=102880
09:57:46:{'code': '200', 'result': '4852', 'value': 'timeout', 'endpos': '102880'}
But when IVR calls me, I still hear IVR DTMF and audio, but while recording nothing happens, I'm talking and sending DTMF for 20sec(until timeout) without error, log :
16:00:38:-> RECORD FILE "/var/asterisk_sound/mobile/temp" wav "" 20000 0 s=2
16:00:58:<- 200 result=0 (timeout) endpos=0
16:00:58:{'code': '200', 'result': '0', 'value': 'timeout', 'endpos': '0'}
I'have a little file in the end I have a little file temp.wav like 0B.
I'm confused, maybe I try to record a speaker but I don't think so. I summarized the problem below :
FYI : I'm using Asterisk 13.1-cert1 on a x86_64 CentOS 5.6
Edit :
My algo is doing this in both cases :
call a number
on reply :
play welcome message (3 sec)
send DTMF
wait 10 sec
play BEEP
record file until silence
stream file
cancel
You need answer call before record and also nice idea send something to other end before record.
Some switches(for example widely used Sonic_UA) not send rtp data to your host until you send something to them.
In most cases used something like
Playback "beep"
Related
Sometime in my sip accounts occurs network problem and generates "UnReachable" event.
[2020-04-27 16:57:56] NOTICE[2949] chan_sip.c: Peer '323' is now UNREACHABLE! Last qualify: 6
I also see it in log files. I have 2 question about this situation.
After how many second Asterisk generate this event when can not access to sip account?
Exist some parametr change this reachable timeout second?
You can look at:
qualifyfreq=60 = default value is 60 sec
qualifygap=100
this works if:
qualify=yes|4000 = 4000 ms
I made an outbound-call service application using Asterisk AMI interface.
Following is how my application works.
I generate an Originate request to internal channel using TCP/IP socket.
my dialplan accepts the request and run dial command. extension.conf file is
[from-internal]
exten => _X.,1,NoOP()
same => n,MixMonitor(${DialMonitorFile}.wav)
same => n,Dial(PJSIP/${EXTEN}#TRUNK_100-1234-5678,30)
What I want to do is record whole call process (from ringback tone sound until user hangup).
But, when dial started, only 44 byte size file is generated (maybe wav file header?) before user accepts the call. And, file increased after user accepts call.
Can someone help me how can I record ringback tone sound as well ?
Regards,
Brian
You should do Answer before MixMonitor if you want that
Please note, CDRs will be affected
Im trying to figure out a clever way to delay the 200 ok for the sip handshake till after the "please enter your calling card code" that my voip system will be transmitting to the incoming call..
Any thoughts on this.. I must admit, I';m looking at this conceptually at this point and am a bit naive...
Thanks in advance!
You won't be able to at least if you're planning on supporting standard SIP devices.
You can send early media to a device, such as your "please enter.." audio, with a 183 Session Progress Response but I can't see that being much use as the SIP calling device won't send any DTMF tones to the server until the call has been answered which requires the 200 Ok response.
Despite that I suspect you may be looking at the wrong thing. The 200 Ok from Asterisk is for the call between the caller and the Asterisk server to get the DTMF tones and determine whether the next call leg is authorised. Only after the calling card code is accepted does the next call leg start. It sounds like your problem is that users are noticing that the billable call time includes the time they spend entering their calling card PIN. Fiddling with the 200 Ok response is not the way to fix that. Trying to get Asterisk to generate a new CDR for the second call leg would be a better approach.
For called party:
[main_content]
exten => _X.,1,Dial(SIP/${NUM}#provider,,M(dialout-macro))
[macro-dialout-macro]
exten => s,1,Noop(here you should add detect of "please enter")
exten => s,n,Noop(some other commands go)
exten => s,n,MacroExit;we are ready to connect call.
For calling party - you need ALL your provider support early media and dtmf before answer. It is posible get provider which support early media, yes. But i not know any system which support dtmf before answer,sorry.
Dialplan will be like this
exten => _x.,1,Read(variable,filename,10,n,3)
note: no answer should be BEFORE that command, should be used option n
n: to read digits even if the line is not up.
However as i say that will work only in theory.
In my Asterisk 1.8 setup, MixMonitor() in the dial plan successfully records calls without issue.
However for queue calls, while a recording file is generated and the log shows that MixMonitor() is recording, however the files are tiny and contain no audio.
This is my queue:
member => SIP/extension123
monitor-type=MixMonitor
monitor-format=wav49
I have also tried changing the monitor type to "Monitor" and the format to "wav", with the same result. I have also tried adding local channels as queue members and recording from the local channel in the dial plan instead of using the queue's recording and I get the same result (even though when dialing the local channel extension directly the recording works fine).
Any help would be appreciated.
Update: I am trying the same thing now on Asterisk 11.7 and experiencing the same issue
Figured it out: calls were being passed to the queue via a local channel. Apparently you need to add "/n" to the local channel call to keep it from being "optimized away".
For example:
Dial(local/7001#Queues/n)
Source: http://svnview.digium.com/svn/asterisk/branches/1.6.1/apps/app_mixmonitor.c?view=markup&pathrev=197897
I am communicating with a server from Verifone Nurit8320(DTE) via siemens MC55 gsm modem(DCE).
I am passing AT commands via UART to give commands to siemens MC55 gsm modem (DCE).
I have given a delay of 100 ms (required) between every AT command and I am flushing the UART of DTE before sending any command on it.
Now the problem is this
In many cases DCE is responding with the response of the previously executed AT command. The DCE UART is never flushed.
Where can I get the set of AT commands so that I can flush the UART buffer of DCE?
The problem you are trying to solve (flushing the DCE UART) is the wrong problem to focus on, because it is a problem that does not exist in AT command communication.
After sending an AT command to the DCE you MUST read every single character sent back as response from the DCE, and parse the text until you have received a Final Result Code (e.g. OK, ERROR and a few more) before you can send the next AT command. Any other way is doomed to bring in an endless list of problems and will never, never, ever work reliably.
See this answer for a general outline of how your AT command sending/parsing should
look like. Using a fixed time delay should never be done; it will either abort the command or in best case waste time while waiting unnecessarily long while never removing the risk of aborting despite of waiting. See this answer for more information about abortion of AT commands.