Posted on 2015/03/31 10:12
Filed Under Linux/설정방법

DNS server, DNS service  

Fail2Ban (with iptables) And Asterisk


Fail2Ban


Fail2Ban is a limited intrusion detection/prevention system. It works by scanning log files and then banning IPs based on the entries in those logs. Note that Digium is moving away from writing security information to log files, and is now using AMI events. Consider fail2ban a short-term solution only.

You can get Fail2Ban, as well as more documentation, at www.fail2ban.org. At the time this is being written, the current release is 0.8.4.

Fail2Ban With Asterisk


The following describes how to setup Fail2Ban to protect an Asterisk PBX from SIP brute force attempts and scans utilizing the iptables firewall.

SECURITY NOTE: fail2ban is rather limited in its ability to detect attacks against asterisk. 
More info http://forums.asterisk.org/viewtopic.php?p=159984
Consider a more comprehensive product like the free edition of SecAst www.generationd.com

Easy Install Script for Fail2ban version 0.8.4 / Red Hat


This script was written by Cédric Brohée in order to simplify and accelerate the integration of the solution in a basic Asterisk configuration on Red Hat.
Do not hesitate to read the bash script and make changes to match your own configuration.

Before running it, you will have to do chmod 755.

Download script with new dedicated sources :
Fail2ban.sh_030512.txt



Installing


Log into the system and su - root, or sudo -i to get a root shell on Ubuntu.

CentOS/Red Hat (this method may install an older version of fail2ban):

Install rpmforge or optionally fetch the fail2ban rpm directly from rpmforge.
Install fail2ban using yum:

yum install fail2ban

Debian/Ubuntu:

apt-get install fail2ban

Source installation:
Change directories to /usr/src:

cd /usr/src

Download and extract Fail2Ban (check for newer releases):

wget http://sourceforge.net/projects/fail2ban/files/fail2ban-stable/fail2ban-0.8.4/fail2ban-0.8.4.tar.bz2/download
tar jxf fail2ban-0.8.4.tar.bz2

Enter the Fail2Ban directory you just extracted:

cd fail2ban-0.8.4

Make sure python and iptables are installed:

CentOS/Red Hat:

yum install python iptables

Debian/Ubuntu:

apt-get install python iptables

Install Fail2Ban:

python setup.py install

Install the Fail2Ban init script (for source installations):

Centos/Red Hat (if you installed via yum/rpm, the init script has already been installed):

cp /usr/src/fail2ban-0.8.4/files/redhat-initd /etc/init.d/fail2ban
chmod 755 /etc/init.d/fail2ban

For other distributions' init scripts, please refer to documentation specific to them.



Configure Fail2Ban


We need to create a configuration for Fail2Ban so that it can understand attacks against Asterisk.

Create a new filter configuration for Asterisk:

touch /etc/fail2ban/filter.d/asterisk.conf

The contents of /etc/fail2ban/filter.d/asterisk.conf should be the following:

Generic (without using /var/log/asterisk/security)


# 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 "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>\S+)
# Values:  TEXT
#

# Asterisk 1.4 use the following failregex

failregex = NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Wrong password
            NOTICE.* .*: Registration from '.*' failed for '<HOST>:.*' - No matching peer found
            NOTICE.* .*: Registration from '.*' failed for '<HOST>' - No matching peer found
            NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Username/auth name mismatch
            NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Device does not match ACL
            NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Peer is not supposed to register
            NOTICE.* .*: Registration from '.*' failed for '<HOST>' - ACL error (permit/deny)
            NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Device does not match ACL
            NOTICE.* <HOST> failed to authenticate as '.*'$
            NOTICE.* .*: No registration for peer '.*' \(from <HOST>\)
            NOTICE.* .*: Host <HOST> failed MD5 authentication for '.*' (.*)
            NOTICE.* .*: Failed to authenticate user .*@<HOST>.*
            NOTICE.* .*: Sending fake auth rejection for device .*\<sip:.*\@<HOST>\>;tag=.*

# In Asterisk 1.8 use the same as above, but after <HOST> add :.* before the single quote. This is because in Asterisk 1.8, the log file includes a port number which 1.4 did not.

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =


If you're having issues with your system not banning properly when the "Registration from" section in your log file contains a quotation mark (") as in this example:

[2011-04-07 17:53:11] NOTICE[7557] chan_sip.c: Registration from '"69106698"<sip:69106698@123.123.123.123>' failed for '123.123.123.123' - No matching peer found


Add the following line, with the others above, in asterisk.conf:

NOTICE.* .*: Registration from '\".*\".*' failed for '<HOST>' - No matching peer found

Recently noticed attacks:

[2011-06-21 17:53:11] NOTICE[7557] chan_sip.c: Registration from '"XXXXXXXXXX"<sip:XXXXXXXXXX@123.123.123.123>' failed for '123.123.123.123' - Wrong Password

Adding the following line will block these attempts:

NOTICE.* .*: Registration from '\".*\".*' failed for '<HOST>' - Wrong password

Using new /var/log/asterisk/security

For this you will need an Asterisk that comes with the new Asterisk Security Framework (Asterisk 10+). You will also need to enable the log output in logger.conf by adding or uncommenting the line "security => security". Likewise, you willl also need to ensure the date format has been changed in logger.conf to "dateformat=%F %T".


# 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 "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>\S+)
# Values:  TEXT
#

failregex = SECURITY.* SecurityEvent="FailedACL".*RemoteAddress=".+?/.+?/<HOST>/.+?".*
            SECURITY.* SecurityEvent="InvalidAccountID".*RemoteAddress=".+?/.+?/<HOST>/.+?".*
            SECURITY.* SecurityEvent="ChallengeResponseFailed".*RemoteAddress=".+?/.+?/<HOST>/.+?".*
            SECURITY.* SecurityEvent="InvalidPassword".*RemoteAddress=".+?/.+?/<HOST>/.+?".*

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =



Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. This does a 3-day ban on the IP that performed the attack. It is recommend to set the bantime in the [DEFAULT] section so if affects all attacks. It is also recommend to turn on an iptables ban for ssh, httpd/apache, and ftp if they are running on the system. Be sure to edit the sendmail-whois action to send notifications to an appropriate address:


Generic (without using /var/log/asterisk/security)


[asterisk-iptables]

enabled  = true
filter   = asterisk
action   = iptables-allports[name=ASTERISK, protocol=all]
           sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]
logpath  = /var/log/asterisk/messages
maxretry = 5
bantime = 259200


note: logpath = /var/log/asterisk/messages is for vanilla asterisk, use logpath = /var/log/asterisk/full for freepbx. You can check the name of the log file in logger.conf.

note: if fail2ban still failed to identify login attempts, try the syslog logging way.

Using new /var/log/asterisk/security


[asterisk-iptables]
enabled  = true
filter   = asterisk
action   = iptables-allports[name=ASTERISK, protocol=all]
           sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]
logpath  = /var/log/asterisk/security
maxretry = 5
bantime = 259200


Don't Ban Yourself


We don't want to ban ourselves by accident. Edit /etc/fail2ban/jail.conf and edit the ignoreip option under the [DEFAULT] section to include your IP addresses or network, as well as any other hosts or networks you do not wish to ban. Note that the addresses must be separated by a SPACE character!

Asterisk Logging


We must change how Asterisk does its time stamp for logging. The default format does not work with Fail2Ban because the pattern Fail2Ban uses that would match this format has a beginning of line character (^), and Asterisk puts its date/time inside of []. The other formats that Fail2Ban supports, however, do not have this character and can be used with Asterisk.

To change this format, open /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). This causes the date and time to be formatted as Year-Month-Day Hour:Minute:Second, [2008-10-01 13:40:04] is an example.


 [general]
 dateformat=%F %T


Then reload the logger module for Asterisk. At the command line, run the following command:

asterisk -rx "logger reload"

If for some reason you do not want to change the date/time format for your normal asterisk logs (maybe you already have scripts that use it or something and do not want to edit them), you can do the following instead:

In /etc/asterisk/logger.conf, add the following line under the [logfiles] section for Asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by Fail2Ban.

syslog.local0 => notice

Be sure to reload the logger module for Asterisk — check above for the command to do so. If you chose this option, you will also have to change the/etc/fail2ban/jail.conf setting under the [asterisk-iptables] section for the logpath option to the following:

logpath = /var/log/messages

Turning it On


Now it is time to put fail2ban to work. There are a couple steps we need to do first.

Turn IPTABLES on


By default, iptables allows all traffic. So if we turn it on, it will not block any traffic until Fail2Ban creates deny rules for attackers. You should create your own firewall rules and setup for iptables, but that is beyond the scope of this guide. Just know that Fail2Ban, by default, inserts rules at the top of the chain, so they will override any rules you have configured in iptables. This is good because you may allow all sip traffic in and then the Fail2Ban will block individual hosts, after they have done an attack, before they are allowed by this rule again.

To start iptables, run the following as root:

/etc/init.d/iptables start

Depending on your install, you may or may not have the iptables init script installed. Please refer to an iptables install/setup guide for your distribution for more information.

Turn on Fail2Ban


To start Fail2Ban, run the following as root:

/etc/init.d/fail2ban start

Check It


If both started properly, issue the following command to view your iptables rules:

iptables -L -v

You should see something like the following for the INPUT chain (you will see more if you have other Fail2Ban filters enabled):

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
2104K 414M fail2ban-ASTERISK all — any any anywhere anywhere

If you do not see something similar to that, then you have some troubleshooting to do; check out /var/log/fail2ban.log.

If you do not see all your rules, or if you see a different subset of rules after stopping and restarting fail2ban, you may be experiencing the issue described on this page on the Fail2ban talk:Community Portal and may wish to use the suggested fix:

fail2ban.action.action ERROR on startup/restart

I had multiple fail2ban.action.action ERROR on startup/restart. It seems there was a "race" condition with iptables. I solved the problem completely on my system by editing /usr/bin/fail2ban-client and adding a time.sleep(0.1)

def __processCmd(self, cmd, showRet = True):
	beautifier = Beautifier()
	for c in cmd:
		time.sleep(0.1)
		beautifier.setInputCmd(c)


Turn it on for good


If all is well up to this point, let's make sure that fail2ban and iptables restart with the server by issuing the following commands.

Centos/Red Hat:

chkconfig iptables on
chkconfig fail2ban on

Debian/Ubuntu:

update-rc.d iptables defaults
update-rc.d fail2ban defaults

You should now be somewhat protected against SIP scans and brute force attacks!

Try a reboot


Once you have fail2ban working ok, make sure that it continues that way after rebooting the server. On some distributions (including Ubuntu daper) fail2ban won't start after the system reboots because the /var/run/fail2ban directory gets deleted and needs to be re-created. This can be frustrating as there is also nothing that shows up in the logs to indicate what the problem is. If this happens, please see the link below for instructions on modifying the startup script so that it checks for and creates the /var/run/fail2ban directory if needed:

http://informationideas.com/news/2010/04/21/fail2ban-does-not-start-after-reboot/

Additional Information

2015/03/31 10:12 2015/03/31 10:12

Posted on 2015/03/19 11:52
Filed Under 컴퓨터 기술 및 정보/일반 팁

DNS server, DNS service  

어제 모 대형 쇼핑몰에서 결제를 하다가 뭘 설치하길레
뭐지?
얼마전에 결제 했을때는 설치 하지 않았는데.. 또 뭘 설치하려고 하네..
에효...국내 대형 쇼핑몰들이 이렇지..
하고 별 생각 없이 설치하고 결제 했는데..

이상하게 오늘 컴퓨터가 버버버버버...벅..  
그래도 구입한지는 2-3년 넘었으나, i5 CPU에, SSD와 8G RAM을 갖춘 쓸만한 노트북인데.. 이상하게 버버버버버버...벅...

작업관리자를 보니.. CPU 점유율이 4개 코어 모두 거의 90~100%..
이거 뭐지? 바이러스 인가?

하고 봤던..

"VPWalletLauncherC.exe"
"VPWalletService.exe"

요 두 녀석이 미친듯.. CPU를 먹구 있었다..
처음에는 바이러스라고 생각하고, 삭제를 하려고 보았는데.. 이름중에. "Service".. 그래서 혹시나 하고.. 서비스 항목을 확인했더니..

떡하니.. 서비스 항목에 등록이 되어 있넹?

그것도 이 서비스를 쇼핑몰 결제 할때도 아닌, 24시간 서비스를 돌리고 있다... 세상에....

사용자 삽입 이미지

나 원참... 기가막혀서 말도 안나온다..

"This service is developed to use ISP in Non-ActiveX environment."

자랑스럽게.. ActiveX 안쓴다고.. 적어 뒀다..
대통령께서 직접 나서서 ActiveX를 없애고, 쉽게 결제 가능하도록 시스템을 개선하라고 누차 이야기 하니깐..

ActiveX를 없애고 우리는 EXE를 사용해~  라고. 자랑스럽게 이야기 한다...
EXE는 쓰지 말라고 안했으니, 사용자 PC에 깔아서 쓰자.. 
이런식으로 해결 하고 있다..

정말 뭐가 문제이고.. 왜 대통령까지 나서서 이런 이야기를 하는지 이해를 못하고 있는 ISP 업체들이 답답하다.

이러니 우리들이 한국 온라인 시장을 점점 멀리하고 해외 시장을 이용하려고 하지..

어서 PayPal 같은 해외 결제 시스템이 빨리 국내에 도입되어야 저런 찌질한 업체들이 사라질텐데..

해결 방법..

제어판 - 관리도구 - 서비스 - VPWallet 을 찾아 
사용 -> 중지 로 변경
자동 -> 수동 으로 변경.

마음같이서는 삭제 하고 싶었으나,.. 가끔 어쩔수 없이 이용하는 온라인 결제때문에.. 삭제는 못했다..

이런 나같은 호갱들 때문에 저런 찌질한 업체들이 먹구 사는 건가...
2015/03/19 11:52 2015/03/19 11:52

Posted on 2015/03/14 22:42
Filed Under Linux/설정방법

DNS server, DNS service  

Ubuntu 12.04를 설치 후 로그를 확인하고자 /var/log/messages 파일을 찾아보니..... 
어라? 없넹......

인터넷을 뒤져보니...  기본적으로 message 설정이 되어 있지 않넹.!~

보통 rssyslogd 는 기본 설치가 되어 있으므로, 
rsyslogd를 이용하여 설치하자!

 

심각한 오류(Critical Error) 는 /var/log/syslog 파일에 남으나,

그 외, INFO, NOTICE 등의 퍼실러티 등은 기록되지 않고 없어진다.

 

이는 기본 rsyslogd 의 설정 때문이라 한다. (왜!!! 덩치를 가볍게 로그조차 허용안하는게냐!)

 

아래 파일을 root 권한으로 열람한다.

$ sudo vi /etc/rsyslog.d/50-default.conf

...

#*.=info;*.=notice;*.=warn;\

#   auth,authpriv.none;\

#   cron,daemon.none;\

#   mail,news.none      -/var/log/messages

...

 

본문 중에 상기 내용을 찾아 아래와 같이 '#'으로 주석처리 되어 있는 부분을 수정한다.

(기록을 원하지 않는 항목이 있다면 제외하면 되겠다)


*.=info;*.=notice;*.=warn;\

   auth,authpriv.none;\

   cron,daemon.none;\

   mail,news.none      -/var/log/messages

 

(옵션) 또한 마지막 부분의 아래 항목을 '#'으로 주석 처리하자.

(다량의 메시지를 화면에 출력하는 것을 막는다)

 

#daemon.*;mail.*;\

#   news.err;\

#   *.=debug;*.=info;\

#   *.=notice;*.=warn   |/dev/xconsole

 

이후 저장하고(:wq) 종료하면 된다. 

 

(참조)아래를 참조하여 얼마 주기로 로그 파일을 갱신할 지 확인이 가능하다.

$ sudo vi /etc/logrotate.d/rsyslog

...

/var/log/messages

{

    rotate 4

    weekly

    missingok

    notifempty

    compress

    delaycompress

    sharedscripts

    postrotate

        reload rsyslog >/dev/null 2>&1 || true

    endscript

}

 

rsyslogd 데몬 서비스를 재실행 한다.

 

$ sudo /etc/init.d/rsyslog restart

 

이 후 부터는 기존처럼 /var/log/messages 에 로그가 쌓이기 시작한다.

 

 

Linux Log files and usage

 

=> /var/log/messages : General log messages

=> /var/log/boot : System boot log

=> /var/log/debug : Debugging log messages

=> /var/log/auth.log : User login and authentication logs

=> /var/log/daemon.log : Running services such as squid, ntpd and others log message to this file

=> /var/log/dmesg : Linux kernel ring buffer log

=> /var/log/dpkg.log : All binary package log includes package installation and other information

=> /var/log/faillog : User failed login log file

=> /var/log/kern.log : Kernel log file

=> /var/log/lpr.log : Printer log file

=> /var/log/mail.* : All mail server message log files

=> /var/log/mysql.* : MySQL server log file

=> /var/log/user.log : All userlevel logs

=> /var/log/xorg.0.log : X.org log file

=> /var/log/apache2/* : Apache web server log files directory

=> /var/log/lighttpd/* : Lighttpd web server log files directory

=> /var/log/fsck/* : fsck command log

=> /var/log/apport.log : Application crash report / log file

 

출처

http://mcchae.egloos.com/10913183

http://ubuntuforums.org/showthread.php?t=1568706

2015/03/14 22:42 2015/03/14 22:42

Posted on 2015/03/11 15:30
Filed Under Programming/SIP (VoIP)

DNS server, DNS service  

Asterisk 설치 방법이 정리가 잘 되어 있음!~

출처 : http://sipjs.com/guides/server-configuration/asterisk/



Guides

Tired of fighting with configs?

Try SIP.js and OnSIP — a perfect pairing for WebRTC!

Configure Asterisk

SIP.js has been tested with Asterisk 11.11.0 without any modification to the source code of SIP.js or Asterisk. Similar configuration should also work for Asterisk 12.

System Setup

Asterisk and SIP.js were tested using the following setup:

Required Packages

Install the following dependencies:

  • wget
  • gcc
  • gcc-c++
  • ncurses-devel
  • libxml2-devel
  • sqlite-devel
  • libsrtp-devel
  • libuuid-devel
  • openssl-devel

Using YUM, all dependencies can be installed with:

yum install wget gcc gcc-c++ ncurses-devel libxml2-devel sqlite-devel libuuid-devel openssl-devel.

Install libsrtp

First try installing libsrtp from the repo.

yum install libsrtp-devel

If libsrtp is not available in the repo install it from source.

  1. cd /usr/local/src/
  2. wget http://srtp.sourceforge.net/srtp-1.4.2.tgz
  3. tar zxvf srtp-1.4.2.tgz
  4. cd /usr/local/src/srtp
  5. ./configure CFLAGS=-fPIC
  6. make && make install

Install Asterisk

  1. cd /usr/local/src/.
  2. Download Asterisk withwget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-11.11.0.tar.gz.
  3. Extract Asterisk: tar zxvf asterisk*.
  4. Enter the Asterisk directory: cd /usr/local/src/asterisk*.
  5. Run the Asterisk configure script:./configure --libdir=/usr/lib64.
  6. Run the Asterisk menuselect tool: make menuselect.
  7. In the menuselect, go to the resources option and ensure that res_srtp is enabled. If there are 3 x’s next to res_srtp, there is a problem with the srtp library and you must reinstall it. Save the configuration (press x).
  8. Compile and install Asterisk: make && make install.
  9. If you need the sample configs you can run make samples to install the sample configs. If you need to install the Asterisk startup script you can run make config.

Setup DTLS Certificates

  1. mkdir /etc/asterisk/keys
  2. Enter the Asterisk scripts directory:cd /usr/local/src/asterisk*/contrib/scripts.
  3. Create the DTLS certificates (replace pbx.mycompany.com with your ip address or dns name, replace My Super Company with your company name):./ast_tls_cert -C pbx.mycompany.com -O "My Super Company" -d /etc/asterisk/keys.

Configure Asterisk For WebRTC

For WebRTC, a lot of the settings that are needed MUST be in thepeer settings. The global settings do not flow down into the peer settings very well. By default, Asterisk config files are located in/etc/asterisk/. Start by editing http.conf and make sure that the following lines are uncommented:

1
2
3
4
5
;http.conf
[general]
enabled=yes
bindaddr=127.0.0.1 ; Replace this with your IP address
bindport=8088 ; Replace this with the port you want to listen on

Change the IP address and port to the IP address of your server and the port that you would like Asterisk to listen for web socket connections on.

Next, edit sip.conf. Here you will set up two peers, one for a WebRTC client and one for a non-WebRTC SIP client. The WebRTC peer requires encryption, avpf, and icesupport to be enabled. In most cases, directmedia should be disabled. Also under the WebRTC client, the transport needs to be listed as ‘ws’ to allow websocket connections. All of these config lines should be under the peer itself; setting these config lines globally might not work.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
;sip.conf
[general]
realm=127.0.0.1 ; Replace this with your IP address
udpbindaddr=127.0.0.1 ; Replace this with your IP address
transport=udp

[1060] ; This will be WebRTC client
type=friend
username=1060 ; The Auth user for SIP.js
host=dynamic ; Allows any host to register
secret=password ; The SIP Password for SIP.js
encryption=yes ; Tell Asterisk to use encryption for this peer
avpf=yes ; Tell Asterisk to use AVPF for this peer
icesupport=yes ; Tell Asterisk to use ICE for this peer
context=default ; Tell Asterisk which context to use when this peer is dialing
directmedia=no ; Asterisk will relay media for this peer
transport=udp,ws ; Asterisk will allow this peer to register on UDP or WebSockets
force_avp=yes ; Force Asterisk to use avp. Introduced in Asterisk 11.11
dtlsenable=yes ; Tell Asterisk to enable DTLS for this peer
dtlsverify=no ; Tell Asterisk to not verify your DTLS certs
dtlscertfile=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS cert file is
dtlsprivatekey=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS private key is
dtlssetup=actpass ; Tell Asterisk to use actpass SDP parameter when setting up DTLS

[1061] ; This will be the legacy SIP client
type=friend
username=1061
host=dynamic
secret=password
context=default

Lastly, set up extensions.conf to allow the two peers to call each other.

1
2
3
4
;extensions.conf
[default]
exten => 1060,1,Dial(SIP/1060) ; Dialing 1060 will call the SIP client registered to 1060
exten => 1061,1,Dial(SIP/1061) ; Dialing 1061 will call the SIP client registered to 1061

Restart Asterisk using service asterisk restart to ensure that the new settings take effect.

Configure SIP.js

Asterisk does not accept Contact headers with the .invaliddomain. When creating a UA, add the configuration parameterhackIpInContact. If you are missing this property you will be able to make calls from WebRTC, but not receive calls through Asterisk will fail.

Additionally this guide will only work with audio calls, Asterisk will reject video calls.

The following configuration example creates a UA for the Asterisk configuration above. Replace the values with the values from your config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var config = {
  // Replace this IP address with your Asterisk IP address
  uri: '1060@127.0.0.1',

  // Replace this IP address with your Asterisk IP address,
  // and replace the port with your Asterisk port from the http.conf file
  ws_servers: 'ws://127.0.0.1:8088/ws',

  // Replace this with the username from your sip.conf file
  authorizationUser: '1060',

  // Replace this with the password from your sip.conf file
  password: 'password',
  
  // HackIpInContact for Asterisk
  hackIpInContact: true,
  
};

var ua = new SIP.UA(config);

// Invite with audio only
ua.invite('1061',{
  audio: true,
  video: false
});
  • Update 10/24/2014 - If you are still having trouble with Asterisk and are using a WebSocket Secure (WSS), you can try using thehackWssInTransport: true parameter in your UA’s configuration. This is new as of commit 32bffbe on the SIP.js Master branch.

Troubleshooting

Firefox 34+ requires SIP.js 0.6.4 or later to interop with FreeSWITCH or Asterisk.

This forum post on troubleshooting WebRTC issues is a great guide for trouble shooting problems with Asterisk.

Asterisk Secure Calling Guide can help you setup dtls certificates.

2015/03/11 15:30 2015/03/11 15:30

About

by CoCo

Notice

Counter

· Total
: 846588
· Today
: 75
· Yesterday
: 70