I'm working on an app that requires to read the reply of a particular sms message sent and update the Database, i know i can use SmsManager (Pending Intent) class to know the status of the message (Like SENT or DELIVERED) and also broadcast receiver for receiving sms but i want to be able to read the user reply to that sms.
There can be multiple message sent at a particular time which i want to be able to differentiate between response for each sms.
Is there a way to attach something like an id to sms and get it back when i receive the reply or how can i achieve this? most of the tutorials online only cover how to listen to the status and how to receive new sms.
Related
I would like to send 1000 messages and retransmit only those that failed. Is there any way?
Are there any methods to identify each failed message, such as a unique message ID?
As you can see, there is no identifiable message ID.
Is actually possible that only one message should be resent as in this case?
Should I resend only this message or all the bulk?
Should I use Exponential Backoff? Then, Where can I find example source?
I'm having a confusion on how to receive delivery receipt from ESME to SMSC?
For Example : If i terminate an Message from SMSC to ESME,then how can ESME sends delivery receipt for the corresponding Message received from SMSC.
If SUBMIT_SM is used for sending the delivery receipt to SMSC,then How can the SMSC differentiates a Normal Text Message and a Delivery Receipt from ESME?
Thanks in advance. :)
Within the SUBMIT_SM message, there is a field called "esm_class" which will allow you to send a delivery receipt to the SMSC. From the SMPP specification 5.0 page 125 the field contains a number of flags that can be set depending upon what kind of message you are sending. The flags for delivery receipts are below.
xx0001xx Short Message contains MC Delivery Receipt Message Type (bits 2 and 5)
xx1000xx Short Message contains Intermediate Delivery Notification
xx0010xx Short Message contains Delivery Acknowledgement
I believe that you will need to send an Intermediate Delivery Notification then a Delivery Acknowledgement message to the SMSC. The Intermediate Delivery Notification is probably optional.
Note that this is highly dependent on what is implemented in the SMSC. It's possible that the SMSC does not even handle these delivery receipts and perhaps will assume that the SMS has been delivered when you send the SUBMIT_SM_RESP in response to the SUBMIT_SM, or perhaps as soon as the SUBMIT_SM message is sent. You will need to test what happens.
I'm using SMSLib for sending and receiving messages. Everything's working great, but now I'd like to plug more than one modem. I want to receive messages by all of my modems and do something with them (I can do that, I think). I also want to send messages, but only through the selected modem (there's my problem). Until I had one gateway i did sending like this:
OutboundMessage msg = new OutboundMessage(recipientNumber, text);
Service.getInstance().sendMessage(msg);
But now, how can I select the one specific gateway, that I want to use to send my message?
I found a topic with a problem a bit like mine, but not exactly:
Use multiple gateway with SMSLIB
Each modem is a AGatway object in SMSLib so you need to set it up first:
SerialModemGateway modemGateway = new SerialModemGateway("FirstGateway", "/dev/ttyM0", "9600", "WAVECOM", "Fastrack");
Service.getInstance().addGateway(modemGateway);
Where FirstGateway is ID of your modem which is called gatewayId in SMSLib. All you have to do now is pass your gatewayId to sendMessage method or queueMessage (if you send messages asynchronously):
OutboundMessage msg = new OutboundMessage(recipientNumber, text);
Service.getInstance().sendMessage(msg, "FirstGateway");
or:
OutboundMessage msg = new OutboundMessage(recipientNumber, text);
msg.setGatewayId("FirstGateway");
Service.getInstance().sendMessage(msg);
I didnt notice that there is such a method sendMessage() which takes gatewayId as a second agrument. If so, there will be perfect. I'll check that tomorrow, are you sure about that? I'm using SmsLib 3.x
EDIT:
It's exactly as you said. I just put gatewayId as a second argument and it's working. Another options is that you can set gatewayId of created OutboundMessage:
OutboundMessage msg = new OutboundMessage(recipientNumber, text);
msg.setGatewayId("FirstGateway");
Service.getInstance().sendMessage(msg);
So easy.. Thanks!
I would't use sendMessage method with multiple gateways, use queueMessage it adds your msg to SMSLib service queue and sends it asynchronously.
Also , if you start your application with:
-Dsmslib.queuedir=yourQueuedMessagesDirectory
you will be able to store all unsent messages on hard drive and give SMSLib service facility to send them after application restart.
I have made a bot which can reply when the client sends a message. I want to send a message to the client without them sending me a message. I don't want to code in each and every message. Can someone please suggest a method for this? Thank you.
XMPPService xmpps = XMPPServiceFactory.getXMPPService();
Message msg = xmpps.parseMessage(req);
.....
......
msg = new MessageBuilder()
.withRecipientJids(jid)
.withBody(respMsg)
.build();
xmpps.sendMessage(msg);
what the above code does is, it sends the message after it receives a message from the client. my bot basically informs the clients about important announcements. so suppose i want to tell them something important without them asking. i just want to send a message and all my clients should receive it. do i need the JID of my clients? if so, then how do i get them? i am new to xmpp please help me.
Thank you.
It is not possible to broadcast messages to all jou xmpp contacts at once. You have to adress them one by one. If you look deepher in the xmpp code you will see that status updates will be broadcasted to all contacts that are not offline. Maybe you can use that to your advantage.
Hello im fairly new to the comet and reverse ajax scene. I discovered stream-hub and it seems very useful.
Reading the documentaions and examples I cant find a way for the server to send a message to a specific client.
I only found the
publish(String topic, Payload payload)
method that broadcast to all users subscribe to the topic
This is what I want EX:
There is 3 users connected User A, User B, and User C
User A sends a message, server receives message and sends to User C, but not User B.
Any ideas?