如何将软件电话连接到 asterisk

如何将软件电话连接到 asterisk

为了提供上下文,这是我的网络:

局域网

tleilax服务器上,明显有来自sipsakon doge 的结果:

tleilax*CLI> 
tleilax*CLI> core show version
Asterisk 1.8.29.0-vici built by abuild @ cloud110 on a x86_64 running Linux on 2014-08-21 23:18:17 UTC
tleilax*CLI> 
[Feb 20 21:06:19] 
<--- SIP read from UDP:192.168.1.3:44226 --->
OPTIONS sip:345@tleilax SIP/2.0
Via: SIP/2.0/UDP 127.0.1.1:44226;branch=z9hG4bK.508a6d72;rport;alias
From: sip:[email protected]:44226;tag=2a099edc
To: sip:345@tleilax
Call-ID: [email protected]
CSeq: 1 OPTIONS
Contact: sip:[email protected]:44226
Content-Length: 0
Max-Forwards: 0
User-Agent: sipsak 0.9.6
Accept: text/plain

<------------->
[Feb 20 21:06:19] --- (11 headers 0 lines) ---
[Feb 20 21:06:19] Looking for 345 in trunkinbound (domain tleilax)
[Feb 20 21:06:19] 
<--- Transmitting (NAT) to 192.168.1.3:44226 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 127.0.1.1:44226;branch=z9hG4bK.508a6d72;alias;received=192.168.1.3;rport=44226
From: sip:[email protected]:44226;tag=2a099edc
To: sip:345@tleilax;tag=as5d21da5c
Call-ID: [email protected]
CSeq: 1 OPTIONS
Server: Asterisk PBX 1.8.29.0-vici
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:192.168.1.2:5060>
Accept: application/sdp
Content-Length: 0


<------------>
[Feb 20 21:06:19] Scheduling destruction of SIP dialog '[email protected]' in 32000 ms (Method: OPTIONS)
[Feb 20 21:06:38] Really destroying SIP dialog '[email protected]' Method: OPTIONS
[Feb 20 21:06:51] Really destroying SIP dialog '[email protected]' Method: OPTIONS
tleilax*CLI> exit
tleilax:~ # 

doge,发送sipsak消息:

thufir@doge:~$ 
thufir@doge:~$ sudo sipsak -vv -s sip:345@tleilax -m "hi"
No SRV record: _sip._tcp.tleilax
No SRV record: _sip._udp.tleilax
using A record: tleilax
Max-Forwards set to 0

message received:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 127.0.1.1:44226;branch=z9hG4bK.508a6d72;alias;received=192.168.1.3;rport=44226
From: sip:[email protected]:44226;tag=2a099edc
To: sip:345@tleilax;tag=as5d21da5c
Call-ID: [email protected]
CSeq: 1 OPTIONS
Server: Asterisk PBX 1.8.29.0-vici
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:192.168.1.2:5060>
Accept: application/sdp
Content-Length: 0



** reply received after 0.794 ms **
   SIP/2.0 200 OK
   final received
thufir@doge:~$ 

我试了几部手机,这个是电话连接:

This assistant is now finished.
You can at any time check your registration state or modify your accounts parameters in the Options/Accounts window.

Alias :   345
Server :   tleilax
Username :   345
Security: None

它不会给出“200 OK”消息来表明它已连接。我该如何排除连接故障?这两台计算机在同一网络中,可以互相 ping 通,甚至ssh;我不明白为什么软件电话doge无法收到“200 OK”消息tleilax——它只是说“正在尝试”,而其他软件电话也会给出类似的结果。

用户:

tleilax*CLI> 
tleilax*CLI> sip show users
Username                   Secret           Accountcode      Def.Context      ACL  Forcerport
101                        password         101              default          No   Yes       
gs102                      password         gs102            default          No   Yes       
tleilax*CLI> 
tleilax*CLI> sip show user 101


  * Name       : 101
  Secret       : <Set>
  MD5Secret    : <Not set>
  Context      : default
  Language     : en
  Accountcode  : 101
  AMA flags    : Unknown
  Netborder CPD: No
  Transfer mode: open
  MaxCallBR    : 384 kbps
  CallingPres  : Presentation Allowed, Not Screened
  Call limit   : 0
  Callgroup    : 
  Pickupgroup  : 
  Callerid     : "" <101>
  ACL          : No
  Sess-Timers  : Accept
  Sess-Refresh : uas
  Sess-Expires : 1800 secs
  Sess-Min-SE  : 90 secs
  RTP Engine   : asterisk
  Codec Order  : (ulaw:20,gsm:20)
  Auto-Framing:  No 

tleilax*CLI> 

配置文件:

tleilax:~ # 
tleilax:~ # cat /etc/asterisk/sip.conf
[general]

...

#include sip-vicidial.conf

; register SIP account on remote machine if using SIP trunks
; register => testSIPtrunk:[email protected]:5060
;
; setup account for SIP trunking:
; [SIPtrunk]
; disallow=all
; allow=ulaw
; allow=alaw
; type=friend
; username=testSIPtrunk
; secret=test
; host=10.10.10.16
; dtmfmode=inband
; qualify=1000
tleilax:~ # 
tleilax:~ # cat /etc/asterisk/sip-vicidial.conf
; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST



[101]
username=101
secret=password
accountcode=101
callerid="" <101>
mailbox=101
context=default
type=friend
host=dynamic

[gs102]
username=gs102
secret=password
accountcode=gs102
callerid="Test Admin Phone" <>
mailbox=102
context=default
type=friend
host=dynamic


; END OF FILE    Last Forced System Reload: 2015-02-20 16:49:28
tleilax:~ # 

答案1

您需要相应设置 localnet 和 nat

externip = X.X.X.X
fromdomain = yourdomain.com
localnet = 192.168.X.0/255.255.255.0
qualify=yes

http://www.voip-info.org/wiki/view/Asterisk+SIP+NAT+solutions

相关内容