Post Call Recording Script not Executing

Hi

I can’t seem to get my Post Call Recording script to work.

I have entered this - /var/lib/asterisk/agi-bin/test.sh in the Post Call Recording section in Advanced Settings.

The log below is what happens after initiating MixMonitor, then ending the call.

   == Begin MixMonitor Recording SIP/118-00001b0a
    -- Executing [[email protected]:1] Macro("SIP/116-00001b09", "hangupcall,") in new stack
    -- Executing [[email protected]:1] GotoIf("SIP/116-00001b09", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,3)
    -- Executing [[email protected]:3] ExecIf("SIP/116-00001b09", "0?Set(CDR(recordingfile)=)") in new stack
    -- Executing [[email protected]:4] Hangup("SIP/116-00001b09", "") in new stack
  == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'SIP/116-00001b09' in macro 'hangupcall'
  == Spawn extension (macro-dial-one, h, 1) exited non-zero on 'SIP/116-00001b09'
  == MixMonitor close filestream (mixed)
  == End MixMonitor Recording SIP/118-00001b0a
  == Spawn extension (macro-dial-one, s, 43) exited non-zero on 'SIP/116-00001b09' in macro 'dial-one'
  == Spawn extension (macro-exten-vm, s, 16) exited non-zero on 'SIP/116-00001b09' in macro 'exten-vm'
  == Spawn extension (Wollongong, 118, 2) exited non-zero on 'SIP/116-00001b09'
  == Extension Changed 118[ext-local] new state Idle for Notify User 100
  == Extension Changed 118[ext-local] new state Idle for Notify User 105
  == Extension Changed 118[ext-local] new state Idle for Notify User 111
  == Extension Changed 118[ext-local] new state Idle for Notify User 118
  == Extension Changed 116[ext-local] new state Idle for Notify User 100
  == Extension Changed 116[ext-local] new state Idle for Notify User 105
  == Extension Changed 116[ext-local] new state Idle for Notify User 111
  == Extension Changed 116[ext-local] new state Idle for Notify User 116
  == MixMonitor close filestream (mixed)
  == Executing [/var/lib/asterisk/agi-bin/test.sh]
  == End MixMonitor Recording SIP/116-00001b09

/var/lib/asterisk/agi-bin/test.sh is :

#!/bin/bash

mutt -s “test” [email protected] < /var/lib/asterisk/agi-bin/test2.txt

It should send me an email when the call is ended but it doesn’t. I have tested it by executing it manually and it works fine.

Any help is greatly appreciated.

asterisk might not know where or what mutt is, wagt does

which mutt

return?

/var/lib/asterisk/agi-bin/test.sh needs to be executable by the asterisk user, and you probably need to use – [email protected] for rather esoteric and escapist reasons I will not go into here

so

$(which mutt) -s “test” – [email protected] < /var/lib/asterisk/agi-bin/test2.txt

is probably more robust, if you have no needed mime “enclosures” then $(which mail) is always mo’ better

1 Like

Thanks for the response.

Still wasn’t able to get the script to work. I was only using mutt so that I get a notification if the script works but I actually want the script to copy files, so I have changed my script to :

if [ -d /var/spool/asterisk/monitor/ ]; then
cp /var/spool/asterisk/monitor/ /mnt/ntserver/Monitor/" "M -R
fi

Still unable to get it to execute.

I’m not surprised, the command is nonsense try reading

man cp

while your at it try also to read

man rsync

it’s a little more economic for your attempted pupose

:slight_smile:

(I’m also pretty sure that your directory /var/spool/asterisk/monitor/ always exists on a FreePBX server, where on earth did you you get that code from?)