For one, you might want to trigger after the hangup so you can get the mixed, complete recording.
Second, it might be better to send this to an AGI script to do the curl. My example is PHP but it could be Perl, Python, whatever floats your boat.
Then, in /var/lib/asterisk/agi-bin/ create recordupload.php:
#!/usr/bin/php
<?php>
require(‘phpagi.php’);
$agi = new AGI();
function curl_upload($recording) {
…your curl specific stuff…
}
sleep(5); //Delay a few seconds to make sure recording is finished and mixed
$datepath = date(“/Y/m/d/”);
$astspooldir = $agi->get_variable(“ASTSPOOLDIR”);
$callfile = $agi->get_variable(“CALLFILENAME”);
$fullpath = $astspooldir[‘data’].“/monitor”.$datepath.$callfile[‘data’].“.wav”;
curl_upload($fullpath);
You can add some kind of file name or identifier wherever you want, anything you can think of.
Good Luck!