Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Loops 如何在callfile中循环播放单个声音文件以获取星号?_Loops_Audio_Asterisk - Fatal编程技术网

Loops 如何在callfile中循环播放单个声音文件以获取星号?

Loops 如何在callfile中循环播放单个声音文件以获取星号?,loops,audio,asterisk,Loops,Audio,Asterisk,我运行asterisk并试图使单个声音文件循环x次或某个时间段。谁能给我指出正确的方向吗?我当前的星号调用文件如下所示: Channel: /sip/flowout/1202XXXXXXX CallerID: <3333> Application: Playback Data: soundfile 频道:/sip/flow out/1202XXXXXXX CallerID: 应用:回放 数据:声音文件 当前配置调用目标方,播放录音并挂断。但是我想知道这个应用程序是否可以使用循环

我运行asterisk并试图使单个声音文件循环x次或某个时间段。谁能给我指出正确的方向吗?我当前的星号调用文件如下所示:

Channel: /sip/flowout/1202XXXXXXX
CallerID: <3333>
Application: Playback
Data: soundfile
频道:/sip/flow out/1202XXXXXXX
CallerID:
应用:回放
数据:声音文件
当前配置调用目标方,播放录音并挂断。但是我想知道这个应用程序是否可以使用循环


非常感谢您的帮助。

例如,您可以在拨号计划中呼叫分机,以重复您的声音

调用文件:

Channel: SIP/flowout/1202XXXXXXX
CallerID: <3333>
Context: play_sound
Extension: 100
Priority: 1
Channel: /sip/flowout/1202XXXXXXX
CallerID: <3333>
Context: play_sound
Set: _soundfile=soundfile
Set: _timePeriod=30
S(x)-使用此选项,您可以指定一段时间,在此时间之后,行 将被挂断。计时器在被叫人接听电话后启动


如果您在callfile中设置了
Context:play_sound
,您的声音将被播放4次,但如果您将其更改为
Context:play_with_timeout
,您的呼叫将在60秒后停止或播放声音4次。

您也可以这样播放5次

Channel: /sip/flowout/1202XXXXXXX
CallerID: <3333>
Application: Playback
Data: soundfile&soundfile&soundfile&soundfile&soundfile
频道:/sip/flow out/1202XXXXXXX
CallerID:
应用:回放
数据:声音文件&声音文件&声音文件&声音文件&声音文件

当然,它不太灵活,但更简单。

您也可以在运行时使用星号cmd

调用文件:

Channel: SIP/flowout/1202XXXXXXX
CallerID: <3333>
Context: play_sound
Extension: 100
Priority: 1
Channel: /sip/flowout/1202XXXXXXX
CallerID: <3333>
Context: play_sound
Set: _soundfile=soundfile
Set: _timePeriod=30
频道:/sip/flow out/1202XXXXXXX
CallerID:
上下文:播放声音
设置:_soundfile=soundfile
设置:_timePeriod=30
拨号计划:

[play_with_timeout]
exten => 100,1,Dial(Local/100@play_sound,15,S(60))

[play_sound]
exten => 100,1,Set(repeatCount=5)
exten => 100,n(playback),Playback(hello-world)
exten => 100,n,Set(repeatCount=$[${repeatCount} - 1])
exten => 100,n,GotoIf(GotoIf($[${repeatCount} = 0]]?exit:playback)
exten => 100,n(exit)Hangup()
same => n,Progress()
same => n,While($[${CDR(duration)} < ${timePeriod} ])       
    same => n,Playback(soundfile,noanswer)
same => n,EndWhile
same => n,HangUp
same=>n,Progress()
相同=>n,而($[${CDR(持续时间)}<${timePeriod}])
相同=>n,播放(声音文件,noanswer)
相同=>n,结束
相同=>n,挂断