【问题标题】:Either the outbound or inbound call only work in asterisk setup, not both. Why?出站或入站呼叫仅适用于星号设置,不能同时使用。为什么?
【发布时间】:2016-07-02 20:29:10
【问题描述】:

这是我的 sip.conf

; inbound configuration

[nexmo-sip]
fromdomain=sip.nexmo.com
type=friend
context=nexmo
insecure=port,invite
nat=no
;Add your codec list here.
; Note: Use "ulaw" for US only, "alaw" for the rest of the world.
allow=ulaw
allow=alaw
allow=G729
dtmfmode=rfc2833

[nexmo-sip-01](nexmo-sip)
host=173.193.199.24

[nexmo-sip-02](nexmo-sip)
host=174.37.245.34

[nexmo-sip-03](nexmo-sip)
host=5.10.112.121

[nexmo-sip-04](nexmo-sip)
host=5.10.112.122

[nexmo-sip-05](nexmo-sip)
host=119.81.44.6

[nexmo-sip-06](nexmo-sip)
host=119.81.44.7

;outbound configuration

[general]
register => <api-key>:<api-secret>@sip.nexmo.com
registerattempts=0
srvlookup=yes  
context=nexmo-sip1

[nexmo]
username=<api-key>
host=sip.nexmo.com
defaultuser=<api-key>
fromuser=<myNumber123>  
fromdomain=sip.nexmo.com
secret=<api-secret>
type=friend
context=nexmo-sip1
insecure=very
qualify=yes
nat=no
;Add your codec list here.
; Note: Use "ulaw" for US only, "alaw" for the rest of the world.
allow=ulaw
allow=alaw
allow=G729
dtmfmode=rfc2833

[<myNumber123>]   ; this number is at soft phone client
type=friend
context=nexmo-sip1
host=dynamic
secret=<myNumber123>
qualify=yes

[<mynumber123456>]  ; this is my mobile number
type=friend
context=nexmo-sip1
host=dynamic
secret=<secretkey>
qualify=yes

这是 extensions.conf

[general]
live_dangerously=yes
[globals]

[nexmo-sip1]

exten => _X.,1,Dial(SIP/${EXTEN}@nexmo)

[default]
exten => s,1,gosub(nexmo-sip1,${EXTEN},1)

设置 1: 如果上面是 extensions.conf 的设置,我可以从我的软客户端进行呼出,但无法向该软客户端接听呼入

设置2:如果我更改extensions.conf的设置如下,我可以在softclient接听来电,但不能拨打外呼。

[general]
live_dangerously=yes
[globals]

[nexmo-sip1]

exten => _X.,1,Dial(SIP/${EXTEN},30)

[default]
exten => s,1,gosub(nexmo-sip1,${EXTEN},1)

问题 1) 我应该进行哪些更改才能同时接听呼出电话和呼入电话?

问题 2: 当我将 extensions.conf 设置为设置 1 时,我听不到对方的声音,但是当 extensions.conf 设置为设置 2 时,我听到双方的对话. 如何解决?这是我没听到时看到的日志

[Jul 1 22:50:38] WARNING[11299]: chan_sip.c:4175 retrans_pkt: seqno 21(关键响应)的传输 tvK9cRGNN- 时已达到重传超时 - 请参阅 https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions 数据包在 8383 毫秒后超时,没有响应 [Jul 1 22:50:38] WARNING[11299]: chan_sip.c:4204 retrans_pkt: 挂断电话 tvK9cRGNN- - 没有回复我们的关键数据包(请参阅 https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions)。

我知道有很多错误的配置,比如 insecure=very 等。但现在我想让这个原型成功运行

【问题讨论】:

  • 您应该为入站和出站创建不同的上下文。您应该正确设置星号服务器 nat 遍历/防火墙。
  • NAT 穿越和防火墙已正确完成。因为如果错了,我不会在设置 1 中进行出站工作,在设置 2 中进行入站工作。我知道问题出在 extensions.conf。

标签: asterisk sip asteriskami sip-server nexmo


【解决方案1】:

要使入站和出站呼叫正常工作,您需要有 2 个独立的入站上下文和出站上下文。

尝试通过以下方式更改您的配置,extensions.conf:

[general]

[globals]

[nexmo-sip2]
exten => _X.,1,Dial(SIP/${EXTEN}@nexmo)

[nexmo-sip1]
exten => _X.,1,Dial(SIP/${EXTEN},30)

请在 sip.conf 中保留所有内容,只需更新我在此处粘贴的内容即可:

[<myNumber123>]   ; this number is at soft phone client
type=friend
context=nexmo-sip2
host=dynamic
secret=<myNumber123>
qualify=yes

[<mynumber123456>]  ; this is my mobile number
type=friend
context=nexmo-sip2
host=dynamic
secret=<secretkey>
qualify=yes

如您所见,我们需要为来自您的 SIP 分机 (nexmo-sip2) 的呼叫和来自您的 sip 提供商 (nexmo-sip1) 的呼叫提供 2 个单独的上下文。

【讨论】:

  • 哇,你太棒了。你解决了我近两周来面临的问题。非常感谢。
  • 我还有另一个问题。假设我有更多的分机(在这种情况下是手机号码)即将推出,我如何将它们动态添加到 sip.conf 并将其注册到 SIP 服务器?
  • 实时查看星号,或许对你有帮助
  • 非常感谢您的帮助。
  • 您好,关于上面的sip.conf和extensions.conf,我在呼出时听不到双方的声音。但我在呼入时听到双方的声音。有什么想法吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-02
  • 1970-01-01
  • 1970-01-01
  • 2023-03-26
相关资源
最近更新 更多