Copy link to clipboard
Copied
At my workplace we have a trixbox phone system which has a module installed called CallerID lookup sources. We also have our CRM system which I
wrote in coldfusion.
The callerid module lets you set a lookup source as a webpage sending the telephone number using the GET method as shown below:
http://cfserver/cidlookup.cfm?cid=[number]
What I need to do is fill cidlookup.cfm with code that looks up the telephone no. in our database and then returns it, i believe on the Request-URI header?
I've plenty of CF experience but never really used the HTTP GET command (normally just use POST).
Can someone point me in the right direction as there is little or no documentation on this on internet searches/forums etc.
Copy link to clipboard
Copied
The page could just get the (one) telephone number from the database and display it. Something like
<cfparam default="0" name="url.cid" type="integer">
<cfquery datasource="myDSN" name="getTelNo">
select telephoneNumber
from customer
where callerID = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.cid#">
</cfquery>
<cfif url.cid eq 0 or getTelNo.recordCount eq 0>
Bad caller ID.
<cfelse>
Telephone number: <cfoutput>#getTelNo.telephoneNumber#</cfoutput>
</cfif>
Copy link to clipboard
Copied
Just to add to BKBK's reply. I would not allow the zero url.cid thru my cfquery. You can then use boolean to check the recordcoun. e.g.
<cfif getTelNo.recordCount>
ok
<cfelse>
not ok
</cfif>
..assuming the CallerID field is an indexed.