3

I'm trying to make a conference and play a sound file in the background of the conference. How can I make this possible?

this obviously wouldn't work because the sound file will be played before entering the conference.

exten => s,1,playback(some/soundfile)
same => n,confbridge(1)

Thanks in advance!

Allover
  • 127
  • 3
  • 11

4 Answers4

3

Wanted to add my solution here in case anyone ever needs it.

first make a context for the conf bridge in extensions.conf:

[conf-msg]
exten => s,1,ConfBridge(01)

where 01 is the bridge number

Then via the command line you can do:

asterisk -x 'channel originate local/s@conf-msg application Playback file'

Its really as simple as that.

tgwaste
  • 439
  • 3
  • 7
  • 1
    This should be the accepted answer. `asterisk -rx 'channel originate local/s@conf-msg application Playback hello-world'` – Tono Nam Jan 03 '18 at 04:26
2

You have create new call,simple method using call files.

http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out

After that you have place one of call legs to your conference like this

Channel: Local/1111@conference
Application: Playback
Data: some/soundfile

Where conference is context to get to ur conference room. No need do spy or somethign like that,that is wast of time/cpu

arheops
  • 15,544
  • 1
  • 21
  • 27
  • i didn't get it properly, if i made a call from extension xxx where channel is zzz then how did it get to know on which channel it has to play? – Steve Jan 07 '16 at 12:08
  • If you have conference, you should just play file to same conference. If you have NO conference, you should send to dialplan channel name on which to wisper(via variables or via database lookup in dialplan) after that create call using ChanSpy(put chanspy in ext 1111 in context conference in this example). I am sorry, you should still do work yourself. – arheops Jan 07 '16 at 15:45
  • Don't be sorry, i have done it by my own, thank you for your suggestion, i appreciate. But i need you to help me on another thing which dangles me in it, i need to detect talk on both ends but asterisk let me detect it on the channel who dialed the exten not who received it, is it possible to detect talk on both ends? – Steve Jan 08 '16 at 10:10
  • Yes, by c/c++ app or by create new channel and attach one end of that channel via chanspy to needed direction of original channel. There are no principal difference between two legs when you work in asterisk core(c/c++ app, see app_monitor.c for example) – arheops Jan 08 '16 at 13:40
  • i have tried the way you told me but i am still not able to get the talk detect events on receiving channel, even i tried to get all channels by implementing loop, but i failed, please kindly lead me to anything by which i can detect talk detect events on receiving channel. – Steve Jan 25 '16 at 11:21
  • I don't know what to add to my answer. Yes, i am sure it working. I did that. – arheops Jan 26 '16 at 16:58
0

See here for a similar question: Asterisk- How to 'whisper' music using ChanSpy(), or any alternative?

Basically, you want to add a participant that points to a local channel (as above, only enter the channel instead of spying), play your sounds, then hangup.

Community
  • 1
  • 1
Mbrevda
  • 2,888
  • 2
  • 27
  • 35
  • Ok, so use a separate call file. For example, if I wanted to connect 2 callers and play background sounds... 2 call files would use confbridge while the other uses chanspy and uses playback? – Allover May 04 '12 at 05:10
  • You would have the 2 callers enter normally (or automatedly if you wanted). Then you originate/call file a 3rd "participant" pointing to a Local channel (pointing to the playback dialplan) and play back files to your hearts content. Said participant will leave the conference when your playbacks are done – Mbrevda May 04 '12 at 11:49
0

Same answers, but for many confBridge:

In extension.conf:

[autobridge]
exten => _X.,1,ConfBridge(${EXTEN})
  • Then, like tgwaste's answer, you could initiate message into conference room 1234, by using originate:

    originate local/1234@autobridge application Playback en_US/tt-monkeys
    

    from console or a manager connection,

  • Or as arheops's answer suggest, by adding a file in outgoing spool dir:

    printf "Channel: Local/%d@autobridge\nApplication: %s\nData: %s\n" \
        1234 Playback sound/file >/var/spool/asterisk/outgoing/f-$RANDOM
    

    from anything at filesystem level ( with correct permissions, could be shared! :-).

F. Hauri - Give Up GitHub
  • 64,122
  • 17
  • 116
  • 137
  • Nota I just extracted `Playback` for `printf` format string to make this line short enough to prevent scrollbar. A correct command could be `printf 'Channel: Local/%d@autobridge\nApplication: Playback\nData: %s\n" >/var/spool/asterisk/outgoing/f-$RANDOM 1234 en_US/tt-monkeys` – F. Hauri - Give Up GitHub Jun 12 '19 at 08:37