如何使用Dialplan调用原始命令?

问题描述 投票:0回答:2

我尝试实现该方案–通过SIP想到的星号通过拨号计划发起命令来拨打移动电话号码。

我运行命令:

asterisk -rx "channel originate SIP/79887772211@sip extension 400@dialplan"

和我的拨号计划:

[dialplan]
exten => 400,1,Answer()
exten => 400,3,Playback(hello-world)
exten => 400,4,Hangup

[现在,当我运行命令时,我拨打了号码79887772211,当我回答时,我听到了您好世界的声音。

现在,如果号码为79887777211,我现在想回答,我想补充一下。

我尝试:

[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

但是它不起作用=(我做错了吗?

UPDATE

我将拨号计划更改为此:

[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 -x "channel originate Local/79887772211@outbound extension s@play"

并且通话有效,如果我挂断电话,星号不会让我想起。

为什么RetryDial不起作用?

asterisk sip
2个回答
0
投票
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.

0
投票

SOLUTION:

我编辑拨号方案,现在是它的工作=)

[play]
exten=>s,1,Noop(///${caller}///)
same=>n,Answer()
same=n,Playback(demo-thanks)
same=>n,MusicOnHold(default)
same=>n,Hangup()

[outbound3]
exten => _x.,1,Dial(SIP/${EXTEN}@sip,15,t)
exten => _x.,n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial1)
exten => _x.,n(redial1),Dial(SIP/${EXTEN}@sip,15,t)
   same => n,Set(secondary=79001112233)
   same => n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial2)
   same => n(redial2),Dial(SIP/${EXTEN}@sip,15,t)
   same => n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial3)
   same => n(redial3),Dial(SIP/${secondary}@sip,15,t)
   same => n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial4)
   same => n(redial4),Dial(SIP/${secondary}@sip,15,t)
   same => n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial5)
   same => n(redial5),Dial(SIP/${secondary}@sip,15,t)

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

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"
© www.soinside.com 2019 - 2024. All rights reserved.