I just committed the project that uses libdwgsms to send/receive text messages through Dinstar’s branded gateways.
The code goes as simple as follows, and you can check it from my github account:
10 thoughts on “Dinstar SMS API client”
Aw, this was a really nice post. In idea I would like to put in writing like this additionally – taking time and actual effort to make a very good article… but what can I say… I procrastinate alot and by no means seem to get something done.
Thanks for spending time on the cmopuetr (writing) so others don’t have to.
Hi Caru,
I compiled the API and client on OpenBSD 4.9 running on a soekris 4801 (so little ram to play with) – it looks to be running ok. However it is failing to allocate excessively large amounts of memory to messages, see debug below. I am not a C programmer, could you help with some instructions on how to send a message?
Thanks, Tim
bash-4.1# ./dwgclient
[DEBUG] main: Setting up sever…
[DEBUG] main: Server listening at port 7008
[DEBUG] [192.168.11.1] Number of ports: 1
[DEBUG] Port0: 0
[DEBUG] [192.168.11.1] Encoding: 13874, From: 447730******, Len: 0, Text:
[DEBUG] [192.168.11.1] Encoding: 13873, From: 447730******, Len: 0, Text:
[DEBUG] [192.168.11.1] Encoding: 13104, From: 447730******, Len: 0, Text:
[DEBUG] [192.168.11.1] Encoding: 12595, From: 447730******, Len: 0, Text:
[DEBUG] [192.168.11.1] Encoding: 13109, From: 447730******, Len: 0, Text:
[DEBUG] dwg_deserialize_message: No more memory trying to allocate 1057819136 bytes
[DEBUG] dwg_process_message: error processing message
[DEBUG] dwg_deserialize_message: No more memory trying to allocate 1751477360 bytes
[DEBUG] dwg_process_message: error processing message
[DEBUG] dwg_deserialize_message: No more memory trying to allocate 1146570591 bytes
[DEBUG] dwg_process_message: error processing message
[DEBUG] dwg_deserialize_message: No more memory trying to allocate -720899 bytes
[DEBUG] dwg_process_message: error processing message
Hi Tim.
What processor architecture are you using?. That error is probably caused by the processor endianness which is not properly handled by my code.
Nice work!
I have tried your SMS API, it is very interesting.
When i receive a message i the c client above, there is no text in the message, the length is always 1.
Hire is my debug info:
[DEBUG] main: Server listening at port 7008
[DEBUG] [192.168.1.49] Number of ports: 1
[DEBUG] Port0: 0
[DEBUG] [192.168.1.49] Encoding: 926036272, From: 4529105612, Len: 1,
[DEBUG] [192.168.1.49] Encoding: 926036272, From: 4529105612, Len: 1,
[root@server Fredagsbar]# ./dwgclient
[DEBUG] main: Setting up sever…
[DEBUG] main: Server listening at port 7008
[DEBUG] [192.168.1.49] Number of ports: 1
[DEBUG] Port0: 0
[DEBUG] [192.168.1.49] ACK response from 4529105612
[DEBUG] Segmentation fault
Can you give a solution to this problem?
Best regards
Lars Hansen
Denmark
Hi Hans,
there’s probably something broken in the code due to things I haven’t took into consideration for certain models.
– what model of Dinstar are you using?
– Is the number of the sender correct? “From: 4529105612”
– What operating system are you using and what is its processor architecture? x86, x86_64, PPC, etc.
Hello Carlos Ruiz DÃaz,
When I run client:
[root@etalon Dinstar-SMS-API-Client-master]# ./dwgclient
[DEBUG] main: Setting up sever…
[DEBUG] main: Server listening at port 7008
[DEBUG] [10.102.100.222] Number of ports: 8
[DEBUG] Port0: 0
[DEBUG] Port1: 1
[DEBUG] Port2: 1
[DEBUG] Port3: 1
[DEBUG] Port4: 1
[DEBUG] Port5: 1
[DEBUG] Port6: 1
[DEBUG] Port7: 1
[DEBUG] Segmentation fault
Dinstar model is DWG200C-8G
OS: CentOS release 6.3 (Final) 2.6.32-279.19.1.el6.x86_64
Can you help me?
Best regards
Konstantin
Hi Konstantin.
Could you please run the binary with gdb to see where it crashes?
gdb ./dwgclient
In the console, type run and paste the output after the Segmentation Fault.
Thank you for answer.
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff6c25700 (LWP 13042)]
strnlen () at ../sysdeps/x86_64/strnlen.S:35
35 pcmpeqb (%rdi), %xmm2
Hi,this moses I have a dinstar 32ports and I would wish to reprogram it with a new ip.could you be of help?
Aw, this was a really nice post. In idea I would like to put in writing like this additionally – taking time and actual effort to make a very good article… but what can I say… I procrastinate alot and by no means seem to get something done.
Thanks for spending time on the cmopuetr (writing) so others don’t have to.
Hi Caru,
I compiled the API and client on OpenBSD 4.9 running on a soekris 4801 (so little ram to play with) – it looks to be running ok. However it is failing to allocate excessively large amounts of memory to messages, see debug below. I am not a C programmer, could you help with some instructions on how to send a message?
Thanks, Tim
bash-4.1# ./dwgclient
[DEBUG] main: Setting up sever…
[DEBUG] main: Server listening at port 7008
[DEBUG] [192.168.11.1] Number of ports: 1
[DEBUG] Port0: 0
[DEBUG] [192.168.11.1] Encoding: 13874, From: 447730******, Len: 0, Text:
[DEBUG] [192.168.11.1] Encoding: 13873, From: 447730******, Len: 0, Text:
[DEBUG] [192.168.11.1] Encoding: 13104, From: 447730******, Len: 0, Text:
[DEBUG] [192.168.11.1] Encoding: 12595, From: 447730******, Len: 0, Text:
[DEBUG] [192.168.11.1] Encoding: 13109, From: 447730******, Len: 0, Text:
[DEBUG] dwg_deserialize_message: No more memory trying to allocate 1057819136 bytes
[DEBUG] dwg_process_message: error processing message
[DEBUG] dwg_deserialize_message: No more memory trying to allocate 1751477360 bytes
[DEBUG] dwg_process_message: error processing message
[DEBUG] dwg_deserialize_message: No more memory trying to allocate 1146570591 bytes
[DEBUG] dwg_process_message: error processing message
[DEBUG] dwg_deserialize_message: No more memory trying to allocate -720899 bytes
[DEBUG] dwg_process_message: error processing message
Hi Tim.
What processor architecture are you using?. That error is probably caused by the processor endianness which is not properly handled by my code.
Nice work!
I have tried your SMS API, it is very interesting.
When i receive a message i the c client above, there is no text in the message, the length is always 1.
Hire is my debug info:
[DEBUG] main: Server listening at port 7008
[DEBUG] [192.168.1.49] Number of ports: 1
[DEBUG] Port0: 0
[DEBUG] [192.168.1.49] Encoding: 926036272, From: 4529105612, Len: 1,
[DEBUG] [192.168.1.49] Encoding: 926036272, From: 4529105612, Len: 1,
[root@server Fredagsbar]# ./dwgclient
[DEBUG] main: Setting up sever…
[DEBUG] main: Server listening at port 7008
[DEBUG] [192.168.1.49] Number of ports: 1
[DEBUG] Port0: 0
[DEBUG] [192.168.1.49] ACK response from 4529105612
[DEBUG] Segmentation fault
Can you give a solution to this problem?
Best regards
Lars Hansen
Denmark
Hi Hans,
there’s probably something broken in the code due to things I haven’t took into consideration for certain models.
– what model of Dinstar are you using?
– Is the number of the sender correct? “From: 4529105612”
– What operating system are you using and what is its processor architecture? x86, x86_64, PPC, etc.
Hello Carlos Ruiz DÃaz,
When I run client:
[root@etalon Dinstar-SMS-API-Client-master]# ./dwgclient
[DEBUG] main: Setting up sever…
[DEBUG] main: Server listening at port 7008
[DEBUG] [10.102.100.222] Number of ports: 8
[DEBUG] Port0: 0
[DEBUG] Port1: 1
[DEBUG] Port2: 1
[DEBUG] Port3: 1
[DEBUG] Port4: 1
[DEBUG] Port5: 1
[DEBUG] Port6: 1
[DEBUG] Port7: 1
[DEBUG] Segmentation fault
Dinstar model is DWG200C-8G
OS: CentOS release 6.3 (Final) 2.6.32-279.19.1.el6.x86_64
Can you help me?
Best regards
Konstantin
Hi Konstantin.
Could you please run the binary with gdb to see where it crashes?
gdb ./dwgclient
In the console, type run and paste the output after the Segmentation Fault.
Thank you for answer.
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff6c25700 (LWP 13042)]
strnlen () at ../sysdeps/x86_64/strnlen.S:35
35 pcmpeqb (%rdi), %xmm2
Hi,this moses I have a dinstar 32ports and I would wish to reprogram it with a new ip.could you be of help?