Audio Streaming - Audio Snoop

Audio Streaming - Audio Snoop

Streaming audio is a process by which same audio files can be provided to different users simultaneously. You can make use of this sample when your customers want to start listening to an audio without having to wait for the entire file to get downloaded. In case of inconsistent Internet connections, streaming audio via our automated system introduces an effective approach.

Download the evaluation version of Xtend IVR and install the telephony application in your system. Run the sample script from the Script Editor. Click here to refer the code.

After creating the script, you can run the script and it works as follows:

  • Initially, IVR verifies if there is any multi-port license to run the script and finds out the device being configured for multimedia streaming
  • IVR waits for the call
  • When a call is encountered, IVR accepts the call and streams the audio to the multimedia device

if ActivePorts() <= 1
	MsgBox("You need multi-port license to run this script")
	return
endif


if find($devicename,"(WAVE)") >= 0
	atomicset(1,"$mmdevice",$deviceid)
endif
sleep 2000

MAIN:
	if atomicget(1,"$mmdevice") = $deviceid
		answer 0
		
		display "Audio streaming in progress.."
		
		while true
			sleepevent
		endwhile
		goto MAIN
	endif
	
	display "Waiting for call"
	answer 1
	
	$displayprefix = ""
	if len($cli) <> 0 
		$displayprefix = concat("[", $cli, "] ")
	endif
	
	$audiodevice = atomicget(1,"$mmdevice")
	
	softstream($audiodevice,0)
	
	display "Audio streaming to " $audiodevice
	
	while true
		sleepevent
	endwhile
	goto MAIN
	
ONHANGUP:
	
	hangup
	goto MAIN
	
ONSYSTEMERROR:
	display $error
	log $error
	hangup
	goto MAIN