Summary:ASTERISK-20593: [patch] Future-dated call files are ignored when astspooldir is relative
Reporter:James Le Cuirot (chewi)Labels:
Date Opened:2012-10-22 06:11:01Date Closed:2012-11-14 13:57:45.000-0600
Versions:10.9.0 Frequency of
Environment:Fedora 17, Linux kernel 3.6.2-4.fc17.x86_64Attachments:( 0) 0004-Fix-future-call-files-from-relative-directories.patch
Description:I develop for a number of projects involving Asterisk and therefore find it easiest to configure it with relative directories. This also makes deployment to other development and production boxes simpler. Besides a couple of gotchas (such as astctl being relative to astrundir), this has been working well.

However, I discovered today that it breaks call files dated in the future. They are simply ignored and no log messages are seen. This can easily be verified using touch.

# touch foo (warning about invalid contents appears)
# touch -d "10 seconds" foo (nothing appears)

I had a look at pbx_spool.c and queue_file turned out to be the culprit. It checks whether filename starts with '/' and prepends qdir if it doesn't. Future-dated files are processed a second time and when a relative directory is involved, qdir will be prepended twice because it doesn't start with '/'. I tried checking for '.' as well, which worked, but it broke dot-files. These should probably be ignored anyway but that's a separate issue. In the end, I used strchr(filename, '/') instead, which does the trick. I don't believe that will cause anything else to break.
Comments:By: James Le Cuirot (chewi) 2012-10-22 06:14:48.912-0500

Patch to fix pbx_spool module so that future-dated call files are picked up from relative directories.

By: Walter Doekes (wdoekes) 2012-10-23 05:48:05.346-0500

I say: Ship it!

As far as I can tell, there are only basename-only filenames and filenames with qdir prepended (queue_file(), scan_service()), so the change should be safe.