Phone Extension Variable in 'Run after record:' Script

Hello the Asterisk Forum

I’m looking to rename call files to include the phone number and extension to meet an archiving requirement.

My approach has been to use a simple shell script that is invoked when a call ends. The script is specified through the GUI under ‘PBX\PBX Configuration\General Settings\Run after record’. Into this script I am passing the variables ^{CALLERID(num)} and ^{SIPCALLID}.

This works perfectly when I am making an outbound call, however inbound calls are missing the SIPCALLID data. I get the number no problem.

Any ideas what is going wrong please?

Kind Regards,
Luke