I am very new to SMS and stumbled upon JamaaSMPP. But I am having trouble with regards to sending a message that is longer than 160 characters. I've read that I need to send or use PDU? But I am not sure how and what to do.
Related
I'm currently learning how to use sockets on c#, and have a question regarding how the messages should be between the client and the server.
Currently i have a server application and a client application, and in each application i have some strings that are the commands. When, for example, the client needs the time from the server, i have a string like this:
public const string GET_TIME_COMMAND = "<GET_TIME_COMMAND>";
Then i have a if statement on the server, thats checks if the message sent from the client starts with that string and if so, it sends another message to the client with another command and with the time in a json string.
My question is, is this a good way to do it, and if not could you advise me on another way to go about this?
TCP
Keep in mind that TCP is a stream based connection. You may or may not get the complete command in one message. You may even get multiple commands in one read.
To solve this TCP messages usually have a unique start and stop sequence or byte that may not be part of the message.
(SomeCommand)
Where ( is the start and ) is the stop symbol.
An alternative way os to prepend a header to the actual message that contains the message length.
11 S O M E M E S S A G E
Where 11 is the message length and somemessage is the actual message. You'd usually transmit the length as a byte or ushort, not a string literal.
In both cases you have to read over and over until you have one complete message - then you can dispatch it into the application.
Also TCP is connection based. You have to connect to the remote site. The advantage is that TCP makes sure that all messages are sent in the very order you put them in. TCP will also automatically re-send lost packets and you don't have to worry about that.
UDP
In contrast to that UDP is a message/packet based, but it is not reliable. You may or may not get the message and have to re-send it in some cases. Also UDP doesn't have a notion of a "session". You would have to do that yourself if required.
The answer to your question depends on the protocol used. For TCP this won't work well with your current message format. You'd probably have to prepend a header.
You could use UDP, but then you may have to detect and re-send messages that got lost.
So I've recently encountered this issue where running my AT Command on sending SMS message which returns a +CMS ERROR: 305 from my AT+CMGS= command. Upon further inspection I've discovered that there seems to be a limit to the number of characters for the message body to contain (160 char max from my testing). As a workaround I've written a code that splits the message into chunks of 160 character messages and send them as separate SMS per chunk. Management however does not like this design as it looks quite messy to be honest.
Is there any way I can get around this issue and send more than 160 characters on a single SMS message?
The 160 character limit is a hard limit imposed by the protocol definition of how a phone exchanges SMS messages with the network. There is however a possibility for the sending phone to split a long message up into multiple parts that are sent (and billed) separately but marked in such a way that the receiving phone are able to concatenate them back into one large message that is presented to the user, so that there is virtual support for sending large messages (Multi-Part is the technical term).
You do not say if you are sending messages in text of PDU mode with AT+CMGS, but I am guessing text mode and as far as I know it does not support this so you have to use PDU mode (related answer).
In my project, I want to send a unicoded text(UTF-8) SMS message through PDU-Submit. I've been searching a lot but all answers using Text-Mode and not PDU-Submit command, therefore I can't send multipart SMS. I want to have a solution for multi-part unicode messages.
Finally I have found the answer and use it.my program works fine. Sending a Concatenated(Multi-Part) SMS in Unicode Format Using PDU, is the same sending a simple septet-character SMS using AT+CMGS Command except you must set the DCS byte to 08.You can earn more Info on these threads:
Add UDH for concatenated Unicode SMS
http://en.wikipedia.org/wiki/Concatenated_SMS#PDU_Mode_SMS
You can send SMS messages with the AT+CMGS command in PDU mode (enable with AT+CMGF=0). The syntax (for pdu mode) is
AT+CMGS=<length><CR>
PDU is given<ctrl-Z/ESC>
I do not know if you are supposed to split into multipart yourself and send each part separately or if this command does that for you. I think maybe the latter, the description of the command says
Execution command sends message from a TE to the network (SMS-SUBMIT).
If/when you find out, feel free to update this answer with regards to that.
I'm working on a project which receive notification from GCM server.
I've got the registration ID from GCM server and i send it to my server application which save it in the database.
My device receive the message but when I try to send another one, the precedent is replaced.
I know that we've 2 types of message:
Collapsible "send to sync"
Non-Collapsible
So without changing the name of the message, how can I get two message send at different time?
UPDATE 1:
When my device is offline (for example airport mode activated), I try
to send for example 2 messages from my application server to Google
server (I read that Google stores all the messages). But when I
desactivate this mode, I receive only the last message sent.
I use different collapse_key for different message and I receive all
of them (of course when the device online).
Is anybody knows how can I fix this?
The collapse key is relevant only to messages that were sent to the GCM server but haven't reached the destination device yet (if more than one such message has the same collapse key, only one of them will be sent to the device when it becomes online).
In your question you describe a different situation - the first message is received by the device and then the second message is received by the device and replaces the original message. That has nothing to do with GCM. It has to do with the way your application handles the received messages. For example, if your application code that receives the message displays is as a notification, it's up to you to decide whether a new message will override the existing notification or create a new notification.
You need to make sure that the value of the 'collapse_key' field in each message is different
I am working on a site and it has to have a newsletter sending functionality. A couple of weeks ago I posted a question on stackoverflow, and the good people suggested that I do a console app which I call from the site and it sends the mails. I did this, and it works locally, but I wasn't able to get it working on the server (security issue). Been trying to make this work for the past 3 days. So then, I decidet to try and change how the email is sent.
To make a long story short, now I split all the emails in "groups" of 50, and then make a new MailMessage object, and mailMessage.To.add(sample#sample.com) emails to it. Then I send it 50 by 50.
It works for now, but my question is, how "BAD" is this solution? I tryed adding the emails to bcc, but for some reason (for me) this works only locally ( !?! ).
And one more thing which I couldn't find on line, what is the maximum number of mails I can add to the MailMessage object?
Thank you for your time!
Andrej
its very bad since each user which receives your newsletter will have access to the 49 other contacts (where do i sign up?)
If you are having problems with multiple BCC's, contact you SMTP host.
Did you try sending each separately? if it is taking to long to send, you can build a multi-threaded solution which will help.
The correct way is to send each one his mail and you create a queue in memory on in database for store mail before send.
Remember send all emails in 1 time if you use public smtp server is bad thing, you can be banned for that server,this means you must schedule such as 1000 mail at time or less.
i have wrote this years ago if you need i can post same code