Asterisk 如何使用dialplan调用原始命令?

Asterisk 如何使用dialplan调用原始命令?,asterisk,sip,Asterisk,Sip,我尝试实现这个方案——通过SIP调用手机号码,并使用dialplan的asterisk origing命令 我运行命令: asterisk -rx "channel originate SIP/79887772211@sip extension 400@dialplan" asterisk -x "channel originate Local/79887772211@outbound extension s@play" 我的计划是: [dialplan] exten => 400,1

我尝试实现这个方案——通过SIP调用手机号码,并使用dialplan的asterisk origing命令

我运行命令:

asterisk -rx "channel originate SIP/79887772211@sip extension 400@dialplan"
asterisk -x "channel originate Local/79887772211@outbound extension s@play"
我的计划是:

[dialplan]
exten => 400,1,Answer()
exten => 400,3,Playback(hello-world)
exten => 400,4,Hangup
现在,当我运行命令时,我接到了电话号码79887772211,当我回答时,我听到了HelloWorld音频

现在我想补充一下,如果79887772211是现在的答案

我尝试:

[dialplan]
exten => 400,1,Answer()
exten => 400,3,RetryDial(hello-world|5|3|SIP/79887772211@sip|5|d)
exten => 400,3,Playback(hello-world)
exten => 400,4,Hangup
但它不起作用 我做错了什么

更新

我将拨号计划更改为:

[outbound]
exten=>_x.,1,verbose( calling to ${EXTEN})
same=>n,Set(CALLERID(num)=${calleridnumber}) ;callerid to use
same=>n,Dial(SIP/${EXTEN}@sip,25) ;trunk to use
same=>n,RetryDial(hello-world|5|3:SIP/${EXTEN}@sip|5|d)

exten=>_xxx,1,verbose( calling to ${EXTEN})
same=>n,Set(CALLERID(num)=${calleridnumber}) ;callerid to use
same=>n,Dial(SIP/${EXTEN},25)

[play]
exten=>s,1,Noop(///${caller}///)
same=>n,Answer()
same=n,Playback(demo-thanks)
same=>n,MusicOnHold(default)
same=>n,Hangup()
现在我可以运行以下命令:

asterisk -rx "channel originate SIP/79887772211@sip extension 400@dialplan"
asterisk -x "channel originate Local/79887772211@outbound extension s@play"
通话有效,若我挂断电话,星号就不会想起我


为什么RetryDial不起作用?

解决方案:

pro-sip*CLI> core show application Originate 

  -= Info about application 'Originate' =- 

[Synopsis]
Originate a call. 

[Description]
This application originates an outbound call and connects it to a specified
extension or application.  This application will block until the outgoing call
fails or gets answered.  At that point, this application will exit with the
status variable set and dialplan processing will continue.
This application sets the following channel variable before exiting:
${ORIGINATE_STATUS}: This indicates the result of the call origination.
    FAILED
    SUCCESS
    BUSY
    CONGESTION
    HANGUP
    RINGING
    UNKNOWN: In practice, you should never see this value.  Please report it to
    the issue tracker if you ever see it.

[Syntax]
Originate(tech_data,type,arg1[,arg2[,arg3[,timeout]]])

[Arguments]
tech_data
    Channel technology and data for creating the outbound channel.             
             For example, SIP/1234.
type
    This should be 'app' or 'exten', depending on whether the outbound channel
    should be connected to an application or extension.
arg1
    If the type is 'app', then this is the application name.  If the type is
    'exten', then this is the context that the channel will be sent to.
arg2
    If the type is 'app', then this is the data passed as arguments to the
    application.  If the type is 'exten', then this is the extension that the
    channel will be sent to.
arg3
    If the type is 'exten', then this is the priority that the channel is sent
    to.  If the type is 'app', then this parameter is ignored.
timeout
    Timeout in seconds. Default is 30 seconds.
我编辑了dialplan,现在它可以工作了=)

我使用命令originate运行它,一切正常:

channel originate Local/791114442233@outbound3 extension s@play
或者通过ARI运行它:

curl -v -u admin:admin -X POST "http://127.0.0.1:8085/ari/channels?endpoint=Local/791114442233@outbound3&extension=s&context=play"

如何在dialplan中检查${ORIGINATE_STATUS}?这只是一个变量。与其他变量相同。参见星号变量