CentOS6.5 にAsterisk13 を入れてSIPクライアント⇔WebRTC間通信してみた。(インストール編)


WebRTCとSipやらなんやらとつなげたいときのAsterisk導入メモ。

環境

ConoHa VPS

メモリ CPU HDD 標準プラン
1GB 2コア 100GB 930円

OS: CentOS6.5 x64

この為だけに借りました...初めてVPS借るとドメインやらなんやらとりたくなるもんですね。
今回Conohaを選んだ理由は 可愛いから 拡張が用意にできそうな点ですかね。
お金ないのでやらないですけどね。1500円で約1.5ヶ月無料で利用できるのは大きい。

ビルド環境構築

$ yum update
$ yum install gcc-c++ make gnutls-devel kernel-devel libxml2-devel ncurses-devel subversion doxygen texinfo curl-devel net-snmp-devel neon-devel
$ yum install uuid-devel libuuid-devel sqlite-devel sqlite git speex-devel gsm-devel

janssonが必要とのことなのでこちらもインストール

$ cd /usr/src/
$ git clone https://github.com/akheron/jansson.git
$ cd jansson
$ autoreconf -i
$ ./configure -prefix=/usr/
$ make && make install

必要ライブラリのインストール

SRTP

$ cd /usr/src/ 
$ wget wget https://downloads.sourceforge.net/project/srtp/srtp/1.4.4/srtp-1.4.4.tgz
$ tar zxvf srtp-1.4.4.tgz 
$ cd srtp
$ autoconf 
$ ./configure CFLAGS=-fPIC
$ make && make install 

PJPROJECT

$ cd /usr/src/
$ wget http://www.pjsip.org/release/2.4/pjproject-2.4.tar.bz2
$ tar xvjf pjproject-2.4.tar.bz2
$ cd pjproject-2.4
$ ./configure --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr
$ ./configure --libdir=/usr/lib64 --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr 
$ touch pjlib/include/pj/config_site.h
$ make dep
$ make clean
$ make 
$ make install
$ ldconfig

確認!!!

$ ldconfig -p | grep pj 

Asteriskのビルド&インストール

$ cd /usr/src/ 
$ wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz 
$ tar -xzvf asterisk-13-current.tar.gz 
$ cd asterisk-13.3.2/
$ ./configure -with-crypto -with-ssl -with-srtp=/usr/local/lib --prefix=/usr --libdir=/usr/lib64
$ contrib/scripts/get_mp3_source.sh 
$ meke menuselect

Resource Modules を選択 下記のように res_pjsip_**** が [*] となっていることを確認。

**************************************************
    Asterisk Module and Build Option Selection
**************************************************

                Press 'h' for help.

               [*] res_format_attr_celt
               [*] res_format_attr_h263
               [*] res_format_attr_h264
               [*] res_format_attr_opus
               [*] res_format_attr_silk
               XXX res_http_post
               [*] res_limit
               [*] res_manager_devicestate
               [*] res_manager_presencestate
               [*] res_monitor
               [*] res_musiconhold
               [*] res_mutestream
               ( ) res_mwi_external
               < > res_mwi_external_ami
               XXX res_odbc
               [*] res_parking
               [*] res_pjsip
               [*] res_pjsip_acl
               [*] res_pjsip_authenticator_digest
               [*] res_pjsip_caller_id
               [*] res_pjsip_config_wizard
               [*] res_pjsip_dialog_info_body_generator
               [*] res_pjsip_diversion
               [*] res_pjsip_dtmf_info
               [*] res_pjsip_endpoint_identifier_anonymous
               [*] res_pjsip_endpoint_identifier_ip
               [*] res_pjsip_endpoint_identifier_user
               [*] res_pjsip_exten_state
               [*] res_pjsip_header_funcs
               [*] res_pjsip_keepalive
                   ... More ...
$ make
 +--------- Asterisk Build Complete ---------+
 + Asterisk has successfully been built, and +
 + can be installed by running:              +
 +                                           +
 +                make install               +
 +-------------------------------------------+

ビルド完了!

$ make install
 +---- Asterisk Installation Complete -------+
 +                                           +
 +    YOU MUST READ THE SECURITY DOCUMENT    +
 +                                           +
 + Asterisk has successfully been installed. +
 + If you would like to install the sample   +
 + configuration files (overwriting any      +
 + existing config files), run:              +
 +                                           +
 +                make samples               +
 +                                           +
 +-----------------  or ---------------------+
 +                                           +
 + You can go ahead and install the asterisk +
 + program documentation now or later run:   +
 +                                           +
 +               make progdocs               +
 +                                           +
 + **Note** This requires that you have      +
 + doxygen installed on your local system    +
 +-------------------------------------------+

インストール完了!!

設定ファイルのサンプルを作成しておわり
Service登録も。。。

$ make samples
$ make config
$ chkconfig asterisk on

起動

$ /etc/init.d/asterisk start

導入、ここまで。

pjproject入れるときに色々ファイルが散らばってしまったので少しずつ整理していく予定。
動作確認等、また今度...