Re: [asterisk-users] Voiceprompts i.e. voicemail and conferencing in multiple codecs
- Original Message - From: "Steve Edwards" To: "Asterisk Users Mailing List - Non-Commercial Discussion" Sent: Friday, 2 July, 2010 5:08:14 PM Subject: Re: [asterisk-users] Voiceprompts i.e. voicemail and conferencing in multiple codecs On Fri, 2 Jul 2010, Kenny Watson wrote: > for i in `ls -R /var/lib/asterisk/sounds/uk/*wav`; # do recursive ls and > only list wav files and loop through each one > do # start do loop > CONV=`echo $i|sed 's/.wav/.g729/g'` # set CONV variable as filename with > wav swapped for G729 > asterisk -rx "file convert $i $CONV" # run convert command placing > original filename and new filename in command > done # end loop First off, Digium provides "core" prompts in many encodings at http://downloads.asterisk.org/pub/telephony/sounds/ Assuming those packages don't meet your needs, this script doesn't do what you intended. Because you specified "*wav," the "ls -R" is not recursing through the directories, it's only listing the wav files in the specified directory. Without the "*wav," ls would recurse, but it wouldn't display the path. The "find" command is a better tool for this. Compare: $ ls -R /var/lib/asterisk/sounds/*wav | wc -l 241 and $ find /var/lib/asterisk/sounds/ -name '*.wav' | wc -l 1596 And then, a few suggestions* on "better practices." ) Use "$(" and ")" instead of back-ticks. They can be nested and they survive emailing, printers (the human kind), telephones, and strange fonts better. ) Use shell functions instead of processes. You create 2 processes for every file just to substitute the file type. ) Use upper case for variables** so they "stand out." ) Don't use single character variable names -- we don't code in FORTRAN any more do we? Also, they're obtuse and a bitch to search for in an editor. ) Use comments before a block of code instead of line by line. # Recurse through the input path, [ab]using Asterisk*** to # convert WAV files to G729 INPUT_PATH=/var/lib/asterisk/sounds/ for INPUT in $(find ${INPUT_PATH} -name '*.wav') do OUTPUT=${INPUT%.wav}.g729 asterisk -r -x "file convert ${INPUT} ${OUTPUT}" done # (end of snippet) I'm sure some shell weenie could code it all up in a single arcane line of cruft, but the goal should be clarity and maintainability. *) I recognize some of these suggestions reflect my "religious beliefs." If you all would "get over it" and "just convert" we can all "just get along." **) Being an "old-school c weenie" I don't know why I prefer upper case for variables in shell scripts, but I do. Whatever case you prefer, be consistent. ***) I know command line g729 encoders are hard to come by, but do you really want to explain to your boss that you crashed the PBX trying to convert some really funny Alison prompts you found on the net but one of them had a funky header and it exposed a hither-to unknown bug? -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users Hi Steve, Thank you for the extensive response, I'm using some UK prompts on my system so would like to convert them to g729. The new script and tips on scripting will be helpful. Thanks Kenny -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Voiceprompts i.e. voicemail and conferencing in multiple codecs
On Fri, 2 Jul 2010, Kenny Watson wrote: > for i in `ls -R /var/lib/asterisk/sounds/uk/*wav`; # do recursive ls and > only list wav files and loop through each one > do # start do loop > CONV=`echo $i|sed 's/.wav/.g729/g'` # set CONV variable as filename with > wav swapped for G729 > asterisk -rx "file convert $i $CONV" # run convert command placing > original filename and new filename in command > done # end loop First off, Digium provides "core" prompts in many encodings at http://downloads.asterisk.org/pub/telephony/sounds/ Assuming those packages don't meet your needs, this script doesn't do what you intended. Because you specified "*wav," the "ls -R" is not recursing through the directories, it's only listing the wav files in the specified directory. Without the "*wav," ls would recurse, but it wouldn't display the path. The "find" command is a better tool for this. Compare: $ ls -R /var/lib/asterisk/sounds/*wav | wc -l 241 and $ find /var/lib/asterisk/sounds/ -name '*.wav' | wc -l 1596 And then, a few suggestions* on "better practices." ) Use "$(" and ")" instead of back-ticks. They can be nested and they survive emailing, printers (the human kind), telephones, and strange fonts better. ) Use shell functions instead of processes. You create 2 processes for every file just to substitute the file type. ) Use upper case for variables** so they "stand out." ) Don't use single character variable names -- we don't code in FORTRAN any more do we? Also, they're obtuse and a bitch to search for in an editor. ) Use comments before a block of code instead of line by line. # Recurse through the input path, [ab]using Asterisk*** to # convert WAV files to G729 INPUT_PATH=/var/lib/asterisk/sounds/ for INPUT in $(find ${INPUT_PATH} -name '*.wav') do OUTPUT=${INPUT%.wav}.g729 asterisk -r -x "file convert ${INPUT} ${OUTPUT}" done # (end of snippet) I'm sure some shell weenie could code it all up in a single arcane line of cruft, but the goal should be clarity and maintainability. *) I recognize some of these suggestions reflect my "religious beliefs." If you all would "get over it" and "just convert" we can all "just get along." **) Being an "old-school c weenie" I don't know why I prefer upper case for variables in shell scripts, but I do. Whatever case you prefer, be consistent. ***) I know command line g729 encoders are hard to come by, but do you really want to explain to your boss that you crashed the PBX trying to convert some really funny Alison prompts you found on the net but one of them had a funky header and it exposed a hither-to unknown bug? -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Voiceprompts i.e. voicemail and conferencing in multiple codecs
- Original Message - From: "Paul Belanger" To: "Asterisk Users Mailing List - Non-Commercial Discussion" Sent: Tuesday, 29 June, 2010 10:22:18 PM Subject: Re: [asterisk-users] Voiceprompts i.e. voicemail and conferencing in multiple codecs On Tue, Jun 29, 2010 at 12:51 PM, Kenny Watson wrote: > Is it simply a case of converting the prompts into other codecs and asterisk > will pick these up? > Yes, install both g729 and ulaw/alaw prompts to avoid trans-coding altogether. -- Paul Belanger | dCAP Polybeacon | Consultant Jabber: paul.belan...@polybeacon.com | IRC: pabelanger (Freenode) blog.polybeacon.com -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users Not sure if this will help anyone else but I wrote a small script to convert the sound files in my uk folder to g729 using asterisk (with some help from the net). The script is below, thanks Kenny for i in `ls -R /var/lib/asterisk/sounds/uk/*wav`; # do recursive ls and only list wav files and loop through each one do # start do loop CONV=`echo $i|sed 's/.wav/.g729/g'` # set CONV variable as filename with wav swapped for G729 asterisk -rx "file convert $i $CONV" # run convert command placing original filename and new filename in command done # end loop -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Voiceprompts i.e. voicemail and conferencing in multiple codecs
On Tue, Jun 29, 2010 at 12:51 PM, Kenny Watson wrote: > Is it simply a case of converting the prompts into other codecs and asterisk > will pick these up? > Yes, install both g729 and ulaw/alaw prompts to avoid trans-coding altogether. -- Paul Belanger | dCAP Polybeacon | Consultant Jabber: paul.belan...@polybeacon.com | IRC: pabelanger (Freenode) blog.polybeacon.com -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
[asterisk-users] Voiceprompts i.e. voicemail and conferencing in multiple codecs
Hi, I am running asterisk 1.6.1.6 with a howler screamer card. I have g729 and alaw trunks from a pbx /sip providers. The howler screamer will only transcode from g729 to alaw / ulaw but my voice prompts are in SLIN and throws errors when i try and access these applications. Is it simply a case of converting the prompts into other codecs and asterisk will pick these up? Thanks Kenny -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users