Re: [Asterisk-java-users] How can i use this library to make a call and run an audio file on it
Brought to you by:
srt
|
From: Brandon H. <bh...@ta...> - 2018-11-23 20:33:50
|
Hey Adriano,
I have within the last few months started using Asterisk-Java for a project
and you can certainly playback an audio file. There are a couple of things
that you will have to think about to determine the best approach for your
situation, here is what I can tell you though
- If you do *not* need to listen for DTMF input (keypresses) while
playing the audio file then you can play an audio file on an AgiChannel in
Java by using something like `agiChannel.exec("playback", "<path to audio
file>");`
- This example in the Asterisk Java GitHub repository shows answering
a call, playing a file back, and then hanging up (note that in
the example
they rely on methods defined in the AgiOperations class so they aren't
operating directly on the AgiChannel like the line of code I am
sharing is
doing)
https://github.com/asterisk-java/asterisk-java/blob/master/src/main/java/org/asteriskjava/examples/fastagi/ExampleCallIn.java
- If you *do* need to listen for DTMF input while playing the audio file
then you will want to use the `getData` or `getOption` methods defined on
AgiChannel. You will need to pick which method is appropriate depending on
the length of DTMF you need to listen for (`getOption` returns a single
char while `getData` will return a String)
Thanks,
Brandon
On Thu, Nov 22, 2018 at 12:09 PM adriano santos <sle...@bs...> wrote:
> Hello, guys!
>
> I would like to play an audio file on a initialized call via java. I
> haven't found an example for this.
> Is this possible?
>
> --
> Adriano P. Santos
>
> "O homem erudito é um descobridor de fatos que já existem - mas o homem
> sábio é um criador de valores que não existem e que ele faz existir."
> Albert Einstein
> _______________________________________________
> Asterisk-java-users mailing list
> Ast...@li...
> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users
>
|