Author |
Post |
|
#1 Tue Aug 03, 2010 08:43, 173 months ago.
|
Member
Registered: Aug 2010
Location: beijing, China
|
Operating system name and version: Linux sms196 2.6.9-42.ELsmp Version of smsd: Version 3.1.6 Smsd installed from: sources Name and model of a modem / phone: GSM1 Interface: serial
I'm trying to send a wappush msg . But it's always failed. The file in /var/spool/sms/failed/ shows:
Fail_reason: Hex presentation error in sms file: incorrect length of data: "„"
what's wrong? is there any example for wappush sms format ?
many thanks ..
|
|
#2 Tue Aug 03, 2010 09:09, 173 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Currently the only example of wap push is here. It looks like you are giving hexadecimal bytes in your message, and the length of a data is not even. Or probably there is a line containing only "„" (single character). In this case comment it out, or remove it.
|
|
#3 Tue Aug 03, 2010 10:21, 173 months ago.
|
Member
Registered: Aug 2010
Location: beijing, China
Topic owner
|
I've seen the example before.
'LENGTH // This stops the counting and places the number'
what does 'LENGTH' mean ?
In my program , its' value is strlen(body);
body= 0x020x050x04.....0x010x01 ;
|
|
#4 Tue Aug 03, 2010 10:45, 173 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
focus wrote 'LENGTH // This stops the counting and places the number'
what does 'LENGTH' mean ?
It's number of bytes in message after the counting was started. In some cases the number of following bytes must be defined in the message, and this is the way how smsd does the counting. For example, if you create messages using some script and the number of bytes varies, your script do not have to count anything. focus wrote In my program , its' value is strlen(body);
body= 0x020x050x04.....0x010x01 ;
With your program you mean a program running on the phone, right? Or did you mean a wap push message itself? If this is the case, do you mean that the length is counted incorrectly? You could show how you have tried to create a wap push message, and explain what kind of a message (binary, or anything) you are willing to get created.
|
|
#5 Tue Aug 03, 2010 10:54, 173 months ago.
|
Member
Registered: Aug 2010
Location: beijing, China
Topic owner
|
keke wrote Currently the only example of wap push is here. It looks like you are giving hexadecimal bytes in your message, and the length of a data is not even. Or probably there is a line containing only "„" (single character). In this case comment it out, or remove it.
here is the php code . I wish you can help me out function getSMSPush($subject, $url) { $pushString = ""; $body = ""; // Content_length Pos // Begin Pos $body .= chr(0x02); $body .= chr(0x05); //-//WAPFORUM//DTD SI 1.0//EN $body .= chr(0x6A); //UTF-8 $body .= chr(0x00); // $body .= chr(0x45); //<si> $body .= chr(0xC6); //<indication $body .= chr(0x0C); //href="http:// $body .= chr(0x03); // $body .= iconv( "GBK", "UTF-8", $url ); $body .= chr(0x00); $body .= chr(0x08); // action=signal-high $body .= chr(0x01); ; // END( of indication attribute list) $body .= chr(0x03); // $body .= iconv( "GBK", "UTF-8", $subject ); // $body .= chr(0x00); // $body .= chr(0x01); ; // END( of indication attribute list) $body .= chr(0x01); ; // END( of indication attribute list) $length = strlen($body); $pud = ""; $pud .= chr(0x81); //transaction id (connectionless WSP) $pud .= chr(0x06); //'pdu type (06=push) $pud .= chr(0x06); //Headers len $pud .= chr(0x03); $pud .= chr(0xAE); $pud .= chr(0x81); $pud .= chr(0xEA); //content type: application/vnd.wap.sic; charset=utf-8 $pud .= chr(0x8D); $pud .= chr(0x00); $pud .= chr(dechex($length)); //content-length $udh = ""; $udh .= chr(0x06); //User Data Header Length (6 bytes) $udh .= chr(0x05); //$udh Item Element id (Port Numbers) $udh .= chr(0x04); //$udh IE length (4 bytes) $udh .= chr(0x0B); $udh .= chr(0x84); //destination port number $udh .= chr(0x23); $udh .= chr(0xF0); //origin port number $pushString = $udh . $pud . $body; return $pushString; }
|
|
#6 Tue Aug 03, 2010 11:12, 173 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
When you create a wap push message directly in binary format, do not use the Hex: yes header. This header can only be used when a message body is presented using the hexadecimal format.
Your message will probably work when you create a message file with a content:
To: destination (in international format) Alphabet: binary <single empty line> <result from getSMSPush()>
Hexadecimal format is available because manually with editor it's easier to write than binary data. Also, sent messages (if stored) are easier to read when the format is hexadecimal. If necessary, the script can easily create message body in hex format, just output "02 " instead of chr(0x02) etc., and use STRING: or INLINESTRING: for strings. Some linefeeds are also needed.
|
|
#7 Wed Aug 04, 2010 04:41, 173 months ago.
|
Member
Registered: Aug 2010
Location: beijing, China
Topic owner
|
yes , Hex: yes is the problem , I delete this line and try a hexadecimal string copy from someones' blog , it works ! thank you! but when I try to write my own hexadecimal string , a new problem occurs : what's that mean? and , another way , can smstools3 send MMS ? keke wrote When you create a wap push message directly in binary format, do not use the Hex: yes header. This header can only be used when a message body is presented using the hexadecimal format.
Your message will probably work when you create a message file with a content:
To: destination (in international format) Alphabet: binary <single empty line> <result from getSMSPush()>
Hexadecimal format is available because manually with editor it's easier to write than binary data. Also, sent messages (if stored) are easier to read when the format is hexadecimal. If necessary, the script can easily create message body in hex format, just output "02 " instead of chr(0x02) etc., and use STRING: or INLINESTRING: for strings. Some linefeeds are also needed.
|
|
#8 Thu Aug 05, 2010 18:46, 173 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
focus wrote yes , Hex: yes is the problem , I delete this line and try a hexadecimal string copy from someones' blog , it works ! thank you! but when I try to write my own hexadecimal string , a new problem occurs : what's that mean?
You could try to send the sample to your handset. It's very similar than what your code provides. After testing it, did it work properly? Wap Push message is always a binary message. Without Hex: yes header, the message body must be presented in binary format. And there should be only one linefeed between headers and message body. Your code is creating binary format, and in that case you are not sending hexadecimal string. focus wrote and , another way , can smstools3 send MMS ?
No. MMS requires TCP/IP connection to the service center, and it's out of scope from smsd's point of view.
|