Asterisk AMI使用Action:Originate拨打电话

时间:2018-08-28 06:54:54

标签: asterisk ami

我已经开始使用Asterisk AMI。 喜欢它,最近几天学到了很多东西。

现在我要拨打电话:Originate

已通过以下方式完成此操作;

//Make an action
Action: Originate
Channel: SIP/1001
Context: phones
Exten: 1000
Priority: 1  
The call comes true, but as soon as I pick up the call is disconnected.
Is there a way to make a call between two extensions.

错误代码如下;

    -- Executing [1000@phones:3] NoOp("SIP/1001-0000000f", "Second Line") in new stack
    -- Executing [1000@phones:4] Dial("SIP/1001-0000000f", "SIP//") in new stack
[Aug 28 15:23:17] WARNING[13897][C-0000000c]: chan_sip.c:6267 create_addr: Purely numeric hostname (), and not a peer--rejecting!
[Aug 28 15:23:17] WARNING[13897][C-0000000c]: app_dial.c:2525 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [1000@phones:5] NoOp("SIP/1001-0000000f", "dialstatus=CHANUNAVAIL,causecode=20") in new stack
    -- Executing [1000@phones:6] Hangup("SIP/1001-0000000f", "") in new stack
  == Spawn extension (phones, 1000, 6) exited non-zero on 'SIP/1001-0000000f'

您将在此行中看到

-- Executing [1000@phones:4] Dial("SIP/1001-0000000f", "SIP//") in new stack

未设置第二个SIP用户。 我可以通过查看AMI输出来说这也是问题所在

Event: Hangup
Privilege: call,all
Channel: SIP/1001-00000010
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum: <unknown>
CallerIDName: <unknown>
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: ja
AccountCode: 
Context: phones
Exten: 1000
Priority: 6
Uniqueid: 1535440117.29
Linkedid: 1535440117.29
Cause: 20
Cause-txt: Subscriber absent

说订户不在。 我该如何通过AMI进行设置?

这甚至可能吗? 谢谢。

[更新]

extensions.conf

[phones]
exten =>  _XXXX,1,NoOp(First Line)
    same  => n,dumpchan()
    same  => n,NoOp(Second Line)
    same  => n,Dial(SIP/${CALLERID(dnid)}/${CALLERID(dnid)})
    same  => n,NoOp(dialstatus=${DIALSTATUS},causecode=${HANGUPCAUSE})
    same  => n,Hangup

sip.conf

[ACCOUNT-COMMON](!)
type=friend
nat=force_rport,comedia 
secret=123456
canreinvite=no
host=dynamic
dtmfmode=auto
callgroup=1
pickupgroup=1
videosupport=yes
qualify=yes
disallow=all
allow=all
;maxcallbitrate=1024   
context=phones


[1000](ACCOUNT-COMMON)
[1001](ACCOUNT-COMMON)
[1002](ACCOUNT-COMMON)
[1003](ACCOUNT-COMMON)
[1004](ACCOUNT-COMMON)
[1005](ACCOUNT-COMMON)
[1006](ACCOUNT-COMMON)
[1007](ACCOUNT-COMMON)
[1008](ACCOUNT-COMMON)
[1009](ACCOUNT-COMMON)
[1010](ACCOUNT-COMMON)
[1011](ACCOUNT-COMMON)
[1012](ACCOUNT-COMMON)
[1013](ACCOUNT-COMMON)
[1014](ACCOUNT-COMMON)
[1015](ACCOUNT-COMMON)
[1016](ACCOUNT-COMMON)
[1017](ACCOUNT-COMMON)
[1018](ACCOUNT-COMMON)
[1019](ACCOUNT-COMMON)
[1020](ACCOUNT-COMMON)

1 个答案:

答案 0 :(得分:1)

在[phones]上下文(extensions.conf)中使用$ {CALLERID(num)}而不是$ {CALLERID(dnid)},如下所示: 相同=> n,拨号(SIP / $ {CALLERID(num)})

目前不确定(不能进行检查),但是如果我没有记错的话,sip.conf中的alwaysauthreject = no将会忽略纯数字对等体。

只是不要用这个来生产:)