Solved

SMS Application CMS Error:500

Posted on 2004-04-07
23
2,272 Views
Last Modified: 2007-12-19
Hello Configuring Siemens SL45i Modem i am trying to send sms from Hyperterminal. i am sending these AT Commands.
AT                                                [i press enter]
OK                                                [Results OK]
AT+CSCA="+0092300000042"        [I Enter SMS Center No.]
OK                                                [Resuls OK]
AT+CMGS="+923006660933"          [I enter where to send sms]
+CMS ERROR: 500                         [Resuls Error]  

i am getting this error when try to send sms message. can someone tell me the solution please.
0
Comment
Question by:zahidrahim
  • 12
  • 11
23 Comments
 
LVL 1

Author Comment

by:zahidrahim
Comment Utility
Note: I have changed the sms center no and mobile no in diffrent formates but again getting these error like
sms center:"+92300000042"
mob number:"+923006624925"
mob number: "3006624925"

or can some one tell me the location from where i can download excat and easy vb code for this sms application
0
 
LVL 4

Expert Comment

by:SimonTay
Comment Utility
Your request is my command! (although your modem may not support the automatic switch on and off)

Timer is set for 50mS interval.

'Demo program will switch a modem on (using DTR), send a message and switch the modem off.
'Message sent demonstrates sending the "@" character - sent as a NULL character

Dim MS50 As Integer
Dim ModemLine As String
Public Function SendCommand(outcomm$, waittime, waitfor$, waiterror$) As Integer
 Dim untiltime, intext$
 Debug.Print outcomm$, waittime;
 dummy = DoEvents()
 SendCommand = False
 If outcomm$ > "" Then
  Comm1.InBufferCount = 0    'clear buffer only if we are sending a command
 End If
 Comm1.Output = outcomm$
 Delay (0)
 untiltime = MS50 + waittime * 20
 Do While MS50 < untiltime
  DoEvents
  If Comm1.InBufferCount Then
   intext$ = intext$ + Comm1.Input
   ModemLine = intext$      'Allows us to see modem responses
   If waiterror$ > "" Then
    If InStr(intext, waiterror$) Then
     SendCommand = False
     Debug.Print "error!"
     Exit Function
    End If
   End If
   If InStr(intext$, waitfor$) Then
    Debug.Print "found!"
    SendCommand = True
    Exit Function
   End If
  End If
 Loop
 Debug.Print "Fell out!"
End Function
Private Sub Form_Load()
 Comm1.PortOpen = True
 'wait for 5 seconds
 Delay (100)
 'check the modem is present
 If Not (SendCommand("AT" & Chr(13), 1, "OK", "ERROR")) Then Stop
 'select text mode
 If Not (SendCommand("AT+CMGF=1" & Chr(13), 1, "OK", "ERROR")) Then Stop
 'select number to send message to
 If Not (SendCommand("AT+CMGS=0779912345678" & Chr(13), 1, ">", "ERROR")) Then Stop
 'send message
 If Not (SendCommand("SMS message goes here." & Chr(26), 10, "OK", "ERROR")) Then Stop
'switch modem off
 If Not (SendCommand("AT^SMSO" & Chr(13), 1, "OK", "ERROR")) Then Stop
 Comm1.PortOpen = False
End Sub
Private Sub Timer_Timer()   'timer is a timer set to 50mS interval
 MS50 = MS50 + 1
 If MS50 > 30000 Then MS50 = 0   'avoid overflows when idle
End Sub
Private Sub Delay(DelayTime As Double)
 MS50 = 0
 Do While MS50 < DelayTime
  DoEvents
 Loop
End Sub

Simon

www.tdc.co.uk
0
 
LVL 1

Author Comment

by:zahidrahim
Comment Utility
Hello simonTay, Before this i check this AT Command
AT+CMGF=?
+CMGF: (0)
i think this means that my mob support only PDU mode not Text Mode, can you please tell me more about this and how to convert my message commands to PDU modes. waiting for reply,
             
0
 
LVL 1

Author Comment

by:zahidrahim
Comment Utility
hey, i increased the points and i will increase more if problem solved, just help me in making my string for PDU Mode, i am unable to convert my phone number to PDU mode waiting for reply very badly
0
 
LVL 4

Expert Comment

by:SimonTay
Comment Utility
You need to get the ETSI specs for PDU really, it is quite complex.

A piece of software you can download is PDUSpy which is quite handy, some VB code which generates PDU formats is below.

Yes your hardware only supports PDU.

Public Function EncodeOutgoingSMS(PDUType As Integer, Number As String, Message As String, PDUInternational As Integer) As String
 Dim i As Integer
 EncodeOutgoingSMS = ""
 If PDUType = A1C Then EncodeOutgoingSMS = EncodeOutgoingSMS & ASCIIHex(&H0) 'TP-MTI etc
 If PDUType = M1C Then EncodeOutgoingSMS = EncodeOutgoingSMS & ASCIIHex(&H1)   'PDU type
 If PDUType = A1C Then EncodeOutgoingSMS = EncodeOutgoingSMS & ASCIIHex(&H11)   'PDU type
 EncodeOutgoingSMS = EncodeOutgoingSMS & ASCIIHex(&H0)        'increment each time TP-MR message reference, the M1 does this for you
 EncodeOutgoingSMS = EncodeOutgoingSMS & ASCIIHex(Len(Number))     'length of destination address
 If PDUInternational Then
  EncodeOutgoingSMS = EncodeOutgoingSMS & ASCIIHex(&H91)      'International number and national numbering plan
 Else
  EncodeOutgoingSMS = EncodeOutgoingSMS & ASCIIHex(&H81)      'National numbering plan
 End If
 For i = 1 To Len(Number) / 2
  EncodeOutgoingSMS = EncodeOutgoingSMS & Mid(Number, i * 2, 1) & Mid(Number, i * 2 - 1, 1)
 Next i
 If Len(Number) / 2 <> Int(Len(Number) / 2) Then EncodeOutgoingSMS = EncodeOutgoingSMS & "F" & Mid(Number, i * 2 - 1, 1)
 EncodeOutgoingSMS = EncodeOutgoingSMS & ASCIIHex(&H0)        ' TP-PID
 EncodeOutgoingSMS = EncodeOutgoingSMS & ASCIIHex(&H0)          'TP-DCS
 If PDUType = A1C Then EncodeOutgoingSMS = EncodeOutgoingSMS & ASCIIHex(&HAA)      'TP-VDF
EncodeOutgoingSMS = EncodeOutgoingSMS & ASCIIHex(Len(Message))
 EncodeOutgoingSMS = EncodeOutgoingSMS & MessageEncode(Message)
End Function
Private Function MessageEncode(InMsg As String) As String
 Dim i As Integer, Byterev As Integer, Bits As Integer, Eightbit As Integer
 Dim Msg As String
 For i = 1 To Len(InMsg)
  Byterev = Byterev * 128       'shift left 7 bits
  Byterev = Byterev + Rev(Asc(Mid(InMsg, i, 1)), 7)
  Bits = Bits + 7
  While Bits >= 8
   Eightbit = Int(Byterev / 2 ^ (Bits - 8))
   Byterev = Byterev - Eightbit * 2 ^ (Bits - 8)
   Bits = Bits - 8
   Msg = Msg & ASCIIHex(Rev(Eightbit, 8))
  Wend
 Next i
 If Bits > 0 Then
  Byterev = Byterev * 128       'shift left 7 bits
  Bits = Bits + 7
  Eightbit = Int(Byterev / 2 ^ (Bits - 8))
  Msg = Msg & ASCIIHex(Rev(Eightbit, 8))
 End If
 MessageEncode = Msg
End Function
Function Rev(Byted As Integer, B As Integer) As Integer
 Dim j As Integer, Value As Integer
 For j = 0 To B - 1
  If Byted And 2 ^ j Then Value = Value + 2 ^ (B - 1 - j)
 Next j
 Rev = Value
End Function
Private Function ASCIIHex(Value) As String
 ASCIIHex = Right("0" & Hex$(Value), 2)
End Function
0
 
LVL 1

Author Comment

by:zahidrahim
Comment Utility
Hello SimonTay,
                     After changing sim card which has credit i send command
AT+CMGS=23
>0001000B812903606690F300000BD3E614D42CCFE7E17319
+cmgs:102
ok
again sending
AT+CMGS=23
>0001000B812903606690F300000BD3E614D42CCFE7E17319
+cmgs:103
ok

but on phone 923006660933 no message received? what can be the problem now?
0
 
LVL 1

Author Comment

by:zahidrahim
Comment Utility
Hello SimonTay,
                      Can you Recheck the mob number in the string may be messages are going some other phone number beacuse i am getting OK with
at+cmgs=23
>0001000B812903606690F300000BD3E614D42CCFE7E17319
+CMGS:105
ok
increased value everytime i am waiting for your responses please help me in completing this issue.
0
 
LVL 4

Expert Comment

by:SimonTay
Comment Utility
0001000A81036026945200000BD3E614D42CCFE7E17319 - without 92 on the number,

0001000C8129036026945200000BD3E614D42CCFE7E17319 with 92 on the number.

Simon
0
 
LVL 4

Expert Comment

by:SimonTay
Comment Utility
Or try this, the SMSC is contained in the PDU :

07912903000040F201000A81036026945200000BD3E614D42CCFE7E17319 (without 92)

07912903000040F201000C8129036026945200000BD3E614D42CCFE7E17319 (with 92)
0
 
LVL 1

Author Comment

by:zahidrahim
Comment Utility
Hey,
     i face Error when send string without 92 but OK with CMGS and a incremented number when i use with 92. the problem is no message i am receiving on this number. what can be the reasons?
and tell me the how can i get PDU from PDUSPY
In Create PDU
destination: International Number
Destination Adress: 923006660933
Enter Message Text: Test Message
and use the default setting press create but i am getting diffrent result than yours.
0
 
LVL 4

Expert Comment

by:SimonTay
Comment Utility
Maybe you have entered a different SMSC?
0
Free camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

 
LVL 1

Author Comment

by:zahidrahim
Comment Utility
Can you tell me the complete settings of PDUspy which are necessary . and u get any idea why i am not getting message on the other mob when ok message i received from here.
0
 
LVL 4

Expert Comment

by:SimonTay
Comment Utility
079194712272303301000C8129036026945200000BD3E614D42CCFE7E17319

=

PDU LENGTH IS 31 BYTES
ADDRESS OF DELIVERING SMSC
      NUMBER IS :      +491722270333
      TYPE OF NR. :      (0x10) International
      NPI :      (0x01) ISDN/Telephone (E.164/163)

MESSAGE HEADER FLAGS      (0x01)
      MESSAGE TYPE :      SMS SUBMIT
      REJECT DUPLICATES :      NO
      VALIDITY PERIOD :      NOT PRESENT
      REPLY PATH :      NO
      USER DATA HEADER :      NO UDH
      REQ. STATUS REPORT :      NO
      MSG REFERENCE NR. :      0 (0x00)

RECIPIENTS ADDRESS
      NUMBER IS :      923006624925
      TYPE OF NR. :      (0x00) Unknown
      NPI :      (0x01) ISDN/Telephone (E.164/163)

PROTOCOL IDENTIFIER      (0x00)
      MESSAGE ENTITIES :      SME-to-SME
      PROTOCOL USED :      Implicit / SC-specific

DATA CODING SCHEME      (0x00)
      COMPRESSION :      OFF
      MESSAGE CLASS :      NONE
      ALPHABET USED :      7bit default

VALIDITY OF MESSAGE :      NONE GIVEN

USER DATA PART OF SM
      USER DATA LENGTH :      11 septets
      USER DATA (TEXT) :      SMS Message

Hope this explains it - see the Decode tab on PDU Spy.
0
 
LVL 4

Accepted Solution

by:
SimonTay earned 150 total points
Comment Utility
Also try using PDUSpy to send the message.
0
 
LVL 1

Author Comment

by:zahidrahim
Comment Utility
what do u say should not i use SMSC of my own telecom company as i am using Mobilink they are giving me smsc 92300000042
and it is giving me error of
CMS:Error 38 what does it mean?
0
 
LVL 4

Expert Comment

by:SimonTay
Comment Utility
If the SMSC is already set up on the SIM, you should be OK.  Put the sim into a phone and try sending one manually from there.  If it does not work, then you have some other network problem.
0
 
LVL 4

Expert Comment

by:SimonTay
Comment Utility
CMS Error 38 is "Network out of order" ...
0
 
LVL 1

Author Comment

by:zahidrahim
Comment Utility
Hi SimonTay,
                 Thanx a lot SMS sent successfully but one problem from PDUSpy only [SMS Message] this text is going , if i change this text Error message appear and no sms is going. what can be the problem with the sms message. :|
0
 
LVL 1

Author Comment

by:zahidrahim
Comment Utility
Hi, simon i have been working in Hyper Terminal so far now i want it in Visual Basic i am using Communication Control. and set following properties but nothing happening.
Private Sub Form_Load()
      MSComm1.CommPort = 1 ' Com Port 1
      MSComm1.PortOpen = True
      MSComm1.Settings = "19200,N,8,1"
end sub

and in button click event
MSComm1.Output = "AT" & Chr(13)

and
Private Sub MSComm1_OnComm()
     MsgBox MSComm1.Input
End Sub
and no msg box appear means communication problem can u tell me communication control parameters like
InBufferSize,OutBufferSize,RThreshold,SThreshold,InputLen,EofEnable,ParityReplace,NullDiscrd,RTSEnable,DTREnable, and Handshaking type things.

0
 
LVL 1

Author Comment

by:zahidrahim
Comment Utility
Hi,
   why are u not replying when my application is on ending stage. SMS Message problem solved too it was length problem , just tell me about the Visual Basic comm control setting or any URL from where i can get these settings or ready  made application, and tell me how much points should i award u as u did a lot for me, waiting for reply very badly , Zahid
0
 
LVL 4

Expert Comment

by:SimonTay
Comment Utility
Default settings should be OK, just check if your modem needs handshaking this could be the problem.  DTREnable should be on, RTSEnable off.
0
 
LVL 1

Author Comment

by:zahidrahim
Comment Utility
Thanx a lot Simon,Well now i am working on Samsung T-100, can you tell me it has built in modem or tell me some url or resources from where the mobile phone can be checked, they can use as GSM Modem or not. if you have any furthur information about this phone that how to send sms using this phone i will reask this question and decide points. waiting for reply,
                                                                     Zahid
                         
0
 
LVL 4

Expert Comment

by:SimonTay
Comment Utility
I don't know anything about the Samsumg modem, but to check you program is outputting data, try connecting it using a null modem cable to another PC or serial port running hyperterminal.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Join & Write a Comment

This article is a step by step guide on how to create a basic PTP link using Ubiquiti airOS devices. This guide can be used on the following Ubiquiti AirMAX devices. Nanostation, Bullets, AirBridge, Nanobeam, NanoBridge to name a few. Please review …
Working settings for French ISP Orange "Prêt à Surfer" SIM cards for data connections only. Can't be found anywhere else !
This Micro Tutorial will show you how to maximize your wireless card to its maximum capability. This will be demonstrated using Intel(R) Centrino(R) Wireless-N 2230 wireless card on Windows 8 operating system.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now