Passing the TMPDIR to the shell

In my asterisk.service file I have PrivateTmp=true. So when I tell Asterisk to record a file to /tmp/foo.wav it actually records it to the apps tmp dir. For instance as of now it will record to /tmp/systemd-private-4cc0d667bd8a436cbf50dc66aebf8d16-asterisk.service-mfiTEc/tmp/foo.wav. I need to call the shell command to some work work with the file (in this case upload it to aws). The enviroment variable for the current tmp directory should be in $TMPDIR. So in theory I should be able to call this via shell
/usr/bin/aws s3 cp $TMPDIR/tmp/foo.wav s3://group-gift/2/campaign_greetings/1000.wav --profile my_profile

But that does not work. Any suggestions how I can get the tmp dir?

By using Asterisk System() application in a post-call "h"ang-up handler configured in your dial plan ?

No. I am looking to send a file up to AWS. If I don’t know the TMP DIR then I can’t specify it to upload it.

It sounds like a separate process then. The “JoinsNamespaceOf” systemd.unit configuration for this separate process might help you get this done.

$TMPDIR/tmp/foo.wav

You probably need to remove the /tmp/ part, or the $TMPDIR part - you probably do not want both.

Also, why not just refer to it as /tmp/foo.wav like you initially did to create the file?

  • Darrin

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.