<% @ Language=VBScript LCID=1036%> <% PageName = "Pull-Push.asp" %> <% If Request("GotMO").Count > 0 Then MsgId = Trim(Request("MsgId")) SOA = Trim(Request("SOA")) DA = Trim(Request("DA")) myContent = Trim(Replace(Request("Content"), "'", "")) 'MG_URL comes from DSN.asp MG_UserName = "*****" MG_Password = "*******" myResponse = "No keyword found. Please try again." FoundFlag_Keyword=0 myContent = Replace(myContent, " ", "") myNow = Year(Now()) & "-" & Month(Now()) & "-" & Day(Now()) & " " _ & Hour(Now()) & ":" & Minute(Now()) & ":" & Second(Now()) ' Find first and top priority if keywords MATCHES with sms mo If FoundFlag_Keyword=0 Then Sql = "Select * From VAS_PullPush " _ & " Where ShortNumber='" & DA _ & "' and UPPER(Replace(Keyword, ' ', ''))=UPPER('" & Cstr(myContent) & "') " _ & " and TimeValidity>=Convert(DateTime, '" & myNow & "', 120)" 'Response.Write Sql Set Rs = Conn.Execute(Sql) Do Until Rs.EOF FoundFlag_Keyword = 1 myResponse = Rs.Fields("SMSResponse") Rs.MoveNext Loop End If ' Find all Keyword for this short number of database matching anywhere in SMS MO If FoundFlag_Keyword=0 Then Sql = "Select * From VAS_PullPush Where ShortNumber='" & DA _ & "' and Keyword<>'' and Keyword is not NULL " _ & " and TimeValidity>=Convert(DateTime, '" & myNow & "', 120) order by Keyword Desc" 'Response.Write Sql Set Rs = Conn.Execute(Sql) Do Until Rs.EOF DBKeyword = Rs.Fields("Keyword") DBKeyword = UCase(Replace(DBKeyword, " ", "")) If InStr(CStr(UCase(myContent)), CStr(DBKeyword)) >= 1 Then FoundFlag_Keyword = 1 myResponse = Rs.Fields("SMSResponse") End If Rs.MoveNext Loop End If ' Find default message in case NO KEYWORD found for this sms mo If FoundFlag_Keyword=0 Then Sql = "Select * From VAS_PullPush " _ & " Where ShortNumber='" & DA & "' and (Keyword='' or Keyword is NULL) " _ & " and TimeValidity>=Convert(DateTime, '" & myNow & "', 120)" 'Response.Write Sql Set Rs = Conn.Execute(Sql) Do Until Rs.EOF FoundFlag_Keyword = 1 myResponse = Rs.Fields("SMSResponse") Rs.MoveNext Loop End If ' Sending back response accordingly to Messaging Manager myFwdURL = MG_URL & "UserName=" & MG_UserName & "&Password=" & MG_Password _ & "&Flags=1&DA=" & SOA & "&SOA=" & DA & "&Headers=msgidMO=" & MsgId _ & "&Content=" & myResponse 'Response.Write myFwdURL Response.Redirect(myFwdURL) End if %>