Script Exiting Unexpectedly

A script I wrote checks incoming caller ID's against Microsoft
Outlook's Contact list. What I've found is that without explicitly
including a 'return' line in the conditional routine the script exits
unexpectedly. I've commented out the explicit return statement that's
required. Any ideas why this is the case? I'm using Ruby 1.8.2 on
Win32. I've traced the script and found that it doesn't bomb out with
any errors that I can tell. The only difference is the line that's
commented with HEADS-UP. Maybe I can't see the forest through the trees

outlookScreenPop.rb snippet



# My screen pop method
def screenPop(alertingCall)
  allContacts = getContacts

  # Continue with the screen pop query if data was passed back from the
Outlook OLE link.
  if allContacts != nil
    # Iterate through each contact to determine its associated telephone
    allContacts.each do | contact |
      cleanHomePhone = clean(contact.HomeTelephoneNumber)
      cleanBusPhone = clean(contact.BusinessTelephoneNumber)
      cleanCellPhone = clean(contact.MobileTelephoneNumber)

      puts "#{"%m/%d/%Y @ %H:%M:%S")} -
Testing #{cleanHomePhone} | #{cleanBusPhone} | #{cleanCellPhone}
against #{alertingCall}."

      # Match them up, append the entry to the logfile and display the
Contact Record
      if alertingCall == cleanHomePhone or alertingCall == cleanBusPhone
or alertingCall == cleanCellPhone
        puts "#{"%m/%d/%Y @ %H:%M:%S")} -
#{alertingCall} matched against #{contact.FullName} in Outlook
      # HEADS-UP!!! Here's the explicit return statement that seems to be
necessary --- return
    puts "#{"%m/%d/%Y @ %H:%M:%S")} - No
records found in Outlook Contacts or OLE link broken."

# My loop that checks for incoming calls
  # Check the monitor every half second for an alerting call.
  loop do
    sleep 0.5
    if @tsession.ringing?

      # If the extension has an alerting call, collect the data.

      # If the call isn't originating from the extension itelf, pop up a
Windows message box with the caller ID and attempt an Outlook Contact
screen pop.
      if @callingNum != @extension
        puts "#{"%m/%d/%Y @ %H:%M:%S")} -
#{@callingNum} calling.""user32", "MessageBox", ['i','p','p','i'],
'i').call(0, "#{@callingNum} calling on
#{"%m/%d/%Y @ %H:%M:%S")}.", "Mojo CTI
Link", 0)
        screenPop(@callingNum) if @callingNum != ""
  puts "#{"%m/%d/%Y @ %H:%M:%S")} - Closed
CTI stream from #{@extension}."