允许使用同一个星号拨打和接听电话(未注册的号码)

允许使用同一个星号拨打和接听电话(未注册的号码)

我遇到过一种特殊情况,运营商(而非提供商)无需注册即可给我打电话。在运营商方面,号码具有关联的 IP,用于路由任何呼叫。对于拨出电话,我只需将呼叫推送到运营商服务器(无需注册)。对于拨出电话,我有一台 Cisco SPA504G,如果我能找到可行的解决方案,我愿意再买几台。

测试了很多配置后,我可以通过更改设置进行拨出或拨入电话,但无法同时进行这两种操作。据我所知,sip.conf 中的“outcall”用于我并不需要的拨入电话。我尝试了很多在线提示/操作方法的配置,但我的情况似乎有点特殊。

请查看以下我的配置并帮助我解决这个问题:)

配置文件

[general]
maxexpirey=3600
defaultexpirey=3600
registertimeout=300
context=default
transport=udp
disallow=all
allow=ulaw
dtmfmode=auto
allowguest=yes
language=ja


[151]
type=user
;nat=force_rport,comedia
secret=151secret
host=dynamic
regext=151
context=fxsgroup
;directmedia=nonat
;directrtpsetup=no
allowguest=yes
defaultuser=151
fromuser=151
;nat=route
[outcall]
defaultuser=03XXXX9510
type=peer
;secret=03XXXX9510
host=10.254.32.1
fromuser=0367449510
context=fxsgroup
;trustrpid = yes
;sendrpid = yes
;canreinvite = no
;directmedia=no
allowguest=no

扩展配置文件

[default]
;[03XXXX9510] ALEX 03XXXX9510 (
    exten => 03XXXX9510,Dial(SIP/151@outcall,60)
;   exten => 03XXXX9510,n,Dial(SIP/03XXXX2740@outcall,80)
    exten => 03XXXX9510,n,Hangup

[fxsgroup]
;151 ext
exten => 151,1,Dial(SIP/151,60,rT)

exten => _XXXXXXXXXXX, 1,Set(CALLERID(num)=03XXXX9510)
exten => _XXXXXXXXXXX, n, Dial(SIP/${EXTEN}@outcall, 20)
exten => _XXXXXXXXXXX, n, Congestion()
exten => _XXXXXXXXXXX, n, Hangup()

exten => _XXXXXXXXXX, 1,Set(CALLERID(num)=03XXXX9510)
exten => _XXXXXXXXXX, n, Dial(SIP/${EXTEN}@outcall, 20)
exten => _XXXXXXXXXX, n, Congestion()
exten => _XXXXXXXXXX, n, Hangup()

在 SIP 调试中跟踪(入站呼叫转到外拨而不是默认上下文)

<--- SIP read from UDP:10.254.32.1:5060 --->
INVITE sip:[email protected]:5060 SIP/2.0
Call-ID: [email protected]
CSeq: 1 INVITE
From: <sip:[email protected]>;tag=12d7dc8113006c-f5c541eb42415
To: <sip:[email protected]>
Via: SIP/2.0/UDP 10.254.32.1:5060;branch=z9hG4bKfbd30971b55b4da33c7b37b23d0d2bf5
Max-Forwards: 70
Contact: <sip:[email protected]:5060>
Allow: OPTIONS, INVITE, ACK, CANCEL, BYE
Supported: timer
Content-Type: application/sdp
Content-Length: 138

v=0
o=- 1494691107189 0 IN IP4 10.254.32.1
s=-
c=IN IP4 10.254.32.1
t=0 0
m=audio 57396 RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=sendrecv
<------------->
--- (12 headers 8 lines) ---
Sending to 10.254.32.1:5060 (no NAT)
Sending to 10.254.32.1:5060 (no NAT)
Using INVITE request as basis request - [email protected]
Found peer 'outcall' for '080XXXX2374' from 10.254.32.1:5060
Found RTP audio format 0
Found audio description format PCMU for ID 0
Capabilities: us - (ulaw), peer - audio=(ulaw)/video=(nothing)/text=(nothing), combined - (ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x0 (nothing), combined - 0x0 (nothing)
Peer audio RTP is at port 10.254.32.1:57396
Looking for 03XXXX9510 in fxsgroup (domain 172.30.20.4)
sip_route_dump: route/path hop: <sip:[email protected]:5060>

<--- Transmitting (no NAT) to 10.254.32.1:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.254.32.1:5060;branch=z9hG4bKfbd30971b55b4da33c7b37b23d0d2bf5;received=10.254.32.1
From: <sip:[email protected]>;tag=12d7dc8113006c-f5c541eb42415
To: <sip:[email protected]>
Call-ID: [email protected]
CSeq: 1 INVITE
Server: Asterisk PBX 14.2.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: <sip:[email protected]:5060>
Content-Length: 0


<------------>
Audio is at 12388
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 10.254.32.1:5060:
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 172.30.20.4:5060;branch=z9hG4bK60e97466
Max-Forwards: 70
From: <sip:[email protected]>;tag=as53476181
To: <sip:[email protected]>
Contact: <sip:[email protected]:5060>
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 14.2.1
Date: Sat, 13 May 2017 15:58:27 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 249

v=0
o=root 1244963103 1244963103 IN IP4 172.30.20.4
s=Asterisk PBX 14.2.1
c=IN IP4 172.30.20.4
t=0 0
m=audio 12388 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---

<--- SIP read from UDP:10.254.32.1:5060 --->
SIP/2.0 486 Busy Here
Via: SIP/2.0/UDP 172.30.20.4:5060;branch=z9hG4bK60e97466
Max-Forwards: 70
From: <sip:[email protected]>;tag=as53476181
To: <sip:[email protected]>
Call-ID: [email protected]:5060
CSeq: 102 INVITE
Contact: <sip:[email protected]:5060>
Allow: OPTIONS, INVITE, ACK, CANCEL, BYE
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---
Transmitting (no NAT) to 10.254.32.1:5060:
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 172.30.20.4:5060;branch=z9hG4bK60e97466
Max-Forwards: 70
From: <sip:[email protected]>;tag=as53476181
To: <sip:[email protected]>
Contact: <sip:[email protected]:5060>
Call-ID: [email protected]:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 14.2.1
Content-Length: 0

我确信有解决方案,可能就领先一步;)

提前谢谢您!

答案1

您应该将 SIP 用户“outcall”重命名为“trunk a”,因为这就是它;是的,入站和出站呼叫都将使用它。

Asterisk 完全按照您的要求执行。到达 10.254.32.1 端点的呼叫属于 SIP 用户“outcalls”,其默认上下文为 fxsgroup。遗憾的是,用户 03XXXX9510 不存在于 fxsgroup 上下文中,因此您的呼叫失败。

相关内容