SSブログ

chan_mobileその11 [raspberrypi]

amazonでBTアダプタを購入した。
両方向で音声が聞こえたplanexのBT-Micro3E2Xを選んだ。
hcitoolでアダプタのアドレスを調べると
# hcitool dev
Devices:        
hci0    00:1B:DC:05:DE:D0
これって音声のぜんぜん通らないCOREGAのBTUSB01Cと同じメーカーコードだ
チップは同じものか・・・

やはりasteriskでは音声片側通行だった

なんとなくCODECが正常に音声を復元できていないような気もするのですが
行きと帰りと別々に設定する場所なんて無い..

 


chan_mobileその10 [raspberrypi]

btのアダプタが壊れた。

暑い部屋で連続通電していたから、熱でやられたか。折角両方向がどうにかこうにか聞こえたので追加の実験を行いたかったけれど出来なくなりました。 


chan_mobileその9 [raspberrypi]

こことかに携帯-携帯はDTMFが通らないと書いてあったが通話中に相手にキーボード押して貰ってピポパ音が聞こえたからIVR使えるだろうと思ってがんばってきたが chan_mobileいろいろ試したけれど実用できなさそうだ。残念
1.sip.confにqualify=yesをすべてのコンテックスの追加した
2.googleを探し回ってペアリングしてからasteriskをコンパイルしたほうが良いと書いてあるのを見つけて再度コンパイルしたけれど変化が無かった。
3.BTアダプタをcoregaのBT2USB01CからPLANEXのBT-Mini2EDRに交換したらCOREGAのときと比べて少し良くなった。COREGAのときは3CXPHONEのGALAXYから 固定電話への音声は通るけど逆はほとんどだめだったがPLANEXだと
どちらも音声が通った。ただし、音質は良くないというか実用は無理みたい。
音質が悪いせいか、IVRが番号を入れなおせという誤動作が時々あった

asterisk/chan_mobileその8 [raspberrypi]

以下はCLIの表示です
root@raspberrypi:/etc/asterisk# asterisk -vvvvcr
Asterisk 11.5.0, Copyright (C) 1999 - 2012 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Running as user 'asterisk'
Running under group 'asterisk'
Connected to Asterisk 11.5.0 currently running on raspberrypi (pid = 2009)
raspberrypi*CLI> 
   -- Registered SIP '2001' at 192.168.1.9:57411
       > Saved useragent "3CXPhone for Android 2.0.5" for peer 2001
    -- Bluetooth Device ET-N95 has connected, initializing...
    -- Bluetooth Device ET-N95 initialized and ready.
外線から 携帯へ電話すると
  -- Executing [s@incoming-mobile:1] Answer("Mobile/ET-N95-480c", "") in new stack
    -- Executing [s@incoming-mobile:2] Playback("Mobile/ET-N95-480c", "demo-echotest") in new stack
デモエコーテストの音声は聞こえます。
    -- <Mobile/ET-N95-480c> Playing 'demo-echotest.gsm' (language 'en')
    -- Executing [s@incoming-mobile:3] Playback("Mobile/ET-N95-480c", "beep") in new stack
    -- <Mobile/ET-N95-480c> Playing 'beep.gsm' (language 'en')
    -- Executing [s@incoming-mobile:4] Echo("Mobile/ET-N95-480c", "") in new stack
ビープ音の後のこのシーケンスでしゃ べってもエコーは返ってきません
#キーを押しても反応がありません 
  == Spawn extension (incoming-mobile, s, 4) exited non-zero on 'Mobile/ET-N95-480c'
しょうがないので電話を切りました 
    -- Registered SIP '2001' at 192.168.1.9:57411

内線電話からエコーテストの番号(1333)に掛けてみます。 
    -- Executing [1333@default:1] Answer("SIP/2001-00000001", "") in new stack
       > 0x294a498 -- Probation passed - setting RTP source address to 192.168.1.9:7102
    -- Executing [1333@default:2] Wait("SIP/2001-00000001", "1") in new stack
    -- Executing [1333@default:3] Playback("SIP/2001-00000001", "demo-echotest") in new stack
    -- <SIP/2001-00000001> Playing 'demo-echotest.gsm' (language 'en')
    -- Executing [1333@default:4] Playback("SIP/2001-00000001", "beep") in new stack
    -- <SIP/2001-00000001> Playing 'beep.gsm' (language 'en')
    -- Executing [1333@default:5] Echo("SIP/2001-00000001", "") in new stack
このシーケンスのときにしゃべればエコーが返ってきます。 
    -- Executing [1333@default:6] Playback("SIP/2001-00000001", "demo-echodone") in new stack
 途中で#キーを押すとちゃんと demo-echodoneとvm-goodbyが聞こえます。
  -- <SIP/2001-00000001> Playing 'demo-echodone.gsm' (language 'en')
    -- Executing [1333@default:7] Playback("SIP/2001-00000001", "vm-goodbye") in new stack
    -- <SIP/2001-00000001> Playing 'vm-goodbye.gsm' (language 'en')
    -- Auto fallthrough, channel 'SIP/2001-00000001' status is 'UNKNOWN'
raspberrypi*CLI>
 

 携帯電話からasteriskに音声が伝わっていないようです。
 chan_mobile.confとextensios.confの書き方は間違っていないようだ
さてどうしたらいいのかなあ 
  
extensios.conf抜粋
[default]
途中省略
;Mobile
exten => _9.,1,Set(TO_DIAL=${EXTEN:1},g)
exten => _9.,2,Goto(outgoing,9100,1)
途中省略
[outgoing]
exten => 9100,1,NoOp
exten => 9100,2,Dial(Mobile/ET-N95/${TO_DIAL},60,T)
exten => 9100,3,Hangup

[incoming-mobile]

exten => s,1,Answer()
exten => s,2,Playback(demo-echotest)
exten => s,3,Playback(beep)
exten => s,4,Echo
exten => s,5,Playback(demo-echodone)
exten => s,6,Playback(vm-goodbye)
 
chan_mobile.conf抜粋
 [ET-N95]
address=00:1E:A4:4D:87:6C       ; the address of the phone
port=1                          ; the rfcomm port number (from mobile search)
context=incoming-mobile         ; dialplan context for incoming calls
adapter=blue                    ; adapter to use
group=1                         ; this phone is in channel group 1



asterisk 光電話に収納 [raspberrypi]

このasteriskはひかり電話パッチを当てていないのですが 
sip.confに 
;RT-200NE Sample
rt200ne=192.168.1.1

;HIKARI-denwa register Sample
register => 7:asterisk:0007@hikari-denwa/201
 
 ; Sample setting of HIKARI-denwa
[hikari-denwa]
type=friend
secret=asterisk
port=5060
defaultuser=0007
fromuser=7
host=192.168.1.1
fromdomain=192.168.1.1
context=default
insecure=invite,port
上記を追加した
 
またextensions.confに
[general]
MYNUMBER=NTTの番号 
[default]
;Hikari-Denwa Dial-out Sample
exten => _0.,1,Set(CALLERID(num)=${MYNUMBER})
exten => _0.,n,Set(CALLERID(name)=${MYNUMBER})
exten => _0.,n,Dial(SIP/${EXTEN}@hikari-denwa,120,T)
 
あと、ひかり電話のルータ(PR-S300SE)にraspberryのMACアドレス登録した
 
3CXPHONEから携帯に電話をしたら一応接続はできたが残念ながら3cxphoneからの声が聞こえなかった。
携帯からNTTへはつながってすぐ切断されてしまう状態だったのであわてて元に戻した
 
戻してから気づいたのだけど外からつながらなかったのは多分
register => 7:asterisk:0007@hikari-denwa/201のせいだな
なんてったってわけもわからずに他人様のをコピーしているから
最後の201は内線番号だな跡で実験してみよう
 
まあ、ひかり電話につなげるつもりは無いからこのままでいいか 
 
15:33追記
sip.confを 
 register=>7:asterisk:0007@hikari-denwa/2001に修正したら
外線からの電話に通常の電話機とソフトフォンが同時に応答して
それぞれの電話機で応答できた
 
ただし依然として片道通話だ
 
 
 

asterisk/IVR [raspberrypi]

昨日までの実験で携帯をasteriskにペアリングすると現状では通常状態での使用ができないので(常に留守電になってしまうから)bluetooth実験はひとまず中止する。
やりたいことは携帯からの通話を携帯で受けて内線に転送することなのでIVRを実験する
と言っても単に高橋隆雄さん(http://itpro.nikkeibp.co.jp/article/COLUMN/20071017/284822/)のをコピーしたら直ぐに動いた 

/etc/asterisk/extensions.confに
[default]に下記を追加
 ;IVR
exten => 1234,1,Goto(ivr-menu,s,1)
[ivr-menu]を新規追加
[ivr-menu]
exten => s,1,Answer()
exten => s,n,Wait(1)
exten => s,n(try-again),Background(vm-enter-num-to-call)

exten => s,n,WaitExten(30)
exten => s,n,Hangup
exten => i,1,Playback(pbx-invalid)
exten => i,n,Goto(s,try-again)
exten => 2001,1,Dial(SIP/2001)
exten => 2002,1,Dial(SIP/2002) 

これで内線で1234にダイアルすると(私のはメッセージの日本語化をしていないので )
Please enter the number you wish to callとしゃべるので2001または2002を 押すと
ちゃんと外部の電話を呼び出した。
あとは携帯が受信したら ivr-menuに飛んでくるようにsip.confで紐付けすればいいのか
 
 

asterisk/chan_mobileその7 [raspberrypi]

chan_mobileも動き始めた。
最初にraspberryと709SCとをペアリングしておいて
それからasteriskを再起動すればconnectedがyesになる
 
raspberrypi*CLI> mobile show devices
ID              Address               Group Adapter         Connected State      SMS
709SC        00:18:AF:FB:A8:63 1     blue                Yes         Free       No
 
 ためしに携帯に電話してみたら留守電サービスになってしまった
[Aug  3 16:42:53] WARNING[3284][C-00000001]: pbx.c:6390 __ast_pbx_run: Channel 'Mobile/709SC-ac32' sent to invalid extension but no invalid handler: context,exten,priority=incoming-mobile,s,1
raspberrypi*CLI>
 
アスタリスクがextensionの書き方で文句言ってる 

asterisk [raspberrypi]

あれっ raspberyypiのasteriskが正常に動作していない
*CLI>     -- Registered SIP '2001' at 192.168.1.5:45476
       > Saved useragent "3CXPhone for Android 2.0.5" for peer 2001
[Aug  1 10:33:13] ERROR[3045][C-00000000]: rtp_engine.c:259 ast_rtp_instance_new: No RTP engine was found. Do you have one loaded?
いままでchan_mobileをチェックしていたけど肝心の通話ができていなかった
早速google先生にお伺い立てたら直ぐに見つかった
Re: No RTP engine was found. Do you have one loaded?
Postby pbrink231 ≫ Tue Jul 16, 2013 10:00 pm

Hey solved my issue with this one For 11.5 you need to (debian)
apt-get install uuid-dev
then run ./configure like normal from the beginning. make sure res_rtp_asterisk has an [*] next to it.
あーあ
再度./configureから実行しなければなら無いのか
make1時間では終わらないのだ 
 
8/3追記
asterisk11からはuuidを使用するようになったのでuuidの無いOSはインストールせよとのことでした

chan_mobileその6 [raspberrypi]

なんとかCLIでmobile searchとmobile show deviceが動くようになった
次はsipとextensionの設定かな
(未だerror出ているのが気にかかるのですが) 

 root@raspberrypi:~# /etc/init.d/asterisk stop
[ ok ] Stopping Asterisk PBX: asterisk.
root@raspberrypi:~# asterisk -vvvvvvgc
Unable to access the running directory (Permission denied).  Changing to '/' for compatibility.Asterisk 11.5.0-rc2, Copyright (C) 1999 - 2012 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Running as user 'asterisk'
Running under group 'asterisk'
中略
  == Parsing '/etc/asterisk/chan_mobile.conf': Found
[Jul 25 10:04:39] ERROR[2485]: chan_mobile.c:4137 mbl_load_adapter: Skipping adapter. Missing id or address settings.
  == Registered channel type 'Mobile' (Bluetooth Mobile Device Channel Driver)
  == Registered application 'MobileStatus'
  == Registered application 'MobileSendSMS'
chan_mobile.so => (Bluetooth Mobile Device Channel Driver)
後略
Asterisk Ready.
 == Parsing '/etc/asterisk/cli.conf': Found
*CLI>
*CLI> core show help
前略
                mobile cusd Send CUSD commands to the mobile
                 mobile rfcomm Send commands to the rfcomm port for debugging
                 mobile search Search for Bluetooth Cell / Mobile devices
           mobile show devices Show Bluetooth Cell / Mobile devices
後略
*CLI>
*CLI>core stop gracefully
oot@raspberrypi:~# /etc/init.d/asterisk start
[ ok ] Starting Asterisk PBX: asterisk.
root@raspberrypi:~# asterisk -vvvvcr
Asterisk 11.5.0-rc2, Copyright (C) 1999 - 2012 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Running as user 'asterisk'
Running under group 'asterisk'
Connected to Asterisk 11.5.0-rc2 currently running on raspberrypi (pid = 2629)
raspberrypi*CLI>
raspberrypi*CLI> mobile search
Address                 Name                           Usable Type    Port
00:18:AF:FB:A8:63 709SC                          Yes     Phone   2

raspberrypi*CLI> mobile show devices
ID                 Address           Group Adapter         Connected State      SMS
709SC           00:18:AF:FB:A8:63 0     blue            No        None       Yes
raspberrypi*CLI>


chan_mobileその5 [raspberrypi]


I had to make a modification to the chan_mobile source before it would recognise my phone:
# vi /usr/src/asterisk-1.8.11.0/addons/chan_mobile.c

Find this:
 addr.rc_channel = (uint8_t) 1;

Replace with:
 addr.rc_channel = (uint8_t) 0;
Build Asterisk and (re)install:という記述があったので

/usr/local/src/asterisk-11.5.0-rc2/addons/chan_mobile.cの中の
addr.rc_channel = (uint8_t) 1を0に変更しついでに
uint8_t rfcomm_channel = 1も0にして再度makeから行った

この広告は前回の更新から一定期間経過したブログに表示されています。更新すると自動で解除されます。