How to divert a call to cell phone number in freepbx

In many occasions it happens that the users (especially managers) would like to divert their extensions to their mobile phone numbers.  To do this we can simply use the follow-me for the extension and add the phone number as the second priority followed by #.

Note: you must take into account the outbound route dial pattern and use the same pattern in follow me.

As can be seen above, if extension 1007 doesn’t answer for more than 25 sec (about 5 rings) the call will be diverted to 0123334455.

Continue Reading

How to backup/Restore in mysql

Dump all databases for backup. Backup file is sql commands to recreate all db’s.

# mysqldump -u root -ppassword --opt > alldatabases.sql

Dump one database for backup.

# [mysql dir]/bin/mysqldump -u username -ppassword
 --databases databasename >/tmp/databasename.sql

Dump a table from a database.

# mysqldump -c -u username -password databasename tablename > /tablename.sql

Restore database (or database table) from backup.

# mysql -u username -password databasename < /tmp/databasename.sql

Load a CSV file into a table.

mysql> LOAD DATA INFILE '/tmp/filename.csv' replace INTO
TABLE [table name] FIELDS TERMINATED BY ',' LINES TERMINATED BY
 'n' (field1,field2,field3);
Continue Reading

How to execute script automatically after startup with root priviliges

There are 2 ways to do this:

  1. Simply put the commands you want at /etc/rc.local
  2. Put your script in the /etc/init.d directory. After you make the script executable, use the following command to add the symbolic links: Code:
update-rc.d your_script_name defaults

If you ever want to remove the script from the startup sequence, use this: Code:

update-rc.d -f  your_script_name remove

You might want to give a look at the update-rc.d man page for further options you can use with the command.

Continue Reading

Copying Files over the Network with scp

To ”’send”’ file or directory ”’to a remote computer”’:
scp -r [/path/filename] [login name@ip address] :

To ”’retrieve”’ file or directory ”’from a remote computer”’  ”’address in your pc”’:
scp -r [login name@ip address] : [/path/filename]  [/path/filename]

Here are the meaning of scp command options:

-r &mdash; recursively copy entire directory
. &mdash; current directory

Examples:

To copy all txt files in the current directory to your home directory on the destination machine:
scp *.txt 192.168.1.100:

To copy txt files to a destination directory. You have to have write permission on the target directory:
scp *.txt 192.168.1.100:/home/username/directory

To retrieve files from the other machine back to the one you’re on:
scp 192.168.1.100:*.txt /home/support/Desktop

Continue Reading

How To Delete File Contents In Linux

How To Delete File Contents In Linux

I am sure you know that situation when you need to delete file contents in Linux. Just think about it – you have some log files on your Linux workstation or server, and their size just keeps growing and growing… Sometimes, it’s really necessary to delete the content of the file, but keep the file itself. So… how can you do that?

In Linux, deleting file content while keeping the file is quite easy! Just use the following command from command line:

cat /dev/null > YOURFILENAME

I recommend you to backup the file first, because you never know when something bad can happen

Continue Reading

How to get the IP address using MAC

It happens alot that you have an IP device (ATA, door phone, …) and you don’t know the IP address. One easy way is to use nmap.

run this command (on linux of course):

$ nmap -sP <ip range>

eg: nmap -sP 192.168.1.2-50

make sure you run this as root otherwise it will show only ip address without the MAC

you can also save the output into a txt file this way:

eg: nmap -sP 192.168.1.2-50

You can also try using scanssh (next post will cover this)

Continue Reading

Cisco SPA 502G

How to configure CISCO SPA 502G phone

Step 1- Get the IP address of the phone
Step 2- Access to the GUI, by browse the IP address of the phone (e.g: 192.168.1.150)
Step 3- Click on Admin login at top right of GUI
Step 4- Click Ext1, and fill in few needed info

Continue Reading