Hello,
We are having some issues with some calls not being recorded in Asterisk.
These are the relevant parts of a custom Asterisk .conf
file:
[service]
exten => 123,1,Set(trunk=${EXTEN})
exten => 123,n,Set(from=${URIENCODE(${SIP_HEADER(FROM)})})
exten => 123,n,Goto(customrecorder,s,1)
[customrecorder]
exten => s,1,Answer()
exten => s,n,Set(nodered=http://localhost:1880/)
;...
exten => s,n,Set(params_start=from_sip=${from})
exten => s,n,Set(logstart=${CURL(${nodered}call_start?${params_start})})
; ...
exten => s,n,Set(rannb=${RAND(1000,9999)}-${STRFTIME(${EPOCH},,%Y%m%d_%H%M%S)})
exten => s,n,Set(msgpath=/var/lib/asterisk/sounds/msg/${rannb})
exten => s,n,Record(${msgpath}:wav,,,kq)
; ...
exten => h,n,Set(wav_path=wav_path=${rannb}.wav) ; H
exten => h,n,Set(params_a=${from_sip}&${to_sip}&${from_ext}&${to_ext})
exten => h,n,Set(params_b=${duration}&${unix_end}&${human_end})
exten => h,n,Set(params_c=${wav_path}&${hangup})
exten => h,n,Set(params_end=${params_a}&${params_b}&${params_c})
exten => h,n,Set(logupdate=${CURL(${nodered}call_end?${params_end})})
exten => h,n,Hangup()
And the sip.conf
file:
[general0]
nat=force_rport,comedia
context=default
allow=!all,ulaw,g722,g729,opus
allowoverlap=no
udpbindaddr=0.0.0.0
tcpenable=no
tcpbindaddr=0.0.0.0
transport=udp
srvlookup=no
[authentication]
[basic-options](!)
dtmfmode=rfc2833
context=from-office
type=friend
[natted-phone](!,basic-options)
directmedia=no
host=dynamic
[public-phone](!,basic-options)
directmedia=yes
[my-codecs](!)
allow=!all,ilbc,g729,gsm,g723,ulaw
[ulaw-phone](!)
allow=!all,ulaw
[300]
type=friend
callerid="300" <300>
secret=300
host=dynamic
allow=all
dtmfmode=rfc2833
mailbox=300@sipdefault
insecure=port,invite
context=sipdefault
[200]
type=friend
callerid="200" <200>
secret=200
host=dynamic
allow=all
dtmfmode=rfc2833
mailbox=200@default
insecure=port,invite
context=default
canreinvite=no
[uac]
type=friend
context=local
host=192.168.37.129
port=12001
defaultuser=UAC_SIPP
dtmfmode=rfc2833
disallow=all
allow=alaw:50
insecure=port,invite
qualify=no
allowguest=yes
nat=force_rport
directmedia=no
[uas]
type=peer
host=192.168.37.129
port=12002
context=local
dtmfmode=rfc2833
username=UAS_SIPP
disallow=all
allow=alaw:50
insecure=port,invite
qualify=no
allowguest=yes
nat=force_rport
directmedia=no
Basically, we are recording a call, setting its filename to rannb
, and sending the SIP message along with that filename to a Node-RED instance.
Most of the time, it works well. But sometimes, the CURL request sends the parameter wav_path
as .wav
(no file name, just the extension).
On some systems, a file called .wav
is actually created, and even though it is an inconvenience, we can detect that file and rename it. The bigger and more common problem is that the file is not even created.
This problem appears to happen randomly as it does not happen with specific extensions.
Using tcpdump
and Wireshark, we can confirm that the RTP was indeed received, but Asterisk did not record/create the file.
Any clue on what the problem may be?
NB: Asked the same question on Stack Overflow