brugnara/sms-pdu-node

text to PDU works great, what about PDU to text?

Opened this issue · 8 comments

hi, it works really great for sending converting text to PDU but what about the other way around?
I want to convert the PDU received into text. do you know an effective module I can use for that?

@HERRKIN I have not found a valid PDU to text because it is very complicated and most NPM modules are very limited doing this. In our production environment, we used something actively developed, it is a python module but it is very powerful and best of all, it simply works as expected.

I can cut-paste our little code to let you understand how simple this is t use. Please also refer to google for more details about that module (here's an example I've found right now: http://txzone.net/2011/01/receiving-sms-in-python-for-cheap/). Best wishes.

from messaging.sms import SmsDeliver
import sys

sms = SmsDeliver(sys.argv[1]).data

print sms['number']
print sms['date']
if 'cnt' in sms:
  print sms['cnt']
else:
  print 1
if 'seq' in sms:
  print sms['seq']
else:
  print 1
if 'ref' in sms:
  print sms['ref']
else:
  print 1
print sms['text'].encode('utf8')

how could I call that from node?

2016-03-08 9:56 GMT-04:30 Daniele notifications@github.com:

@HERRKIN https://github.com/HERRKIN I have not found a valid PDU to
text because it is very complicated and most NPM modules are very limited
doing this. In our production environment, we used something actively
developed, it is a python module but it is very powerful and best of all,
it simply works as expected.

I can cut-paste our little code to let you understand how simple this is t
use. Please also refer to google for more details about that module (here's
an example I've found right now:
http://txzone.net/2011/01/receiving-sms-in-python-for-cheap/). Best
wishes.

from messaging.sms import SmsDeliverimport sys

sms = SmsDeliver(sys.argv[1]).data
print sms['number']print sms['date']if 'cnt' in sms:
print sms['cnt']else:
print 1if 'seq' in sms:
print sms['seq']else:
print 1if 'ref' in sms:
print sms['ref']else:
print 1print sms['text'].encode('utf8')


Reply to this email directly or view it on GitHub
#1 (comment)
.

All the Javascript code for this can be found by looking at the source of the page at http://www.rednaxela.net/pdu.php, I don't see why it would be difficult to use?

Because the the output was not always correct. You can call with a simple
child.exec. Hope this helps.

Il Mar 8 Mar 2016 15:48 Andrew A notifications@github.com ha scritto:

All the Javascript code for this can be found by looking at the source of
the page at http://www.rednaxela.net/pdu.php, I don't see why it would be
difficult to use?


Reply to this email directly or view it on GitHub
#1 (comment)
.

I tried using your example @brugnara look the errors i got.

Traceback (most recent call last):
  File "pdu.py", line 4, in <module>
    print SmsDeliver('07914400000000F001000B811000000000F000002BE8373B0C52BFE705D0F8DD7E83CA737A18C40E83ECE1B43BFC03B7C3FDB03B0CB287DBEFF90F').data
  File "build/bdist.linux-x86_64/egg/messaging/sms/deliver.py", line 24, in __init__
  File "build/bdist.linux-x86_64/egg/messaging/sms/deliver.py", line 99, in _set_pdu
ValueError: Cannot decode a SmsSubmitReport message yet

I just used a pdu from the website http://www.rednaxela.net/pdu.php tried using it but it throws that error. I have no idea whats wrong, I managed to install the modules but I am not too familiar with python.

Try to print as my example shows. Maybe that way it throws error because you are printing a structure and not a string

its the same, the error is in that line.