Asterisk, How can I play an audio file

Here is the subscriber group

[testInComingCalls]

exten => s,1,Answer

exten => 30953025,1,Dial(SIP/20000,20)

I would like to play the audio file as soon as someone answered the call.

Please give me some idea on how to call php file, send input and forward call on output.

+4
source share
3 answers

Since most Dialing Options act on the called party, not on the caller, you should get a little creative. It's a little weird to do such things to the caller, not the callee, but hey, this is Asterisk: there is usually a way to do what you want.

- ( ) G. :

, .

, G / - - . , Bridge. Dialplan (: , , ):

[default]

exten => 1000,1,NoOp()
 same => n,Dial(SIP/alice,,G(default^bridge_and_play^1))
 same => n,Hangup()

exten => bridge_and_play,1,Goto(jump_caller,1)
 same => n,Goto(jump_called,1)
 same => n,Hangup()

exten => jump_caller,1,NoOp()
 same => n,Answer()
 same => n,Playback(tt-monkeys)
 same => n,Bridge(${bridge_this})
 same => n,Hangup()

exten => jump_called,1,NoOp()
 same => n,Set(MASTER_CHANNEL(bridge_this)=${CHANNEL})
 same => n,Wait(1000)
 same => n,Hangup()
+3

, ?

M , SIP/200000. :

[testInComingCalls]
exten => 30953025,1,Dial(SIP/20000,20,M(onanswer))

[macro-onanswer]
exten => s,1,Playback(hello-world)
+2

You need information about the AGI interface, which allows you to use php through phpagi to control dialplan.

http://www.voip-info.org/wiki/view/Asterisk+AGI

For the playback file, use the STREAM FILE agi command ($ agi-> stream_file in php)

0
source

Source: https://habr.com/ru/post/1524644/


All Articles