Dialout - Payment Reminder

Dialout - Payment Reminder

Automated payment reminder solution enables you to send reminders to customers about their due payments. This solution handles routine communication to customers effectively and conveniently. Following the sample script given here, deploy an interactive payment reminder system which will try to reduce the overall cost of maintaining large number of service personnels for doing the same task manually, thus allowing the available staff to spend more time in attending critical service issues.

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.

The automated attendant will work as given below:

  • IVR selects a record that matches the date and time
  • The auto-attendant dials the person and informs the payment-related information
  • IVR updates the database based on the connection status
Download the source file zip download for the Dialout - Payment Reminder


$db = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Reminder.mdb;User Id=admin;Password=;"

MAIN:
	display "Waiting . . ."
	Lock()
	$rtime = format("%s/%s/%s %s",right($date,4),mid($date,3,2),left($date,2),$time)
	
	$sql = format("SELECT * FROM Payments WHERE ReminderlTime <= #%s#
							AND Status = 0",$rtime)
	$alias = db.RunSQL($db,$sql)
	if $alias = 0 or $alias.eof = 1
		Unlock()
		
		sleep 5000
		goto MAIN
	endif
	
	
	if $alias.RetryCount > 3
		display "Ignoring . . ."
		$sql = format("UPDATE Payments SET Status = -1 WHERE ID = %d",$id)
		$alias = db.RunSQL($db,$sql)
		if $alias != 1
			
			log $error
			Unlock()
			sleep 5000
			goto MAIN
		endif
		Unlock()
		goto MAIN
	endif
	
	display "Scheduling . . ."
	$id = $alias.ID
	$Phone = $alias.Phone
	$Reminder = $alias.Reminder
	
	$sql = format("UPDATE Payments SET CalledTime = #%s#,RetryCount = %d,
			Status = 1 WHERE ID = %d",$rtime,$alias.RetryCount+1,$id)
	$alias = db.RunSQL($db,$sql)
	if $alias != 1
		
		log $error
		Unlock()
		sleep 5000
		goto MAIN
	endif
	Unlock()
	
	display "Dialing . . ."
	
	$stat = MakeCall($phone,$Reminder)
	if $stat = 1
		$sql = format("UPDATE Payments SET Status = 2 WHERE ID = %d",$id)
		$alias = db.RunSQL($db,$sql)
		if $alias != 1
			
			log $error
			sleep 5000
			goto MAIN
		endif
	endif
	goto MAIN    
    
ONHANGUP:
	
	hangup
	return 1

   
function MakeCall($Phone,$Text)
    
	
	while GetMessage() != ""
	endwhile
	while GetCallProgress() != ""
	endwhile
	
	
	if dial($phone) = 0
		return 0
	endif
	
	
	$result = 0
	while true
		$stat = GetCallProgress()
		if $stat = ""
			sleepevent
			continue
		endif
		display $stat
		
		if find($stat,"CONNECTED") = 0
			display "Reminding..."
			$result = 1
			speak $Text
			break
		endif
		if find($stat,"DISCONNECTED") = 0
			break
		endif
	endwhile
	hangup
	return $result