tgalal / yowsup

The WhatsApp lib
GNU General Public License v3.0
7.08k stars 2.23k forks source link

"Waiting for this Message" #2244

Closed fwmarcel closed 5 years ago

fwmarcel commented 7 years ago

main-qimg-c8a56c3b3006356bc59e6183be4f3d6f-c

Hello, i have a Problem with sending Messages to Groups. Some Messages will work, some other not. I start yowsup with following command with a python script. "yowsup -c /root/yowsup/config.yowsup -s xxxnumberxx message" I hope, that you can help me...

mhuzqu commented 7 years ago

i got some prob like that.

whatsapp official has been udpdate their apps, try to use command line.

if you already connected to WA, then re-try you command: "yowsup -c /root/yowsup/config.yowsup -s xxxnumberxx message" it should work

fwmarcel commented 7 years ago

@MuhammadHuzaifah yeah thanks, but i want to send messages automated... It is possible to get a python script for sending it over command line ??

mhuzqu commented 7 years ago

it is posible, try to send via python yowsup-cli demos -y -c yowsup-cli_1.config first, once you sent and received the message, then use "yowsup -c /root/yowsup/config.yowsup -s xxxnumberxx message" command, should work. this problem caused by whatsapp

"Due to end-to-end encryption, you may need to wait for someone's message to arrive because their phone needs to come online and properly encrypt the message for you."

holgerschochwitz commented 7 years ago

Hi, i insert in the sendclient/layer.py this:

@ProtocolEntityCallback("receipt")
def onReceipt(self, entity):
    self.toLower(entity.ack())

and now all get the massages

Who can test it?

mhuzqu commented 7 years ago

Hi @holgerschochwitz i tested your code, it does't working, still

i think, you have to add code to make a Yowsup waiting (still connect to the server) for a while when the message send.

this happen when we send message to the new number, like whatsapp said, you have to know (end to end encription) each other before send and receive the message. then why i sugest to add waiting functionality to coplete the end-to-end whatsapp encryption. i am working on it.

mhuzqu commented 7 years ago

Hi,

if we run "python yowsup-cli demos -c yowsup-cli_3.config -s xxnumberxx "message "" which code in yowsup to be executed? could someone help please...

holgerschochwitz commented 7 years ago

I'm not shure what you need..

souzarod commented 7 years ago

I've same problem, but i reproduced this error in my enviroment and i can was identifie that it's has relaction with character limits in command line mode. If i send the same message in client mode, this message is delivered whith success.

souzarod commented 7 years ago

In new test, in client mode the message only is delivered if has less than 190 characters

mhuzqu commented 7 years ago

hi @souzarod , no way, i just send 20 characters of message, and still the same, still result like this

schlaubstar commented 7 years ago

This problem occurs when you have send a message to someone - and after that, the receiver reinstalles Whatsapp. There is some parts of the encryption stored at your sending device, and you need to delete a file on the sender side, so python forgets about the past communication and regenerates the encryption. My problem is: I already did this in the past, but I now do not remember the files/location ...

I found the folder and the file: On my Raspi 3 running LibreElec/KODI: it is stored in this location: /storage/.yowsup/[telNumber]/axolotl.db

stephanvdm77 commented 7 years ago

Can someone post a solution on this problem, we are using whatsapp on a production system where we rely on getting messages timeously, for now we have a substantial amount of devices that are giving us the message "Waiting for this message. This may take a while" Is there anything we can do fix these from the sending server? The message happend when phones get reinstalled or replaced. Please kindly assist.

schlaubstar commented 7 years ago

Hello stephanvdm77, first of all I would like to point out that the productive usage of yowsup is extremely risky. Any day Whatsapp can block your account or change the protocol so that yowsup doesn't work anymore.

If you had made the effort, you would have found the solution already, as it is directly in the post above your question: You have to look for the folder on your server, in which the axolotl.db for the respective phone number resides, and then delete this file. The next time you send a message to this number, the file will be regenerated and the download to the device will work again.

Although I'm no crypto expert, this happens because on your first contact, you seem to exchange a key or at least calculate one depending on the whatsapp "security id". If you reinstall the phone your "security id" changes, but this is not taken into consideration by yowsup as it uses the old one. Only if you delete the axolotl.db(s) (there will be a lot of those files in your case, as they are being generated within a folder that equals the phone numer) yowsup will regenerate the file.

Hope I could help you: I don't know under which OS you're running yowsup, so you have to figure out the final storage location by yourself, but this should not be so hard as you know: there will be a folder containing the mobile number, and there will be a file called axolotl.db

LabtronicsDesign commented 6 years ago

add the following to run.py

+from yowsup.layers.axolotl.props import PROP_IDENTITY_AUTOTRUST

+stack.setProp(PROP_IDENTITY_AUTOTRUST, True)

schlaubstar commented 6 years ago

@SPWC: could you be so kind and add some more details ? Which run.py are you talking about?

LabtronicsDesign commented 6 years ago

Pretty much what I said. If you aren't using run.py then stack.py or wherever the stack functions are

zencubic commented 6 years ago

Because no solution I found worked, I wrote a small workaround in Python which simply deletes the encryption keys from the axolotl.db


import os
import sqlite3

def clean(receiver_phonenumber):
    connection = sqlite3.connect(os.path.expanduser('~/.yowsup/{}/axolotl.db'.format("sender_phonenumber")))
    cursor = connection.cursor()

    identities_sql = "DELETE FROM identities WHERE recipient_id = {};".format(receiver_phonenumber)
    sessions_sql = "DELETE FROM sessions WHERE recipient_id = {};".format(receiver_phonenumber)

    cursor.execute(identities_sql)
    cursor.execute(sessions_sql)
    connection.commit()
    connection.close()
    return

Please report if it worked for you

franquitt commented 6 years ago

i think that will work to send, but when yowsup cant recive msg this need to be done on the user phone too

malanve commented 5 years ago

Because no solution I found worked, I wrote a small workaround in Python which simply deletes the encryption keys from the axolotl.db

import os
import sqlite3

def clean(receiver_phonenumber):
    connection = sqlite3.connect(os.path.expanduser('~/.yowsup/{}/axolotl.db'.format("sender_phonenumber")))
    cursor = connection.cursor()

    identities_sql = "DELETE FROM identities WHERE recipient_id = {};".format(receiver_phonenumber)
    sessions_sql = "DELETE FROM sessions WHERE recipient_id = {};".format(receiver_phonenumber)

    cursor.execute(identities_sql)
    cursor.execute(sessions_sql)
    connection.commit()
    connection.close()
    return

Please report if it worked for you

Hi there zencubic,

Could you add an example of what the "sender_phonenumber" and "receiver_phonenumber" should look like?

pbissoondial commented 3 years ago

Hi. I was getting this issue and deleting the axolotl.db file fixed the issue.