「Asterisk」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(Pkg/AUR テンプレートの更新)
(→‎modules.conf: {{=}} を一部修正)
 
(3人の利用者による、間の29版が非表示)
1行目: 1行目:
[[Category:電話と音声]]
+
[[Category:電話]]
  +
[[Category:Voice over IP]]
 
[[en:Asterisk]]
 
[[en:Asterisk]]
[http://www.asterisk.org Asterisk] は完全な PBX (電話交換機) ソフトウェアです。Linux, BSD, Windows, macOS などで動作し、PBX が通常備えている機能は全て含まれています。Asterisk は4つのプロトコルによる VoIP ができ、比較的安価なハードウェアでほぼ全ての規格の電話装置と一緒に使うことが可能です。
+
[http://www.asterisk.org Asterisk] は完全な PBX (構内交換機) ソフトウェアです。Linux, BSD, Windows, macOS などで動作し、PBX が通常備えている機能は全て含まれています。Asterisk は4つのプロトコル Voice over IP を実現し、比較的安価なハードウェアでほぼ全ての規格の電話装置と一緒に使うことが可能です。
   
 
Asterisk はボイスメールサービス、電話帳、電話会議、自動音声応答、コールキューイングを実現します。また、三者通話、発信者番号通知サービス、ADSI、IAX、SIP、H.323 (クライアントとゲートウェイの両方)、MGCP (コールマネージャのみ)、SCCP/Skinny をサポートしています。
 
Asterisk はボイスメールサービス、電話帳、電話会議、自動音声応答、コールキューイングを実現します。また、三者通話、発信者番号通知サービス、ADSI、IAX、SIP、H.323 (クライアントとゲートウェイの両方)、MGCP (コールマネージャのみ)、SCCP/Skinny をサポートしています。
11行目: 12行目:
 
{{AUR|asterisk}} パッケージをインストールしてください。Cisco の IP 電話を使用する場合はパッチが適用されている {{AUR|asterisk-cisco}} パッケージを使うことが推奨されます ([https://issues.asterisk.org/jira/browse/ASTERISK-13145 https://issues.asterisk.org/jira/browse/ASTERISK-13145] を参照)。
 
{{AUR|asterisk}} パッケージをインストールしてください。Cisco の IP 電話を使用する場合はパッチが適用されている {{AUR|asterisk-cisco}} パッケージを使うことが推奨されます ([https://issues.asterisk.org/jira/browse/ASTERISK-13145 https://issues.asterisk.org/jira/browse/ASTERISK-13145] を参照)。
   
  +
あるいは、{{AUR|asterisk-lts-20}} パッケージをインストールすると、長期サポートリリースを入手できます(現在の最新 LTS メジャーバージョンは Asterisk 20です)。Asterisk LTS リリースは機能が少ない傾向にありますが、ずっと長い間メンテナンスされます。すべての asterisk バージョンのリリースサイクルに関する完全な詳細については、[https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions Asterisk Versions] ページを参照してください。
インストールしたら {{ic|asterisk.service}} でサーバーを[[起動]]してください。
 
   
  +
インストールしたら {{ic|asterisk.service}} systemd サービスを[[有効化]]および[[起動]]してください。
SIP [[アプリケーション一覧/インターネット#VoIP / ソフトフォン|ソフトフォン]]と最低2つのマシンが必要です。SIP フォンとしては [http://www.linphone.org/ linphone] ({{AUR|linphone}}{{Broken package link|パッケージが存在しません}}) や [http://www.counterpath.com/x-lite/ X-Lite] ({{AUR|xlite_bin}}) が推奨されます。
 
  +
  +
SIP [[アプリケーション一覧/インターネット#VoIP / ソフトフォン|ソフトフォン]]と最低2つのマシンが必要です。SIP フォンとしては [https://icanblink.com/ Blink] ({{AUR|blink}})、 [https://www.linphone.org/ Linphone] ({{AUR|liblinphone-git}}) または [https://www.counterpath.com/x-lite/ X-Lite] ({{AUR|xlite-bin}}) が推奨されます。
   
 
ilbc コーデックのサポートを有効にするには PKGBUILD の {{ic|build}} セクションの冒頭に以下を追加してください:
 
ilbc コーデックのサポートを有効にするには PKGBUILD の {{ic|build}} セクションの冒頭に以下を追加してください:
21行目: 24行目:
 
</nowiki>}}
 
</nowiki>}}
   
==設定==
+
== 設定 ==
  +
===SIP===
 
  +
Asterisk 20 から、従来の {{ic|chan_sip}} モジュールはデフォルトでコンパイルされなくなりました。Asterisk 21 がリリースされると(2023年10月予定)、{{ic|chan_sip}} は完全に削除されます(すでにマスターブランチから削除されています)。もし {{ic|res_pjsip}} よりも {{ic|chan_sip}} を使用したい場合は、{{AUR|asterisk-lts-18}} をインストールしてください。これは、{{ic|chan_sip}} をビルドした最後の LTS リリースでした。
  +
  +
{{ic|res_pjsip}} は、より新しく、より高性能な Asterisk チャネルモジュールで、標準の SIP(Session Initiation Protocol)プロトコルをサポートしています。これは、多くのキャリア、電話会社、インターネット電話サービスプロバイダ(ITSP)、および企業で使用されている主要な VoIP(Voice over Internet Protocol)プロトコルです。ただし、{{ic|res_pjsip}} は、古い {{ic|chan_sip}} よりも設定がかなり複雑です。
  +
  +
広く受け入れられている Asterisk コミュニティの意見では、既存の設定がある場合に限り {{ic|chan_sip}} を使用し、{{ic|res_pjsip}} へのアップグレードも計画することを提案しています。新規インストールの場合は、{{ic|res_pjsip}} が推奨されます。上記で述べたように、{{ic|chan_sip}} はもはやメンテナンスされておらず、セキュリティ修正も(古い LTS リリースを除いて)行われないため、新しい Asterisk PBX 管理者は、サポートされている SIP チャネルドライバー(つまり、{{ic|res_pjsip}})を選択するべきです。
  +
  +
既存の {{ic|chan_sip}} 設定がある場合、Asterisk 20 でビルドするには、次の手順を実行します:{{AUR|asterisk}} の PKGBUILD を編集し、{{ic|build()}} 関数内で次の行を変更します:
  +
  +
{{hc|PKGBUILD|2=make MENUSELECT_CFLAGS= OPTIMIZE= DEBUG= ASTVARRUNDIR="/run/$pkgname" NOISY_BUILD=1}}
  +
  +
これを menuselect ツールをビルドする呼び出しでプレフィックスし、{{ic|chan_sip}} を有効にします:
  +
  +
{{hc|PKGBUILD|2=
  +
make menuselect.makeoptions && \
  +
menuselect/menuselect --enable chan_sip && \
  +
make MENUSELECT_CFLAGS= OPTIMIZE= DEBUG= ASTVARRUNDIR="/run/$pkgname" NOISY_BUILD=1
  +
}}
  +
  +
この手順は、{{AUR|asterisk}} パッケージの更新ごとに行う必要がありますが、{{AUR|asterisk}} が Asterisk 21 に移行すると、この手順は機能しなくなることに注意してください。
  +
  +
=== PJSIP ===
  +
  +
インストール後、Asterisk は {{ic|res_pjsip}} 設定を {{ic|/etc/asterisk/pjsip.conf}} に持っています。Asterisk に同梱されているサンプルファイルには、いくつかの基本的な例が含まれていますが、すべての pjsip オプションには網羅されていません。続行する前に、[https://wiki.asterisk.org/wiki/x/EwFB Asterisk Wiki Security best practices article] と [https://wiki.asterisk.org/wiki/display/AST/Configuring+res_pjsip Configuring res_pjsip] を読むことをお勧めします。
  +
  +
この記事には、基本的なシングル SIP 電話と複数の SIP トランクの例が含まれており、[https://store.sipstation.com/ss_index/ SIP Station SIP trunks, from Sangoma] を使用しています。SIP Station の推奨に従って、2つの SIP トランクが冗長性のために SIP Station で設定されています。次の例は、Sangoma/Digium D60 ハードウェア電話を使用してテストされましたが、SIP 2.0 準拠のハードウェア電話またはソフトウェア電話でも十分です。
  +
  +
この例では、Asterisk PBX サーバーと SIP 電話がプライベートな IPv4 LAN 上にあり、NAT ルーターがサーバー/電話と WAN/インターネットの間にあると仮定しています。IPv6 を使用したい場合は、[https://wiki.asterisk.org/wiki/display/AST/Configuring+res_pjsip+for+IPv6 Configuring res_pjsip for IPv6] の記事をお読みください。
  +
  +
==== modules.conf ====
  +
  +
まず、{{ic|res_pjsip.so}} が {{ic|1=noload =}} でプレフィックスされていないことを確認してください。この例では、{{ic|1=require =}} プレフィックスを使って、{{ic|chan_pjsip.so}} のロードに失敗した場合に Asterisk がロードに失敗するようにしています。これは絶対に必要ではありませんが、{{ic|res_pjsip}} がロードされない場合、Asterisk がロードされる意味がないかもしれません。
  +
  +
{{hc|/etc/asterisk/modules.conf|
  +
;...
  +
require {{=}} chan_pjsip.so
  +
;...
  +
}}
  +
  +
==== pjsip.conf ====
  +
  +
{{ic|pjsip.conf}} の設定に取り掛かる前に、[https://wiki.asterisk.org/wiki/display/AST/PJSIP+Configuration+Wizard PJSIP Configuration Wizard] を確認してください。これは、1つの SIP プロバイダー/ ITSP のみの簡単なユースケースに役立ち、pjsip オブジェクトの多くを自動的に処理します。
  +
  +
ファイル {{ic|pjsip.conf}} は、ini 形式の設定ファイルで、{{ic|[section-headers-in-square-brackets]}} と、ハッシュ({{ic|#}})またはセミコロン({{ic|;}})をコメント文字として使用します。セクションヘッダーの下の各行は {{ic|key{{=}}value}} ペアで、セクション固有のキーを指定された値に設定します。セクションヘッダーには、閉じる角括弧の後に {{ic|(!)}} を追加できることに注意してください。これは、セクションがテンプレートであり、後で {{ic|pjsip.conf}} 内で使用することを示しています。以前に定義されたテンプレートを使用してセクションをインスタンス化するには、セクションヘッダーに {{ic|(template-name)}} を追加してください。
  +
  +
===== transport section =====
  +
  +
In order to define a SIP trunk for use with Asterisk, PJSIP has the concept of a network {{ic|transport}}. From the Asterisk Wiki, the transport section configures how {{ic|res_pjsip}} will operate at the transport layer. For example, it supports configuration options for protocols such as TCP, UDP, or WebSockets and encryption methods like TLS/SSL.
  +
  +
Transport sections can be named arbitrarily, but it is recommended to name the section that makes it easy to remember what it signifies. The following example names it {{ic|[transport-udp-nat]}} for identifying that this transport is using UDP for SIP, and is expected to traverse a NAT device.
  +
  +
{{hc|/etc/asterisk/pjsip.conf|2=
  +
[transport-udp-nat]
  +
type=transport ; signifies this is a transport definition
  +
protocol=udp ; specifies this uses the UDP transport protocol
  +
; this transport binds to all configured network interfaces,
  +
; replace with the IP address of the desired interface. 0.0.0.0 means all interfaces
  +
bind=0.0.0.0
  +
; ===== NOTE, the following directives are OPTIONAL
  +
local_net=10.20.30.0/24 ; specify the networks that this Asterisk server should consider as local/LAN networks. Change this to the local LAN subnet (in CIDR notation)
  +
local_net=127.0.0.0/8 ; specify the networks that this Asterisk server should consider as local/LAN networks (this one sets it to the IPv4 loopback network)
  +
external_media_address=96.69.199.60 ; specify the external/WAN IP address for RDP media (audio)
  +
external_signaling_address=96.69.199.60 ; specify the external/WAN IP address for SIP (signaling)
  +
}}
  +
  +
Note that only one transport is allowed for each IP address/port or IP address/protocol mapping. If you would like to configure multiple transport protocols (e.g. both TCP and UDP), you will need to bind each protocol to a different IP address. Likewise if you want to define multiple transports using the same protocol, the ports used need to be different for each transport definition.
  +
  +
===== registration section =====
  +
  +
Next, define the registrations the SIP trunks will use. Note that the SIP Station registrations are first defined via a template (with {{ic|(!)}} appended to the section name). Each template defines the settings that are common for each section using the template; the sections themselves only contain the options that need to be set for that section.
  +
  +
{{hc|/etc/asterisk/pjsip.conf|2=
  +
[sipstation-reg](!)
  +
type=registration
  +
transport=transport-udp-nat
  +
contact_user=15055551234
  +
retry_interval=60
  +
  +
; ==== ... several other templates and sections will appear here
  +
; ==== including the authentication sections, etc., which are also used by the registration
  +
; ==== ....
  +
  +
[siptsation-reg1](sipstation-reg)
  +
outbound_auth=sipstation-auth1
  +
<nowiki>server_uri=sip:trunk1.freepbx.com ; trunk1 provided by SIP Station
  +
client_uri=sip:my_username@trunk1.freepbx.com</nowiki>
  +
  +
[siptsation-reg2](sipstation-reg)
  +
outbound_auth=sipstation-auth2
  +
<nowiki>server_uri=sip:trunk2.freepbx.com ; trunk2 provided by SIP Station
  +
client_uri=sip:my_username@trunk2.freepbx.com</nowiki>
  +
}}
  +
  +
===== authentication section =====
  +
  +
Here, define the authentication template, and the specific authentication sections for use with the SIP Station trunks.
  +
  +
{{hc|/etc/asterisk/pjsip.conf|2=
  +
[sipstation-auth](!)
  +
type=auth
  +
password=Super*Secret@Password!
  +
username=my_username
  +
  +
; ==== ... more templates may appear here
  +
  +
[sipstation-auth1](sipstation-auth)
  +
realm=trunk1.freepbx.com
  +
  +
[sipstation-auth2](sipstation-auth)
  +
realm=trunk2.freepbx.com
  +
}}
  +
  +
===== endpoint section =====
  +
  +
An endpoint is essentially a profile for the configuration of a SIP device such as a phone or remote server. This defines the transport, the Asterisk Dialplan context where calls originating from the endpoint gets handled, and the audio codecs allowed for the endpoint. For the SIP station trunks, define the following:
  +
  +
{{hc|/etc/asterisk/pjsip.conf|2=
  +
[sipstation-endpoint](!)
  +
type=endpoint
  +
transport=transport-udp-nat
  +
context=from-external ; Dialplan context, defined in extensions.conf or related file
  +
disallow=all ; disallows all codecs, including default ones, unless explicitly allowed below
  +
allow=ulaw ; standard G.711, uncompressed PCM codec. Uses the most bandwidth
  +
allow=gsm ; another standard, compressed codec. Uses less bandwidth than ulaw
  +
; other codecs are available, and have different attributes. Some require paid licenses to use.
  +
aors=sipstation-aors ; AOR - Address of Record, to be defined later
  +
;direct_media=no ; setting this may not allow audio to pass through NAT
  +
direct_media=yes
  +
rtp_symmetric=yes
  +
  +
; ==== ... more template definitions
  +
  +
[sipstation-endpoint1](sipstation-endpoint)
  +
outbound_auth=sipstation-auth1
  +
from_domain=trunk1.freepbx.com
  +
  +
[sipstation-endpoint2](sipstation-endpoint)
  +
outbound_auth=sipstation-auth2
  +
from_domain=trunk2.freepbx.com
  +
}}
  +
  +
===== identify section =====
  +
  +
Controls how the res_pjsip_endpoint_identifier_ip module determines what endpoint an incoming packet is from. For the SIP Station trunks, the following is defined:
  +
  +
{{hc|/etc/asterisk/pjsip.conf|2=
  +
[sipstation-identify](!)
  +
type=identify
  +
; this is the LAN IP address of the NAT router, which calls from the SIP Station
  +
; trunks may appear to come from (because of NAT).
  +
match=10.20.30.254/32
  +
  +
[sipstation-id1](sipstation-identify)
  +
endpoint=sipstation-endpoint1
  +
match=192.159.66.3 ; IP address of trunk1.freepbx.com
  +
  +
[sipstation-id2](sipstation-identify)
  +
endpoint=sipstation-endpoint2
  +
match=162.253.134.142 ; IP address of trunk2.freepbx.com
  +
}}
  +
  +
===== aor (Address Of Record) section =====
  +
  +
A primary feature of AOR objects (Address of Record) is to tell Asterisk where an endpoint can be contacted. Without an associated AOR section, an endpoint cannot be contacted. For the SIP Station trunks, define this:
  +
  +
{{hc|/etc/asterisk/pjsip.conf|2=
  +
[sipstation-aors]
  +
type=aor
  +
<nowiki>contact=sip:trunk1.freepbx.com
  +
contact=sip:trunk2.freepbx.com</nowiki>
  +
}}
  +
  +
===== phone sections =====
  +
  +
Finally, define the necessary sections for the SIP phone that will register to Asterisk. It has several similar sections as with the SIP Station trunks. Expand these with templates if multiple local SIP phones are intended to register to your Asterisk PBX. Remote phones (from the WAN/Internet) can also be configured, but that iss outside the scope of this example.
  +
  +
{{hc|/etc/asterisk/pjsip.conf|2=
  +
[home-phone]
  +
type=endpoint
  +
transport=transport-udp-nat
  +
context=from-internal ; Dialplan context that gets executed when a user dials from this phone
  +
disallow=all
  +
allow=ulaw
  +
allow=gsm
  +
auth=home-phone-auth
  +
aors=home-phone
  +
  +
[home-phone-auth]
  +
type=auth
  +
auth_type=userpass
  +
password=MyPhonePa$$word0
  +
username=home-phone
  +
  +
[home-phone]
  +
type=aor
  +
max_contacts=1
  +
}}
  +
  +
==== Managing PJSIP ====
  +
  +
There are several commands regarding {{ic|res_pjsip}} available in the Asterisk CLI, all prefixed with the {{ic|pjsip}} command. To get to the Asterisk CLI, enter the following command, as the {{ic|asterisk}} user:
  +
  +
$ asterisk -rvvv
  +
  +
This assumes Asterisk is already running (e.g., via the systemd service unit). Once in the Asterisk CLI, you will see the prompt {{ic|hostname*CLI> }}. To see a list of available PJSIP commands, type {{ic|help pjsip}}.
  +
  +
To see a list of PJSIP registrations, type the following:
  +
  +
{{hc|hostname*CLI> pjsip show registrations|<nowiki>
  +
  +
<Registration/ServerURI..............................> <Auth....................> <Status.......>
  +
---------------------------------------------------------------------------------------------
  +
  +
siptsation-reg1/sip:trunk1.freepbx.com sipstation-auth1 Registered (exp. 2062s)
  +
siptsation-reg2/sip:trunk2.freepbx.com sipstation-auth2 Registered (exp. 2069s)
  +
  +
Objects found: 2
  +
</nowiki>}}
  +
  +
To see a list of PJSIP endpoints, type the following:
  +
  +
{{hc|hostname*CLI> pjsip show endpoints|<nowiki>
  +
  +
Endpoint: <Endpoint/CID.....................................> <State.....> <Channels.>
  +
I/OAuth: <AuthId/UserName...........................................................>
  +
Aor: <Aor............................................> <MaxContact>
  +
Contact: <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  +
Transport: <TransportId........> <Type> <cos> <tos> <BindAddress..................>
  +
Identify: <Identify/Endpoint.........................................................>
  +
Match: <criteria.........................>
  +
Channel: <ChannelId......................................> <State.....> <Time.....>
  +
Exten: <DialedExten...........> CLCID: <ConnectedLineCID.......>
  +
----------------------------------------------------------------------------------------------
  +
  +
Endpoint: home-phone Not in use 0 of inf
  +
InAuth: home-phone-auth/home-phone
  +
Aor: home-phone 1
  +
Contact: home-phone/sip:home-phone@10.20.30.229:506 f91928f561 NonQual nan
  +
Transport: transport-udp-nat udp 0 0 0.0.0.0:5060
  +
  +
Endpoint: sipstation-endpoint1 Not in use 0 of inf
  +
OutAuth: sipstation-auth1/mw3FSBsPPjQ7
  +
Aor: sipstation-aors 0
  +
Contact: sipstation-aors/sip:trunk1.freepbx.com 256c242e36 NonQual nan
  +
Contact: sipstation-aors/sip:trunk2.freepbx.com c07c6c7180 NonQual nan
  +
Transport: transport-udp-nat udp 0 0 0.0.0.0:5060
  +
Identify: sipstation-id1/sipstation-endpoint1
  +
Match: 10.20.30.254/32
  +
Match: 192.159.66.3/32
  +
  +
Endpoint: sipstation-endpoint2 Not in use 0 of inf
  +
OutAuth: sipstation-auth2/mw3FSBsPPjQ7
  +
Aor: sipstation-aors 0
  +
Contact: sipstation-aors/sip:trunk1.freepbx.com 256c242e36 NonQual nan
  +
Contact: sipstation-aors/sip:trunk2.freepbx.com c07c6c7180 NonQual nan
  +
Transport: transport-udp-nat udp 0 0 0.0.0.0:5060
  +
Identify: sipstation-id2/sipstation-endpoint2
  +
Match: 10.20.30.254/32
  +
Match: 162.253.134.142/32
  +
  +
Objects found: 3
  +
</nowiki>}}
  +
  +
=== chan_sip ===
 
asterisk サーバーを動かしたら、後は2つのファイルを編集すれば設定できます: {{ic|sip.conf}} と {{ic|extensions.conf}}。asterisk の設定ディレクトリ ({{ic|/etc/asterisk}}) に移動して、{{ic|sip.conf}} を編集して以下を記述してください:
 
asterisk サーバーを動かしたら、後は2つのファイルを編集すれば設定できます: {{ic|sip.conf}} と {{ic|extensions.conf}}。asterisk の設定ディレクトリ ({{ic|/etc/asterisk}}) に移動して、{{ic|sip.conf}} を編集して以下を記述してください:
 
{{bc|1=
 
{{bc|1=
51行目: 317行目:
   
 
これでコンテキスト {{Ic|house}} が作成され SIP ユーザー {{Ic|me1}} にエクステンション 100 が、SIP ユーザー {{Ic|me2}} にエクステンション 101 が割り当てられます。後は実際に動作するか確認するだけです。
 
これでコンテキスト {{Ic|house}} が作成され SIP ユーザー {{Ic|me1}} にエクステンション 100 が、SIP ユーザー {{Ic|me2}} にエクステンション 101 が割り当てられます。後は実際に動作するか確認するだけです。
  +
 
===保留音===
 
===保留音===
 
保留音はとても楽しい機能です。簡単に設定することができます。{{ic|/etc/asterisk/musiconhold.conf}} を編集して以下を追加してください:
 
保留音はとても楽しい機能です。簡単に設定することができます。{{ic|/etc/asterisk/musiconhold.conf}} を編集して以下を追加してください:
59行目: 326行目:
 
}}
 
}}
   
後はお気に入りの MP3 を {{ic|/var/lib/asterisk/mohmp3}} にコピーしてください。
+
後は合法的に入手したお気に入りの MP3 を {{ic|/var/lib/asterisk/mohmp3}} にコピーしてください。
   
 
===ボイスメール===
 
===ボイスメール===
78行目: 345行目:
 
</nowiki>}}
 
</nowiki>}}
   
[general] の設定の内容は [http://voip-info.jp/index.php/Asterisk_%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E8%A8%AD%E5%AE%9A%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB_voicemail.conf こちら] を見て下さい。[[Postfix]] が正しくセットアップされていれば PBX からメールの通知がユーザーに送信され、{{Ic|1=attach=yes}} と定義されている場合、メールに音声ファイルが添付されます。
+
{{Ic|[general]}} の設定の内容は [http://voip-info.jp/index.php/Asterisk_%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E8%A8%AD%E5%AE%9A%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB_voicemail.conf こちら] を見て下さい。[[Postfix]] が正しくセットアップされていれば PBX からメールの通知がユーザーに送信され、{{Ic|1=attach=yes}} と定義されている場合、メールに音声ファイルが添付されます。
   
 
次にメールボックスの設定です。フォーマットは:
 
次にメールボックスの設定です。フォーマットは:
96行目: 363行目:
 
600 番を呼び出すと、'VoiceMailMain' アプリケーションは default コンテキストの 100 番に行きます。{{Ic|s}} で自動ログインが許可されます。
 
600 番を呼び出すと、'VoiceMailMain' アプリケーションは default コンテキストの 100 番に行きます。{{Ic|s}} で自動ログインが許可されます。
   
  +
{{Note|'VoiceMail' アプリケーションには多くのオプションがありますので、追加のドキュメントに目を通すことをお勧めします。これは、基本的な家庭用の設定です。 また、一般的に 'VoiceMail' にアクセスする際には、ユーザーの内線より高い内線を使用することをお勧めします。208 にダイヤルしても、205 のボイスメールにヒットしないようにするためです。}}
{{Note|The 'VoiceMail' applications have a significant amount of options, so it is suggested reading over some additional documentation. This is just for a basic, home use setup. Also note that it is generally a good idea to use extensions higher then your users extensions for accessing 'VoiceMail'. This way someone dialing 208 does not hit someone's voice-mail at 205.}}
 
   
 
===PSTN に接続===
 
===PSTN に接続===
133行目: 400行目:
 
}}
 
}}
   
*outbound コンテキストでは、ダイアルした番号を全てサービスプロバイダに送信します。2 の 'whatever' は {{ic|sip.conf}} の設定と一致させる必要があります。
+
* 発信(outbound)コンテキストでは、ダイアルした番号を全てサービスプロバイダに送信します。2 の 'whatever' は {{ic|sip.conf}} の設定と一致させる必要があります。
  +
* もちろん、着信(inbound)番号計画は、あなたが望むように変更することができます。例えば、{{Ic|Dial(SIP/me1)}}とすることで、誰かがあなたの番号に電話をかけると、あなたのコンピュータの SIP 電話に転送されるようにすることができます。それから、ボイスメールなどを追加します。
*Of course, the inbound dial-plan can be modified to do what you want. For instance, you can have {{Ic|Dial(SIP/me1)}} so when someone calls your number they are routed to your SIP phone on your computer. Then add in voice-mail and so on.
 
   
 
=====iax.conf=====
 
=====iax.conf=====
  +
The first step is to log into FWD and enable their side of IAX. It is under extra features, and keep in mind that the authors claim it takes a little while to activate.
 
  +
まず、FWD にログインして、FWD 側の IAX を有効にします。これは extra features の下にあり、作者は有効化するのに少し時間がかかると主張しているのを覚えておいてください。
   
 
そして {{ic|iax.conf}} の 'general' セクションを以下のように編集:
 
そして {{ic|iax.conf}} の 'general' セクションを以下のように編集:
155行目: 423行目:
 
}}
 
}}
   
  +
これにより、FWD からの呼び出しが許可されます。
This allows calls from FWD.
 
   
 
=====extensions.conf=====
 
=====extensions.conf=====
167行目: 435行目:
 
}}
 
}}
   
  +
次に、これを発信用のコンテキストに追加します:
Next, add this to a context for outgoing:
 
 
{{bc|1=
 
{{bc|1=
 
exten => _393.,1,SetCallerId,${FWDCIDNAME}
 
exten => _393.,1,SetCallerId,${FWDCIDNAME}
174行目: 442行目:
 
}}
 
}}
   
  +
「393」は好きなように変更できます。これは、「転送」番号をダイヤルする前にダイヤルするものです。例えば、「744561」をダイヤルする場合は、「393744561」をダイヤルします。
You can change the '393' to whatever you want. This is what you will dial before dialing a 'fwd' number. For instance, to dial '744561' you would dial '393744561'.
 
   
  +
そして最後に、着信です。
And lastly, the incoming calls:
 
 
{{bc|1=
 
{{bc|1=
 
[fromiaxfwd]
 
[fromiaxfwd]
184行目: 452行目:
 
}}
 
}}
   
  +
{{Note|もし問題があれば、{{ic|extensions.conf}}から変数を削除してみてください。この手順は FWD のサイトからのもので、この記事の著者によってテストされたわけではありません。}}
{{Note|If you have problems try removing the variables from {{ic|extensions.conf}}. These instructions are from FWD's site and I have not been tested by this article's author.}}
 
  +
  +
内線番号の 55555(有志のテスト回線)、514(会議)にかけてみてください。
   
Extensions to try calling are 55555 (a volunteer maned test line) and 514 (conference).
 
 
===音声===
 
===音声===
 
音声は {{ic|/var/lib/asterisk/xx}} フォルダに保存します。{{ic|xx}} は言語コードです。例えば英語なら "en" になります。新しい音声を追加したいときはこのフォルダにコピーしてください。以下のフォルダ構造を守って下さい:
 
音声は {{ic|/var/lib/asterisk/xx}} フォルダに保存します。{{ic|xx}} は言語コードです。例えば英語なら "en" になります。新しい音声を追加したいときはこのフォルダにコピーしてください。以下のフォルダ構造を守って下さい:
237行目: 506行目:
 
==トラブルシューティング==
 
==トラブルシューティング==
 
404 Not Found エラーが表示される場合は {{ic|extensions.conf}} とダイアルした電話番号を確認してください。
 
404 Not Found エラーが表示される場合は {{ic|extensions.conf}} とダイアルした電話番号を確認してください。
  +
  +
{{TranslationStatus|Asterisk|2023-3-2|737751}}

2023年5月1日 (月) 14:49時点における最新版

Asterisk は完全な PBX (構内交換機) ソフトウェアです。Linux, BSD, Windows, macOS などで動作し、PBX が通常備えている機能は全て含まれています。Asterisk は4つのプロトコルで Voice over IP を実現し、比較的安価なハードウェアでほぼ全ての規格の電話装置と一緒に使うことが可能です。

Asterisk はボイスメールサービス、電話帳、電話会議、自動音声応答、コールキューイングを実現します。また、三者通話、発信者番号通知サービス、ADSI、IAX、SIP、H.323 (クライアントとゲートウェイの両方)、MGCP (コールマネージャのみ)、SCCP/Skinny をサポートしています。

この記事では家庭ネットワークにおけるシンプルな設定を説明し、SIP ソフトフォンを使って LAN 上の他の SIP ソフトフォンと会話できるようにします。

インストール

asteriskAUR パッケージをインストールしてください。Cisco の IP 電話を使用する場合はパッチが適用されている asterisk-ciscoAUR パッケージを使うことが推奨されます (https://issues.asterisk.org/jira/browse/ASTERISK-13145 を参照)。

あるいは、asterisk-lts-20AUR パッケージをインストールすると、長期サポートリリースを入手できます(現在の最新 LTS メジャーバージョンは Asterisk 20です)。Asterisk LTS リリースは機能が少ない傾向にありますが、ずっと長い間メンテナンスされます。すべての asterisk バージョンのリリースサイクルに関する完全な詳細については、Asterisk Versions ページを参照してください。

インストールしたら asterisk.service systemd サービスを有効化および起動してください。

SIP ソフトフォンと最低2つのマシンが必要です。SIP フォンとしては Blink (blinkAUR)、 Linphone (liblinphone-gitAUR) または X-Lite (xlite-binAUR) が推奨されます。

ilbc コーデックのサポートを有効にするには PKGBUILD の build セクションの冒頭に以下を追加してください:

cd ${srcdir}/${pkgname}-${pkgver}/contrib/scripts
echo | ./get_ilbc_source.sh

設定

Asterisk 20 から、従来の chan_sip モジュールはデフォルトでコンパイルされなくなりました。Asterisk 21 がリリースされると(2023年10月予定)、chan_sip は完全に削除されます(すでにマスターブランチから削除されています)。もし res_pjsip よりも chan_sip を使用したい場合は、asterisk-lts-18AUR をインストールしてください。これは、chan_sip をビルドした最後の LTS リリースでした。

res_pjsip は、より新しく、より高性能な Asterisk チャネルモジュールで、標準の SIP(Session Initiation Protocol)プロトコルをサポートしています。これは、多くのキャリア、電話会社、インターネット電話サービスプロバイダ(ITSP)、および企業で使用されている主要な VoIP(Voice over Internet Protocol)プロトコルです。ただし、res_pjsip は、古い chan_sip よりも設定がかなり複雑です。

広く受け入れられている Asterisk コミュニティの意見では、既存の設定がある場合に限り chan_sip を使用し、res_pjsip へのアップグレードも計画することを提案しています。新規インストールの場合は、res_pjsip が推奨されます。上記で述べたように、chan_sip はもはやメンテナンスされておらず、セキュリティ修正も(古い LTS リリースを除いて)行われないため、新しい Asterisk PBX 管理者は、サポートされている SIP チャネルドライバー(つまり、res_pjsip)を選択するべきです。

既存の chan_sip 設定がある場合、Asterisk 20 でビルドするには、次の手順を実行します:asteriskAUR の PKGBUILD を編集し、build() 関数内で次の行を変更します:

PKGBUILD
make MENUSELECT_CFLAGS= OPTIMIZE= DEBUG= ASTVARRUNDIR="/run/$pkgname" NOISY_BUILD=1

これを menuselect ツールをビルドする呼び出しでプレフィックスし、chan_sip を有効にします:

PKGBUILD
make menuselect.makeoptions && \
menuselect/menuselect --enable chan_sip && \
make MENUSELECT_CFLAGS= OPTIMIZE= DEBUG= ASTVARRUNDIR="/run/$pkgname" NOISY_BUILD=1

この手順は、asteriskAUR パッケージの更新ごとに行う必要がありますが、asteriskAUR が Asterisk 21 に移行すると、この手順は機能しなくなることに注意してください。

PJSIP

インストール後、Asterisk は res_pjsip 設定を /etc/asterisk/pjsip.conf に持っています。Asterisk に同梱されているサンプルファイルには、いくつかの基本的な例が含まれていますが、すべての pjsip オプションには網羅されていません。続行する前に、Asterisk Wiki Security best practices articleConfiguring res_pjsip を読むことをお勧めします。

この記事には、基本的なシングル SIP 電話と複数の SIP トランクの例が含まれており、SIP Station SIP trunks, from Sangoma を使用しています。SIP Station の推奨に従って、2つの SIP トランクが冗長性のために SIP Station で設定されています。次の例は、Sangoma/Digium D60 ハードウェア電話を使用してテストされましたが、SIP 2.0 準拠のハードウェア電話またはソフトウェア電話でも十分です。

この例では、Asterisk PBX サーバーと SIP 電話がプライベートな IPv4 LAN 上にあり、NAT ルーターがサーバー/電話と WAN/インターネットの間にあると仮定しています。IPv6 を使用したい場合は、Configuring res_pjsip for IPv6 の記事をお読みください。

modules.conf

まず、res_pjsip.sonoload = でプレフィックスされていないことを確認してください。この例では、require = プレフィックスを使って、chan_pjsip.so のロードに失敗した場合に Asterisk がロードに失敗するようにしています。これは絶対に必要ではありませんが、res_pjsip がロードされない場合、Asterisk がロードされる意味がないかもしれません。

/etc/asterisk/modules.conf
;...
require テンプレート:= chan_pjsip.so
;...

pjsip.conf

pjsip.conf の設定に取り掛かる前に、PJSIP Configuration Wizard を確認してください。これは、1つの SIP プロバイダー/ ITSP のみの簡単なユースケースに役立ち、pjsip オブジェクトの多くを自動的に処理します。

ファイル pjsip.conf は、ini 形式の設定ファイルで、[section-headers-in-square-brackets] と、ハッシュ(#)またはセミコロン(;)をコメント文字として使用します。セクションヘッダーの下の各行は keyテンプレート:=value ペアで、セクション固有のキーを指定された値に設定します。セクションヘッダーには、閉じる角括弧の後に (!) を追加できることに注意してください。これは、セクションがテンプレートであり、後で pjsip.conf 内で使用することを示しています。以前に定義されたテンプレートを使用してセクションをインスタンス化するには、セクションヘッダーに (template-name) を追加してください。

transport section

In order to define a SIP trunk for use with Asterisk, PJSIP has the concept of a network transport. From the Asterisk Wiki, the transport section configures how res_pjsip will operate at the transport layer. For example, it supports configuration options for protocols such as TCP, UDP, or WebSockets and encryption methods like TLS/SSL.

Transport sections can be named arbitrarily, but it is recommended to name the section that makes it easy to remember what it signifies. The following example names it [transport-udp-nat] for identifying that this transport is using UDP for SIP, and is expected to traverse a NAT device.

/etc/asterisk/pjsip.conf
[transport-udp-nat]
type=transport  ; signifies this is a transport definition
protocol=udp  ; specifies this uses the UDP transport protocol
; this transport binds to all configured network interfaces, 
; replace with the IP address of the desired interface. 0.0.0.0 means all interfaces
bind=0.0.0.0
; =====  NOTE, the following directives are OPTIONAL
local_net=10.20.30.0/24  ; specify the networks that this Asterisk server should consider as local/LAN networks. Change this to the local LAN subnet (in CIDR notation)
local_net=127.0.0.0/8  ; specify the networks that this Asterisk server should consider as local/LAN networks (this one sets it to the IPv4 loopback network)
external_media_address=96.69.199.60  ; specify the external/WAN IP address for RDP media (audio)
external_signaling_address=96.69.199.60  ; specify the external/WAN IP address for SIP (signaling)

Note that only one transport is allowed for each IP address/port or IP address/protocol mapping. If you would like to configure multiple transport protocols (e.g. both TCP and UDP), you will need to bind each protocol to a different IP address. Likewise if you want to define multiple transports using the same protocol, the ports used need to be different for each transport definition.

registration section

Next, define the registrations the SIP trunks will use. Note that the SIP Station registrations are first defined via a template (with (!) appended to the section name). Each template defines the settings that are common for each section using the template; the sections themselves only contain the options that need to be set for that section.

/etc/asterisk/pjsip.conf
[sipstation-reg](!)
type=registration
transport=transport-udp-nat
contact_user=15055551234
retry_interval=60

; ==== ... several other templates and sections will appear here
; ====     including the authentication sections, etc., which are also used by the registration
; ==== ....

[siptsation-reg1](sipstation-reg)
outbound_auth=sipstation-auth1 
server_uri=sip:trunk1.freepbx.com  ; trunk1 provided by SIP Station
client_uri=sip:my_username@trunk1.freepbx.com

[siptsation-reg2](sipstation-reg)
outbound_auth=sipstation-auth2 
server_uri=sip:trunk2.freepbx.com  ;  trunk2 provided by SIP Station
client_uri=sip:my_username@trunk2.freepbx.com
authentication section

Here, define the authentication template, and the specific authentication sections for use with the SIP Station trunks.

/etc/asterisk/pjsip.conf
[sipstation-auth](!)
type=auth
password=Super*Secret@Password!
username=my_username

; ==== ... more templates may appear here

[sipstation-auth1](sipstation-auth)
realm=trunk1.freepbx.com

[sipstation-auth2](sipstation-auth)
realm=trunk2.freepbx.com
endpoint section

An endpoint is essentially a profile for the configuration of a SIP device such as a phone or remote server. This defines the transport, the Asterisk Dialplan context where calls originating from the endpoint gets handled, and the audio codecs allowed for the endpoint. For the SIP station trunks, define the following:

/etc/asterisk/pjsip.conf
[sipstation-endpoint](!)
type=endpoint
transport=transport-udp-nat
context=from-external  ; Dialplan context, defined in extensions.conf or related file
disallow=all   ; disallows all codecs, including default ones, unless explicitly allowed below
allow=ulaw     ; standard G.711, uncompressed PCM codec. Uses the most bandwidth
allow=gsm      ; another standard, compressed codec. Uses less bandwidth than ulaw
; other codecs are available, and have different attributes. Some require paid licenses to use.
aors=sipstation-aors  ; AOR - Address of Record, to be defined later
;direct_media=no  ; setting this may not allow audio to pass through NAT
direct_media=yes
rtp_symmetric=yes

; ==== ... more template definitions

[sipstation-endpoint1](sipstation-endpoint)
outbound_auth=sipstation-auth1
from_domain=trunk1.freepbx.com

[sipstation-endpoint2](sipstation-endpoint)
outbound_auth=sipstation-auth2
from_domain=trunk2.freepbx.com
identify section

Controls how the res_pjsip_endpoint_identifier_ip module determines what endpoint an incoming packet is from. For the SIP Station trunks, the following is defined:

/etc/asterisk/pjsip.conf
[sipstation-identify](!)
type=identify
; this is the LAN IP address of the NAT router, which calls from the SIP Station
; trunks may appear to come from (because of NAT).
match=10.20.30.254/32

[sipstation-id1](sipstation-identify)
endpoint=sipstation-endpoint1
match=192.159.66.3   ;  IP address of trunk1.freepbx.com

[sipstation-id2](sipstation-identify)
endpoint=sipstation-endpoint2
match=162.253.134.142    ;  IP address of trunk2.freepbx.com
aor (Address Of Record) section

A primary feature of AOR objects (Address of Record) is to tell Asterisk where an endpoint can be contacted. Without an associated AOR section, an endpoint cannot be contacted. For the SIP Station trunks, define this:

/etc/asterisk/pjsip.conf
[sipstation-aors]
type=aor
contact=sip:trunk1.freepbx.com
contact=sip:trunk2.freepbx.com
phone sections

Finally, define the necessary sections for the SIP phone that will register to Asterisk. It has several similar sections as with the SIP Station trunks. Expand these with templates if multiple local SIP phones are intended to register to your Asterisk PBX. Remote phones (from the WAN/Internet) can also be configured, but that iss outside the scope of this example.

/etc/asterisk/pjsip.conf
[home-phone]
type=endpoint
transport=transport-udp-nat
context=from-internal  ;  Dialplan context that gets executed when a user dials from this phone
disallow=all
allow=ulaw
allow=gsm
auth=home-phone-auth
aors=home-phone

[home-phone-auth]
type=auth
auth_type=userpass
password=MyPhonePa$$word0
username=home-phone

[home-phone]
type=aor
max_contacts=1

Managing PJSIP

There are several commands regarding res_pjsip available in the Asterisk CLI, all prefixed with the pjsip command. To get to the Asterisk CLI, enter the following command, as the asterisk user:

$ asterisk -rvvv

This assumes Asterisk is already running (e.g., via the systemd service unit). Once in the Asterisk CLI, you will see the prompt hostname*CLI> . To see a list of available PJSIP commands, type help pjsip.

To see a list of PJSIP registrations, type the following:

hostname*CLI> pjsip show registrations

 <Registration/ServerURI..............................>  <Auth....................>  <Status.......>
---------------------------------------------------------------------------------------------

 siptsation-reg1/sip:trunk1.freepbx.com                  sipstation-auth1            Registered        (exp. 2062s)
 siptsation-reg2/sip:trunk2.freepbx.com                  sipstation-auth2            Registered        (exp. 2069s)

Objects found: 2

To see a list of PJSIP endpoints, type the following:

hostname*CLI> pjsip show endpoints
                                                                                                 
 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
 ----------------------------------------------------------------------------------------------

 Endpoint:  home-phone                                           Not in use    0 of inf
     InAuth:  home-phone-auth/home-phone
        Aor:  home-phone                                         1
      Contact:  home-phone/sip:home-phone@10.20.30.229:506 f91928f561 NonQual         nan
  Transport:  transport-udp-nat         udp      0      0  0.0.0.0:5060

 Endpoint:  sipstation-endpoint1                                 Not in use    0 of inf
    OutAuth:  sipstation-auth1/mw3FSBsPPjQ7
        Aor:  sipstation-aors                                    0
      Contact:  sipstation-aors/sip:trunk1.freepbx.com     256c242e36 NonQual         nan
      Contact:  sipstation-aors/sip:trunk2.freepbx.com     c07c6c7180 NonQual         nan
  Transport:  transport-udp-nat         udp      0      0  0.0.0.0:5060
   Identify:  sipstation-id1/sipstation-endpoint1
        Match: 10.20.30.254/32
        Match: 192.159.66.3/32

 Endpoint:  sipstation-endpoint2                                 Not in use    0 of inf
    OutAuth:  sipstation-auth2/mw3FSBsPPjQ7
        Aor:  sipstation-aors                                    0
      Contact:  sipstation-aors/sip:trunk1.freepbx.com     256c242e36 NonQual         nan
      Contact:  sipstation-aors/sip:trunk2.freepbx.com     c07c6c7180 NonQual         nan
  Transport:  transport-udp-nat         udp      0      0  0.0.0.0:5060
   Identify:  sipstation-id2/sipstation-endpoint2
        Match: 10.20.30.254/32
        Match: 162.253.134.142/32

Objects found: 3

chan_sip

asterisk サーバーを動かしたら、後は2つのファイルを編集すれば設定できます: sip.confextensions.conf。asterisk の設定ディレクトリ (/etc/asterisk) に移動して、sip.conf を編集して以下を記述してください:

[me1]
type=friend
username=me1
secret=PASSWORD
host=dynamic
context=house

[me2]
type=friend
username=me2
secret=PASSWORD
host=dynamic
context=house

これで house コンテキストに二人の SIP ユーザー me1me2 が作成されます。パスワードは PASSWORD です。

次にコンテキストを定義します。extensions.conf を以下のように編集:

[house]
exten => 100,1,Dial(SIP/me1)

exten => 101,1,Dial(SIP/me2)

これでコンテキスト house が作成され SIP ユーザー me1 にエクステンション 100 が、SIP ユーザー me2 にエクステンション 101 が割り当てられます。後は実際に動作するか確認するだけです。

保留音

保留音はとても楽しい機能です。簡単に設定することができます。/etc/asterisk/musiconhold.conf を編集して以下を追加してください:

[default]
mode=files
directory=mohmp3

後は合法的に入手したお気に入りの MP3 を /var/lib/asterisk/mohmp3 にコピーしてください。

ボイスメール

Asterisk にはボイスメール機能が存在します。設定する方法は多数ありますが、この記事ではシンプルな設定方法だけを紹介します。

voicemail.conf を作成・編集:

[general]
format=gsm|wav49|wav
serveremail=asterisk
attach=no
mailcmd=/usr/sbin/sendmail -t
maxmessage=180
maxgreet=60

[default]
100 => 1234,Me,me@mydomain.com

[general] の設定の内容は こちら を見て下さい。Postfix が正しくセットアップされていれば PBX からメールの通知がユーザーに送信され、attach=yes と定義されている場合、メールに音声ファイルが添付されます。

次にメールボックスの設定です。フォーマットは:

mailbox => password,user,email

上記の場合、'Me' というユーザー名でメールアドレスが me@mydomain.com、パスワードが 1234 のメールボックス 100 が設定されます。

それから、ボイスメールボックスにメッセージを残す方法と、記録されたメッセージにアクセスする手段を用意する必要があります。

extensions.conf に戻り、既存のエントリを次のように変更します:

exten => 100,1,Dial(SIP/me1,20)
exten => 100,2,Voicemail(100@default)

最初の 'exten' は 'Dial()' で20秒間電話を呼び出します。応答がない場合、default コンテキストの 100 番のボイスメールボックスに転送します。

さらに以下のように設定することで実際にボイスメールにアクセスすることができます:

exten => 600,1,VoiceMailMain,s100@default

600 番を呼び出すと、'VoiceMailMain' アプリケーションは default コンテキストの 100 番に行きます。s で自動ログインが許可されます。

ノート: 'VoiceMail' アプリケーションには多くのオプションがありますので、追加のドキュメントに目を通すことをお勧めします。これは、基本的な家庭用の設定です。 また、一般的に 'VoiceMail' にアクセスする際には、ユーザーの内線より高い内線を使用することをお勧めします。208 にダイヤルしても、205 のボイスメールにヒットしないようにするためです。

PSTN に接続

ここまで設定できたら、次は外線と繋ぎましょう。OnSIP などのプロバイダが必要です。asterisk に接続する手順がプロバイダによって用意されているかもしれないため、このセクションは共通のことだけ記述します。

一般的なセットアップ

sip.conf
[general]
register => username:password@sip.specific.com

[whatever]                   
fromdomain=specific.com     
host=sip.specific.com
insecure=very    ; check with provider
username=usernameduh
secret=passwordduh
type=peer
extensions.conf
[outboundwithCID]  ; this can be whatever
exten => _1NXXNXXXXXX,1,SetCIDNum(15555551234)
exten => _1NXXNXXXXXX,2,Dial(SIP/${EXTEN}@whatever)
exten => _1NXXNXXXXXX,3,Congestion()
exten => _1NXXNXXXXXX,103,Busy()

[default]  ; This should be set in your sip.conf for incoming calls

;These should to be changed to your actual number
; ie     15555555555
exten => 1NXXNXXXXXX,1,Answer()
exten => 1NXXNXXXXXX,2,Playback(ttt-weasels)
exten => 1NXXNXXXXXX,3,HangUp()
  • 発信(outbound)コンテキストでは、ダイアルした番号を全てサービスプロバイダに送信します。2 の 'whatever' は sip.conf の設定と一致させる必要があります。
  • もちろん、着信(inbound)番号計画は、あなたが望むように変更することができます。例えば、Dial(SIP/me1)とすることで、誰かがあなたの番号に電話をかけると、あなたのコンピュータの SIP 電話に転送されるようにすることができます。それから、ボイスメールなどを追加します。
iax.conf

まず、FWD にログインして、FWD 側の IAX を有効にします。これは extra features の下にあり、作者は有効化するのに少し時間がかかると主張しているのを覚えておいてください。

そして iax.conf の 'general' セクションを以下のように編集:

register => FWDNUMBER:PASSWORD@iax2.fwdnet.net 
disallow = all
allow = ulaw

そして末尾に以下を追加:

[iaxfwd]
type=user
context=fromiaxfwd
auth=rsa
inkeys=freeworlddialup

これにより、FWD からの呼び出しが許可されます。

extensions.conf

'[globals]' の一番上に以下を記述:

FWDNUMBER=MYFWDNUMBER ; your calling number
FWDCIDNAME="MyName"; your caller id
FWDPASSWORD=MYFWDPASSWORD ; your password
FWDRINGS=sip/office ; the phone to ring
FWDVMBOX=1000 ; the VM box for this user

次に、これを発信用のコンテキストに追加します:

exten => _393.,1,SetCallerId,${FWDCIDNAME}
exten => _393.,2,Dial(IAX2/${FWDNUMBER}:${FWDPASSWORD}@iax2.fwdnet.net/${EXTEN:3},60,r)
exten => _393.,3,Congestion

「393」は好きなように変更できます。これは、「転送」番号をダイヤルする前にダイヤルするものです。例えば、「744561」をダイヤルする場合は、「393744561」をダイヤルします。

そして最後に、着信です。

[fromiaxfwd]
exten => ${FWDNUMBER},1,Dial(${FWDRINGS},20,r)
exten => ${FWDNUMBER},2,Voicemail,u${FWDVMBOX}
exten => ${FWDNUMBER},102,Voicemail,b${FWDVMBOX}
ノート: もし問題があれば、extensions.confから変数を削除してみてください。この手順は FWD のサイトからのもので、この記事の著者によってテストされたわけではありません。

内線番号の 55555(有志のテスト回線)、514(会議)にかけてみてください。

音声

音声は /var/lib/asterisk/xx フォルダに保存します。xx は言語コードです。例えば英語なら "en" になります。新しい音声を追加したいときはこのフォルダにコピーしてください。以下のフォルダ構造を守って下さい:

/var/lib/asterisk/sounds/xx
/var/lib/asterisk/sounds/xx/digits
/var/lib/asterisk/sounds/xx/letters
/var/lib/asterisk/sounds/xx/phonetic

sip.conf の language パラメータを編集してください:

[general]
...
language=en
...

音声が入手できる場所:

MeetMe

MeetMe は電話会議をできるようにするアプリケーションです。設定は簡単です。

meetme.conf を編集:

conf => 1000

extensions.conf を編集:

exten => 999,1,MeetMe(1000|M)

999 にダイアルすることで会議 1000 に入ることができます。|M を設定することで誰もいないときは保留音が鳴ります。誰かが会議に参加すると保留音は自動的に消えます。

ノート: MeetMe を使うには zaptel パッケージが必要です。asterisk を起動する前にインストールして modprobe ztdummy を実行してください。それによって TDM が利用できるようになります。

Asterisk コンソールとソフトフォン

Asterisk を立ち上げてください:

# asterisk -vvvvvvc

詳細な出力がされる Asterisk CLI が立ち上がります。

Asterisk が既に起動している場合、以下のコマンドを実行:

# asterisk -r

SIP クライアントを起動して sip.conf の情報にあわせて設定してください。Asterisk CLI に戻って以下のように表示されることを確認:

Registered SIP 'me1' at 192.168.0.142 port 5061 expires 60

これで me1 から 101 にダイアルして me2 と会話できるはずです。

トラブルシューティング

404 Not Found エラーが表示される場合は extensions.conf とダイアルした電話番号を確認してください。

翻訳ステータス: このページは en:Asterisk の翻訳バージョンです。最後の翻訳日は 2023-3-2 です。もし英語版に 変更 があれば、翻訳の同期を手伝うことができます。