Hello, I have to following dial plan. exten => 5551234,1,Answer() exten => 5551234,n,Read(ACCOUNTNUMBER|/var/lib/asterisk/clientsounds/company/recordingsystem/welcome_accountnumberplease) exten => 5551234,n,Read(MENUNUMBER|/var/lib/asterisk/clientsounds/ company /recordingsystem/menu_number_please) exten => 5551234,n,Read(WHICHMESSAGE|/var/lib/asterisk/clientsounds/ company /recordingsystem/whichmessage|1) exten => 5551234,n,Playback(/var/lib/asterisk/clientsounds/kesher/recordingsystem/recordaftertone) exten => 5551234,n,Record(/var/lib/asterisk/clientsounds/features/${ACCOUNTNUMBER}/${MENUNUMBER}/${WHICHMESSAGE}.wav) However, Record fails if the directory doesnt exist. How can I automatically create the directory before (or while) running the Record command? Thanks Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100817/0e38f9d6/attachment.htm
Solved. exten => 5551234,1,Answer() exten => 5551234,n,Read(ACCOUNTNUMBER|/var/lib/asterisk/clientsounds/ company /recordingsystem/welcome_accountnumberplease) exten => 5551234,n,System(mkdir /var/lib/asterisk/clientsounds/features/${ACCOUNTNUMBER}) exten => 5551234,n,Read(MENUNUMBER|/var/lib/asterisk/clientsounds/ company /recordingsystem/menu_number_please) exten => 5551234,n,System(mkdir /var/lib/asterisk/clientsounds/features/${ACCOUNTNUMBER}//${MENUNUMBER}) exten => 5551234,n,Read(WHICHMESSAGE|/var/lib/asterisk/clientsounds/ company /recordingsystem/whichmessage|1) exten => 5551234,n,Playback(/var/lib/asterisk/clientsounds/ company /recordingsystem/recordaftertone) exten => 5551234,n,Record(/var/lib/asterisk/clientsounds/features/${ACCOUNTNUMBER}/${MENUNUMBER}/${WHICHMESSAGE}.wav) From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Dan Journo Sent: 17 August 2010 15:10 To: asterisk-users at lists.digium.com Subject: [asterisk-users] Create File Directory Hello, I have to following dial plan. exten => 5551234,1,Answer() exten => 5551234,n,Read(ACCOUNTNUMBER|/var/lib/asterisk/clientsounds/company/recordingsystem/welcome_accountnumberplease) exten => 5551234,n,Read(MENUNUMBER|/var/lib/asterisk/clientsounds/ company /recordingsystem/menu_number_please) exten => 5551234,n,Read(WHICHMESSAGE|/var/lib/asterisk/clientsounds/ company /recordingsystem/whichmessage|1) exten => 5551234,n,Playback(/var/lib/asterisk/clientsounds/kesher/recordingsystem/recordaftertone) exten => 5551234,n,Record(/var/lib/asterisk/clientsounds/features/${ACCOUNTNUMBER}/${MENUNUMBER}/${WHICHMESSAGE}.wav) However, Record fails if the directory doesnt exist. How can I automatically create the directory before (or while) running the Record command? Thanks Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100817/fd501adc/attachment.htm
Un-top-posting... On Tue, 17 Aug 2010, Dan Journo wrote:> I have to following dial plan.[snip]> However, Record fails if the directory doesnt exist. > > How can I automatically create the directory before (or while) running > the Record command?(Seems like a reasonable feature to add to the record application...) On Tue, 17 Aug 2010, Dan Journo wrote:> Solved. > > exten => 5551234,n,Read(ACCOUNTNUMBER|/var/lib/asterisk/clientsounds/ company > /recordingsystem/welcome_accountnumberplease) > exten => 5551234,n,System(mkdir /var/lib/asterisk/clientsounds/features/${ACCOUNTNUMBER}) > exten => 5551234,n,Read(MENUNUMBER|/var/lib/asterisk/clientsounds/ company /recordingsystem/menu_number_please) > exten => 5551234,n,System(mkdir /var/lib/asterisk/clientsounds/features/${ACCOUNTNUMBER}//${MENUNUMBER}) > exten => 5551234,n,Read(WHICHMESSAGE|/var/lib/asterisk/clientsounds/ company /recordingsystem/whichmessage|1) > exten => 5551234,n,Playback(/var/lib/asterisk/clientsounds/ company /recordingsystem/recordaftertone) > exten => 5551234,n,Record(/var/lib/asterisk/clientsounds/features/${ACCOUNTNUMBER}/${MENUNUMBER}/${WHICHMESSAGE}.wav)Ugly*, but if it works for you... If you add the "--parents" command line option, the first mkdir is unnecessary. *) Personally, I would wrap all of this into a simple AGI (record-client-message?) where you could handle errors better and make it easier to re-use the logic for multiple extensions. -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000