lunedì 23 dicembre 2013

901901, The killer extension

You may want to configure a cool "reboot extension" to your box. This modification to your extensions.conf will do the trick:

exten => 901901,1,Answer
exten => 901901,n,Authenticate(2345)
exten => 901901,n,Playback(vm-goodbye)
exten => 901901,n,System(/sbin/shutdown -r now)
exten => 901901,n,Hangup()

By calling the 901901 extension your system will reboot (password "2345" is required). The Hangup() command makes sense since Asterisk is cleanly dying!

Spaghetti core sounds

Here is how to get your system to speak italian language in exactly 2 minutes:

mkdir it

cd it/

wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-it-ulaw-current.tar.gz

tar zxvf asterisk-core-sounds-it-ulaw-current.tar.gz

rm -rf asterisk-core-sounds-it-ulaw-current.tar.gz

cd ..

mv it/ /var/lib/asterisk/sounds/

nano /etc/asterisk/asterisk.conf

uncomment:

languageprefix=yes

modify:

defaultlanguage=it

save, exit and

shutdown -r now

1'58''.....1'59''.....DONE!

Built-in call park feature

Add this line to any of your contexts

include => parkedcalls

And reload the dialplan by typing

asterisk -rx "dialplan reload"

Call any extension, say 6001, then transfer the call to extension 700. The system will output the "parking lot" where the call has been parked, say 701. Now any user can pick up the call by calling extension 701.

Don't try this @home!!!

Comment out the only line in

/etc/modprobe.d/dist-oss.conf

Then add this extension to your dialplan:

exten => 912345,1,Dial(console/dsp,20)
exten => 912345,n,Hangup()

Reload your server and call the 912345 extension: you've just turned out your system into a stealth microphone that silently broadcasts your voice to any logged in user...

Turn off any cdr logging

Here is the simple configuration task that turns off any CDR logging:

nano /etc/asterisk/modules.conf

Add this line:

noload => cdr_csv.so

Save, exit and do an

asterisk -rx "restart gracefully"

From now on, Asterisk won't log any received, missed, failed inbound or outbound call: nothing can be less Calea compliant!

domenica 22 dicembre 2013

Dialable entities one-liner

With this one-liner you get all the "dialable entities" of your dialplan:

asterisk -rx "dialplan show" | cut -d' ' -f3 |  grep '^..' | grep -o '[0-9]*' | uniq

EXPLANATION:

asterisk -rx "dialplan show" --> Asterisk CLI command that shows the loaded dialplan

| cut -d' ' -f3 --> shows only the third field of each line (with whitespace as the delimiter)

| grep '^..' --> removes empty lines

| grep -o '[0-9]*' --> filters out anything non-numeric

| uniq --> removes duplicates