pajikos / sms-gammu-gateway

Simple SMS REST API gateway for sending SMS from gammu supported devices
Apache License 2.0
116 stars 31 forks source link

Getting-Started, How to set SMSC? How to handle SMS message to send pool? How to go production with WSGY (for non python users)? #6

Closed kopax closed 3 years ago

kopax commented 3 years ago

Hi, I want to create a SMS service and I have found your work, thanks once more for sharing it.

I am testing your docker server with my /dev/ttyUSB0 device.

After doing docker-compose up -d, I am running:

AUTH=$(echo -ne "admin:password" | base64 --wrap 0)
kopax@master-letort-01:~$ curl -H 'Content-Type: application/json' -H "Authorization: Basic $AUTH" -X POST --data '{"text":"Hello world", "number":"+33699886677"}' http://localhost:5000/sms
{"message": "Internal Server Error"}

Looking at the server logs:

sms-gammu-gateway    | gammu.ERR_GETTING_SMSC: {'Text': 'Failed to get SMSC number from phone.', 'Where': 'SendSMS', 'Code': 69}
  1. I opened #7 to allow to overwrite the smsc for people like met that are having https://github.com/gammu/gammu/issues/541
  2. Does your server allow sending of multiple messages at the same time (I tried before gammu at that jobed and it was giving me Resource busy and fail. Using this, will it also fail to send a message at the same time?
  3. The server start with Use a production WSGI server instead, I don't know about python at all, and I rather not learn python at the moment, what should I do to have a docker production server? Perhaps this can help : https://github.com/tiangolo/uwsgi-nginx-flask-docker but I couldn't get it to work with my understanding of wsgi
pajikos commented 3 years ago

Hi, Have tou tried using this for auth? curl --user admin:password …..

In all cases, I am forwarding all requests to the official gamma python library. I think you should make the sending synchronised in your code, if it is a problem. I do not think any of this protection in library itself.

Regards Pavel

On 9 Sep 2020, at 23:33, Dimitri KOPRIWA notifications@github.com wrote:

Hello and thanks for sharing this.

I want to create a SMS service and I have found your work, thanks once more for sharing it.

I am testing your docker server with my /dev/ttyUSB0 device.

After doing docker-compose up -d, I am running:

curl -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Basic admin password' -X POST --data '{"text":"Hello world", "number":"+33695826789"}' http://localhost:5000/sms It tells me Unauthorized access

Why are the credentials not working? How can I set smsc number, I tested outside docker gammu and this is required for my sim card. I must use -smscnumber +33695826789 option when sending the message. I tested to send locally two message at the same time (with gammy), and it gives me Resource busy and fail. Does your software take care of creating a message pull or will te fail if two request happen to send a message at the same time? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pajikos/sms-gammu-gateway/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATC6W76Y5MZZI4AYBFRMCLSE7YBRANCNFSM4RDK4JNA.

kopax commented 3 years ago

Hi pajikos. I fixed the authentication issue, I was just not sending the base64.

Thanks for passing #7 , will you release the docker image ?

For question (2), I tested it and we can send message concurrently.

For question (3), I have no clue as I am not doing python, do you think it is worth to replace the docker image by the tiangolo one for production?

pajikos commented 3 years ago

Hi Kopax, ad 2) You can create a new issue for it to avoid multiple threads in this issue. ad 3) Did you mean to add a production-ready server? Send me the link to tiangolo image, what did you have in mind.

kopax commented 3 years ago

Yes I mean use a production ready server. I've looked into it but my knowledge in there are insufficient.

This is the repo https://github.com/tiangolo/uwsgi-nginx-flask-docker