Useful Commands to manage everyday tasks on Asterisk/Vicidial Servers

Useful Commands to manage everyday tasks on Asterisk/Vicidial Servers

useful tools

Useful Commands to manage everyday tasks on Asterisk/Vicidial Servers

I wanted to put together a list of commands that I use often or daily that may help other people manage their days easier. If you have anything you use or think others would find useful, please comment below and I will add them with credit to you and your website or blog if you’d like. Ok so these commands will go over things for services such as Apache, MySQL, Vicidial, Asterisk, and more.

MySQL Commands and examples:

### repair a broken Database Table
repair table vicidial_live_agents use_frm;


### get level 9 users in vicidial
mysql asterisk -u cron -p1234 -e "select user,pass,active from vicidial_users where user_level='9'"

### check and repair mysql
mysqlcheck -p --auto-repair --all-databases

### show what IP's are in the Dynamic Portal IP set
use asterisk;
select computer_ip from vicidial_user_log where event = 'VICIBOX' group by computer_ip;


### reset a user whos locked out due to too many login attempts through mysql instead of GUI (Thanks Venkat from vicidial.sh)
mysql -e "use asterisk; update vicidial_users set failed_login_count='0' where user='6666'";


### How to create a user in mysql - change user(cron) and pass(1234)
CREATE USER 'cron'@'localhost' IDENTIFIED BY '1234';
GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@'%' IDENTIFIED BY '1234';
GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@localhost IDENTIFIED BY '1234';
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;

### change root password(to delete it leave it BY '')
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';

### check a user groups permissions(replace 'ADMIN' accordingly)
mysql -u cron -p1234 asterisk -e "select * from vicidial_user_groups where user_group='ADMIN'\G"

####### if leads wont load or you get "no one in your session"
nano /etc/my.cnf
Look for sql_mode and change it to sqlmode=""
mysql -u cron -p1234 asterisk -e “select * from vicidial_user_groups where user_group=’ADMIN’\G”

Other useful commands

### watch asterisk messages thru linux cli ######
tail -f /var/log/asterisk/messages


####### apache tools ############
check web connections: netstat -tuna | grep ":80" | wc -l


##### Useful Vicidial Commands for Linux ##########
/usr/share/astguiclient/ADMIN_keepalive_ALL.pl --cu3way
/usr/share/astguiclient/AST_manager_listen.pl --debugX
/usr/share/AST_DB_action.pl --debugX

#### Check if Dahdi(Meetme/Vicidial Conferences) is running ####
dahdi_cfg -vv
If its not run this command: 
modprobe dahdi


### check keepalives
cat /etc/astguiclient.conf | grep VARactive_keepalives



##### viciphone time for autologin 
$webphone_call_seconds = '5 ; in options.php in agc dir



### upgrade vici ####
cd /usr/src/astguiclient
svn checkout svn://svn.eflo.net:3690/agc_2-X/trunk
cd trunk
perl install.pl

mysql -p -f --database=asterisk < /usr/src/astguiclient/trunk/extras/upgrade_2.14.sql


### certbot renewal command #####
certbot certonly --cert-name cyburityllc.com -d sunfun.cyburityllc.com -d mail.cyburityllc.com -d sunfunnow.cyburityllc.com -d cyburity.ml -d cyburity.ga -d cyburity.gq -d cyburity.cf -d informationtechnology.gq -d cyburityllc.com -d www.cyburityllc.com -d cyburhack.com -d cyburhacker.com -d cyburshield.com -d cyberdialer.net -d www.cyburdial.com -d www.cyberdialer.net -d cyburphone.com -d dialer.one -cyburdialer.com -d contactcentersrus.com -d fldream.cyburityllc.com -d www.contactcentersrus.com -d portal.contactcentersrus.com -d cyburdialer.com-d cyburdial.com



### to check whats eating all the ram
ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 20

#### cpu usage
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -11

## check HDD space
df -h

### find the largest files and folders on your linux server(good to see whats taking up space) - This will find the top 20 files and folders, try it from /
du -ah | sort -hr | head -n 20

### check processors
grep processor /proc/cpuinfo | wc -l

### tcp dump for ports(change accordingly) #####
tcpdump -nttv -s 0 -i eth0 port 80

#### check connections to a port ##########
netstat -tuna | grep ":5038" | wc -l


###clear dns cache
/etc/init.d/nscd restart

###For a "live" view showing the logic involved in dialing:
screen -r ASTVDauto

ctrl-a - ctrl-d to get out of it.

###perl install based on asterisk version
perl install.pl --copy_sample_conf_files --asterisk_version=11.X

### start up asterisk
/usr/share/astguiclient/start_asterisk_boot.pl

/usr/share/astguiclient/ADMIN_keepalive_ALL.pl --cu3way



###VOLUME FOR AST13########
With Asterisk 13, the mechanism in Asterisk that allowed for volume changes and muting of meetme participants had been causing random crashes in Asterisk. We now disable this functionality by default, but if you want to enable it, all you have to do is use the agc/options.php setting of "$ast13_volume_override = '1';"

    

####USEFUL SVN TOOLS#######


Beware of the version in system settings. To be absolutely certain to version match:

SVN is used to manage the "install directory" (/usr/src/astguiclient/trunk)

The install directory has a group of sql files that are used to upgrade from the first version to NOW (based on the svn revision level presently in THAT directory).

When your last sql upgrade file has a last line indicating that the db schema value should be what is presently shown in your System Settings ... you have a match. All your code will match your entire DB if you run install.pl with that version loaded.

Anything else is more of a "sort of" match. That's the only truly reliable method. How you get there is a matter of experience and knowledge of svn. But upgrading/downgrading that svn repository until you get lucky and it matches is the easiest amateur way to get a lock-on match of your present db schema.

start here:

CODE: 
tail /usr/src/astguiclient/trunk/extras/upgrade_2.14.sql | grep db_schema_version
mysql -u cron -p1234 asterisk -e "select * from system_settings\G" | grep schema
cd /usr/src/astguiclient/trunk
svn info | grep Revision

Compare the db schema in system settings to the db schema in the upgrade.sql file.
Note the svn revision level.
Increase or decrease the svn revision level with "svn up -r ####" and ... try again until the db schema in the sql file and system settings match. Example:

svn up -r 2946

Then run perl install.pl. Example:
CODE: SELECT ALL
cd /usr/src/astguiclient/trunk
perl install.pl --copy_sample_conf_files


Note that --copy_sample_conf_files will overwrite the .conf files presently in the system. Any that you have edited will need to be re-edited. Such as externip=xxx.xx.xx.x in sip.conf. While updating these isn't always necessary, NOT updating them has been known to blow an entire workday for simple "missed" change that's very difficult to find otherwise. Skip copy_sample_conf_files at your own risk. 8-)

### for webrtc phone issue with chrome 87 update
zypper in ncurses-devel libxml2-devel sqlite-devel libsrtp-devel libuuid-devel openssl-devel
 


Leave a Reply