[Asterisk-Users] Hint: how to include dialplan files from remote systems

Tzafrir Cohen tzafrir at cohens.org.il
Fri Dec 2 02:16:28 MST 2005


On Thu, Dec 01, 2005 at 06:51:54PM -0800, John Todd wrote:

> #exec /usr/bin/curl -s http://webserver.domain.com/privatefiles/username-to-numbers > /etc/asterisk/username-to-numbers
> #include username-to-numbers

Nice. However, what happens if curl takes longer than expected? your
reload waits for it.

And what if you get a broken copy? I figure you should generally fetch
to a temporary file and only replace the working copy if the download
was successful.

Something like (untested):

  filename=`mktemp`
  destination=/etc/asterisk/username-to-numbers
  wget -q -O$filename && cp $filename $destination
  rm $filename

This still won't report errors up, and won't do any single sanity
check, but you get my point.

-- 
Tzafrir Cohen         | tzafrir at jbr.cohens.org.il | VIM is
http://tzafrir.org.il |                           | a Mutt's  
tzafrir at cohens.org.il |                           |  best
ICQ# 16849755         |                           | friend



More information about the asterisk-users mailing list