Richard Dale wrote:
Yes, it is. That way you don't need an extra thread, and you can detect any
input on the socket as part of the normal Qt event loop. But you didn't
describe quite what you wanted to monitor in your original post, I didn't
know what you meant by 'incoming signals'.
I have a CRM application that I've written. And I am looking to add CTI
screen pops coming from alerting phone calls. This is based off my
recent RubyPhone addition to the RubyForge projects. I want the caller
ID to be pushed into the CRM application's customer lookup window. My
CTI thread is just a loop that listens for the CTI caller ID
information.
Like this:
···
------------------------
require "tsapi"
screenPop=Thread.new {
puts "screen pop thread started!\n"
tsession=Tsapi.new("555","AVAYA#MAGIX#CSTA#MERLIN-CTI", "username",
"password", "CTI Test")
puts "tsession is #{tsession}.\n"
# this represents the call ID and caller ID of the incoming caller
caller = 0
callingNum= 0
# this represents the result set of the contact database lookup
contactData =
puts "trying to invoke tsession.open()...\n"
results=tsession.open
puts "tsession open() returned #{results}.\n"
sleep 1
puts "trying to invoke tsession.monitorOn()...\n"
results=tsession.monitorOn(CF_DELIVERED, 0, 0, 0)
puts "tsession monitorOn() returned #{results}.\n"
sleep 1
loop do
sleep 1
if tsession.ringing? == true
caller=tsession.callIdMon
callingNum=tsession.callDevIdMon
puts "alerting call #{caller} from #{callingNum}.\n"
# retrieve the customer contact data associated with the incoming
calling number
c = XMLRPC::Client.new("10.0.0.200", "/RPC2", 8888)
contactData = c.call("crm.getContactScreenPop", "#{callingNum}")
if contactData == 1
@displayName, @compName, @lastName, @middleName, @firstName,
@street, @city, @state, @zip, @comments, @custNum, @birthday,
@anniversary, @spouseName, @homeCity, @homeZip, @homeState,
@homeStreet, @homeFax, @homePhone, @busFax, @busPhone, @cellPhone = ""
else
@displayName = contactData[0]
@compName = contactData[1]
@lastName = contactData[2]
@middleName = contactData[3]
@firstName = contactData[4]
@street = contactData[5]
@city = contactData[6]
@state = contactData[7]
@zip = contactData[8]
@comments = contactData[9]
@custNum = contactData[10]
@birthday = contactData[11]
@anniversary = contactData[12]
@spouseName = contactData[13]
@homeCity = contactData[14]
@homeZip = contactData[15]
@homeState = contactData[16]
@homeStreet = contactData[17]
@homeFax = contactData[18]
@homePhone = contactData[19]
@busFax = contactData[20]
@busPhone = contactData[21]
@cellPhone = contactData[22]
puts "Contact data:\n"
puts "-------------\n"
puts "Full Name: #{@displayName}\n"
puts "Street: #{@street}\n"
puts "City: #{@city}\n"
puts "State: #{@state}\n"
puts "ZIP: #{@zip}\n"
puts "Home Phone: #{@homePhone}\n"
puts "Bus. Phone: #{@busPhone}\n"
puts "Cell Phone: #{@cellPhone}\n"
puts "-------------------------\n"
puts "Comments: #{@comments}\n"
end
sleep 1
end
end
}
------------------------
So when the loop detects an incoming phone call I throw an XMLRPC call
out and get the CRM data back.