Summary:ASTERISK-01320: [patch] Add file-management applications to asterisk
Reporter:oacyscom (oacyscom)Labels:
Date Opened:2004-03-31 16:53:27.000-0600Date Closed:2011-06-07 14:05:27
Versions:Frequency of
Environment:Attachments:( 0) app_file.c
( 1) app_file.c
Description:This patch adds several useful (to me) file-management apps to asterisk: Copy, Move (Rename), Delete and Exists. Very beta.


This file compiles (on my system) and does not crash asterisk (on my system). I've tested all the features and they work, but there are a few existing bugs: Copy, Rename and Delete terminate the call on completion instead of continuing in the priority. My testing server is down for a while, so I decided to release the beta rather than sit on this until I get a new server.
Comments:By: slepp (slepp) 2004-04-02 02:35:45.000-0600

I might suggest naming the applications FileXxxx instead of just 'Exists'. Exists could easily be confused for an application to check for existance of a channel.

Line 81 is inconsistent with the synopsis for Exists.

Check through the code for some more of these.

By: twisted (twisted) 2004-04-29 09:35:08

I believe slePP is correct here... Any update?

By: oacyscom (oacyscom) 2004-04-29 16:26:31

Just got my testing server up and running and fixed and remaining bugs (that I know of). The most recent file works fine on my machine. One outstanding issue is that currently these apps log an error but return 0 on failure. What is the proper behavior? Return -1; probably. Jump to extension n+101; probably not.

By: twisted (twisted) 2004-04-29 22:45:00

Actually, jump to extension n+101 on failure WOULD be the correct action on failed command like this.  DBPut/Get do this, as well as many other apps that deal with data manipulation.

By: twisted (twisted) 2004-05-02 23:13:35

Just spoke to markster about this.   What he'd like to see (and i would too, honestly) is to be able to perform the same functions from the CLI, by hand.  It's already good in the fact that we can do it via the phone, but we'd appreciate a cli command interface to perform these functions without having to bash out.

By: Brian West (bkw918) 2004-05-02 23:15:04

Why?  is ! too hard to type?  Why? OH why?


By: oacyscom (oacyscom) 2004-05-03 11:53:11

twisted: Okay, I'll work on that as soon as I figure out a strange bug that I'm seeing.

bkw918: I can see two reasons. First, on a secure box (i.e. a VoIP appliance) ! would be a Bad Thing. Second, the files might not always be located in the same base path. Adding file management commands to the CLI lets you (eg) write scripts that will work on any machine without needing to parse the config file (i.e. just do `asterisk -rx 'file move me/outofoffice me/status'`)

By: twisted (twisted) 2004-05-23 23:23:51

Any update on this?

By: Brian West (bkw918) 2004-05-24 10:04:40

well I for one don't want to see anything that can delete, move or rename files in the CLI or as an app.  Asterisk runs as root and if you have a bug then the fun will begin.


By: oacyscom (oacyscom) 2004-05-24 12:16:24

twisted: I need someone to try this out on a devel system and (hopefully) tell me what I'm doing wrong. FileExists works perfectly. The other apps work, but they randomly report failure when they should have succeeded. I assume it's something to do with either shared memory or improper locking, but I can't find the problem.

By: flavour (flavour) 2004-05-24 12:29:47

I agree with bkw that it's potentially very dangerous, but on my system this is mitigated by running as non-root.
Maybe the default install should have this app noload=> in modules.conf, along with a warning note.
This way those that need it can enable it, but it's one less hole in the default config...

By: oacyscom (oacyscom) 2004-05-24 12:36:06

Definately should be noload'd by default. As a side not, FC2 now supports Mandatory Access Control as another way to solve this problem.

By: twisted (twisted) 2004-06-16 23:53:11

For the sake of sanity, as much as I'd like to see this happen and all, there are indeed too many security risks in having bugs in this.  I'm going to suspend this, however, not close it, until we can get to a point where it's stable.  Possibly we should have this worked on off-the-tracker for awhile, and post it back here when we believe we have ZERO bugs in this app.