Issue with Asterisk MixMonitor Creating Empty Files and Terminating Calls Prematurely

Hello everyone (again),

I have a Debian 12 VPS (OVH) running Asterisk 20.11.1. My goal is to receive inbound calls on a DID from my SIP trunk providers. I’ve tried also to place test calls from a Windows softphone (MicroSIP). Calls do get in and I can even listen to a custom .wav file I’ve created.

Problem is, I’ve tried using Record and MixMonitor and, only the second generates a file, Record doesn’t even create a file, but file generated by MixMonitor is empty.

Environment

  • Host : OVH VPS with 1 vCore, 2GB RAM, 20GB SSD
  • Public IP : SERVERIP (no NAT on the server side)
  • OS: Debian 12 running on a VPS (no soundcard)
  • Asterisk Version : 20.11.1 (installed from source)
  • Firewall : None active (for now, to eliminate blocking issues)
  • RTP Port Range: 10000-20000
  • SIP Transport: UDP
  • Recording Directory: /var/spool/asterisk/records/ (permissions set to 777, owned by asterisk:asterisk)

The Problem:

  1. Empty Files:
  • When using MixMonitor , the files (e.g., /var/spool/asterisk/records/test.wav ) are created but are always 0 bytes.
  1. Call Termination:
  • If I use the p option (for a beep at the start of recording), the beep is audible, but the call terminates immediately.

Dialplan Configuration:

Here is the current dialplan:

[from-internal]
exten => 700,1,Answer()
    same => n,Playback(intro-iessa-v1_ak)
    same => n,MixMonitor(/var/spool/asterisk/records/test.wav,p)
    same => n,Wait(10)
    same => n,Hangup()

What I’ve Tried:

  1. Verified File Permissions:
  • Ensured that the /var/spool/asterisk/records/ directory is writable by the Asterisk process.
sudo chmod -R 777 /var/spool/asterisk/records/
sudo chown -R asterisk:asterisk /var/spool/asterisk/records/
  1. Tested with and without the p option:
  • Without p , the file is created but remains empty.
  • With p , the beep is heard, but the call terminates immediately after the beep.
  1. Tried Different File Formats:
  • Tested .wav , .gsm , and .sln formats. All result in either empty files or termination issues.
  1. Checked RTP Stream:
  • Confirmed RTP packets are being sent and received in real-time using rtp set debug on .
  • RTP flows seem fine, and audio plays correctly (e.g., in Playback(intro-iessa-v1_ak) ).
  1. Verified MixMonitor Dependencies:
  • Checked the loaded modules:
module show like mixmonitor
  • All relevant modules appear to be loaded.
  1. Used Simple Dialplan for Testing:
  • Replaced the Playback() step to isolate MixMonitor :
[from-internal]
exten => 700,1,Answer()
    same => n,MixMonitor(/var/spool/asterisk/records/test.wav,p)
    same => n,Wait(10) ;It does wait these 10 seconds, if I remove it, call ends immediately
    same => n,Hangup()
  • The same issue persists.
  1. Checked Logs:
  • Logs show the call is handled normally, MixMonitor starts and stops recording, but the output file is empty.
  1. Investigated Soundcard Dependency:
  • As this is a VPS without a soundcard, I suspected this might be an issue. However, several sources indicate that MixMonitor should work without a soundcard since it records RTP streams directly.
  1. Recompiled Asterisk:
  • Rebuilt Asterisk to ensure no missing dependencies. The issue remains unchanged.

Questions:

  1. Is the lack of a soundcard on the VPS a possible cause for this issue?
  2. Are there any additional modules or configurations I might be missing for MixMonitor to work properly?
  3. Could this be related to my Asterisk version or the VPS environment?
  4. Are there alternative ways to debug or confirm if the issue lies with MixMonitor or my dialplan setup?

Any guidance or suggestions would be greatly appreciated! Thank you in advance for your help.

Best regards,
Pedro

What exactly are you trying to… achieve?

MixMonitor immediately followed by a Hangup will hang the call up. If you want to record what the caller is saying, then you use Record and stop trying MixMonitor.

You haven’t actually provided any logging, aside from comments based on your own analysis. If you’re still selectively loading modules, just load everything to eliminate that as a factor.

A soundcard is not required.

Thank you for your answer. I’m sorry, I wasn’t clear on what I want to achieve.

I want to record the call but only the part where the caller talks.

As I’ve mentioned, Record option doesn’t even create a file.

If it’s not a matter of files/folders permissions (because MixMonitor can create a audio file, although empty), if modules are loaded this time (can you please confirm which ones are needed for Record to work?) and if I’ve there is sound and RTP is working correctly, then what might be the cause of this?

Record stores what is received from a channel. Depending on the codec in use transcoding may be required, which would require the appropriate transcoding module.

There is insufficient information, logging, configuration, to be able to answer any further.

You are right, I haven’t posted here necessary information.

Here’s some that I hope it may help you to help me. :slight_smile:

debian@vps-bd7a2bd9:~$ sudo asterisk -rx "core show codecs"
Disclaimer: this command is for informational purposes only.
        It does not indicate anything about your configuration.
      ID TYPE  NAME         FORMAT           DESCRIPTION
------------------------------------------------------------------------------------------------
      30 image png          png              (PNG Image)
       6 audio g726         g726             (G.726 RFC3551)
       4 audio alaw         alaw             (G.711 a-law)
       2 audio g723         g723             (G.723.1)
      20 audio speex        speex            (SpeeX)
      21 audio speex        speex16          (SpeeX 16khz)
      22 audio speex        speex32          (SpeeX 32khz)
      24 audio g722         g722             (G722)
      25 audio siren7       siren7           (ITU G.722.1 (Siren7, licensed from Polycom))
      31 video h261         h261             (H.261 video)
      32 video h263         h263             (H.263 video)
       8 audio adpcm        adpcm            (Dialogic ADPCM)
      35 video h265         h265             (H.265 video)
      43 audio silk         silk8            (SILK Codec (8 KHz))
      44 audio silk         silk12           (SILK Codec (12 KHz))
      45 audio silk         silk16           (SILK Codec (16 KHz))
      46 audio silk         silk24           (SILK Codec (24 KHz))
      27 audio g719         g719             (ITU G.719)
      33 video h263p        h263p            (H.263+ video)
      34 video h264         h264             (H.264 video)
      19 audio g729         g729             (G.729A)
       9 audio slin         slin             (16 bit Signed Linear PCM)
      10 audio slin         slin12           (16 bit Signed Linear PCM (12kHz))
      11 audio slin         slin16           (16 bit Signed Linear PCM (16kHz))
      12 audio slin         slin24           (16 bit Signed Linear PCM (24kHz))
      13 audio slin         slin32           (16 bit Signed Linear PCM (32kHz))
      14 audio slin         slin44           (16 bit Signed Linear PCM (44kHz))
      15 audio slin         slin48           (16 bit Signed Linear PCM (48kHz))
      16 audio slin         slin96           (16 bit Signed Linear PCM (96kHz))
      17 audio slin         slin192          (16 bit Signed Linear PCM (192kHz))
       3 audio ulaw         ulaw             (G.711 u-law)
      18 audio lpc10        lpc10            (LPC10)
      42 audio none         none             (<Null> codec)
      41 image t38          t38              (T.38 UDPTL Fax)
      38 video vp9          vp9              (VP9 video)
      37 video vp8          vp8              (VP8 video)
       5 audio gsm          gsm              (GSM)
      36 video mpeg4        mpeg4            (MPEG4 video)
      23 audio ilbc         ilbc             (iLBC)
      39 text  red          red              (T.140 Realtime Text with redundancy)
      40 text  t140         t140             (Passthrough T.140 Realtime Text)
      28 audio opus         opus             (Opus Codec)
      29 image jpeg         jpeg             (JPEG image)
       7 audio g726aal2     g726aal2         (G.726 AAL2)
       1 audio codec2       codec2           (Codec 2)
      26 audio siren14      siren14          (ITU G.722.1 Annex C, (Siren14, licensed from Polycom))
debian@vps-bd7a2bd9:~$ sudo asterisk -rx "core show file formats"
Format     Name       Extensions
------     ----       ----------
g722       g722       g722
ulaw       au         au
alaw       alaw       alaw|al|alw
ulaw       pcm        pcm|ulaw|ul|mu|ulw
g719       g719       g719
ilbc       iLBC       ilbc
gsm        wav49      WAV|wav49
siren14    siren14    siren14
g726       g726-16    g726-16
g726       g726-24    g726-24
g726       g726-32    g726-32
g726       g726-40    g726-40
gsm        gsm        gsm
slin16     wav16      wav16
slin       wav        wav
slin192    sln192     sln192
slin96     sln96      sln96
slin48     sln48      sln48
slin44     sln44      sln44
slin32     sln32      sln32
slin24     sln24      sln24
slin16     sln16      sln16
slin12     sln12      sln12
slin       sln        sln|slin|raw
g723       g723sf     g723|g723sf
h264       h264       h264
h263       h263       h263
g729       g729       g729
siren7     siren7     siren7
adpcm      vox        vox
slin       ogg_vorbis ogg
speex32    ogg_speex32 spx32
speex16    ogg_speex16 spx16
speex      ogg_speex  spx
34 file formats registered.
debian@vps-bd7a2bd9:~$ sudo asterisk -rx "module show like format"
sudo asterisk -rx "module show like codec"
sudo asterisk -rx "module show like rtp"
Module                         Description                              Use Count  Status      Support Level
format_g719.so                 ITU G.719                                0          Running              core
format_g723.so                 G.723.1 Simple Timestamp File Format     0          Running              core
format_g726.so                 Raw G.726 (16/24/32/40kbps) data         0          Running              core
format_g729.so                 Raw G.729 data                           0          Running              core
format_gsm.so                  Raw GSM data                             0          Running              core
format_h263.so                 Raw H.263 data                           0          Running              core
format_h264.so                 Raw H.264 data                           0          Running              core
format_ilbc.so                 Raw iLBC data                            0          Running              core
format_ogg_speex.so            OGG/Speex audio                          0          Running          extended
format_ogg_vorbis.so           OGG/Vorbis audio                         0          Running              core
format_pcm.so                  Raw/Sun uLaw/ALaw 8KHz (PCM,PCMA,AU), G. 0          Running              core
format_siren14.so              ITU G.722.1 Annex C (Siren14, licensed f 0          Running              core
format_siren7.so               ITU G.722.1 (Siren7, licensed from Polyc 0          Running              core
format_sln.so                  Raw Signed Linear Audio support (SLN) 8k 0          Running              core
format_vox.so                  Dialogic VOX (ADPCM) File Format         0          Running          extended
format_wav.so                  Microsoft WAV/WAV16 format (8kHz/16kHz S 0          Running              core
format_wav_gsm.so              Microsoft WAV format (Proprietary GSM)   0          Running              core
res_format_attr_celt.so        CELT Format Attribute Module             1          Running              core
res_format_attr_g729.so        G.729 Format Attribute Module            1          Running              core
res_format_attr_h263.so        H.263 Format Attribute Module            1          Running              core
res_format_attr_h264.so        H.264 Format Attribute Module            1          Running              core
res_format_attr_ilbc.so        iLBC Format Attribute Module             1          Running              core
res_format_attr_opus.so        Opus Format Attribute Module             1          Running              core
res_format_attr_silk.so        SILK Format Attribute Module             1          Running              core
res_format_attr_siren14.so     Siren14 Format Attribute Module          1          Running              core
res_format_attr_siren7.so      Siren7 Format Attribute Module           1          Running              core
res_format_attr_vp8.so         VP8 Format Attribute Module              1          Running              core
27 modules loaded
Module                         Description                              Use Count  Status      Support Level
codec_a_mu.so                  A-law and Mulaw direct Coder/Decoder     0          Running              core
codec_adpcm.so                 Adaptive Differential PCM Coder/Decoder  0          Running              core
codec_alaw.so                  A-law Coder/Decoder                      0          Running              core
codec_codec2.so                Codec 2 Coder/Decoder                    0          Running              core
codec_g722.so                  ITU G.722-64kbps G722 Transcoder         0          Running              core
codec_g726.so                  ITU G.726-32kbps G726 Transcoder         0          Running              core
codec_gsm.so                   GSM Coder/Decoder                        0          Running              core
codec_ilbc.so                  iLBC Coder/Decoder                       0          Running              core
codec_lpc10.so                 LPC10 2.4kbps Coder/Decoder              0          Running              core
codec_resample.so              SLIN Resampling Codec                    0          Running              core
codec_speex.so                 Speex Coder/Decoder                      1          Running              core
codec_ulaw.so                  mu-Law Coder/Decoder                     0          Running              core
12 modules loaded
Module                         Description                              Use Count  Status      Support Level
bridge_native_rtp.so           Native RTP bridging module               0          Running              core
chan_rtp.so                    RTP Media Channel                        0          Running              core
res_pjsip_sdp_rtp.so           PJSIP SDP RTP/AVP stream handler         0          Running              core
res_rtp_asterisk.so            Asterisk RTP Stack                       0          Running              core
res_rtp_multicast.so           Multicast RTP Engine                     1          Running              core
res_srtp.so                    Secure RTP (SRTP)                        0          Running              core
6 modules loaded
debian@vps-bd7a2bd9:~$ sudo asterisk -rx "console dialplan reload"
sudo asterisk -rx "channel originate Local/700@from-internal application Playback demo-congrats"
No such command 'console dialplan reload' (type 'core show help console dialplan reload' for other possible commands)
debian@vps-bd7a2bd9:~$

Here’s my extensions.conf:

[from-internal]
exten => 700,1,Answer()
    ;same => n,Playback(intro-iessa-v1_ak)
    same => n,Record(/var/spool/asterisk/records/test.wav)
    same => n,Hangup()

exten => 701,1,Answer()
    same => n,Playback(/var/spool/asterisk/records/test.wav)
    same => n,Hangup()

If I uncomment the Playback, it does produce the sound perfectly. Also, I noticed that now the call does not hang-up automatically and if I ls /var/spool/asterisk/records/ I do see the test.wav file in there. But when call if finished, file is deleted.

I tried Record(/var/spool/asterisk/records/test.wav,,skip) but did not worked.

I also tried Record(/tmp/test.wav) but same thing happens.

Here’s a log of a 1 second call (I hang-up after that time to avoid a huge log):

vps-bd7a2bd9*CLI> rtp set debug on
RTP Packet Debugging Enabled
    -- Executing [700@from-internal:1] Answer("PJSIP/testar-00000022", "") in new stack
    -- Executing [700@from-internal:2] Record("PJSIP/testar-00000022", "/var/spool/asterisk/records/test.wav") in new stack
Sent RTP packet to      192.168.1.68:4022 (type 00, seq 045306, ts 000160, len 000160)
    -- <PJSIP/testar-00000022> Playing 'beep.gsm' (language 'en')
Sent RTP packet to      192.168.1.68:4022 (type 00, seq 045307, ts 000320, len 000160)
Sent RTP packet to      192.168.1.68:4022 (type 00, seq 045308, ts 000480, len 000160)
Sent RTP packet to      192.168.1.68:4022 (type 00, seq 045309, ts 000640, len 000160)
Sent RTP packet to      192.168.1.68:4022 (type 00, seq 045310, ts 000800, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018093, ts 000960, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045311, ts 000960, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018094, ts 001120, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045312, ts 001120, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018095, ts 001280, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045313, ts 001280, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018096, ts 001440, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045314, ts 001440, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018097, ts 001600, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045315, ts 001600, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018098, ts 001760, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045316, ts 001760, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018099, ts 001920, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045317, ts 001920, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018100, ts 002080, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045318, ts 002080, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018101, ts 002240, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045319, ts 002240, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018102, ts 002400, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045320, ts 002400, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018103, ts 002560, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045321, ts 002560, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018104, ts 002720, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045322, ts 002720, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018105, ts 002880, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045323, ts 002880, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018106, ts 003040, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045324, ts 003040, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018107, ts 003200, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045325, ts 003200, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018108, ts 003360, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045326, ts 003360, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018109, ts 003520, len 000160)
Sent RTP packet to      HIDDENIP:51125 (type 00, seq 045327, ts 003520, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018110, ts 003680, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018111, ts 003840, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018112, ts 004000, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018113, ts 004160, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018114, ts 004320, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018115, ts 004480, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018116, ts 004640, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018117, ts 004800, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018118, ts 004960, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018119, ts 005120, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018120, ts 005280, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018121, ts 005440, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018122, ts 005600, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018123, ts 005760, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018124, ts 005920, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018125, ts 006080, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018126, ts 006240, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018127, ts 006400, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018128, ts 006560, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018129, ts 006720, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018130, ts 006880, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018131, ts 007040, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018132, ts 007200, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018133, ts 007360, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018134, ts 007520, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018135, ts 007680, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018136, ts 007840, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018137, ts 008000, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018138, ts 008160, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018139, ts 008320, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018140, ts 008480, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018141, ts 008640, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018142, ts 008800, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018143, ts 008960, len 000160)
Got  RTP packet from    HIDDENIP:51125 (type 00, seq 018144, ts 009120, len 000160)
  == Spawn extension (from-internal, 700, 2) exited non-zero on 'PJSIP/testar-00000022'

And the PJSIP log:

debian@vps-bd7a2bd9:~$ sudo asterisk -rvvv
Asterisk 20.11.1, Copyright (C) 1999 - 2022, Sangoma Technologies Corporation and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 20.11.1 currently running on vps-bd7a2bd9 (pid = 4692)
<--- Received SIP request (995 bytes) from UDP:HIDDENIP:63666 --->
INVITE sip:700@SERVERIP SIP/2.0
Via: SIP/2.0/UDP 192.168.1.68:58100;rport;branch=z9hG4bKPj66643f83a74d403caeeb5654c6033c77
Max-Forwards: 70
From: <sip:testar@SERVERIP>;tag=314f463e335b487c9cbca5cfb9c1c74d
To: <sip:700@SERVERIP>
Contact: <sip:testar@192.168.1.68:58100;ob>
Call-ID: b53264416d9b4f59a7c8ef64c710afb6
CSeq: 19962 INVITE
Route: <sip:SERVERIP:5060;lr>
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
User-Agent: MicroSIP/3.21.6
Content-Type: application/sdp
Content-Length:   341

v=0
o=- 3946711720 3946711720 IN IP4 192.168.1.68
s=pjmedia
b=AS:84
t=0 0
a=X-nat:0
m=audio 4030 RTP/AVP 8 0 101
c=IN IP4 192.168.1.68
b=TIAS:64000
a=rtcp:4031 IN IP4 192.168.2.126
a=sendrecv
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ssrc:1815350832 cname:3dd922d90ee46d8f

<--- Transmitting SIP response (550 bytes) to UDP:HIDDENIP:63666 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.68:58100;rport=63666;received=HIDDENIP;branch=z9hG4bKPj66643f83a74d403caeeb5654c6033c77
Call-ID: b53264416d9b4f59a7c8ef64c710afb6
From: <sip:testar@SERVERIP>;tag=314f463e335b487c9cbca5cfb9c1c74d
To: <sip:700@SERVERIP>;tag=z9hG4bKPj66643f83a74d403caeeb5654c6033c77
CSeq: 19962 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1737722920/745060ddf7f600a236659d0353660ce1",opaque="5015c87e7e9e5535",algorithm=MD5,qop="auth"
Server: Asterisk PBX 20.11.1
Content-Length:  0


<--- Received SIP request (405 bytes) from UDP:HIDDENIP:63666 --->
ACK sip:700@SERVERIP SIP/2.0
Via: SIP/2.0/UDP 192.168.1.68:58100;rport;branch=z9hG4bKPj66643f83a74d403caeeb5654c6033c77
Max-Forwards: 70
From: <sip:testar@SERVERIP>;tag=314f463e335b487c9cbca5cfb9c1c74d
To: <sip:700@SERVERIP>;tag=z9hG4bKPj66643f83a74d403caeeb5654c6033c77
Call-ID: b53264416d9b4f59a7c8ef64c710afb6
CSeq: 19962 ACK
Route: <sip:SERVERIP:5060;lr>
Content-Length:  0


<--- Received SIP request (1288 bytes) from UDP:HIDDENIP:63666 --->
INVITE sip:700@SERVERIP SIP/2.0
Via: SIP/2.0/UDP 192.168.1.68:58100;rport;branch=z9hG4bKPja21ca381ba49448fa8ccceb847d6e123
Max-Forwards: 70
From: <sip:testar@SERVERIP>;tag=314f463e335b487c9cbca5cfb9c1c74d
To: <sip:700@SERVERIP>
Contact: <sip:testar@192.168.1.68:58100;ob>
Call-ID: b53264416d9b4f59a7c8ef64c710afb6
CSeq: 19963 INVITE
Route: <sip:SERVERIP:5060;lr>
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
User-Agent: MicroSIP/3.21.6
Authorization: Digest username="testar", realm="asterisk", nonce="1737722920/745060ddf7f600a236659d0353660ce1", uri="sip:700@SERVERIP", response="fb6985988d4fd841fb5baf1e4fa269d4", algorithm=MD5, cnonce="857713bd195946b1b35f548072a33a24", opaque="5015c87e7e9e5535", qop=auth, nc=00000001
Content-Type: application/sdp
Content-Length:   341

v=0
o=- 3946711720 3946711720 IN IP4 192.168.1.68
s=pjmedia
b=AS:84
t=0 0
a=X-nat:0
m=audio 4030 RTP/AVP 8 0 101
c=IN IP4 192.168.1.68
b=TIAS:64000
a=rtcp:4031 IN IP4 192.168.2.126
a=sendrecv
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ssrc:1815350832 cname:3dd922d90ee46d8f

<--- Transmitting SIP response (352 bytes) to UDP:HIDDENIP:63666 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.1.68:58100;rport=63666;received=HIDDENIP;branch=z9hG4bKPja21ca381ba49448fa8ccceb847d6e123
Call-ID: b53264416d9b4f59a7c8ef64c710afb6
From: <sip:testar@SERVERIP>;tag=314f463e335b487c9cbca5cfb9c1c74d
To: <sip:700@SERVERIP>
CSeq: 19963 INVITE
Server: Asterisk PBX 20.11.1
Content-Length:  0


    -- Executing [700@from-internal:1] Answer("PJSIP/testar-00000025", "") in new stack
<--- Transmitting SIP response (936 bytes) to UDP:HIDDENIP:63666 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.68:58100;rport=63666;received=HIDDENIP;branch=z9hG4bKPja21ca381ba49448fa8ccceb847d6e123
Call-ID: b53264416d9b4f59a7c8ef64c710afb6
From: <sip:testar@SERVERIP>;tag=314f463e335b487c9cbca5cfb9c1c74d
To: <sip:700@SERVERIP>;tag=629682b6-8dec-4413-8b4b-d5ead9bb4e26
CSeq: 19963 INVITE
Server: Asterisk PBX 20.11.1
Contact: <sip:SERVERIP:5060>
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, INFO, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800;refresher=uac
Require: timer
Content-Type: application/sdp
Content-Length:   261

v=0
o=- 3946711720 3946711722 IN IP4 SERVERIP
s=Asterisk
c=IN IP4 SERVERIP
t=0 0
m=audio 18810 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:140
a=sendrecv

    -- Executing [700@from-internal:2] Record("PJSIP/testar-00000025", "/var/spool/asterisk/records/test.wav") in new stack
    -- <PJSIP/testar-00000025> Playing 'beep.gsm' (language 'en')
<--- Received SIP request (366 bytes) from UDP:HIDDENIP:63666 --->
ACK sip:SERVERIP:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.68:58100;rport;branch=z9hG4bKPj5b4111a57c144a09b8b9d45369937159
Max-Forwards: 70
From: <sip:testar@SERVERIP>;tag=314f463e335b487c9cbca5cfb9c1c74d
To: <sip:700@SERVERIP>;tag=629682b6-8dec-4413-8b4b-d5ead9bb4e26
Call-ID: b53264416d9b4f59a7c8ef64c710afb6
CSeq: 19963 ACK
Content-Length:  0


<--- Received SIP request (865 bytes) from UDP:HIDDENIP:63666 --->
UPDATE sip:SERVERIP:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.68:58100;rport;branch=z9hG4bKPjf8211da264404b85a1c1e3d08dbe12ea
Max-Forwards: 70
From: <sip:testar@SERVERIP>;tag=314f463e335b487c9cbca5cfb9c1c74d
To: <sip:700@SERVERIP>;tag=629682b6-8dec-4413-8b4b-d5ead9bb4e26
Contact: <sip:testar@192.168.1.68:58100;ob>
Call-ID: b53264416d9b4f59a7c8ef64c710afb6
CSeq: 19964 UPDATE
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800;refresher=uac
Min-SE: 90
Content-Type: application/sdp
Content-Length:   317

v=0
o=- 3946711720 3946711721 IN IP4 192.168.1.68
s=pjmedia
b=AS:84
t=0 0
a=X-nat:0
m=audio 4030 RTP/AVP 0 101
c=IN IP4 192.168.1.68
b=TIAS:64000
a=rtcp:4031 IN IP4 192.168.2.126
a=ssrc:1815350832 cname:3dd922d90ee46d8f
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv

<--- Transmitting SIP response (912 bytes) to UDP:HIDDENIP:63666 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.68:58100;rport=63666;received=HIDDENIP;branch=z9hG4bKPjf8211da264404b85a1c1e3d08dbe12ea
Call-ID: b53264416d9b4f59a7c8ef64c710afb6
From: <sip:testar@SERVERIP>;tag=314f463e335b487c9cbca5cfb9c1c74d
To: <sip:700@SERVERIP>;tag=629682b6-8dec-4413-8b4b-d5ead9bb4e26
CSeq: 19964 UPDATE
Session-Expires: 1800;refresher=uac
Require: timer
Contact: <sip:SERVERIP:5060>
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, INFO, REFER
Supported: 100rel, timer, replaces, norefersub
Server: Asterisk PBX 20.11.1
Content-Type: application/sdp
Content-Length:   237

v=0
o=- 3946711720 3946711723 IN IP4 SERVERIP
s=Asterisk
c=IN IP4 SERVERIP
t=0 0
m=audio 18810 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:140
a=sendrecv

<--- Received SIP request (395 bytes) from UDP:HIDDENIP:63666 --->
BYE sip:SERVERIP:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.68:58100;rport;branch=z9hG4bKPj3f2b610bea274ce894357474de40a0d2
Max-Forwards: 70
From: <sip:testar@SERVERIP>;tag=314f463e335b487c9cbca5cfb9c1c74d
To: <sip:700@SERVERIP>;tag=629682b6-8dec-4413-8b4b-d5ead9bb4e26
Call-ID: b53264416d9b4f59a7c8ef64c710afb6
CSeq: 19965 BYE
User-Agent: MicroSIP/3.21.6
Content-Length:  0


<--- Transmitting SIP response (386 bytes) to UDP:HIDDENIP:63666 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.68:58100;rport=63666;received=HIDDENIP;branch=z9hG4bKPj3f2b610bea274ce894357474de40a0d2
Call-ID: b53264416d9b4f59a7c8ef64c710afb6
From: <sip:testar@SERVERIP>;tag=314f463e335b487c9cbca5cfb9c1c74d
To: <sip:700@SERVERIP>;tag=629682b6-8dec-4413-8b4b-d5ead9bb4e26
CSeq: 19965 BYE
Server: Asterisk PBX 20.11.1
Content-Length:  0


  == Spawn extension (from-internal, 700, 2) exited non-zero on 'PJSIP/testar-00000025'
vps-bd7a2bd9*CLI>

Am I missing something?

Use the ‘k’ option to Record[1] to keep the recorded file upon hangup.

This is invalid. You do not specify the file extension. It is found automatically.

[1] Record - Asterisk Documentation

Thank you, but still no file is kept there.

For the record, after changing the extensions.conf I did sudo asterisk -rx "dialplan reload"

Show it, as the correct string would be:

same => n,Record(/var/spool/asterisk/records/test.wav,,,k)

1 Like

You are a star! That did the trick. Working flawlessly and with great audio quality. :smiley: