The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

RE: xQL Metoer SQL


  • Subject: RE: xQL Metoer SQL
  • From: "Neil Frost" <neil@xxxxxxxxxxxxx>
  • Date: Mon, 28 Feb 2005 20:03:44 -0000


OK,



Changed the script, renamed the table and



IT WORKS!!!! YAY!!!



If you're interested, here's the script. I've taken a lot out such as
the OSD bits, also deleted a couple of columns from the table, namely
friendly and answered not too bothered about the answered bit but easy
enough to put it back again. As for the friendly... I'm going to let SQL
do the lookups when required. The OSD can be done with determinators now
that the globals change.



Anyway here's my new script. If it looks naf you can view it here:
www.plugandpray.biz/meteourscript.html



Cheers

Neil



' source script for JOHNB-METEOR.LINE1

Sub JOHNB_METEOR_LINE1_Trigger(xPLMessage)



select case ucase(xpl.getparam(xplmessage,"CallType",true))

case "INBOUND"

select case ucase(xpl.getparam(xplmessage,"CCS",true))

case "CID"

sys.value("Call_Start") = cstr(NOW())

sys.value("Call_Type") = "I"



phoneno=xpl.getparam(xplmessage,"Phone",true)



if xpl.getparam(xplmessage,"RNN",true)<>"" then

if xpl.getparam(xplmessage,"CLN",true)<>"" then

sys.value("Call_ID") =
xpl.getparam(xplmessage,"CLN",true) & chr(10)

else

sys.value("Call_ID") =
xpl.getparam(xplmessage,"RNN",true) & chr(10)

end if

else

sys.value("Call_ID") = phoneno

end if



case "NOCID"



case "RING"



case "DIGIT"



case "ANSWERED"

sys.value("Call_Answered") = cstr(NOW())



case "COMPLETE"

sys.value("Call_Complete") = cstr(NOW())



call write_sql()



end select



case "OUTBOUND"

select case ucase(xpl.getparam(xplmessage,"CCS",true))

case "INITIATED"

sys.value("LINE1_NUMBER")="x"

sys.value("Call_Start") = cstr(NOW())

sys.value("Call_Type") = "O"



case "DIGIT"

if sys.value("LINE1_NUMBER")<>"" then

' still dialling

cd=xpl.getparam(xplmessage,"CD",true)

if isnumeric(cd)=false then

' must be complete if non numeric

sys.value("LINE1_NUMBER")=""

exit sub

end if


sys.value("LINE1_NUMBER")=sys.value("LINE1_NUMBER")
& cd


sys.value("Call_ID")=mid(sys.value("LINE1_NUMBER"),2)

end if



case "TERMINATED"

strmsg="Command=CLOSE"+chr(10)

strmsg=strmsg+"SQLID=1"

call
xpl.sendmsg("","TONYT-XQL.MASTER","DB.XQL",strmsg)



case "COMPLETE"

sys.value("Call_Complete") = cstr(NOW())



call write_sql()



end select



end select



End Sub



Sub write_sql()



strmsg="Command=OPEN" & chr(10)

strmsg=strmsg & "SQLID=1" & chr(10)

strmsg=strmsg & "SQL=SELECT * FROM TelephoneCalls" &
chr(10)

call
xpl.sendmsg("","TONYT-XQL.MASTER","DB.XQL",strmsg)



strmsg="Command=ADD" & chr(10)

strmsg=strmsg & "SQLID=1" & chr(10)

strmsg=strmsg & "Type=" &
sys.value("Call_Type") &
chr(10)

strmsg=strmsg & "CALL=" &
sys.value("Call_Start") &
chr(10)

strmsg=strmsg & "CID=" & sys.value("Call_ID")
&
chr(10)

strmsg=strmsg & "COMPLETE=" &
sys.value("Call_Complete") & chr(10)

call
xpl.sendmsg("","TONYT-XQL.MASTER","DB.XQL",strmsg)

end sub





[Non-text portions of this message have been removed]



xPL Links: http://www.xplproject.org.uk http://www.xplhal.com http://www.xpl.myby.co.uk
To Post a Message: ukha_xpl@xxxxxxx
To Subscribe:  ukha_xpl-subscribe@xxxxxxx
To Unsubscribe:  ukha_xpl-unsubscribe@xxxxxxx

xPL Main Index | xPL Thread Index | xPL Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.