Two app.py files handling the same message

14 views
Skip to first unread message

dannette opot

unread,
Apr 27, 2013, 2:44:36 AM4/27/13
to rapi...@googlegroups.com
I have this problem where when i send an SMS to the SMS Kannel the message is routed to two different app.py files yet for one of the app.py's the message format expected should start with 'VA' and the other should start with 'RCT'. Yet all messages starting with 'VA' are handled in the other app.py.Help.

Tim Akinbo

unread,
Apr 27, 2013, 4:07:19 AM4/27/13
to RapidSMS
Two things to consider:

1. Ensure that after processing the message in the app.py module that handles 'VA' messages that you return True to stop the propagation of the same message to the second module.
2. Are you using regular expressions to check the prefix of the message? You could share some code for the processing so we can pinpoint the problem.

Cheers.

Tim Akinbo


On Sat, Apr 27, 2013 at 7:44 AM, dannette opot <dane...@gmail.com> wrote:
I have this problem where when i send an SMS to the SMS Kannel the message is routed to two different app.py files yet for one of the app.py's the message format expected should start with 'VA' and the other should start with 'RCT'. Yet all messages starting with 'VA' are handled in the other app.py.Help.

--
You received this message because you are subscribed to the Google Groups "rapidsms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rapidsms+u...@googlegroups.com.
To post to this group, send email to rapi...@googlegroups.com.
Visit this group at http://groups.google.com/group/rapidsms?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

dannette opot

unread,
Apr 27, 2013, 9:12:19 AM4/27/13
to rapi...@googlegroups.com
@Tim Akinbo i will share the code.About the regular expression am just doing an if statement on the incoming message.Something like:

if response.startsith('va'):
   #Do stuff here

Tim Akinbo

unread,
Apr 29, 2013, 3:18:01 AM4/29/13
to RapidSMS
The reason this is happening is because response.startswith('va') is always evaluating to false so #Do stuff here never gets executed.

First off, shouldn't it be message.text.startswith('va') or how is "response" created? Also, you may want to ensure that you're doing a case insensitive match so you might want to do a response.lower().startswith(...) however you are generating response.

Also, the word "response" somehow connotes that this is supposed to be the response that is sent when the message has been successfully processed.

Tim Akinbo

dannette opot

unread,
Apr 29, 2013, 3:23:27 AM4/29/13
to rapi...@googlegroups.com
response is generated by:

response=message.text.lower()

then i do:

if response.startswith('va')..



Thanks again.

Tim Akinbo

unread,
Apr 29, 2013, 3:24:52 AM4/29/13
to RapidSMS
And the module handling "rct" messages is response.startswith("rct")?

Tim Akinbo

dannette opot

unread,
Apr 29, 2013, 5:29:43 AM4/29/13
to rapi...@googlegroups.com
Yes it is response.startswith("rct")

Tim Akinbo

unread,
Apr 29, 2013, 2:36:34 PM4/29/13
to RapidSMS
Could you share more code? That will help with the debugging.

Tim Akinbo

dannette opot

unread,
Apr 30, 2013, 1:35:28 AM4/30/13
to rapi...@googlegroups.com
Here are the two files giving me a problem. The rct_notify executes the return False statement in rct_app. Why?
rct_app.py
rct_notify_app.py
Reply all
Reply to author
Forward
0 new messages