Call Recording

Home » Asterisk Users » Call Recording
Asterisk Users 4 Comments

I am trying to record calls on demand both inbound and outbound calls. I can record outbound calls just fine but not inbound calls or calls from an internally between extensions. I am using the latest asterisk 1.8.x certified version. On an outbound call I see:
== Using SIP RTP CoS mark 5
— Called SIP/ BVTrunk /7190000000
SIP/BVTrunk-00000163 is making progress passing it to SIP/1010-00000162
— SIP/BVTrunk-00000163 answered SIP/1010-00000162
— Feature Found: apprecord exten: apprecord
— Executing [s@macro-one-touch-record:1] ExecIf(“SIP/1010-00000162”, “0?Set(THISEXTEN=71900000000)”) in new stack
— Executing [s@macro-one-touch-record:2] ExecIf(“SIP/1010-00000162”, “1?Set(THISEXTEN=1010)”) in new stack
— Executing [s@macro-one-touch-record:3] ExecIf(“SIP/1010-00000162”, “0?MacroExit()”) in new stack
— Executing [s@macro-one-touch-record:4] GotoIf(“SIP/1010-00000162”, “0?stoprec”) in new stack
— Executing [s@macro-one-touch-record:5] GotoIf(“SIP/1010-00000162”, “0?stopped”) in new stack
— Executing [s@macro-one-touch-record:6] GotoIf(“SIP/1010-00000162”, “0?recording”) in new stack
— Executing [s@macro-one-touch-record:7] Set(“SIP/1010-00000162”, “MASTER_CHANNEL(ONETOUCH_REC)=RECORDING”) in new stack
— Executing [s@macro-one-touch-record:8] Set(“SIP/1010-00000162”, “MASTER_CHANNEL(REC_STATUS)=RECORDING”) in new stack
— Executing [s@macro-one-touch-record:9] Set(“SIP/1010-00000162”, “AUDIOHOOK_INHERIT(MixMonitor)=yes”) in new stack
— Executing [s@macro-one-touch-record:10] MixMonitor(“SIP/1010-00000162”, “2012/08/21/out-7190000000-1010-20120821-183119-1345595479.530.wav,a,”) in new stack
== Begin MixMonitor Recording SIP/1010-00000162
— Executing [s@macro-one-touch-record:11] Set(“SIP/1010-00000162”, “MON_FMT=wav”) in new stack
— Executing [s@macro-one-touch-record:12] Set(“SIP/1010-00000162”, “MASTER_CHANNEL(CDR(recordingfile))=out-7190000000-1010-20120821-183119-1345595479.530.wav”) in new stack
— Executing [s@macro-one-touch-record:13] Set(“SIP/1010-00000162”, “MASTER_CHANNEL(ONETOUCH_RECFILE)=out-7190000000-1010-20120821-183119-1345595479.530.wav”) in new stack
— Executing [s@macro-one-touch-record:14] Playback(“SIP/1010-00000162”, “beep”) in new stack
Playing ‘beep.ulaw’ (language ‘en’)
— Executing [s@macro-one-touch-record:15] MacroExit(“SIP/1010-00000162”, “”) in new stack
— Executing [h@macro-dialout-trunk:1] Macro(“SIP/1010-00000162”, “hangupcall,”) in new stack
— Executing [s@macro-hangupcall:1] GotoIf(“SIP/1010-00000162”, “1?theend”) in new stack
— Goto (macro-hangupcall,s,3)
— Executing [s@macro-hangupcall:3] ExecIf(“SIP/1010-00000162”, “1?Set(CDR(recordingfile)=out-7190000000-1010-20120821-183119-1345595479.530.wav)”) in new stack
— Executing [s@macro-hangupcall:4] Hangup(“SIP/1010-00000162”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 4) exited non-zero on ‘SIP/1010-00000162’ in macro ‘hangupcall’
== Spawn extension (macro-dialout-trunk, h, 1) exited non-zero on ‘SIP/1010-00000162’
== Spawn extension (macro-dialout-trunk, s, 22) exited non-zero on ‘SIP/1010-00000162’ in macro ‘dialout-trunk’
== Spawn extension (from-internal, 7190000000, 6) exited non-zero on ‘SIP/1010-00000162’
== MixMonitor close filestream
== End MixMonitor Recording SIP/1010-00000162
== Extension Changed 1010[ext-local] new state Idle for Notify User 1004
On inbound calls I see:
== Using SIP RTP CoS mark 5
— Called SIP/1010
— Connected line update to SIP/ BVTrunk -00000160 prevented.
== Extension Changed 1010[ext-local] new state Ringing for Notify User 1004
— SIP/1010-00000161 is ringing
— Connected line update to SIP/ BVTrunk -00000160 prevented.
— SIP/1010-00000161 answered SIP/ BVTrunk -00000160
== Extension Changed 1010[ext-local] new state InUse for Notify User 1004
— Executing [s@macro-auto-blkvm:1] Set(“SIP/1010-00000161”, “__MACRO_RESULT=”) in new stack
— Executing [s@macro-auto-blkvm:2] Macro(“SIP/1010-00000161”, “blkvm-clr,”) in new stack
— Executing [s@macro-blkvm-clr:1] Set(“SIP/1010-00000161”, “SHARED(BLKVM,SIP/BVTrunk-00000160)=”) in new stack
— Executing [s@macro-blkvm-clr:2] Set(“SIP/1010-00000161”, “GOSUB_RETVAL=”) in new stack
— Executing [s@macro-blkvm-clr:3] MacroExit(“SIP/1010-00000161”, “”) in new stack
— Executing [s@macro-auto-blkvm:3] ExecIf(“SIP/1010-00000161”, “0?Set(MASTER_CHANNEL(CONNECTEDLINE(num))=1010)”) in new stack
— Executing [s@macro-auto-blkvm:4] ExecIf(“SIP/1010-00000161”, “0?Set(MASTER_CHANNEL(CONNECTEDLINE(name))=Josh Hopkins)”) in new stack
— Feature Found: apprecord exten: apprecord
— Executing [s@macro-one-touch-record:1] ExecIf(“SIP/1010-00000161”, “0?Set(THISEXTEN=1010)”) in new stack
— Executing [s@macro-one-touch-record:2] ExecIf(“SIP/1010-00000161”, “1?Set(THISEXTEN=1010)”) in new stack
— Executing [s@macro-one-touch-record:3] ExecIf(“SIP/1010-00000161”, “1?MacroExit()”) in new stack
— Executing [h@macro-dial:1] Macro(“SIP/ BVTrunk -00000160”, “hangupcall”) in new stack
— Executing [s@macro-hangupcall:1] GotoIf(“SIP/ BVTrunk -00000160”, “1?theend”) in new stack
— Goto (macro-hangupcall,s,3)
— Executing [s@macro-hangupcall:3] ExecIf(“SIP/ BVTrunk -00000160”, “0?Set(CDR(recordingfile)=)”) in new stack
— Executing [s@macro-hangupcall:4] Hangup(“SIP/ BVTrunk -00000160”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 4) exited non-zero on ‘SIP/ BVTrunk -00000160’ in macro ‘hangupcall’
== Spawn extension (macro-dial, h, 1) exited non-zero on ‘SIP/ BVTrunk -00000160’
== Spawn extension (macro-dial, s, 7) exited non-zero on ‘SIP/BVTrunk-00000160’ in macro ‘dial’
== Spawn extension (from-did-direct, 1010, 21) exited non-zero on ‘SIP/BVTrunk-00000160’
== Extension Changed 1010[ext-local] new state Idle for Notify User 1004

[macro-one-touch-record]
include => macro-one-touch-record-custom exten => s,1,ExecIf($[“${PICKUP_EXTEN}”!=””]?Set(THISEXTEN=${CUT(CALLFILENAME,-,2)}))
exten => s,n,ExecIf($[“${THISEXTEN}”=””]?Set(THISEXTEN=${IF($[“${REALCALLERIDNUM}”=””]?${CUT(CALLFILENAME,-,2)}:${FROMEXTEN})}))
exten => s,n,ExecIf($[“${CUT(CALLFILENAME,-,1)}”=”exten” & “${DB(AMPUSER/${THISEXTEN}/recording/ondemand)}”!=”enabled”]?MacroExit())
exten => s,n,GotoIf($[“${MASTER_CHANNEL(ONETOUCH_REC)}”=”RECORDING”]?stoprec)
exten => s,n,GotoIf($[“${MASTER_CHANNEL(REC_POLICY_MODE)}”=”never”]?stopped)
exten => s,n,GotoIf($[“${MASTER_CHANNEL(ONETOUCH_REC)}”=”” & “${MASTER_CHANNEL(REC_STATUS)}”=”RECORDING”]?recording)
exten => s,n,Set(MASTER_CHANNEL(ONETOUCH_REC)=RECORDING)
exten => s,n,Set(MASTER_CHANNEL(REC_STATUS)=RECORDING)
exten => s,n(mixmon),Set(AUDIOHOOK_INHERIT(MixMonitor)=yes)
exten => s,n,MixMonitor(${MIXMON_DIR}${YEAR}/${MONTH}/${DAY}/${CALLFILENAME}.${MIXMON_FORMAT},a,${MIXMON_POST})
exten => s,n,Set(MON_FMT=${IF($[${LEN(${MIXMON_FORMAT})}]?${MIXMON_FORMAT}:wav)})
exten => s,n,Set(MASTER_CHANNEL(CDR(recordingfile))=${CALLFILENAME}.${MON_FMT})
exten => s,n,Set(MASTER_CHANNEL(ONETOUCH_RECFILE)=${CALLFILENAME}.${MON_FMT})
exten => s,n(recording),Playback(beep)
exten => s,n,MacroExit()
exten => s,n(stoprec),StopMixMonitor()
exten => s,n,Set(MASTER_CHANNEL(ONETOUCH_REC)=PAUSED)
exten => s,n,Set(MASTER_CHANNEL(REC_STATUS)=PAUSED)
exten => s,n,ExecIf($[“${THISEXTEN}”=””]?Set(THISEXTEN=${IF($[“${REALCALLERIDNUM}”=””]?${DIALEDPEERNUMBER}:${FROMEXTEN})}))
exten => s,n(stopped),Playback(beep&beep)
exten => s,n,MacroExit()

4 thoughts on - Call Recording

  • You should simplify until you have something that works, then add your conditions back in one line at a time.

    This is where the inbound call is exiting.

    This condition is causing MacroExit to be called, so fix these conditions.

  • Hello!

    I inherited an asterisk setup that works fine, but I’d like to make a change and it’s not working the way I want.

    Right now, our incoming calls are recorded at the “Queue” level. It works but it records hold music, etc and when the call is sent to an extension, the “Channel ID” (I think it’s called) is not accessible via the API to pause the recording. For those two reasons I would like the call recording to begin when the call is sent to an extension and answered.

    Our current setup is:

    Inbound route: Don’t Care Queue: Yes Extension: Don’t Care

    I thought I could change it to:

    Inbound route: Don’t Care Queue: Don’t care Extension: Yes

    but the calls are not recorded with this configuration. I tried Force on the Extension as well and still no luck.

    The “Call Recording” application has this enticing little bit of text…
    “If a call is to be recorded, it can start immediately which will incorporate any announcements, hold music, etc. prior to being answered, or it can have recording start at the time that call is answered.” but it doesn’t tell you how to achieve that. I tried putting the extension in here with Force and that also had no effect.

    I would appreciate any suggestions for troubleshooting or things to try.

    Thank you!

    – Ian

  • What front end are you using?

    What version of Asterisk, OS, etc?

    You may get more interest on a mailing list specific to that front end.

  • I’m not super sure about the names for these various things.. but it’s PBX in a Flash FreePBX 12.0.76.2 on CentOS6.5
    2.6.32-431.1.2.0.1.el6.x86_64 (SMP) x86_64.

    I see PBX in a Flash has a forum so I’ll hit them up too. Thanks!