jackkum / node-pdu Goto Github PK
View Code? Open in Web Editor NEWCreates and parses a SMS PDU strings
License: MIT License
Creates and parses a SMS PDU strings
License: MIT License
I'm trying to encode this message: 'sms_manu_pfofensor_3005, seu acordo esta em atraso, evite que o desconto seja cancelado. Caso ja tenha efetuado o pagamento favor enviar o comprovante para [email protected] para baixa em sistema.'
Part 1: F3F6FCDB0EBBEB5FB8F96D2EBBE76FF9770683D558A079B90E0A8FDF72F21B549ED3C3A0721B14A6CBC3F3370B54B6A7E96550BC5E06BD41E4F27CFC76D3DFA079591D068DC3EE71991D26BF5DA06178FE06A9C3207AD98D0E83CAE632BD1E26BF416F103C7C0EB7CB6EFA1B640EDBDF7250D96D4F87E5A03768FC6EC3E56F7BD84D2F83E0
Part 2:
617918247EB3CBF4F71C6E06B2D3E4B23CEC1E87C76FB13CEC1E87E7AEF1BBED12CB41F0B03C0C1287D3F830A8DC06CDD3737AB91D7601
but the Pdu is not reconized here: https://www.diafaan.com/sms-tutorials/gsm-modem-tutorial/online-sms-submit-pdu-decoder/
Can you help me?
Encode7bit produces incorrect for some strings.
For example:
*171*1*1*5*085767240000*123456#
generates
AAD82DA68AA962AA9A0A86ABDD6C37190D0683C15431D98C56B38D00
which should be
AAD82DA68AA962AA9A0A86ABDD6C37190D0683C15431D98C56B38D1A
http://smstools3.kekekasvi.com/topic.php?id=288
occur error when i send message >140 character
Modem Write: AT+CMGS=137
Modem Received: AT+CMGS=137
Activate Message Processing for: AT+CMGS=137
Modem Received:
Modem Write: 0041000B914853958845F700008C060804AB650201472475096A81886FD03C9C0691D361D0189D069DD3E137081D769F592022126493E172B59C2C37038DEB61D014FD8683A8E5391DD47C8BD3EC32685E0691EBEF31E89C0EBF41F6F01B340E83E8E9321C444797DF2E50B49E07ADD1E1311A64AFA741ECB7FB0C62A7CB6E10BA0C6287D32072197406
Modem Received: > 0041000B914853958845F700008C060804AB650201472475096A81886FD03C9C0691D361D0189D069DD3E137081D769F592022126493E172B59C2C37038DEB61D014FD8683A8E5391DD47C8BD3EC32685E0691EBEF31E89C0EBF41F6F01B340E83E8E9321C444797DF2E50B49E07ADD1E1311A64AFA741ECB7FB0C62A7CB6E10BA0C6287D32072197406
Modem Received: >
Modem Received:
Modem Received: +CMS ERROR: 513
Call callback for: 0041000B914853958845F700008C060804AB650201472475096A81886FD03C9C0691D361D0189D069DD3E137081D769F592022126493E172B59C2C37038DEB61D014FD8683A8E5391DD47C8BD3EC32685E0691EBEF31E89C0EBF41F6F01B340E83E8E9321C444797DF2E50B49E07ADD1E1311A64AFA741ECB7FB0C62A7CB6E10BA0C6287D32072197406
Modem Write: AT+CMGS=45
Modem Received: AT+CMGS=45
Activate Message Processing for: AT+CMGS=45
Modem Received:
Modem Write: 0041000B914853958845F7000023060804AB650202E93A1C74445297A0733AFC06A1C3EE33C88D0EBBD120F4DB0D
Modem Received: > 0041000B914853958845F7000023060804AB650202E93A1C74445297A0733AFC06A1C3EE33C88D0EBBD120F4DB0D
Modem Received: >
Modem Received:
Modem Received: +CMS ERROR: 513
Call callback for: 0041000B914853958845F7000023060804AB650202E93A1C74445297A0733AFC06A1C3EE33C88D0EBBD120F4DB0D
I don't know how to do it :(
No workflow for tests available. Repository must be cloned, tests must be run manually
Workflow to check if the tests pass through
Is this project active?
07915510100102910407D1D6A4F50900C8715091415320291FD6F7B80CA297DBA018C8FDB68751F314A85D76CFC3E7721BE59EA700
this pdu reproduces a wrong msg: 훷렌ꊗ�ᣈﶶ蝑ꡝ盏쏧爛꜀
try it on https://www.diafaan.com/sms-tutorials/gsm-modem-tutorial/online-sms-pdu-decoder/
Im using serialport-gsm together with node-pdu.
And I found that SMS length from my database queue is not equal with sms recivied on the phone.
I did some test, and in my country we are using some special characters "ěěščřřžýáí".
So if the SMS used these special characters node-pdu switch to use ALPHABET_UCS2 and it was OK.
But with simply sms without special characters with simple ASCII chars the function Helper.encode7Bit starts to return wrong length of text. Basically it was missing char at the end of each SMS PDU part.
I fixed it with increase length of return string
file: node-pdu/PDU/Helper.js
function: Helper.encode7Bit = function(text, alignBits)
return [len+1, ret]; };
hi is it possible that your 7bit encoding ignore these letters?
[]^`\{|}~
as this is delivereable, all these signs
If you create a new Submit or Deliver class and set a phone number (address), no SCA type is set. This causes incorrect results.
Address: +999
Message: Hello
const pdu = require('node-pdu');
const submit = pdu.Submit();
submit.setAddress('+999');
submit.setData('Hello');
const output = submit.getParts()[0].toString();
const recreated = pdu.parse(output);
console.log('Output: ', output);
console.log('Phone Number: ', recreated.getAddress()._phone);
console.log('SCA: ', recreated._address._type.toString());
/**
* Output: 000100039199F9000005C8329BFD06
* Phone Number: 999
* SCA Type: 91
* ^ Wrong address SCA type
*/
PDU Output:
🖨 | 👀 |
---|---|
Output: | 0001000 39 199F9000005C8329BFD06 |
Expected output: | 0001000 38 199F9000005C8329BFD06 |
Reference: zabsalahid/serialport-gsm#129
We need to set DCS SIM SPECIFIC MESSAGE.
We are now doing this:
`var DCS = pdu.getModule('PDU/DCS');
var scheme = new DCS();
scheme.setClass(DCS.CLASS_SIM_SPECIFIC_MESSAGE);
Submit.setDcs(scheme);`
Is this the correct way?
In Helper.js:decode7bit() you do:
ret.push(Helper.ALPHABET_7BIT.charCodeAt(digit));
String.charCodeAt returns the utf16 value while Buffer.toString() at the end of the method expects utf-8 encoding.
A solution could be something like this:
if(digit % 128 == 27){
inExt = true;
} else {
if(inExt){
ret.push(Helper.EXTENDED_TABLE.charCodeAt(digit));
inExt = false;
} else {
var c = Helper.ALPHABET_7BIT.charCodeAt(digit);
if (c < 0x80) {
ret.push(c);
} else if (c < 0x800) {
ret.push(0xC0 | (c >> 6), 0x80 | (c & 0x3F));
} else {
//BUGBUG: more magic needed...
}
}
}
Code:
var pdu = require('node-pdu');
pdu.parse('06810458759100100200005D242454657374696E672061206E6577206D65737361676520746F2074656C6974203C39323338343938333E3C32393338393530383233393035242424243E2C3C3933383539303832333530393E2C3C39323338353039383233353E2323');
Error:
/node_code/node_modules/node-pdu/PDU/Data/Part.js:76
text = Helper.decode8bit(hex);
^
TypeError: Helper.decode8bit is not a function
at Function.Part.parse (/node_code/node_modules/node-pdu/PDU/Data/Part.js:76:27)
at Function.Data.parse (/node_code/node_modules/node-pdu/PDU/Data.js:56:20)
at Function.Helper.initVars (/node_code/node_modules/node-pdu/PDU/Helper.js:285:26)
at Function.PDU.parse (/node_code/node_modules/node-pdu/pdu.js:122:19)
at Object.<anonymous> (/node_code/pdutest.js:3:5)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
not sure on this one.
Submit.setDCS(???)
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.