サンプル集 |
■VC ■C# ■Java ■BorlandC ■LinuxC ■MS-DOS ■bash ■Excel VBA ■VBScript ■PHP ■HTML ■perl ■iPhone ■Android ■Lua ■other |
Linuxコマンド |
用語集 |
debian メモ |
apache2 メモ |
MySQL メモ |
Oracle メモ |
HOME |
asteriskでIAXを使ってみます。
◆環境OS | Linux obsax3 3.0.6 #1 SMP Thu Mar 7 19:14:19 JST 2013 armv7l GNU/Linux |
---|---|
asterisk | 1.8.21.0 |
/etc/asterisk/iax.confを編集します。
iax.conf | ||
|
続いて/etc/asterisk/extensions.confを編集します。
extensions.conf | ||
|
CLI で iax と dialplan をリロード(reload)して iax の状態を確認します。
*CLI> iax2 show peers
Name/Username Host Mask Port Status
iaxcntxt/58 66.222.222.111 (S) 255.255.255.255 4569 Unmonitored
1 iax2 peers [0 online, 0 offline, 1 unmonitored]
Name/Username Host Mask Port Status
iaxcntxt/58 66.222.222.111 (S) 255.255.255.255 4569 Unmonitored
1 iax2 peers [0 online, 0 offline, 1 unmonitored]
正常につながっているとHostにIPアドレスが表示されるようです。 レジストできているかどうかも確認します。
*CLI> iax2 show registry
Host dnsmgr Username Perceived Refresh S
tate
66.222.222.111:4569 N 12345678 222.111.44.111:60261 1800 R
egistered
1 IAX2 registrations.
Host dnsmgr Username Perceived Refresh S
tate
66.222.222.111:4569 N 12345678 222.111.44.111:60261 1800 R
egistered
1 IAX2 registrations.
うまくいっていないときはHostにIPアドレスが表示されませんでした。
*CLI> iax2 show peers
Name/Username Host Mask Port Status
iaxcntxt/58 (Unspecified) (S) 255.255.255.255 4569 Unmonitored
1 iax2 peers [0 online, 0 offline, 1 unmonitored]
Name/Username Host Mask Port Status
iaxcntxt/58 (Unspecified) (S) 255.255.255.255 4569 Unmonitored
1 iax2 peers [0 online, 0 offline, 1 unmonitored]
Hostに表示されるIPアドレスが全て 0 になっているケースもありました。
*CLI> iax2 show peers
Name/Username Host Mask Port Status
iaxcntxt/58 0.0.0.0 (S) 255.255.255.255 4569 Unmonitored
1 iax2 peers [0 online, 0 offline, 1 unmonitored]
Name/Username Host Mask Port Status
iaxcntxt/58 0.0.0.0 (S) 255.255.255.255 4569 Unmonitored
1 iax2 peers [0 online, 0 offline, 1 unmonitored]
レジストできているかどうかも確認しましたが、unregisteredでした。
*CLI> iax2 show registry
Host dnsmgr Username Perceived Refresh State
(null) N 12345678 <Unregistered> 60 Uuregistered
1 IAX2 registrations.
Host dnsmgr Username Perceived Refresh State
(null) N 12345678 <Unregistered> 60 Uuregistered
1 IAX2 registrations.
発信
発信すると以下のログがCLIに出ました。
== Using SIP RTP CoS mark 5
-- Executing [009011112222@front:1] Dial("SIP/1111-00000005", "IAX
2/iaxcntxt/09011112222,30") in new stack
-- Called IAX2/iaxcntxt/09011112222
[Aug 28 10:29:37] WARNING[6741]: /root/asterisk-1.8.21.0/include/aster
isk/crypto.h:145 __stub__ast_aes_set_encrypt_key: AES encryption disa
bled. Install OpenSSL.
[Aug 28 10:29:37] WARNING[6741]: /root/asterisk-1.8.21.0/include/aster
isk/crypto.h:157 __stub__ast_aes_set_decrypt_key: AES encryption disa
bled. Install OpenSSL.
[Aug 28 10:29:37] WARNING[6741]: /root/asterisk-1.8.21.0/include/aster
isk/crypto.h:157 __stub__ast_aes_set_decrypt_key: AES encryption disa
bled. Install OpenSSL.
-- Call accepted by 66.222.222.111 (format ulaw)
-- Format for call is ulaw
-- Executing [009011112222@front:1] Dial("SIP/1111-00000005", "IAX
2/iaxcntxt/09011112222,30") in new stack
-- Called IAX2/iaxcntxt/09011112222
[Aug 28 10:29:37] WARNING[6741]: /root/asterisk-1.8.21.0/include/aster
isk/crypto.h:145 __stub__ast_aes_set_encrypt_key: AES encryption disa
bled. Install OpenSSL.
[Aug 28 10:29:37] WARNING[6741]: /root/asterisk-1.8.21.0/include/aster
isk/crypto.h:157 __stub__ast_aes_set_decrypt_key: AES encryption disa
bled. Install OpenSSL.
[Aug 28 10:29:37] WARNING[6741]: /root/asterisk-1.8.21.0/include/aster
isk/crypto.h:157 __stub__ast_aes_set_decrypt_key: AES encryption disa
bled. Install OpenSSL.
-- Call accepted by 66.222.222.111 (format ulaw)
-- Format for call is ulaw
OpenSSLをインストールしなさいと警告がでました。
呼び出しが始まると以下のログが出ました。
-- IAX2/iaxcntxt-13895 is making progress passing it to SIP/1111-00
000005
-- IAX2/iaxcntxt-13895 is ringing
-- IAX2/iaxcntxt-13895 is making progress passing it to SIP/1111-00
000005
000005
-- IAX2/iaxcntxt-13895 is ringing
-- IAX2/iaxcntxt-13895 is making progress passing it to SIP/1111-00
000005
受話器を置くと以下のログが出ました。
-- Hungup 'IAX2/iaxcntxt-13895'
== Spawn extension (front, 009011112222, 1) exited non-zero on 'SIP/1
111-00000005'
== Spawn extension (front, 009011112222, 1) exited non-zero on 'SIP/1
111-00000005'
今までの流れとは別の通話ですが、相手が出た場合は以下のログが出ました。
-- IAX2/iaxcntxt-13895 stopped sounds
-- IAX2/iaxcntxt-13895 answered SIP/1900-0000005a
-- IAX2/iaxcntxt-13895 answered SIP/1900-0000005a
着信
着信すると以下のログがCLIに出ました。
-- Accepting UNAUTHENTICATED call from 66.22.22.111:
> requested format = ulaw,
> requested prefs = (ulaw|alaw|gsm),
> actual format = ulaw,
> host prefs = (ulaw),
> priority = mine
-- Executing [12345678@12345678:1] Dial("IAX2/66.222.222.111:4569-
1278", "SIP/1111,30") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/1111
[Dec 18 14:25:18] WARNING[1508]: app_dial.c:2345 dial_exec_full: Unabl
e to channel of type 'SIP' (cause 20 - Subscriber absent)
[Dec 18 14:25:18] WARNING[1508]: app_dial.c:2345 dial_exec_full: Unabl
e to channel of type 'SIP' (cause 20 - Subscriber absent)
[Dec 18 14:25:18] WARNING[1508]: app_dial.c:2345 dial_exec_full: Unabl
e to channel of type 'SIP' (cause 20 - Subscriber absent)
-- SIP/111-00000006 is running
> requested format = ulaw,
> requested prefs = (ulaw|alaw|gsm),
> actual format = ulaw,
> host prefs = (ulaw),
> priority = mine
-- Executing [12345678@12345678:1] Dial("IAX2/66.222.222.111:4569-
1278", "SIP/1111,30") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/1111
[Dec 18 14:25:18] WARNING[1508]: app_dial.c:2345 dial_exec_full: Unabl
e to channel of type 'SIP' (cause 20 - Subscriber absent)
[Dec 18 14:25:18] WARNING[1508]: app_dial.c:2345 dial_exec_full: Unabl
e to channel of type 'SIP' (cause 20 - Subscriber absent)
[Dec 18 14:25:18] WARNING[1508]: app_dial.c:2345 dial_exec_full: Unabl
e to channel of type 'SIP' (cause 20 - Subscriber absent)
-- SIP/111-00000006 is running
電話に出ると以下のログが出ました。
-- SIP/1111-00000006 answered IAX2/66.222.222.111:4567-1278
受話器を置くと以下のログが出ました。
== Spawn extension (12345678, 12345678, 1) exited non-zero on 'IAX2/6
6.222.222.111:4569-1278'
-- Hungup 'IAX2/66.222.222.111:4569-1278'
6.222.222.111:4569-1278'
-- Hungup 'IAX2/66.222.222.111:4569-1278'
Copyright (C) 2014 ymlib.com