Showing posts with label resolve. Show all posts
Showing posts with label resolve. Show all posts

Friday, July 12, 2013

Multiple carriers

Multiple Carriers in Asterisk
or Utilizing all the TRUNK's randomly

Below Dialplan will Dial the number randomly on the assigned Carriers

[general]
TRUNKA=SIP/voiptrunk
TRUNKB=SIP/clickdial
TRUNKC=DAHDI/g0


exten => _9044X.,1,Answer
exten => _9044X.,n,Set(Trunk=${RAND(1|3)})
exten => _9044X.,n,GoToIf($[${Trunk} = 1]?trunkA)
exten => _9044X.,n,GoToIf($[${Trunk} = 2]?trunkB)
exten => _9044X.,n,GoToIf($[${Trunk} = 3]?trunkC)
exten => _9044X.,n,Hangup
exten => _9044X.,n(trunkA),Dial(${TRUNKA}/${EXTEN:4},,tToR)
exten => _9044X.,n(trunkB),Dial(${TRUNKB}/${EXTEN:4},,tToR)
exten => _9044X.,n(trunkC),Dial(${TRUNKC}/${EXTEN:4},,tToR)
exten => _9044X.,n,Hangup

Install Fail2ban in Asterisk (Centos)

Installing Fail2ban in centos
1.yum install fail2ban
If your CentOS doesn't find the package, please execute the following command and then try again.
2.rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
3.yum install python iptables
or
wget http://downloads.sourceforge.net/project/fail2ban/fail2ban-stable/fail2ban-0.8.4/fail2ban-0.8.4.tar.bz2?use_mirror=transact

tar -xf fail2ban-0.8.4.tar.bz2
cd fail2ban-0.8.4
python setup.py install
cp files/redhat-initd /etc/init.d/fail2ban
chkconfig --add fail2ban
chkconfig fail2ban on

Once installing the Fail2ban  create asteirsk.conf file under the fail2ban directory

4.  vi /etc/fail2ban/filter.d/asterisk.conf

and copy and paste the below

# ===================
# /etc/fail2ban/filter.d/asterisk.conf
# Fail2Ban configuration file
#
#
# $Revision: 250 $
#
[INCLUDES]
# Read common prefixes. If any customizations available -- read them from
# common.local
#before = common.conf
[Definition]
#_daemon = asterisk
# Option: failregex
# Notes.: regex to match the password failures messages in the logfile.
#The
# host must be matched by a group named "host". The tag "" can
# be used for standard IP/hostname matching and is only an alias
#for
# (?:::f{4,6}:)?(?PS+)
# Values: TEXT
#

failregex = Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?' - Wrong password
            Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?' - No matching peer found
            Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?' - Device does not match ACL
            Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?' - Username/auth name mismatch
            Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?' - Peer is not supposed to register
            NOTICE.* <HOST> failed to authenticate as '.*'$
            NOTICE.* .*: No registration for peer '.*' (from <HOST>)
            NOTICE.* .*: Host <HOST> failed MD5 authentication for '.*' (.*)
            VERBOSE.* logger.c: -- .*IP/<HOST>-.* Playing 'ss-noservice' (language '.*')


# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
# ===================
Add the [asterisk-iptables] section to your /etc/fail2ban/jail.conf file :
# /etc/fail2ban/jail.conf
#====================



5 .  Save and exit the file
6.   vi /etc/fail2ban/jail.conf
      go to the last line of theis file and paste the below lines there

[asterisk-iptables]
enabled = true
filter = asterisk
action = iptables-allports[name=ASTERISK, protocol=all]
sendmail-whois[name=ASTERISK,
dest=youremailaddress@somewhere.com, sender=fail2ban@somewhere.com]
logpath = /var/log/asterisk/full
maxretry = 5
bantime = 600
#====================


7. Also in /etc/fail2ban/jail.conf file you want to add your own IP address range ( ours is192.168.1.0 ) :
ignoreip = 127.0.0.1 192.168.1.0/24

8.  make the fail2ban to start at startup
     chkconfig fail2ban on
9.  start the fail2ban now
    /etc/init.d/fail2ban start
10 . now check whether the fail2ban is installed properly to detect the attacks
       iptables -L –v
      You should see "fail2ban-ASTERISK" in your iptables output.

11. now try to register a extension from outside with wrong password or worng extension and run the iptables command to see the blocked ip addresses

Tuesday, July 2, 2013

Time synchronization Error , Vicidial ,Goautodial

Time synchronization Error in vicidial goautodial


there is a problem of time synchronization in your system .please contact administrator
The major cause for the time sync error are
  1. The vicidial based system is using  MeetMe conference , These MeetMe Conference Bridge requires a timing resources like  Dahdi or Zaptel.  if they are not loaded poperly then time sync error occurs
  2. wrong System timing . different timing in server and agent systems
  3. wrong time set for DB time , PHP time , server Time
  4. Not updated the New server ip for the vicidial /goautodial 
-------------------------------------------------------------------------------------------
Troubleshoot 1:

type  "mysqlcheck -u root -pvicidialnow --auto-repair --check --optimize --all-databases"

 once finishes the repair of the MYSQL
 reboot the server and chec.


Troubleshoot 2:
MeetMe Conference dahdi issue
  • make sure the dahdi/zaptel driver is installed properly
If you are not using any telephony cards then you need to use the dummy drivers
type:   modprobe dahdi_dummy
          dahdi_cfg -vvvvv
          asterisk  -vvvvvr
          module unload chan_dahdi.so
          module load chan_dahdi.so
  • Now login as agent and check whether the problem arises
  • For those using asterisk telephone cards like digium , sangoma ,allo use the below links 
  • Digium Sangoma
-------------------------------------------------------------------------------------------
Troubleshoot 3:
wrong server time
check the server time ,
type  date  in the linux console ,  it will display the current server time.  if the server time and timezone is wrong follow the below commands to change it.
  • rm /etc/localtime
  • ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
  • rdate -s time-a.nist.gov
  • chkconfig ntpd on
  • ntpdate pool.ntp.org
  • /etc/init.d/ntpd start
-------------------------------------------------------------------------------------------
Troubleshoot 3:

Check the db time php time from the vicidail report section


          if the time is different for all the three then follow the above trouble shoot and reboot the server.
-------------------------------------------------------------------------------------------
Troubleshoot 4:
If you have changed your server ip, dont forget to run the ip update script.
type the below command to update
/usr/share/astguiclient/ADMIN_update_server_ip.pl
and follow the onscreen steps , once done reboot the server and login as agent and check .
-------------------------------------------------------------------------------------------
Troubleshoot 5
If you have very big setup of vicidial , then Dahdi_dummy will not be sufficient to provide time source , so you can use the Sangoma voice time sync USB stick
-------------------------------------------------------------------------------------------
For Support
gtalk:sweetravinder
skypeid:sweetravinder | sweetravinder@gmail.com