Change the audio file (player)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

After trying several solutions, I end up here and look forward to your help:
How can I change the audio file which is in audio the slot?
When a call is received, the wav is played by the following source:

>     def on_media_state(self):
>     if self.call.info().media_state == pj.MediaState.ACTIVE:
>         global player_id
>         dtmfInput=""
>         call_slot = self.call.info().conf_slot
>         #pj.Lib.instance().conf_connect(call_slot, 0)#only for real call
> with microphone
>         #pj.Lib.instance().conf_connect(0, call_slot)#only for real call
> with microphone
>         print "get audio file frames/length"
>         wfile = wave.open("info.wav")
>         time = (1.0 * wfile.getnframes ()) / wfile.getframerate ()
>         print str(time) + "ms"
>         wfile.close()
>         print "create player"
>         player_id = lib.create_player("info.wav",True)#loop the audio file
>         lib.conf_connect(lib.player_get_slot(player_id), current_call.info
> ().conf_slot)
>         print "audio wait...",time
>         sleep(time*3)
>         print "audio over now..."
>         print "lib.conf_disconnect..."
>         lib.conf_disconnect(lib.player_get_slot(player_id),
> current_call.info().conf_slot)
>         print "lib.player_destroy(player_id)"
>         lib.player_destroy(player_id)
>     else:
>         print "Media is inactive"
>

Now I have a DTMF trigger which works already and writes the dtmf to the
console. Whenever a dtmf digit is received, I want the current player to
stop and start another one instead.
However, I can not find a way or manual entry for "changing" the audio
source on runtime :-/

Any hints?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20091115/2d90c05c/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux