[asterisk-dev] [Code Review] Patch: Adds 'astsounddir' configuration option to asterisk.conf.

lottc reviewboard at asterisk.org
Wed Jan 19 09:41:24 CST 2011



> On 2011-01-19 03:43:03, Tzafrir Cohen wrote:
> > Why not set 'astdatadir' instead?

Modifying 'astdatadir' effects several other aspects of the program for which there are no way of overriding.

channels/chan_iax2.c: firmware path
main/image.c: images path
main/xmldoc.c: documentation path
main/http.c: static-http path
res/res_phoneprov.c: phoneprov path
res/res_agi.c: agi-bin path (this can be overridden)


If one wanted to cache the sounds (reducing the IO overhead from reading sounds files off disk), they would either need to cache the entire 'astdatadir' or symlink the sounds directory from a tmpfs (or other) mount-point.  By setting 'astsounddir', I can create a persistent in-memory sounds cache, updating the sounds files as needed (startup/update).

/etc/asterisk/asterisk.conf: astsounddir => /mnt/ramdisk/sounds

Add to a cron-job and/or the asterisk init.d file:
mkdir -p /mnt/ramdisk
mount -t tmpfs tmpfs /mnt/ramdisk
cp -au /var/lib/asterisk/sounds /mnt/ramdisk


A more elegant solution would be to have Asterisk manage a sounds cache, storing commonly accessed files in memory...but until then, this works equally well.

-Lott Caskey


- lottc


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1080/#review3107
-----------------------------------------------------------


On 2011-01-19 03:34:16, lottc wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1080/
> -----------------------------------------------------------
> 
> (Updated 2011-01-19 03:34:16)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> The patch adds the 'astsounddir' option to /etc/asterisk/asterisk.conf.
> This allows you to override Asterisk's sound directory without needing to
> make symlinks.  A practical application of this would be to load the contents
> of /var/lib/asterisk/sounds into a tmpfs or ramdisk mount.  Asterisk will then
> read the files directly from memory (provided tmpfs hasn't swapped) instead of
> a calling out to disk for every file.
> 
> This patch also adds the Sounds directory location to 'core show settings'.
> 
> 
> Diffs
> -----
> 
>   /trunk/Makefile 302411 
>   /trunk/apps/app_dial.c 302411 
>   /trunk/build_tools/make_defaults_h 302411 
>   /trunk/include/asterisk/paths.h 302411 
>   /trunk/main/app.c 302411 
>   /trunk/main/asterisk.c 302411 
>   /trunk/main/file.c 302411 
> 
> Diff: https://reviewboard.asterisk.org/r/1080/diff
> 
> 
> Testing
> -------
> 
> Compiled.
> Verified that setting astsounddir overrides default with 'core show settings'.
> Tested playback of sounds.
> Has been running on about a dozen systems for 1+ month.
> 
> 
> Thanks,
> 
> lottc
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110119/a399b717/attachment.htm>


More information about the asterisk-dev mailing list