SMS Port number

Hi All,

This is only applicable here as the modem being used is a Wavecom 1306B…it’s not strictly a OpenAT issue.

A friend of a friend is trying to receive and deliver info to mobile handsets via SMS. It appears that they are using either Java J2ME or Java MIDP to do this - at least from the phone end. Anyway, to send a SMS using the Java SMS API, what appears to be an URL is created - along the lines of “sms://destphoneno:portno”, then the data is sent once the connection is opened. On the server end, my contact is using a 1306B and having problems sending SMS’s via the Java API.

My Question: What is this port number? is it part of the SMS standard, or is it a Java enhancement to the SMS system?

I’ve looked through a couple of Java SMS examples on the web (and I’m not a proficient Java programmer by any means, although I can work my way around it), and it appears that there is a mechanism similar to a webserver (i.e. listens on a range of ports) in the Java engine embedded in the phone. It looks like the programmer can attach an applet to a “port” on the phone and manage data sent via SMS without the data ending up in the conventional text message UI.

I’ve looked through the SMS AT commands in the AT Commands Interface Guide, and can’t find anything that indicates a port number is required. In fact, all I can find is that there are two modes - text mode (160 x 7 bit chars) or PDU mode (140 x 8 bit (binary) characters).

Can anyone shed some light about this “port number” and maybe some comments on how it integrates into the “standard” SMS system as implemented by Wavecom?

All help gratefully appreciated.

ciao, Dave

Correct - it has nothging to do with Open-AT at all.

See: viewtopic.php?f=37&t=3259&p=12648&hilit=sms+port#p12648

Just found this: ozekisms.com/index.php?owpn=221

So it does look like this could be a useful feature to add to the ADL API…

Cross-ref: viewtopic.php?f=23&t=4253#p16914

You’ve got me interested now, so I did some more research…

Some stuff about the User Data Header (UDH): viewtopic.php?f=23&t=4253#p16914

My favourite site about the PDU format: dreamfabric.com/sms/
The first octet of the SMS-DELIVER PDU contains the TP-UDHI User data header indicator: This bit is set to 1 if the User Data field starts with a header dreamfabric.com/sms/deliver_fo.html
Similarly in the first octet of the SMS-SUBMIT PDU: dreamfabric.com/sms/submit_fo.html

The GSM Short Message Service is defined in GSM 03.40, “Technical realization of the Short Message Service (SMS)”
3gpp.org/ftp/Specs/html-info/0340.htm

Application Port Addressing is defined in sections 9.2.3.24.3 (8-bit) and 9.2.3.24.4 (16-bit)


PC-based tools for decoding SMS PDUs:

scampers.org/steve/sms/tools.htm
nobbi.com/pduspy.html

Hiya,

Thanks for the help - it’s much appreciated.

You have been busy - interesting, as I put SMS Port Number into Google and didn’t find ANY of the links that you found. I did find a lot referencing the Java J2ME standard though - it appears that the “sms://phone:port” construct is only applicable to J2ME, not standard Java as implemented on the PC.

I’ve passed on your info to my friend. Hopefully this will let them get the job finished (or maybe I’ll pick up some work :smiley: ).

Thanks again.
Dave

I think the key term was the “User Data Header” (UDH) - which I got from the post by wismo_coder

Hi there.

I will try to make my little contribution in this question :smiley:
Here is the my function to send SMS in PDU mode to specific port. The function works well, but optimization of the code is welcome :unamused:

  1. Your own specific port number you can fill in UDH part with 16-bit hex number mark with comment:
// J2ME port Number:	5000	 =  0x1388
  1. Characters that you can use in your UD Message are: “a…z”, “A…Z”, “.,:;!-/+*”, space, “0…9”. You can use other characters gsm 7-bit alphabet, but they require more several strings in code inside the function.
  2. Inside this func You have to use global variable SMS_Handle which you receive with adl_smsSubscribe func.
s8 		SendRawPDU_SMS ( 	ascii * Dst_Address,
   						        ascii * Ascii_Text)
{
    s8 		   smsSend_Handle;
    ascii 		telbuf[12];
    ascii		 buf[8];
    ascii 		out[200];
    ascii 		Phone[12];
    ascii		 len[2];
    u16         i, j;

    ascii		UDLBuf[1000];

    // DecToBin part variables
    float		del, d;
    double		div;

	wm_memset(telbuf, '\0', 12);
	wm_memset(out, '\0', 200);
	wm_memset(Phone, '\0', 12);
	wm_memset(len, '\0', 2);

	wm_strcat(Phone, Dst_Address);

	// SMSC FLAGS:		  0x00
	// SMSC ADDRESS:      NOT SPECIFIED (USED IN SIM)
	wm_strcat(out, "00");

	// MESSAGE FLAGS:     0x51
	// MESSAGE TYPE:      SmsSubmit
	// REJECT DUPLICATES: NO
	// VALIDITY PERIOD:   Relative
	// STATUS REPORT:     NO
	// USER DATA HEADER:  YES
	// REPLY PATH:        NO
	wm_strcat(out, "51");

	// MESSAGE REFERENCE:   0x00
	wm_strcat(out, "00");

	// DESTINATION ADDRESS TYPE:        0x91
	// TYPE OF NUMBER:    0x01 (International)
	// NUMBERING PLAN:    0x01 (ISDN/telephone)
	// CONVERT IT TO PDU MODE
	wm_strcat(out, "0B91");

	wm_strncat(telbuf, &Phone[2], 1);
	wm_strncat(telbuf, &Phone[1], 1);
	wm_strncat(telbuf, &Phone[4], 1);
	wm_strncat(telbuf, &Phone[3], 1);
	wm_strncat(telbuf, &Phone[6], 1);
	wm_strncat(telbuf, &Phone[5], 1);
	wm_strncat(telbuf, &Phone[8], 1);
	wm_strncat(telbuf, &Phone[7], 1);
	wm_strncat(telbuf, &Phone[10], 1);
	wm_strncat(telbuf, &Phone[9], 1);
	wm_strcat(telbuf, "F");
	wm_strncat(telbuf, &Phone[11], 1);
	wm_strcat(out, telbuf);

	// PROTOCOL ID:         0x00 (SME-to-SME protocol)
	wm_strcat(out, "00");

	// DATA CODING SCHEME:  0x00
	// CODING GROUP:        0x00 (General Coding)
	// COMPRESSED:          NO
	// CLASS SPECIFIED:   	NO
	// ALPHABET:          	0x00 (Default alphabet)
	// RESERVED:          	0x00
	wm_strcat(out, "00");

	// MESSAGE VALIDITY:    27d
	wm_strcat(out, "C1");

	// USER DATA LENGTH = UDH-LENGTH + UD-MESSAGE + 1
	wm_itohexa(len, (7+wm_strlen(Ascii_Text)+1),2);
	wm_strcat(out, len);

	// UDH LENGTH:          7
	// UDH:                 06050413880000
	// J2ME port Number:	5000	 =  0x1388
	wm_strcat(out, "06050413880000");

	// USER DATA MESSAGE
	wm_memset(UDLBuf, '\0', 1000);

	// REPRESENT MESSAGE IN 7-BIT GSM ALPHABET IN UDLBuf
	//  AFTER THIS WE HAVE TO
	for (i = 0; i < wm_strlen(Ascii_Text); ++i)
	{
				wm_memset(buf,'\0',8);

				ascii buf2[8];

				wm_memset(buf2, '\0', 8);

				if ( wm_isascii(Ascii_Text[i]) ) {
				j=0;
				d = 2.0;

				del = (u32)(Ascii_Text[i]);
				while ( d >= 1 )
					{
						d = abs ((u32)del / 2);
						div = del - (d * 2);
						del = d;
						wm_sprintf( &buf2[j], "%d", (u16)div );
						j++;
					}
	}	else	{
		// SPECIAL SYMBOLS CODE'S IN 7-BIT GSM-CODING DIFFER
		//    FROM GENERAL ASCII CODES AND WE HAVE TO
		//    REPRESENT THEM MANUALLY
					if ((char)(Ascii_Text[i]) == ' ') {
						wm_sprintf( buf2, "0000010");
					} else if ((char)(Ascii_Text[i]) == '.') {
						wm_sprintf( buf2, "0111010");
					} else if ((char)(Ascii_Text[i]) == ';') {
						wm_sprintf( buf2, "1101110");
					} else if ((char)(Ascii_Text[i]) == '!') {
						wm_sprintf( buf2, "1000010");
					} else if ((char)(Ascii_Text[i]) == ',') {
						wm_sprintf( buf2, "0011010");
					} else if ((char)(Ascii_Text[i]) == '-') {
						wm_sprintf( buf2, "1011010");
					} else if ((char)(Ascii_Text[i]) == '/') {
						wm_sprintf( buf2, "1111010");
					} else if ((char)(Ascii_Text[i]) == '+') {
						wm_sprintf( buf2, "1101010");
					} else if ((char)(Ascii_Text[i]) == '*') {
						wm_sprintf( buf2, "0101010");
					} else if ((char)(Ascii_Text[i]) == ':') {
						wm_sprintf( buf2, "0101110");
					} else if ((char)(Ascii_Text[i]) == '0') {
						wm_sprintf( buf2, "0000110");
					} else if ((char)(Ascii_Text[i]) == '1') {
						wm_sprintf( buf2, "1000110");
					} else if ((char)(Ascii_Text[i]) == '2') {
						wm_sprintf( buf2, "0100110");
					} else if ((char)(Ascii_Text[i]) == '3') {
						wm_sprintf( buf2, "1100110");
					} else if ((char)(Ascii_Text[i]) == '4') {
						wm_sprintf( buf2, "0010110");
					} else if ((char)(Ascii_Text[i]) == '5') {
						wm_sprintf( buf2, "1010110");
					} else if ((char)(Ascii_Text[i]) == '6') {
						wm_sprintf( buf2, "0110110");
					} else if ((char)(Ascii_Text[i]) == '7') {
						wm_sprintf( buf2, "1110110");
					} else if ((char)(Ascii_Text[i]) == '8') {
						wm_sprintf( buf2, "0001110");
					} else if ((char)(Ascii_Text[i]) == '9') {
						wm_sprintf( buf2, "1001110");
					}
				}
				wm_strncat(UDLBuf, buf2, wm_strlen(buf2));
	}

	// LAST BYTE (MEAN 8-BIT) WE HAVE TO FILL WITH '0'
	j = fmod(wm_strlen(UDLBuf),8);
	if ( (8-j) != 0 ){
		for (i = 1; i <= (8-j) ; ++i) {
			wm_strcat(UDLBuf,"0");
		}
	}

	i = j =0;

	// AND THEN BACK REPRESENT TO HEX NUMBERS
	//	FROM 8-BIT BINARY STRUCTURES
	for (i = 0; i < wm_strlen(UDLBuf)/8; ++i)
	{
		u32 m1, m2, sum;
		sum =0;

		for ( j = 0; j< 8; ++j)
		{
			m1 = m2 = 0;
			m1 = pow( 2, (j) );

			if ( (char)UDLBuf[ j + i*8 ] == '1' ) {
				m2 = 1;
			}  else	{
				m2 = 0;
				}

			sum = sum +  m1* m2;
		}
			ascii bufc[2];
			wm_memset(bufc, '\0', 2);
			wm_itohexa(bufc, (sum),2);
			wm_strncat(out, bufc, wm_strlen(len));
	}

    smsSend_Handle = adl_smsSend ( SMS_Handle, NULL, out, ADL_SMS_MODE_PDU);

    return smsSend_Handle;
}
  1. Dst_Address is TP-DA phone number in International format +XXXXXXXXXXX only!
  2. Ascii_Text can not contain more than 119 characters.
  3. Function return handle receive from adl_smsSend in PDU format.

I’ll be glad to see your comments and suggestions. :slight_smile:

Hello my friend
What is the call function

What “call function” are you asking about :question:

hi
How to call function
SendRawPDU_SMS (ascii * Dst Address, ascii * Ascii Text)
What is the
:smiley:
What is the function of the input values

I want to write a program that would send him to pdu
Please help on a specific port

Do you have any embedded ‘C’ programming experience :question:

Do you have any programming experience at all :question:

I have programming experience
But this code does not work well if you can help me

But do you have ‘C’ experience? Specifically, embedded ‘C’ experience?

That’s like saying, “My car won’t go - what’s wrong with it?”

What, exactly, have you tried?

What were the results?

What results were you expecting?

What have you done to reconcile the expected results with the actual results?

In other words, what debugging have you done?

Here’s some debugging tips to get you started:

8052.com/faqs/120313

eetimes.com/discussion/break … geNumber=0

Hello my friend
I’m sending a pdu with q24
What should i do

Are you using Open-AT?

Does your PDU need to address a “port” number?

yes

How to make pdu
And how to send it on a specific port
With open at

Isn’t that exactly what the code so kindly posted by DrLan does :question: :exclamation:

You will, of course, need to spend time studying the Open-AT documentation and learning how to use it…

You should also study the links already given, and other materials, to understand the PDU format, User Data Header, Port Addressing, etc,…

Please give me the code pdu
I’m working on a project
I’ve been on this part of the problem.