Skype - Answering Machine

Skype - Answering Machine

Deploying automatic answering system using Xtend IVR will ensure that every customer call is answered promptly without any delay andyour business always stay connected even, if you are not available to answer your incoming Skype calls. The automated IVR picks up the incoming call and processes the call at a faster pace while recording and storing all the phone conversations as audio files for future references.

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 sample script, you can run the script and it works as follows:

  • Initially, set the parameters for IVR configuration and Skype setup
  • IVR waits for the call
  • Checks whether the connection is established
  • If the call appears connected, the phone conversation gets recorded
  • If the recipient has not picked up the call within the specified number of rings, then, IVR announces the message
  • If call has been picked up within the specified number of rings, IVR stops the answering machine and records the phone conversation


$AnsweringMachineRings = 10


Skype.Command("SET SILENT_MODE ON")
Skype.Command("MINIMIZE")

	
MAIN:
	voicelog
	display "Waiting for call..."
	Skype.ConnectMMedia(0)
	
WAITFORCALL:
	
	$Str = GetCallProgress()
	if $Str == "CONNECTED" then goto CONVERSATIONRECORDING
	
	
	if $Ring > 0
		display "Incoming call..."
	endif
	if $Ring >= $AnsweringMachineRings then goto ANSWERINGMACHINE
	
	
	if Skype.Response() == ""
		SleepEvent 100
		goto WAITFORCALL
	endif
	goto WAITFORCALL
	

ANSWERINGMACHINE:
	display "Answering Machine"
	answer 1
	
	$Curr = GetTime()
	$CallWaveFile = Format("AM-%04u%02u%02u%02u%02u%02u-%03u.wav", 
			mid($curr,0,4), mid($curr,5,2), mid($curr,8,2), 
			mid($curr,11,2), mid($curr,14,2), mid($curr,17,2), $DeviceId)
	voiceLog $CallWaveFile
    
	Skype.ConnectMMedia(1)
	speak "Hi I am currently not at home, could you kindly leave a message
					and I'll get back to you."
	play "\pau=500\"
	while PlayTimeLeft() > 0
		
		if Skype.Response() == ""
			SleepEvent 50
			continue
		endif
		
		if Left($Skype.Response,16) == "CONTACTS FOCUSED"
			VoiceLog
			goto CONVERSATIONRECORDING
		endif 
	endwhile
	beep 
	
	record 60
	while RecordTimeLeft() > 0
		
		if Skype.Response() == ""
			SleepEvent 50
			continue
		endif
		
		if Left($Skype.Response,16) == "CONTACTS FOCUSED"
			VoiceLog
			goto CONVERSATIONRECORDING
		endif 
	endwhile
	hangup
	goto MAIN
	
	
CONVERSATIONRECORDING:	
	Skype.ConnectMMedia(2)
	$Curr = GetTime()
	$CallWaveFile = Format("CR-%04u%02u%02u%02u%02u%02u-%03u.wav", mid($curr,0,4), 
				mid($curr,5,2), mid($curr,8,2), mid($curr,11,2), 
				mid($curr,14,2), mid($curr,17,2), $DeviceId)
	voiceLog $CallWaveFile
	
	display "Conversation Recording"
	while true
		if Skype.Response() == ""
			SleepEvent
			continue
		endif
	endwhile
	hangup
	goto MAIN


ONHANGUP:
	hangup
	goto MAIN


ONSYSTEMERROR:
	log $error
	display $error
	if $debug 
		msgbox($error)
	endif
	hangup
	goto MAIN