Jonathan H
2016-Nov-04 22:14 UTC
[asterisk-users] Any way of creating a file to write to from the dialplan, or must I use AGI?
That's just what I'm using, John. But I'm getting (eg) [Nov 4 21:46:16] ERROR[1676][C-00000003]: func_env.c:449 file2format: Cannot open '/home/logs/anonymous.txt': No such file or directory [Nov 4 21:46:16] ERROR[1676][C-00000003]: func_env.c:949 file_write: File '/home/logs/anonymous.txt' not in line format Asterisk is running as root (yeah, I know!), and has permissions on that directory. Hmmm.... On 4 November 2016 at 21:50, John Kiniston <johnkiniston at gmail.com> wrote:> I'm able to use the FILE function to create files just fine. > > Set(FILE(${CALLFILE},,,al,u)=Extension: s) > > On Fri, Nov 4, 2016 at 2:26 PM, Jonathan H <lardconcepts at gmail.com> wrote: >> >> Seems I can write to an existing file, but is there really no way of >> creating a new file to log some data to, without reverting to AGI? >> (will be different for each caller ID) >> >> -- >> _____________________________________________________________________ >> -- Bandwidth and Colocation Provided by http://www.api-digital.com -- >> >> Check out the new Asterisk community forum at: >> https://community.asterisk.org/ >> >> New to Asterisk? Start here: >> https://wiki.asterisk.org/wiki/display/AST/Getting+Started >> >> asterisk-users mailing list >> To UNSUBSCRIBE or update options visit: >> http://lists.digium.com/mailman/listinfo/asterisk-users > > > > > -- > A human being should be able to change a diaper, plan an invasion, butcher a > hog, conn a ship, design a building, write a sonnet, balance accounts, build > a wall, set a bone, comfort the dying, take orders, give orders, cooperate, > act alone, solve equations, analyze a new problem, pitch manure, program a > computer, cook a tasty meal, fight efficiently, die gallantly. > Specialization is for insects. > ---Heinlein > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: > https://community.asterisk.org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users
John Kiniston
2016-Nov-04 23:02 UTC
[asterisk-users] Any way of creating a file to write to from the dialplan, or must I use AGI?
Could it be SELinux blocking you? If you change the path to /tmp does it work? On Fri, Nov 4, 2016 at 3:14 PM, Jonathan H <lardconcepts at gmail.com> wrote:> That's just what I'm using, John. > > But I'm getting (eg) > > [Nov 4 21:46:16] ERROR[1676][C-00000003]: func_env.c:449 file2format: > Cannot open '/home/logs/anonymous.txt': No such file or directory > [Nov 4 21:46:16] ERROR[1676][C-00000003]: func_env.c:949 file_write: > File '/home/logs/anonymous.txt' not in line format > > Asterisk is running as root (yeah, I know!), and has permissions on > that directory. Hmmm.... > > On 4 November 2016 at 21:50, John Kiniston <johnkiniston at gmail.com> wrote: > > I'm able to use the FILE function to create files just fine. > > > > Set(FILE(${CALLFILE},,,al,u)=Extension: s) > > > > On Fri, Nov 4, 2016 at 2:26 PM, Jonathan H <lardconcepts at gmail.com> > wrote: > >> > >> Seems I can write to an existing file, but is there really no way of > >> creating a new file to log some data to, without reverting to AGI? > >> (will be different for each caller ID) > >> > >> -- > >> _____________________________________________________________________ > >> -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > >> > >> Check out the new Asterisk community forum at: > >> https://community.asterisk.org/ > >> > >> New to Asterisk? Start here: > >> https://wiki.asterisk.org/wiki/display/AST/Getting+Started > >> > >> asterisk-users mailing list > >> To UNSUBSCRIBE or update options visit: > >> http://lists.digium.com/mailman/listinfo/asterisk-users > > > > > > > > > > -- > > A human being should be able to change a diaper, plan an invasion, > butcher a > > hog, conn a ship, design a building, write a sonnet, balance accounts, > build > > a wall, set a bone, comfort the dying, take orders, give orders, > cooperate, > > act alone, solve equations, analyze a new problem, pitch manure, program > a > > computer, cook a tasty meal, fight efficiently, die gallantly. > > Specialization is for insects. > > ---Heinlein > > > > -- > > _____________________________________________________________________ > > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > > > Check out the new Asterisk community forum at: > > https://community.asterisk.org/ > > > > New to Asterisk? Start here: > > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > > > asterisk-users mailing list > > To UNSUBSCRIBE or update options visit: > > http://lists.digium.com/mailman/listinfo/asterisk-users > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: https://community.asterisk. > org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-- A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. ---Heinlein -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20161104/183e0ed7/attachment.html>
Jonathan H
2016-Nov-05 17:40 UTC
[asterisk-users] Any way of creating a file to write to from the dialplan, or must I use AGI?
Ugh. Thanks, John. I took another look at your example, and saw that you had a ,u at the end. So, even though that supposedly only specifies the line format, it also seems to act as "create if not exist". Problem solved - thanks! I'll add that to my ever lengthening list of Asterisk tips/gotchas! On 4 November 2016 at 23:02, John Kiniston <johnkiniston at gmail.com> wrote:> Could it be SELinux blocking you? > > If you change the path to /tmp does it work? > > > On Fri, Nov 4, 2016 at 3:14 PM, Jonathan H <lardconcepts at gmail.com> wrote: >> >> That's just what I'm using, John. >> >> But I'm getting (eg) >> >> [Nov 4 21:46:16] ERROR[1676][C-00000003]: func_env.c:449 file2format: >> Cannot open '/home/logs/anonymous.txt': No such file or directory >> [Nov 4 21:46:16] ERROR[1676][C-00000003]: func_env.c:949 file_write: >> File '/home/logs/anonymous.txt' not in line format >> >> Asterisk is running as root (yeah, I know!), and has permissions on >> that directory. Hmmm.... >> >> On 4 November 2016 at 21:50, John Kiniston <johnkiniston at gmail.com> wrote: >> > I'm able to use the FILE function to create files just fine. >> > >> > Set(FILE(${CALLFILE},,,al,u)=Extension: s) >> > >> > On Fri, Nov 4, 2016 at 2:26 PM, Jonathan H <lardconcepts at gmail.com> >> > wrote: >> >> >> >> Seems I can write to an existing file, but is there really no way of >> >> creating a new file to log some data to, without reverting to AGI? >> >> (will be different for each caller ID) >> >> >> >> -- >> >> _____________________________________________________________________ >> >> -- Bandwidth and Colocation Provided by http://www.api-digital.com -- >> >> >> >> Check out the new Asterisk community forum at: >> >> https://community.asterisk.org/ >> >> >> >> New to Asterisk? Start here: >> >> https://wiki.asterisk.org/wiki/display/AST/Getting+Started >> >> >> >> asterisk-users mailing list >> >> To UNSUBSCRIBE or update options visit: >> >> http://lists.digium.com/mailman/listinfo/asterisk-users >> > >> > >> > >> > >> > -- >> > A human being should be able to change a diaper, plan an invasion, >> > butcher a >> > hog, conn a ship, design a building, write a sonnet, balance accounts, >> > build >> > a wall, set a bone, comfort the dying, take orders, give orders, >> > cooperate, >> > act alone, solve equations, analyze a new problem, pitch manure, program >> > a >> > computer, cook a tasty meal, fight efficiently, die gallantly. >> > Specialization is for insects. >> > ---Heinlein >> > >> > -- >> > _____________________________________________________________________ >> > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- >> > >> > Check out the new Asterisk community forum at: >> > https://community.asterisk.org/ >> > >> > New to Asterisk? Start here: >> > https://wiki.asterisk.org/wiki/display/AST/Getting+Started >> > >> > asterisk-users mailing list >> > To UNSUBSCRIBE or update options visit: >> > http://lists.digium.com/mailman/listinfo/asterisk-users >> >> -- >> _____________________________________________________________________ >> -- Bandwidth and Colocation Provided by http://www.api-digital.com -- >> >> Check out the new Asterisk community forum at: >> https://community.asterisk.org/ >> >> New to Asterisk? Start here: >> https://wiki.asterisk.org/wiki/display/AST/Getting+Started >> >> asterisk-users mailing list >> To UNSUBSCRIBE or update options visit: >> http://lists.digium.com/mailman/listinfo/asterisk-users > > > > > -- > A human being should be able to change a diaper, plan an invasion, butcher a > hog, conn a ship, design a building, write a sonnet, balance accounts, build > a wall, set a bone, comfort the dying, take orders, give orders, cooperate, > act alone, solve equations, analyze a new problem, pitch manure, program a > computer, cook a tasty meal, fight efficiently, die gallantly. > Specialization is for insects. > ---Heinlein > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: > https://community.asterisk.org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users