Salam

I think you need some thing like this page bellow to rout the received SMS to 
special location.


<%@ Language=VBScript %>

<!--#include virtual="/adovbs.inc"-->
<%

Dim MyDBconn
Dim cn, rs

Dim M 'End User Message
Dim G 'Users mobile number
Dim I 'Operator ID
Dim S 'Operator short code
Dim L 'Language, L=L for English, L=A for Aranic
Dim Encoding 'SMS Message Encoding
Dim MyAutoID, strSQL
Dim TRCHAT_TRX

TRCHAT_TRX = False
M = Request("sms")
G = Request("msisdn")
I = Request("sc")
S = Request("sc")
L = Request("enc")
If G = "" Or I = "" Or S = "" Or L = "" Then
 response.End
Else
 G=Replace(G,"+","")
 MyDBconn="Provider=SQLOLEDB.1;User ID=username;Pwd=password;Initial 
Catalog=DBNAME;Data Source=xxx.xxx.xxx.xxx"

 set cn = CreateObject("ADODB.Connection")
 cn.open MyDBconn

 Select Case L
  Case "ISO-8859-1" 'English Language
   Encoding = 0
  Case "UTF-16BE" 'Arabic Language
   Encoding = 2
    'M = myArabicDecoder(CStr(M))
    Set myXMLobj = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
    myXMLobj.Open "GET", "http://127.0.0.1:9999/ucs2n.aspx?"; & 
Request.ServerVariables("QUERY_STRING"), False
    myXMLobj.send
    M = myXMLobj.responseText
  Case Else 'Other
   Encoding = 1
 End Select

 M=Replace(M,"'","")
 If mid(G,1,3) = "345" And I = "6419" Then
  'save to  DB1

  MyDBconn="Provider=SQLOLEDB.1;User ID=US1;Pwd=PW1;Initial Catalog=DB1;Data 
Source=xxx.xxx.xxx.xxx"
 End If

 If mid(G,1,3) = "456" And I = "6418" Then
  'Save to DB2
  MyDBconn="Provider=SQLOLEDB.1;User ID=US2;Pwd=PW2;Initial Catalog=DB1;Data 
Source=xxx.xxx.xxx.xxx"
 End If
'save to DB1
If mid(G,1,3) = "345" And I = "4353" Then
  'Save to DB3
  MyDBconn="Provider=SQLOLEDB.1;User ID=US3;Pwd=PW3;Initial Catalog=DB3;Data 
Source=xxx.xxx.xxx.xxx"

End If

 strSQL = "Insert into sms_inbox 
(smscdate,smsdate,msisdn,shortcode,smstext,smsmode,flag,operatorid) values(" _
    & "getdate()," _
    & "getdate()," _
    & "'" & G & "'," _
    & "'" & S & "'," _
    & "N'" & M & "'," _
    & "'" & Encoding & "'," _
    & "'R'," _
    & I & ")"
 
 'Response.Write strSQL
 'Response.End

 MyAutoID = ExecuteID(strSQL,MyDBconn)
 'Response.Write MyAutoID
 strSQL = "Insert into sms_trx 
(recid,smscdate,smsdate,msisdn,shortcode,smstext,smsmode,flag,operatorid) 
values(" _
    & MyAutoID & "," _
    & "getdate()," _
    & "getdate()," _
    & "'" & G & "'," _
    & "'" & S & "'," _
    & "N'" & M & "'," _
    & "'" & Encoding & "'," _
    & "'P'," _
    & I & ")"
 'Response.Write strSQL
 cn.execute(strSQL)

 Set cn=Nothing
 Response.Write(MyAutoID)
End If

Function ExecuteID(SQL, DBCon)

 Dim cn, rs
    Dim AutoID

 Set cn = CreateObject("ADODB.Connection")
    Set rs = CreateObject("ADODB.Recordset")
    
 With rs
'Prepare the RecordSet
        .CursorLocation = adUseServer
        .CursorType = adOpenForwardOnly
        .LockType = adLockReadOnly
        .Source = "SELECT @@IDENTITY"
    End With

    With cn
            .ConnectionString = DBCon
            .CursorLocation = adUseServer
            .Open
            .BeginTrans
            .Execute SQL, , adCmdText + adExecuteNoRecords
        With rs
                .ActiveConnection = cn
                .Open , , , , adCmdText
                AutoID = rs(0).Value
                .Close
            End With
            .CommitTrans
            .Close
        End With
        Set rs = Nothing
        Set cn = Nothing
'If we get here ALL was Okay
        ExecuteID = AutoID
End Function

Function myArabicDecoder(text)
    On Error Resume Next
    Dim var2, var1, i
    For i = 0 To ((Len(text) / 4) - 1)
        var1 = "&H" & Mid(text, i * 4 + 1, 4)
        var2 = var2 & ChrW(var1)
    Next
    myArabicDecoder = var2
End Function

Function myArabicDecoder2(text)
    On Error Resume Next
    Dim var2, var1, i
    For i = 0 To ((Len(text) / 2) - 1)
  fpart = AscW(Mid(text, i * 2 + 1, 1))
  lpart = AscW(Mid(text, i * 2 + 2, 1))
  If Len(CStr(fpart)) < 2 Then fpart = "0" & CStr(fpart)
  If Len(CStr(lpart)) < 2 Then lpart = "0" & CStr(lpart)
        var1 = "&H" & fpart & lpart
        var2 = var2 & chrW(var1)
    Next
    myArabicDecoder = var2
End Function

%>
........................................................... 
Best Regards 
Eng: Abdulraheem Ali Obaisi 
Software Engineer 



 
> Date: Wed, 20 May 2009 12:07:59 +0600
> From: [email protected]
> To: [email protected]
> Subject: Re: shortcode routing
> CC: [email protected]
> 
> I think you mistook my concept.... I want to route the messages on the 
> short code basis.... I have an idea of get-url, but all I want is to 
> route messages from 515 to one application and 153 to another....
> 
> 
> 
> Arne K. Haaje wrote:
> > Ishtiaq Ahmed wrote:
> >> hi Fellows,
> >>
> >> I have multiple shortcodes from multiple carriers i.e. 6561, 515, 
> >> 153 etc. Now what I want to do is to route the messages coming from 
> >> 515 to specific application and 153 to another.... Kindly help in 
> >> configuration option we have...
> >>
> > You could have one processing application that selects the correct 
> > service application based on shortnumber;
> >
> > something like;
> >
> > get-url="http://my.host.com/sms.php?message=%a&msisdn=%p&shortnumber=%P";
> >
> >
> > Regards,
> >
> > Arne
> >
> >
> 
> 

_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

Reply via email to