Archive for September, 2013

Asterisk run user

Friday, September 27th, 2013

When installing Asterisk from source, you need to create an unprivileged user manually.
Add to /etc/group something like:
asterisk:x:110:
and to /etc/passwd:
asterisk:x:107:110:Asterisk PBX daemon,,,:/var/lib/asterisk:/bin/false
Just set unused GID and UID.

Then change permissions:
chown -R asterisk:asterisk /var/lib/asterisk/
chown -R asterisk:asterisk /var/spool/asterisk/
chown -R asterisk:asterisk /var/log/asterisk/
chown -R asterisk:asterisk /var/run/asterisk/

And finally, set the running user in asterisk.conf.

It is not mentioned in the Book, but I think chown‘ing /etc/asterisk/ with the -R option is also worth doing; changing config files (not directories, if exist) permissions in /etc/asterisk to 640 either.

Putting a plenty of numbers to the blacklist

Monday, September 16th, 2013

for i in (list_numbers); do
asterisk -rx "database put blacklist $i 1"
done

Where ‘list_numbers’ is your file with numbers.
Tnanks to zzuz.

How to define an Asterisk module by function name

Monday, September 16th, 2013

Asterisk has a nice function PITCH_SHIFT, which can modify caller’s/callee’s voice. Let’s imagine, we have a system without autoloaded modules, and we need to find which module provides this function.

1. Go to the astmoddir (I have a Debian system):

cd /usr/lib/asterisk/modules

2. Find.

root@voiprouter1:/usr/lib/asterisk/modules# grep PITCH *
Binary file func_pitchshift.so matches
root@voiprouter1:/usr/lib/asterisk/modules#

3. We can also find the dependencies:

root@voiprouter1:/usr/lib/asterisk/modules# ldd func_pitchshift.so
linux-gate.so.1 => (0xb776e000)
libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xb7747000)
libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb75e4000)
/lib/ld-linux.so.2 (0xb776f000)

4. That’s it! Thanks to meral.