The problem I’m trying to solve is: accept the call on my 3G modem, start recording, wait until the other party hangs up and stop recording.
I’ve come to this a little ugly solution:
[dongle-incoming]
exten => _+X.,1,NoOp(Call from dongle {CALLERID}. Start call recording.)
same => n,MixMonitor(/home/pi/recordings/{UNIQUEID}.wav)
same => n,answer()
same => n,Wait(86400)
same => n,StopMixMonitor()
same => n,NoOp(Call from dongle ${CALLERID} ended. Stop call recording.)
same => n,hangup()
As you see, I’ve put a Wait application (which basically waits for 24 hours), as I couldn’t find a better way to handle the hang-ups. I tried to use “hangup_handler_push” but I would get some Gosub errors.
I’m not an expert in Asterisk, so I’m not really sure what that is. How can I modify this config dialplan in order to handle hang-ups in a more “professional” way?
What is the purpose of this code? There is no second leg. Either you write something like a little app, or connect to some other phone. In both cases you do not need to explicitly call StopMixMonitor.
Yes you re right, I did not check your dial plan correctly , if remove same => n,Wait(86400) it will hang up the call almost immediately. Using wait app is fine only limitation is that you re limitting the call to 86400 seconds, which I think it is enough time, anyway there are many other ways, like sending the call to confbridge and record the conference, or also use record() app with the k option