Link to home
Start Free TrialLog in
Avatar of j_jpg
j_jpg

asked on

SMS in PDU Mode

Hello, I'm developing a program to send SMS through a mobile phone (Siemens C45), this phone doesn't support Text Mode so I have to use PDU Mode. I send this string to the phone:

    'SCA
    sCadena = sCadena & "00"
   
    'PDU Type
    sCadena = sCadena & "11"
   
    'Message Reference
    sCadena = sCadena & "00"
   
    'Destination Phone
    sCadena = sCadena & "07" & "81" & "56177465F5"
   
    'Protocol Identifier
    sCadena = sCadena & "00"
   
    'Data Coding Scheme
    sCadena = sCadena & "00"
   
    'Validity Period
    sCadena = sCadena & "AA"
   
    'Datos
    sCadena = sCadena & "04" & "C8273308"

I get the Error=500. Why?? There is some Routine to convert a SMS to PDU Mode?? Can anyone help me??

Thank you
Avatar of _nn_
_nn_

>  'Destination Phone
>    sCadena = sCadena & "07" & "81" & "56177465F5"

Prueba con
    sCadena = sCadena & "09" & "81" & "56177465F5"

The length field is wrong, should be the number of digits.
Avatar of j_jpg

ASKER

I try what you say and I get the same error, Error 500.

The operation complete is:

AT+CMGF=0
AT+CMGS=18
Port.Write sCadena
Port Write Chr(26)

AT+CMGS:ERROR 500

Do you have any idea more?

Thank you
ASKER CERTIFIED SOLUTION
Avatar of _nn_
_nn_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here's mine in RatScript :-

(* PDU Routines *)

function makeNumber(telNr string) as
var str string;
var i,j,leng numeric;
do
   (* assumes international + number *)
   if §telNr startswith '+' then let telNr be §telNr after '+'; fi;
   (* make up the actual encoding *)
   let leng be Length(§telNr);
   let str be stringToHex(Char(§leng)) & '91';
   for i from 1 to (§leng+1) div 2 do
      (* first character is the second *)
      let j be (§i-1)*2+2;
      if §j>§leng then
         call Append(§str,'F');
      else
         call Append(§str,§telNr[§j]);
      fi;
      (* second character is always the first *)
      let j be (§i-1)*2+1;
      call Append(§str,§telNr[§j]);
   od;
   return §str;
od;

function makeMessage(message string; validity string) as
var mymess string;
do
   if §charset='8859-1' then
      (* encode in 8-bit *)
      let mymess be toansi(§message);
      if Length(§mymess)>140 then
         call Throw('5568: Message too long ' & Length(§mymess));
      fi;
      return '04' & §validity & stringToHex(Char(length(§mymess)) & §mymess);
   else
      (* default GSM 7 bit *)
      let mymess be togsm7(§message);
      if Length(§mymess)>140 then
         call Throw('5568: Message too long ' & Length(§mymess));
      fi;
      return '00' & §validity & stringToHex(Char(length(§mymess)) & gsmPack(§mymess));
   fi;
od;

function makePDU(telNr,message string; var leng numeric) as
var pdu string;
do
   (* make up a hex string for the pdu *)
   let pdu be '001100' & makeNumber(§telNr) &
              '00'  & makeMessage(§message,'AA');
   (* return in leng the number of REAL bytes *)
   (* the first zero byte does not count *)
   let leng be (Length(§pdu) div 2)-1;
   return §pdu;
od;

Notes
togsm() converts to 7-bit chars (one per byte)
gsmPack() converts 7-bit chars (one per byte) to packed format
numeric is a generic type for integer types and reals
Avatar of j_jpg

ASKER

Thank you to all!!

Both answers are good, it's work well.

PD: Do you know some manual where explain well the pdu structure??
ETSI standards 03.38, 03.40 and 07.05 describe it.  It is a PITA, but the information is there.  I wrote PDU in VB many years ago from these documents, converting text to PDU.

Most GSM modems now support AT+CMGF=1, so the code's not so relevant now unless you want to send binary data!

Simon

www.tdc.co.uk
Hi All,
   I use Siemens TC35 GSM Module. I have to use this as an modem to dial up an ISP, then connect to an Internet connection & then transmit data to an particular website. These datas are then manipulated using the IIS server.
   Now tell me, How to I dialup an ISP & provide the Username & password & rest other acknowledgements.
   Also is that possible of sending the direct data calls to an other GSM Module & read the datas from them, If so How to do the data calls & how to recive them.
   If using the GPRS can we directly connect to the website(IP address), as soon as the GPRS mopdule is switched ON. If so what are the steps to do so??
   Pls help me with the source code available or with the Hints or steps to be done.
   Its very urgent so pls help me out.
 
Thanks in advance.
You can contact me at my mail ID somu@softcrylic.com
 
Regards,
somasundaram.J
somu@softcrylic.com
Hi All,
       well i am using SIEMENS SL45i it is also support only PDU mode i am facing problem the conversion of destination number to PDU mode can some one tell me the exact method to convert or any resource, or can some one tell me the excat string of AT+CMGS if the mob number where i wanna send sms is
+923006660933
+92 is our country code (Pakistan)
300 is mobilink code which is 0300
6660933 is the destination mob number.
0001000B812903606690F300000BD3E614D42CCFE7E17319

is a PDU, message is "SMS Message" - created using PDUSpy.

Simon

www.tdc.co.uk
Hi SimonTay,
What will be the number for AT+CMGS=?? in case of my string
i am entered only
at+cmgs=23
>0001000B812903606690F300000BD3E614D42CCFE7E17319
+CMS ERROR: 21

and one more thing the balance in my SIM card is Zero ;) will it cause any problem or i should charge it at first.
Waiting for furthur assistance very badly,
Zahid
I think it's 24 - er, if there's no credit on your SIM, you can't send an SMS!

These questions should really be asked on a new question, this one is closed.
One More thing from where can i get this PDUSPY in English language and is there any help to use it?
try typing pduspy into google!
i will award as many points as u will say with a new question just don't worry about it.
USING AT+CMGS=24 CAUSE SIMPLE ERROR BUT WITH
AT+CMGS=23 CAUSE   +CMS ERROR: 21
NOW WHAT CAN BE  THE PROBLEM? :(