[Command]# cat /etc/redhat-release
The Guru Of Tech - Gobind
Asterisk Insall, Codec Install, Vicidial Install.
Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS
All in One
Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS
Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS
Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS
Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS.
Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS
Vicidial, Asterisk, Web-MeetMe, MySQL, OTRS.
Wednesday, December 28, 2011
How to change SSH port on Centos,Ubuntu,Debian
Tuesday, December 27, 2011
Asterisk as a SIP client
Format:
register => user[:secret[:authuser]]@host[:port][/extension]
or
register => fromuser@fromdomain:secret@host
or
register => fromuser@fromdomain:secret:authuser@host:port/extension
Example1:
register => username:pwd:username@216.144.238.155/extension
; Register 2345@mysipprovider.com with authname 2345 at mysipprovider.com at sip provider as 1234 here:
register => 2345:password@mysipprovider.com/1234
; Register 1235@mysipprovider.com with authname 1235 and realm mysipprovider.com at proxyof.mysipprovider.com as s here.
; (as needed by budgetphone.nl):
register => 1235@mysipprovider.com:password:1235@proxyof.mysipprovider.com
Asterisk configuration templates
like extensions.conf, sip.conf or iax.conf. Templates are not to be confused with
macros in extensions.conf.
For template configurations, the syntax for defining a section is as follows:
[section](options)
label = value
The options field is used to define templates, refer to templates and hide
templates. Any object can be used as a template.
No whitespace is allowed between the closing "]" and the parenthesis "(".
Adding to an existing section
(this is actually not template-related, but still an interesting method)
[section]
label = value
[section](+)
label2 = value2
In this case, the plus sign indicates that the second section (with the
same name) is an addition to the first section. The second section can
be in another file (by using the #include statement). If the section
name referred to before the plus is missing, the configuration will fail
to load.
Defining a template-only section
[section](!)
label = value
The exclamation mark indicates to the config parser that this is a only
a template and should not itself be used by the Asterisk module for
configuration. The section can be inherited by other sections (see section
"Using templates" below) but is not used by itself.
Using templates (or other configuration sections)
[section](name[,name])
label = value
The name within the parenthesis refers to other sections, either
templates or standard sections. The referred sections are included
before the configuration engine parses the local settings within the
section as though their entire contents (and anything they were
previously based upon) were included in the new section.
Example 1
[tpl_ext](!) ; a template
dtmfmode=rfc2833
context=from-internal
type=friend
disallow=all
allow=gsm
qualify=yes
host=dynamic
[1000](tpl_ext)
secret=1000
callcounter=yes ; Enable call counter
busylevel=1
Example 2
[foo]
permit=192.168.0.2
host=asdf
deny=192.168.0.1
[bar]
permit=192.168.1.2
host=jkl
deny=192.168.1.1
[baz](foo,bar)
permit=192.168.3.1
host=bnm
The [baz] section will be processed as though it had been written in the
following way:
[baz]
permit=192.168.0.2
host=asdf
deny=192.168.0.1
permit=192.168.1.2
host=jkl
deny=192.168.1.1
permit=192.168.3.1
host=bnm
Example 3
In top-level sip.conf:
[defaults](!)
type=friend
nat=yes
qualify=on
dtmfmode=rfc2833
disallow=all
allow=alaw
include accounts/*/sip.conf
In accounts/customer1/sip.conf:
[def-customer1](!,defaults)
secret=this_is_not_secret
context=from-customer1
callerid=Customer 1 <300>
accountcode=0001
[phone1](def-customer1)
mailbox=phone1@customer1
[phone2](def-customer1)
mailbox=phone2@customer1
Monday, December 26, 2011
Change the Linux User Root Password
su to root
Type "passwd" (without quotes)
It will then prompt you to type your new pass, and then to confirm it.
Wednesday, December 21, 2011
How to Reset forgotten root password on Centos/Red Hat
If you are desperate because you have forgotten root password, don’t be. This tutorial will show you how to reset root.
Please note that you cannot perform this remotely, you must be physically at the machine.
1. Step : Reboot The Server
2. Step : Look for the centos blue screen saying booting press DOWN arrow key
3. Step : Select any Kernel and Press “ e ”
4. Step : Select Kernel /vmlinuz and Press “ e ”
5. Step : Type “ single “ and Press Enter
6. Step : You Will see the kernel /vmlinuz selected Press “ b ” Server will reboot
7. Step : After Rebooting the server you will get the Shell Prompt and Type Command “ passwd ”
8. Step : Type password “ newpassword “
9. Step : Reboot server using command “ init 6”
10. You Are Done!!
Repairing a Corrupted Database in MYSQL
[root@123]#
mysqlcheck --auto-repair --databases database-name -uUser -pPass (for {INNODB} and MYSQL service should be running)
And
[root@123]#
myisamchk /var/lib/mysql/database-name/*.MYI ( for {MyISAM} and MYSQL service should be stopped)
Sunday, December 18, 2011
HOW TO CHANGE NAME OF AUTHOR in Blogger
1.Log in to your dashboard--> template- -> Edit HTML
2.Click on "Expand Widget Templates"
3.Scroll down to where you see this:
<span class='post-author vcard'><b:if cond='data:top.showAuthor'><data:top.authorLabel/><span class='fn'><data:post.author/></span></b:if></span>
4.Replace <data:post.author/> of above code with your new name.
5.Click on "Save Templates" and Refresh your site.
Friday, December 16, 2011
Dialplan that will act as a plug-in replacement for AgentCallbackLogin
This is a sample dialplan that will act as a plug-in replacement for AgentCallbackLogin
for Asterisk 1.6's.
It offers the following features:
- Single log-on and log-off, managing queue/agent associations centrally
- Agent pause (with pause reason) and unpause
- Managed device state - the queue will not try calling members that are busy
on other queues or because of other calls
- Tracking of the current hot-desk extension
- Fully compatible with QueueMetrics
- Very compact and easy to expand
It requires Asterisk 1.6.1 or newer to run.
SETTING UP
----------
First, make sure that the extension that you plan to use in sip.conf have
callconter=yes
busylevel=1
so that when one call is being made or received, the telephone state is BUSY.
Then define your queues in queues.conf (see file here for an example configuration).
For this example we define two queues aclled "q1" and "q2".
We leave the file agents.conf completely alone (agent/queue associations are managed
in the dialplan).
Import the file "agent16_queuemetrics.conf" in the main extension.conf file and create
"hooks" that your agents will dial (see examples in the extensions.conf file included).
Edit "agent16_queuemetrics.conf" to define which agents work on which queues (see below).
Included hooks:
- 820 -> Agent login. It will ask you the agent code and the current extension (as in SIP/ext)
- 821 -> Agent log off. It will ask you the current agent number.
- 823 -> Agent pause. It will autodetect the current agent based on the extension and will
ask you for a pause code. Enter # if none.
- 824 -> Agent unpause. It will autodetect the current agent.
Then at 827/828 you see an example of routing calls to each queue. Set up queues as you best
see fir in your dialplan.
Enjoy!
DEFINING WHICH AGENTS WORK ON WHICH QUEUES
------------------------------------------
Edit the file agent16_queuemetrics.conf where it says:
[macro-xagents-allqueues]
....
exten => s,n,Macro(xagents-associate,${ARG1},${ARG2},${ARG3},q1,100:101:103:105)
....
As you can see, here we say that for "q1" we have agents 100, 101, 103 and 105.
You must separate agents using a semicolon.
Add a line for each queue that you have defined in your dialplan.
SETTING UP QUEUEMETRICS
-----------------------
QueueMetrics requires no special setup:
1. make sure that default.rewriteLocalChannel=true (this should be the current default anyway)
2. manually assign agents to the queues
++++++++++++++++++++++++++++++++++++++++++++
QUEUS.CONF
++++++++++++++++++++++++++++++++++++++++++++
[general]
persistentmembers = yes
keepstats = no
autofill = yes
monitor-type = MixMonitor
shared_lastcall=no
[q1]
music=default
strategy=rrmemory
eventwhencalled=no
timeout=15
retry=1
wrapuptime=0
maxlen = 0
announce-frequency = 0
announce-holdtime = no
autopause=no
autofill=yes
joinempty=yes
[q2]
music=default
strategy=rrmemory
eventwhencalled=no
timeout=15
retry=1
wrapuptime=0
maxlen=0
announce-frequency = 0
announce-holdtime=no
autopause=no
autofill=yes
joinempty=yes
++++++++++++++++++++++++++++++++++++++++++++
SIP.CONF
++++++++++++++++++++++++++++++++++++++++++++
[tpl_grandstream](!) ; a template
dtmfmode=rfc2833
context=from-internal
type=friend
disallow=all
allow=gsm
qualify=yes
host=dynamic
[999](tpl_grandstream)
secret=999
callcounter=yes ; Enable call counter
busylevel=1
++++++++++++++++++++++++++++++++++++++++++++
agents16_queuemetrics.conf
++++++++++++++++++++++++++++++++++++++++++++
[xagents]
exten => _.,1,Set(realchan=${DB(Xagent/${EXTEN})})
exten => _.,n,NoOP("Trying Xagent/${EXTEN} as ${realchan}")
exten => _.,n,Dial(${realchan},60,tT)
exten => h,1,NoOp
[macro-xagents-associate]
;
; ARG1 : operation: ADD or REM
; ARG2 : Agent ID
, ARG3 : Device to be used as state for agent ID
; ARG4 : queue name
, ARG5 : queue members, as 100:103:104
;
exten => s,1,NoOp("Macro2")
exten => s,n,Set(queue=${ARG4})
exten => s,n,Set(agentlist=:${ARG5}:)
exten => s,n,Set(agent=${ARG2})
exten => s,n,Set(oper=${ARG1})
exten => s,n,Set(devstate=${ARG3})
exten => s,n,Set(fnd=${REGEX(":${agent}:" ${agentlist})})
exten => s,n,GotoIf(${fnd}?found)
exten => s,n,NoOP( "NOTFOUND" )
exten => s,n,MacroExit
exten => s,n(found),Goto(op-${oper})
exten => s,n,MacroExit
exten => s,n(op-ADD),AddQueueMember(${queue},Local/${agent}@xagents,,,,${devstate})
exten => s,n,MacroExit
exten => s,n(op-REM),RemoveQueueMember(${queue},Local/${agent}@xagents)
exten => s,n,MacroExit
[macro-xagents-allqueues]
; AGR1: operation: ADD or REM
; ARG2: Agent ID
; ARG3: Device to be used as a source of state
exten => s,1,NoOP("")
exten => s,n,Macro(xagents-associate,${ARG1},${ARG2},${ARG3},q1,100:101:103:105)
exten => s,n,Macro(xagents-associate,${ARG1},${ARG2},${ARG3},q2,101:100:103:105)
exten => s,n,Macro(xagents-associate,${ARG1},${ARG2},${ARG3},q3,108:101:103:105)
exten => s,n,MacroExit
[xagents-logon]
exten => s,1,Answer
exten => s,n,Read(agent,agent-user)
exten => s,n,Read(phone,agent-newlocation)
exten => s,n,Set(DB(Xagent/${agent})=SIP/${phone})
exten => s,n,Set(DB(Xagent_byphone/${phone})=${agent})
exten => s,n,QueueLog(NONE,${UNIQUEID},Local/${agent}@xagents,AGENTCALLBACKLOGIN,${phone})
exten => s,n,Macro(xagents-allqueues,ADD,${agent},SIP/${phone})
exten => s,n,Playback(agent-loginok)
exten => s,n,Hangup
[xagents-logoff]
exten => s,1,Answer
exten => s,n,Read(agent,agent-user)
exten => s,n,Set(chan=${DB(Xagent/${agent})})
exten => s,n,Set(DB(Xagent/${agent})=)
exten => s,n,Macro(xagents-allqueues,REM,${agent},-)
exten => s,n,QueueLog(NONE,${UNIQUEID},Local/${agent}@xagents,AGENTCALLBACKLOGOFF,)
exten => s,n,Playback(agent-loggedoff)
exten => s,n,Hangup
[xagents-pause]
exten => s,1,Answer
exten => s,n,Set(agent=${DB(Xagent_byphone/${CALLERID(num)}})
exten => s,n,Read(code,agent-user)
exten => s,n,PauseQueueMember(,Local/${agent}@xagents,,${code})
exten => s,n,QueueLog(NONE,${UNIQUEID},Local/${agent}@xagents,PAUSEREASON,${code})
exten => s,n,Hangup
[xagents-unpause]
exten => s,1,Answer
exten => s,n,Set(agent=${DB(Xagent_byphone/${CALLERID(num)}})
exten => s,n,UnpauseQueueMember(,Local/${agent}@xagents)
exten => s,n,Hangup
++++++++++++++++++++++++++++++++++++++++++++
EXTENSIONS.CONF
++++++++++++++++++++++++++++++++++++++++++++
#include "agents16_queuemetrics.conf"
[from-internal]
exten => 820,1,Dial(Local/s@xagents-logon)
exten => 821,1,Dial(Local/s@xagents-logoff)
exten => 823,1,Dial(Local/s@xagents-pause)
exten => 824,1,Dial(Local/s@xagents-unpause)
exten => 827,1,Answer
exten => 827,n,Queue(q1)
exten => 828,1,Answer
exten => 828,n,Queue(q2)
----------------------
YOU ARE DONE!!!
Friday, December 9, 2011
Multiple Logins In Windows Live Messenger
The support for multi-WLM is not enabled by default, but can be easily turned on and enable with registry hack.
- Run Registry Editor (regedit).
- Navigate to the following registry key: KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Live\Messenge
For 64-bit (x64) OS, go to following registry branch instead:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows Live\Messenger - In the right pane, right click on any blank space, select New on context menu, and then click on DWORD (32-bit) Value.
- Name the new registry value entry as MultipleInstances.
- Modify the MultipleInstances and set its value data as 1.
- Start as many Windows Live Messenger windows as you want from Start Menu.
Thursday, December 8, 2011
Adding User Accounts in MYSQL
CREATE USER 'sam'@'localhost' IDENTIFIED BY 'some-password';
GRANT ALL PRIVILEGES ON *.* TO 'sam'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES; (telling the server to reload the grant tables using flush command)
The accounts created by these statements have the following properties:
Two of the accounts have a user name of sam and a password of some_pass. Both accounts are superuser accounts with full privileges to do anything. The 'sam'@'localhost' account can be used only when connecting from the local host. The 'sam'@'%' account uses the '%' wildcard for the host part, so it can be used to connect from any host.
Monday, December 5, 2011
Exporting Table Data in a File
SELECT * FROM table_name INTO OUTFILE 'C:/new_file.xls'
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n';
Friday, December 2, 2011
Remote UNIX connection
If getting an error in asterisk cli (1.6.1.8)
-- Remote UNIX connection
-- Remote UNIX connection disconnected
-- Remote UNIX connection
-- Remote UNIX connection disconnected
-- Remote UNIX connection
-- Remote UNIX connection disconnected
-- Remote UNIX connection
-- Remote UNIX connection disconnected
-- Remote UNIX connection
-- Remote UNIX connection disconnected
-- Remote UNIX connection
-- Remote UNIX connection disconnected
then use the following command in asterisk cli
cli>core set verbose 0
Thursday, December 1, 2011
SHOW CREATE TABLE displays the CREATE TABLE statement to create a given table.
Shows the CREATE TABLE
statement that creates the given table. The statement requires the SELECT
privilege for the table. As of MySQL 5.0.1, this statement also works with views.
mysql> SHOW CREATE TABLE tablename
check directory/dir/file size in linux
#check partition sizes df -h
#check directory size du -s -h /var/log/
#check every directory and file sizes under a dir.
du -s -h /var/log/*
#check individual size size du -s -h /var/log/lastlog
Send Mail from CLI (LINUX)
body message here => ctrl+d for CC return key
to check the logs:
cd /var/log
tail -100 maillog
Change the system date in Linux
Set the current date to May 7 2011 8:42:45pm.
#date -s "7 May 2011 20:42:45"
Asterisk updating from 1.6.1.8 to 1.6.2.19
tar -zxvf asterisk-1.6.2.19.tar.gz
cd asterisk-1.6.2.19
./configure
make
make install (Do not delete G729 module)
asterisk -vvvgc
asterisk -vr
http://www.blog.manhag.org/2010/05/installing-the-free-g729-codec-for-asterisk/
Download from here: (Depend on 32bit or 64bit)["i686" means 32-bit. If it was 64-bit, it would be "x86_64"] Check by "uname -a" command
wget http://asterisk.hosting.lv/bin/codec_g729-ast14-gcc4-glibc-pentium.so
(codec_g729-ast16-gcc4-glibc-pentium4.so)
Notice that we are in the modules directory
Rename the codec file
mv codec_g729-ast14-gcc4-glibc-pentium4.so codec_g729.so
Restart Asterisk
/etc/init.d/asterisk restart
Check your work
Connect to Asterisk
asterisk -r
Then show all of the codec translations available using the command below, and check g729 at the left, you should see that it can be translated to many other codecs on the top of the table
Machine*CLI> show translations
**********
After that install mysql module in a proper directory
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-addons-1.6.2.3.tar.gz
tar -zxvf asterisk-addons-1.6.2.3.tar.gz
cd asterisk-addons-1.6.2.3
./configure
make clean
make
make install
How to Compile Asterisk module like (app_Voicemail.c)
At starting of the file add this lines
#ifndef AST_MODULE
#define AST_MODULE "app_voicemail"
#endif
AFTER THAT COMPILE THE MODULE
cd /usr/src/asterisk-1.6.1.8/apps/
gcc -shared app_voicemail.c -o app_voicemail.so
cp app_voicemail.so /usr/lib/asterisk/modules/
CLI> restart now
MYSQL Packet too large
If you are using MySQL 4.0 or newer, enter:
[mysqld]
# Allow packets up to 16M (change its value)
max_allowed_packet=16M
If you are using an older version of MySQL, enter:
[mysqld]
# Allow packets up to 16M
set-variable = max_allowed_packet=16M
To store 8 MB objects (default is 16M).
LoopProtection in OTRS
LoopProtection!!! Send no more emails to 'emailid@.com'! Max. count of 40 has been reached!
PostmasterMaxEmails 40 Default
Change its value from 40 to whatever you want
[otrs] State change New to Open
Frontend::Agent::Ticket::ViewNote
Then --> Ticket::Frontend::AgentTicketNote###State: "YES" --> Update
After adding this, you will have the otion to change the state of a ticket
under notes.
Check Size of Database [in MB]
Run the below command
SELECT table_schema "Data Base Name", sum( data_length + index_length) / 1024 / 1024
"Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;
Setting for MYSQL replication in my.cnf
In /etc/my.cnf
server-id=2
replicate-same-server-id = 0
auto-increment-increment = 2
auto-increment-offset = 2
replicate-do-db = databasename
Trouble Shooting MySQL Replication.
Mysql> Show slave status;
Above command will show the status of replication. we see two column -- value for both should be 'Yes'.
a. SlaveIORunning -- 'Yes'
b.SlaveSQLRunning --'Yes'
Incase of replication failure value for the columns will be 'No'.
If value is 'No' look for the error. Note the logfile and logposition being read.
Stop slave. First Diagnose error and resync replication from the log position it broke.
Maintenance of Replicated Mysql Server
Deleting Binlogs of mysql. ----->
Log into Secondary Server
mysql> show slave status;
Above command will give the file name being read by slave machine.
Go to master and execute--->
mysql> purge binlogs to 'file_name_got_from_above_command'
In case of master to master replication we have to delete binlog from both machines. Do the same as above on both machines.
Complete Master to Slave MySQL DB Replicate
My.ini/My.cnf configuration for Master
-------------------------------
log-bin=mysql-bin
server-id=1
--------------------------------
INNODB Specific options
--------------------------------
innodb_flush_log_at_trx_commit=1
sync_binlog=1
--------------------------------
Restart MySql Service
FLUSH PRIVILEGES;
-----------------------------------------
mysql>USE exampledb;
mysql>FLUSH TABLES WITH READ LOCK;
Take a backup (or MYSQLDUMP) of the DB to be replicated
Restore DB on Slave
************************************************** *********************************
Step 2 – Configure the Slave Server(Windows XP)
Edit the my.ini/my.cnf
server-id=2
replicate-do-db = exampledb
Step 3 – Restart Mysql Service
Restart mysql Service
mysql > Stop slave;
mysql>CHANGE MASTER TO MASTER_HOST='master_IP', MASTER_USER='user', MASTER_PASSWORD='password',MASTER_LOG_FILE='mysql-bin.000006',MASTER_LOG_POS=183;
mysql > Start slave;
mysql > show slave_status; [This command will show whether your replication is running fine.]
To know if your replication is working check output of above command.
IN Out put of above command value of these two running status should be yes.
Slave_IO_Running | Slave_SQL_Running
Yes | Yes |
If any of these is NO than your replication is not working. To resynchronize DB and start replication again contact your MYSQL DBA.