nyaruka / rapidsms-httprouter

Implements a router in the HTTP thread, one message per call.
http://www.nyaruka.com/
40 stars 38 forks source link

handset messages not saved in table and not pushed to dashboard #3

Closed sosewe closed 12 years ago

sosewe commented 12 years ago

When sending messages via the message tester,the messages are saved into the messages table and they also appear on the message log web interface(dashboard),but for messages sent via a handset,no message is logged into a table and the dashboard shows nothing too.

when i send 'ping-kannel' I get the approriate response 'kannel is online and responding to messages' but still this message is not saved in a table and neither does it appear on the dashboard,but on sending 'ping' i get no response at all.

thedavidmccann commented 12 years ago

Sounds as if Kannel may not be wired correctly to the HTTP endpoint of rapidsms-httprouter, at least that'd be the first place to check. What does your kannel.conf look like?

On Thu, Jun 7, 2012 at 9:52 AM, sosewe < reply@reply.github.com

wrote:

When sending messages via the message tester,the messages are saved into the messages table and they also appear on the message log web interface(dashboard),but for messages sent via a handset,no message is logged into a table and the dashboard shows nothing too.

when i send 'ping-kannel' I get the approriate response 'kannel is online and responding to messages' but still this message is not saved in a table and neither does it appear on the dashboard,but on sending 'ping' i get no response at all.


Reply to this email directly or view it on GitHub: https://github.com/nyaruka/rapidsms-httprouter/issues/3

sosewe commented 12 years ago

this is my kannel.conf

#

CONFIGURATION FOR USING SMS KANNEL WITH RAPIDSMS IN MALAWI

#

For any modifications to this file, see Kannel User Guide

If that does not help, see Kannel web page (http://www.kannel.org) and

various online help and mailing list archives

#

Notes on those who base their configuration on this:

1) check security issues! (allowed IPs, passwords and ports)

2) groups cannot have empty rows inside them!

3) read the user guide

#

Kalle Marjola for Kannel project 2001, 2004

include = "/etc/kannel/modems.conf"

---------------------------------------------

CORE

#

There is only one core group and it sets all basic settings

of the bearerbox (and system). You should take extra notes on

configuration variables like 'store-file' (or 'store-dir'),

'admin-allow-ip' and 'access.log'

group = core admin-port = 13004 smsbox-port = 13006 admin-password = CHANGEME status-password = CHANGEME admin-deny-ip = "..." admin-allow-ip = "127.0.0.1" box-deny-ip = "..." box-allow-ip = "127.0.0.1" sms-outgoing-queue-limit =-1 sms-incoming-queue-limit =-1 log-file = "/var/log/kannel/bearerbox.log" log-level = 0

dlr-storage = mysql

---------------------------------------------

SMSC CONNECTIONS

#

SMSC connections are created in bearerbox and they handle SMSC specific

protocol and message relying. You need these to actually receive and send

messages to handset, but can use GSM modems as virtual SMSCs

This is a fake smsc connection, only used to test the system and

services.

It really cannot relay messages to actual handsets!

group = smsc

smsc = fake

smsc-id = FAKE

port = 20000

connect-allow-ip = 127.0.0.1

group = smsc

smsc = smpp

smsc-id = tnm-smpp

my-number = 88160

does not seem to be used; included for consistency

interface-version = 34

host = 41.221.99.35

port = 5019

smsc-username = CHANGEME

smsc-password = CHANGEME

system-type = default

transceiver-mode = 1

By denying all other SMSCes, we are assured this one is used only to

deliver messages from the TNM backend in RapidSMS.

denied-smsc-id = zain-modem

mysql connection

group = mysql-connection

id = mydlr

host = localhost

username = root

password = admin

database = Kannel

max-connection = 1

group =dlr-db

id = mydlr

table = dlr

field-smsc = smsc

field-timestamp = ts

field-destination = destination

field-source = source

field-service = service

field-url = url

field-mask = mask

field-status = status

field-boxc-id = boxc

group = smsc smsc = at smsc-id = safaricom-modem my-number = +265999279085 # probably overridden by the network modemtype = huawei_e160 device = /dev/ttyUSB1

send-url=http://127.0.0.1:13013/cgi-bin/sendsms

By denying all other SMSCes, we are assured this one is used only to

deliver messages from the Zain backend in RapidSMS.

denied-smsc-id = tnm-smpp

---------------------------------------------

SMSBOX SETUP

#

Smsbox(es) do higher-level SMS handling after they have been received from

SMS centers by bearerbox, or before they are given to bearerbox for

delivery

group = smsbox bearerbox-host = 127.0.0.1 sendsms-port = 13013 sendsms-chars = "0123456789 +-" log-file = "/var/log/kannel/smsbox.log" log-level = 0 access-log = "/var/log/kannel/smsbox-access.log" reply-couldnotfetch = "Your message could not be processed at this time. Please try again later. (err=couldnotfetch)" reply-requestfailed = "Your message could not be processed at this time. Please try again later. (err=requestfailed)" reply-couldnotrepresent = "Your message could not be processed at this time. Please try again later. (err=couldnotrepresent)" http-request-retry = 3 http-queue-delay = 10

SEND-SMS USERS

#

These users are used when Kannel smsbox sendsms interface is used to

send PUSH sms messages, i.e. calling URL like

# http://kannel.machine:13013/cgi-bin/sendsms?username=tester&password=foobar. ..

This is the username and password that RapidSMS uses to deliver SMSes to

Kannel. It must also set the 'smsc' variable in the query string, so that

Kannel knows which SMSC to use to route the message.

group = sendsms-user username = rapidsms password = CHANGEME user-deny-ip = "..." user-allow-ip = "127.0.0.1;" concatenation = true max-messages = 10

---------------------------------------------

SERVICES

#

These are 'responses' to sms PULL messages, i.e. messages arriving from

handsets. The response is based on message content. Only one sms-service

is

applied, using the first one to match.

The 'ping-kannel' service let's you check to see if Kannel is running,

even if RapidSMS is offline for some reason.

group = sms-service keyword = ping-kannel text = "Kannel is online and responding to messages."

There should be always a 'default' service. This service is used when no

other 'sms-service' is applied. These relay incoming messages from Zain

and TNM, respectively, to the appropriate HTTP backend URLs in RapidSMS.

By setting 'accepted-smsc', we are assured that messages are routed to

the appropriate backend in RapidSMS.

group = sms-service keyword = default accepted-smsc = safaricom-modem catch-all= yes

don't send a reply here (it'll come through sendsms):

max-messages = 0 get-url = http://127.0.0.1:8081/?id=%p&text=%a&charset=%C&coding=%c

group = sms-service

keyword = default

accepted-smsc = tnm-smpp

don't send a reply here (it'll come through sendsms):

max-messages = 3

get-url = http://127.0.0.1:8082/?id=%p&text=%a&charset=%C&coding=%c

On Thu, Jun 7, 2012 at 4:58 PM, David McCann < reply@reply.github.com

wrote:

Sounds as if Kannel may not be wired correctly to the HTTP endpoint of rapidsms-httprouter, at least that'd be the first place to check. What does your kannel.conf look like?

On Thu, Jun 7, 2012 at 9:52 AM, sosewe < reply@reply.github.com

wrote:

When sending messages via the message tester,the messages are saved into the messages table and they also appear on the message log web interface(dashboard),but for messages sent via a handset,no message is logged into a table and the dashboard shows nothing too.

when i send 'ping-kannel' I get the approriate response 'kannel is online and responding to messages' but still this message is not saved in a table and neither does it appear on the dashboard,but on sending 'ping' i get no response at all.


Reply to this email directly or view it on GitHub: https://github.com/nyaruka/rapidsms-httprouter/issues/3


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6176408

stephen osewe websys software solutions www.websysltd.com +254-721-765 824 info@websysltd.com

thedavidmccann commented 12 years ago

Yup. problem is with this line:

get-url = http://127.0.0.1:8081/?id=%p&text=%a&charset=%C&coding=%c

change that to :

get-url = http://127.0.0.1:8081/router/receive/?backend=kannel&sender=%p&message=%a

That assumes that you're not using a custom urls.py to point to the receive view, and that your urlpatterns are all wired up properly.

On Thu, Jun 7, 2012 at 10:07 AM, sosewe < reply@reply.github.com

wrote:

this is my kannel.conf

#

CONFIGURATION FOR USING SMS KANNEL WITH RAPIDSMS IN MALAWI

#

For any modifications to this file, see Kannel User Guide

If that does not help, see Kannel web page (http://www.kannel.org) and

various online help and mailing list archives

#

Notes on those who base their configuration on this:

1) check security issues! (allowed IPs, passwords and ports)

2) groups cannot have empty rows inside them!

3) read the user guide

#

Kalle Marjola for Kannel project 2001, 2004

include = "/etc/kannel/modems.conf"

---------------------------------------------

CORE

#

There is only one core group and it sets all basic settings

of the bearerbox (and system). You should take extra notes on

configuration variables like 'store-file' (or 'store-dir'),

'admin-allow-ip' and 'access.log'

group = core admin-port = 13004 smsbox-port = 13006 admin-password = CHANGEME status-password = CHANGEME admin-deny-ip = "..." admin-allow-ip = "127.0.0.1" box-deny-ip = "..." box-allow-ip = "127.0.0.1" sms-outgoing-queue-limit =-1 sms-incoming-queue-limit =-1 log-file = "/var/log/kannel/bearerbox.log" log-level = 0

dlr-storage = mysql

---------------------------------------------

SMSC CONNECTIONS

#

SMSC connections are created in bearerbox and they handle SMSC specific

protocol and message relying. You need these to actually receive and send

messages to handset, but can use GSM modems as virtual SMSCs

This is a fake smsc connection, only used to test the system and

services.

It really cannot relay messages to actual handsets!

group = smsc

smsc = fake

smsc-id = FAKE

port = 20000

connect-allow-ip = 127.0.0.1

group = smsc

smsc = smpp

smsc-id = tnm-smpp

my-number = 88160

does not seem to be used; included for consistency

interface-version = 34

host = 41.221.99.35

port = 5019

smsc-username = CHANGEME

smsc-password = CHANGEME

system-type = default

transceiver-mode = 1

By denying all other SMSCes, we are assured this one is used only to

deliver messages from the TNM backend in RapidSMS.

denied-smsc-id = zain-modem

mysql connection

group = mysql-connection

id = mydlr

host = localhost

username = root

password = admin

database = Kannel

max-connection = 1

group =dlr-db

id = mydlr

table = dlr

field-smsc = smsc

field-timestamp = ts

field-destination = destination

field-source = source

field-service = service

field-url = url

field-mask = mask

field-status = status

field-boxc-id = boxc

group = smsc smsc = at smsc-id = safaricom-modem my-number = +265999279085 # probably overridden by the network modemtype = huawei_e160 device = /dev/ttyUSB1

send-url=http://127.0.0.1:13013/cgi-bin/sendsms

By denying all other SMSCes, we are assured this one is used only to

deliver messages from the Zain backend in RapidSMS.

denied-smsc-id = tnm-smpp

---------------------------------------------

SMSBOX SETUP

#

Smsbox(es) do higher-level SMS handling after they have been received

from

SMS centers by bearerbox, or before they are given to bearerbox for

delivery

group = smsbox bearerbox-host = 127.0.0.1 sendsms-port = 13013 sendsms-chars = "0123456789 +-" log-file = "/var/log/kannel/smsbox.log" log-level = 0 access-log = "/var/log/kannel/smsbox-access.log" reply-couldnotfetch = "Your message could not be processed at this time. Please try again later. (err=couldnotfetch)" reply-requestfailed = "Your message could not be processed at this time. Please try again later. (err=requestfailed)" reply-couldnotrepresent = "Your message could not be processed at this time. Please try again later. (err=couldnotrepresent)" http-request-retry = 3 http-queue-delay = 10

SEND-SMS USERS

#

These users are used when Kannel smsbox sendsms interface is used to

send PUSH sms messages, i.e. calling URL like

# http://kannel.machine:13013/cgi-bin/sendsms?username=tester&password=foobar . ..

This is the username and password that RapidSMS uses to deliver SMSes to

Kannel. It must also set the 'smsc' variable in the query string, so that

Kannel knows which SMSC to use to route the message.

group = sendsms-user username = rapidsms password = CHANGEME user-deny-ip = "..." user-allow-ip = "127.0.0.1;" concatenation = true max-messages = 10

---------------------------------------------

SERVICES

#

These are 'responses' to sms PULL messages, i.e. messages arriving from

handsets. The response is based on message content. Only one sms-service

is

applied, using the first one to match.

The 'ping-kannel' service let's you check to see if Kannel is running,

even if RapidSMS is offline for some reason.

group = sms-service keyword = ping-kannel text = "Kannel is online and responding to messages."

There should be always a 'default' service. This service is used when no

other 'sms-service' is applied. These relay incoming messages from Zain

and TNM, respectively, to the appropriate HTTP backend URLs in RapidSMS.

By setting 'accepted-smsc', we are assured that messages are routed to

the appropriate backend in RapidSMS.

group = sms-service keyword = default accepted-smsc = safaricom-modem catch-all= yes

don't send a reply here (it'll come through sendsms):

max-messages = 0 get-url = http://127.0.0.1:8081/?id=%p&text=%a&charset=%C&coding=%c

group = sms-service

keyword = default

accepted-smsc = tnm-smpp

don't send a reply here (it'll come through sendsms):

max-messages = 3

get-url = http://127.0.0.1:8082/?id=%p&text=%a&charset=%C&coding=%c

On Thu, Jun 7, 2012 at 4:58 PM, David McCann < reply@reply.github.com

wrote:

Sounds as if Kannel may not be wired correctly to the HTTP endpoint of rapidsms-httprouter, at least that'd be the first place to check. What does your kannel.conf look like?

On Thu, Jun 7, 2012 at 9:52 AM, sosewe < reply@reply.github.com

wrote:

When sending messages via the message tester,the messages are saved into the messages table and they also appear on the message log web interface(dashboard),but for messages sent via a handset,no message is logged into a table and the dashboard shows nothing too.

when i send 'ping-kannel' I get the approriate response 'kannel is online and responding to messages' but still this message is not saved in a table and neither does it appear on the dashboard,but on sending 'ping' i get no response at all.


Reply to this email directly or view it on GitHub: https://github.com/nyaruka/rapidsms-httprouter/issues/3


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6176408

stephen osewe websys software solutions www.websysltd.com +254-721-765 824 info@websysltd.com


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6176611

sosewe commented 12 years ago

am still not getting my way withi this even after implementing the changes,any other idea ?

thedavidmccann commented 12 years ago

What do your main urls.py and settings.py look like? Possible it's some sort of wiring problem. Are you getting any errors from kannel now when it opens the new url? What is the response it gets? It should be a json object echoing the message contents.

On Fri, Jun 8, 2012 at 2:25 AM, sosewe < reply@reply.github.com

wrote:

am still not getting my way withi this even after implementing the changes,any other idea ?


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6195446

sosewe commented 12 years ago

Let me send you a copy of my settings.py

settings.py

!/usr/bin/env python

vim: ai ts=4 sts=4 et sw=4

encoding=utf-8

--------------------------------------------------------------------

MAIN CONFIGURATION

--------------------------------------------------------------------

you should configure your database here before doing any real work.

see: http://docs.djangoproject.com/en/dev/ref/settings/#databases

DATABASES = { "default": {

"ENGINE": "django.db.backends.sqlite3",

    "ENGINE": "django.db.backends.mysql",
    #"NAME": "rapidsms.sqlite3",
    "NAME": "RapidsmsDB",
    "HOST":"localhost",
    "PASSWORD":"admin",
}

}

the rapidsms backend configuration is designed to resemble django's

database configuration, as a nested dict of (name, configuration).

#

the ENGINE option specifies the module of the backend; the most common

backend types (for a GSM modem or an SMPP server) are bundled with

rapidsms, but you may choose to write your own.

#

all other options are passed to the Backend when it is instantiated,

to configure it. see the documentation in those modules for a list of

the valid options for each.

INSTALLED_BACKENDS = {

"safaricom": {

   #"ENGINE": "rapidsms.backends.gsm",
   #"PORT": "/dev/ttyUSB0",
   #"baudrate": 115200,
#"rtscts": 1
#},
"message_tester": {
   "ENGINE": "rapidsms.backends.bucket",
},

"safaricom-modem" : {
    "ENGINE": "rapidsms.backends.kannel",
    "host": "127.0.0.1",
    "port": 8080,
    "sendsms_url": "http://127.0.0.1:13013/cgi-bin/sendsms",
    "sendsms_params": { "smsc": "safaricom-modem",
                        "from": "+254701062068",
                        "username": "rapidsms",
                        "password": "CHANGEME"},
    "coding": 0,
    "charset": "ascii",
    "encode_errors": "ignore" },

 #  "email": {
                    # "ENGINE":  "rapidsms.backends.email",
                    # "smtp_host": "smtp.gmail.com",
                     #"smtp_port": 587,
                    # "imap_host": "imap.gmail.com",
                    # "imap_port": 993,
                    # "username": "kemricdc.rapidsms@gmail.com",
                    # "password": "P@55w0rd123",
                   #  "use_tls":  "True"},

}

to help you get started quickly, many django/rapidsms apps are enabled

by default. you may wish to remove some and/or add your own.

INSTALLED_APPS = [

# the essentials.
"django_nose",
"djtables",
"rapidsms",
"rapidsms_httprouter",
"eav",
"uni_form",
"django_digest",
"rapidsms_xforms",
"mileage",

# common dependencies (which don't clutter up the ui).
"rapidsms.contrib.handlers",
"rapidsms.contrib.ajax",

# enable the django admin using a little shim app (which includes
# the required urlpatterns), and a bunch of undocumented apps that
# the AdminSite seems to explode without.
"django.contrib.sites",
"django.contrib.auth",
"django.contrib.admin",
"django.contrib.sessions",
"django.contrib.contenttypes",

# the rapidsms contrib apps.
"rapidsms.contrib.default",
"rapidsms.contrib.export",
"rapidsms.contrib.httptester",
"rapidsms.contrib.locations",
"rapidsms.contrib.messagelog",
"rapidsms.contrib.messaging",
"rapidsms.contrib.registration",
"rapidsms.contrib.scheduler",
"rapidsms.contrib.echo",

]

this rapidsms-specific setting defines which views are linked by the

tabbed navigation. when adding an app to INSTALLED_APPS, you may wish

to add it here, also, to expose it in the rapidsms ui.

RAPIDSMS_TABS = [ ("rapidsms.contrib.messagelog.views.message_log", "Message Log"), ("rapidsms.contrib.registration.views.registration", "Registration"), ("rapidsms.contrib.messaging.views.messaging", "Messaging"), ("rapidsms.contrib.locations.views.locations", "Map"), ("rapidsms.contrib.scheduler.views.index", "Event Scheduler"), ("rapidsms.contrib.httptester.views.generate_identity", "Message Tester"), ("httprouter-console", "Console"), ('xforms', 'XForms') ]

--------------------------------------------------------------------

BORING CONFIGURATION

--------------------------------------------------------------------

Time Zone Settings

TIME_ZONE = "Africa/Nairobi"

debug mode is turned on as default, since rapidsms is under heavy

development at the moment, and full stack traces are very useful

when reporting bugs. don't forget to turn this off in production.

DEBUG = TEMPLATE_DEBUG = True

after login (which is handled by django.contrib.auth), redirect to the

dashboard rather than 'accounts/profile' (the default).

LOGIN_REDIRECT_URL = "/"

set our login url to match RapidSMS; url patterns

LOGIN_URL="/account/login"

use django-nose to run tests. rapidsms contains lots of packages and

modules which django does not find automatically, and importing them

all manually is tiresome and error-prone.

TEST_RUNNER = "django_nose.NoseTestSuiteRunner"

for some reason this setting is blank in django's global_settings.py,

but it is needed for static assets to be linkable.

MEDIA_URL = "/static/"

If you are going to use XForms with ODK collect or another XForms

client,you need to #specify your host in your settings as well XFORMS_HOST = 'www.rapidsms-server.com'

this is required for the django.contrib.sites tests to run, but also

not included in global_settings.py, and is almost always 1.

see: http://docs.djangoproject.com/en/dev/ref/contrib/sites/

SITE_ID = 1

the default log settings are very noisy.

LOG_LEVEL = "DEBUG" LOG_FILE = "rapidsms.log" LOG_FORMAT = "[%(name)s]: %(message)s" LOG_SIZE = 8192 # 8192 bits = 8 kb LOG_BACKUPS = 256 # number of logs to keep

these weird dependencies should be handled by their respective apps,

but they're not, so here they are. most of them are for django admin.

TEMPLATE_CONTEXT_PROCESSORS = [ "django.core.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.core.context_processors.request", ]

--------------------------------------------------------------------

HERE BE DRAGONS!

these settings are pure hackery, and will go away soon

--------------------------------------------------------------------

rapidsms-httprouter also only pulls in the applications you specify for

SMS handling.

This lets you use the models from existing SMS application.So you'll need

to add an SMS_APPS list to your settings.py #

SMS_APPS = [

"myproject",

]

these apps should not be started by rapidsms in your tests, however,

the models and bootstrap will still be available through django.

TEST_EXCLUDED_APPS = [ "django.contrib.sessions", "django.contrib.contenttypes", "django.contrib.auth", "rapidsms", "rapidsms.contrib.ajax", "rapidsms.contrib.httptester", ]

the project-level url patterns

ROOT_URLCONF = "urls"

since we might hit the database from any thread during testing, the

in-memory sqlite database isn't sufficient. it spawns a separate

virtual database for each thread, and syncdb is only called for the

first. this leads to confusing "no such table" errors. We create

a named temporary instance instead.

import os import tempfile import sys

if 'test' in sys.argv: for db_name in DATABASES: DATABASES[db_name]['TEST_NAME'] = os.path.join( tempfile.gettempdir(), "%s.rapidsms.test.sqlite3" % db_name)

this is my url.py

from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',

Example:

# (r'^my-project/', include('my_project.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

(r'^admin/', include(admin.site.urls)),

# RapidSMS core URLs
(r'^account/', include('rapidsms.urls.login_logout')),
url(r'^$', 'rapidsms.views.dashboard', name='rapidsms-dashboard'),
('', include('rapidsms_httprouter.urls')),
('', include('rapidsms_xforms.urls')),

# RapidSMS contrib app URLs
(r'^ajax/', include('rapidsms.contrib.ajax.urls')),
(r'^export/', include('rapidsms.contrib.export.urls')),
(r'^httptester/', include('rapidsms.contrib.httptester.urls')),
(r'^locations/', include('rapidsms.contrib.locations.urls')),
(r'^messagelog/', include('rapidsms.contrib.messagelog.urls')),
(r'^messaging/', include('rapidsms.contrib.messaging.urls')),
(r'^registration/', include('rapidsms.contrib.registration.urls')),
(r'^scheduler/', include('rapidsms.contrib.scheduler.urls')),

)

if settings.DEBUG: urlpatterns += patterns('',

helper URLs file that automatically serves the 'static' folder in

    # INSTALLED_APPS via the Django static media server (NOT for use in
    # production)
    (r'^', include('rapidsms.urls.static_media')),
)

On Sat, Jun 9, 2012 at 2:16 AM, David McCann < reply@reply.github.com

wrote:

What do your main urls.py and settings.py look like? Possible it's some sort of wiring problem. Are you getting any errors from kannel now when it opens the new url? What is the response it gets? It should be a json object echoing the message contents.

On Fri, Jun 8, 2012 at 2:25 AM, sosewe < reply@reply.github.com

wrote:

am still not getting my way withi this even after implementing the changes,any other idea ?


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6195446


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6215077

stephen osewe websys software solutions www.websysltd.com +254-721-765 824 info@websysltd.com

thedavidmccann commented 12 years ago

Everything here seems okay...it's difficult to diagnose further for me from here. Can you try one more thing? Point your browser at:

http://:<your port>/router/receive/?backend=safaricom-modem&sender=8675309&message=test

And see what the response is from the server, and what shows up in the message log? If you get a response with a json body, the rapidsms-httprouter is at least working properly.

On Mon, Jun 11, 2012 at 1:48 AM, sosewe < reply@reply.github.com

wrote:

Let me send you a copy of my settings.py

settings.py

!/usr/bin/env python

vim: ai ts=4 sts=4 et sw=4

encoding=utf-8

--------------------------------------------------------------------

MAIN CONFIGURATION

--------------------------------------------------------------------

you should configure your database here before doing any real work.

see: http://docs.djangoproject.com/en/dev/ref/settings/#databases

DATABASES = { "default": {

"ENGINE": "django.db.backends.sqlite3",

   "ENGINE": "django.db.backends.mysql",
   #"NAME": "rapidsms.sqlite3",
   "NAME": "RapidsmsDB",
   "HOST":"localhost",
   "PASSWORD":"admin",

} }

the rapidsms backend configuration is designed to resemble django's

database configuration, as a nested dict of (name, configuration).

#

the ENGINE option specifies the module of the backend; the most common

backend types (for a GSM modem or an SMPP server) are bundled with

rapidsms, but you may choose to write your own.

#

all other options are passed to the Backend when it is instantiated,

to configure it. see the documentation in those modules for a list of

the valid options for each.

INSTALLED_BACKENDS = {

"safaricom": {

  #"ENGINE": "rapidsms.backends.gsm",
  #"PORT": "/dev/ttyUSB0",
  #"baudrate": 115200,

"rtscts": 1

},

"message_tester": { "ENGINE": "rapidsms.backends.bucket", },

"safaricom-modem" : { "ENGINE": "rapidsms.backends.kannel", "host": "127.0.0.1", "port": 8080, "sendsms_url": "http://127.0.0.1:13013/cgi-bin/sendsms", "sendsms_params": { "smsc": "safaricom-modem", "from": "+254701062068", "username": "rapidsms", "password": "CHANGEME"}, "coding": 0, "charset": "ascii", "encode_errors": "ignore" },

#  "email": {
                   # "ENGINE":  "rapidsms.backends.email",
                   # "smtp_host": "smtp.gmail.com",
                    #"smtp_port": 587,
                   # "imap_host": "imap.gmail.com",
                   # "imap_port": 993,
                   # "username": "kemricdc.rapidsms@gmail.com",
                   # "password": "P@55w0rd123",
                  #  "use_tls":  "True"},

}

to help you get started quickly, many django/rapidsms apps are enabled

by default. you may wish to remove some and/or add your own.

INSTALLED_APPS = [

the essentials.

"django_nose", "djtables", "rapidsms", "rapidsms_httprouter", "eav", "uni_form", "django_digest", "rapidsms_xforms", "mileage",

common dependencies (which don't clutter up the ui).

"rapidsms.contrib.handlers", "rapidsms.contrib.ajax",

enable the django admin using a little shim app (which includes

the required urlpatterns), and a bunch of undocumented apps that

the AdminSite seems to explode without.

"django.contrib.sites", "django.contrib.auth", "django.contrib.admin", "django.contrib.sessions", "django.contrib.contenttypes",

the rapidsms contrib apps.

"rapidsms.contrib.default", "rapidsms.contrib.export", "rapidsms.contrib.httptester", "rapidsms.contrib.locations", "rapidsms.contrib.messagelog", "rapidsms.contrib.messaging", "rapidsms.contrib.registration", "rapidsms.contrib.scheduler", "rapidsms.contrib.echo", ]

this rapidsms-specific setting defines which views are linked by the

tabbed navigation. when adding an app to INSTALLED_APPS, you may wish

to add it here, also, to expose it in the rapidsms ui.

RAPIDSMS_TABS = [ ("rapidsms.contrib.messagelog.views.message_log", "Message Log"), ("rapidsms.contrib.registration.views.registration", "Registration"), ("rapidsms.contrib.messaging.views.messaging", "Messaging"), ("rapidsms.contrib.locations.views.locations", "Map"), ("rapidsms.contrib.scheduler.views.index", "Event Scheduler"), ("rapidsms.contrib.httptester.views.generate_identity", "Message Tester"), ("httprouter-console", "Console"), ('xforms', 'XForms') ]

--------------------------------------------------------------------

BORING CONFIGURATION

--------------------------------------------------------------------

Time Zone Settings

TIME_ZONE = "Africa/Nairobi"

debug mode is turned on as default, since rapidsms is under heavy

development at the moment, and full stack traces are very useful

when reporting bugs. don't forget to turn this off in production.

DEBUG = TEMPLATE_DEBUG = True

after login (which is handled by django.contrib.auth), redirect to the

dashboard rather than 'accounts/profile' (the default).

LOGIN_REDIRECT_URL = "/"

set our login url to match RapidSMS; url patterns

LOGIN_URL="/account/login"

use django-nose to run tests. rapidsms contains lots of packages and

modules which django does not find automatically, and importing them

all manually is tiresome and error-prone.

TEST_RUNNER = "django_nose.NoseTestSuiteRunner"

for some reason this setting is blank in django's global_settings.py,

but it is needed for static assets to be linkable.

MEDIA_URL = "/static/"

If you are going to use XForms with ODK collect or another XForms

client,you need to #specify your host in your settings as well XFORMS_HOST = 'www.rapidsms-server.com'

this is required for the django.contrib.sites tests to run, but also

not included in global_settings.py, and is almost always 1.

see: http://docs.djangoproject.com/en/dev/ref/contrib/sites/

SITE_ID = 1

the default log settings are very noisy.

LOG_LEVEL = "DEBUG" LOG_FILE = "rapidsms.log" LOG_FORMAT = "[%(name)s]: %(message)s" LOG_SIZE = 8192 # 8192 bits = 8 kb LOG_BACKUPS = 256 # number of logs to keep

these weird dependencies should be handled by their respective apps,

but they're not, so here they are. most of them are for django admin.

TEMPLATE_CONTEXT_PROCESSORS = [ "django.core.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.core.context_processors.request", ]

--------------------------------------------------------------------

HERE BE DRAGONS!

these settings are pure hackery, and will go away soon

--------------------------------------------------------------------

rapidsms-httprouter also only pulls in the applications you specify for

SMS handling.

This lets you use the models from existing SMS application.So you'll need

to add an SMS_APPS list to your settings.py #

SMS_APPS = [

"myproject",

]

these apps should not be started by rapidsms in your tests, however,

the models and bootstrap will still be available through django.

TEST_EXCLUDED_APPS = [ "django.contrib.sessions", "django.contrib.contenttypes", "django.contrib.auth", "rapidsms", "rapidsms.contrib.ajax", "rapidsms.contrib.httptester", ]

the project-level url patterns

ROOT_URLCONF = "urls"

since we might hit the database from any thread during testing, the

in-memory sqlite database isn't sufficient. it spawns a separate

virtual database for each thread, and syncdb is only called for the

first. this leads to confusing "no such table" errors. We create

a named temporary instance instead.

import os import tempfile import sys

if 'test' in sys.argv: for db_name in DATABASES: DATABASES[db_name]['TEST_NAME'] = os.path.join( tempfile.gettempdir(), "%s.rapidsms.test.sqlite3" % db_name)

this is my url.py

from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',

Example:

(r'^my-project/', include('my_project.foo.urls')),

Uncomment the admin/doc line below to enable admin documentation:

(r'^admin/doc/', include('django.contrib.admindocs.urls')),

(r'^admin/', include(admin.site.urls)),

RapidSMS core URLs

(r'^account/', include('rapidsms.urls.login_logout')), url(r'^$', 'rapidsms.views.dashboard', name='rapidsms-dashboard'), ('', include('rapidsms_httprouter.urls')), ('', include('rapidsms_xforms.urls')),

RapidSMS contrib app URLs

(r'^ajax/', include('rapidsms.contrib.ajax.urls')), (r'^export/', include('rapidsms.contrib.export.urls')), (r'^httptester/', include('rapidsms.contrib.httptester.urls')), (r'^locations/', include('rapidsms.contrib.locations.urls')), (r'^messagelog/', include('rapidsms.contrib.messagelog.urls')), (r'^messaging/', include('rapidsms.contrib.messaging.urls')), (r'^registration/', include('rapidsms.contrib.registration.urls')), (r'^scheduler/', include('rapidsms.contrib.scheduler.urls')), )

if settings.DEBUG: urlpatterns += patterns('',

helper URLs file that automatically serves the 'static' folder in

   # INSTALLED_APPS via the Django static media server (NOT for use in
   # production)
   (r'^', include('rapidsms.urls.static_media')),

)

On Sat, Jun 9, 2012 at 2:16 AM, David McCann < reply@reply.github.com

wrote:

What do your main urls.py and settings.py look like? Possible it's some sort of wiring problem. Are you getting any errors from kannel now when it opens the new url? What is the response it gets? It should be a json object echoing the message contents.

On Fri, Jun 8, 2012 at 2:25 AM, sosewe < reply@reply.github.com

wrote:

am still not getting my way withi this even after implementing the changes,any other idea ?


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6195446


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6215077

stephen osewe websys software solutions www.websysltd.com +254-721-765 824 info@websysltd.com


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6235786

sosewe commented 12 years ago

How can you make python listen to port 8081 ?

On Mon, Jun 18, 2012 at 5:31 PM, David McCann < reply@reply.github.com

wrote:

Everything here seems okay...it's difficult to diagnose further for me from here. Can you try one more thing? Point your browser at:

http://:<your port>/router/receive/?backend=safaricom-modem&sender=8675309&message=test

And see what the response is from the server, and what shows up in the message log? If you get a response with a json body, the rapidsms-httprouter is at least working properly.

On Mon, Jun 11, 2012 at 1:48 AM, sosewe < reply@reply.github.com

wrote:

Let me send you a copy of my settings.py

settings.py

!/usr/bin/env python

vim: ai ts=4 sts=4 et sw=4

encoding=utf-8

--------------------------------------------------------------------

MAIN CONFIGURATION

--------------------------------------------------------------------

you should configure your database here before doing any real work.

see: http://docs.djangoproject.com/en/dev/ref/settings/#databases

DATABASES = { "default": {

"ENGINE": "django.db.backends.sqlite3",

   "ENGINE": "django.db.backends.mysql",
   #"NAME": "rapidsms.sqlite3",
   "NAME": "RapidsmsDB",
   "HOST":"localhost",
   "PASSWORD":"admin",

} }

the rapidsms backend configuration is designed to resemble django's

database configuration, as a nested dict of (name, configuration).

#

the ENGINE option specifies the module of the backend; the most common

backend types (for a GSM modem or an SMPP server) are bundled with

rapidsms, but you may choose to write your own.

#

all other options are passed to the Backend when it is instantiated,

to configure it. see the documentation in those modules for a list of

the valid options for each.

INSTALLED_BACKENDS = {

"safaricom": {

  #"ENGINE": "rapidsms.backends.gsm",
  #"PORT": "/dev/ttyUSB0",
  #"baudrate": 115200,

"rtscts": 1

},

"message_tester": { "ENGINE": "rapidsms.backends.bucket", },

"safaricom-modem" : { "ENGINE": "rapidsms.backends.kannel", "host": "127.0.0.1", "port": 8080, "sendsms_url": "http://127.0.0.1:13013/cgi-bin/sendsms", "sendsms_params": { "smsc": "safaricom-modem", "from": "+254701062068", "username": "rapidsms", "password": "CHANGEME"}, "coding": 0, "charset": "ascii", "encode_errors": "ignore" },

#  "email": {
                   # "ENGINE":  "rapidsms.backends.email",
                   # "smtp_host": "smtp.gmail.com",
                    #"smtp_port": 587,
                   # "imap_host": "imap.gmail.com",
                   # "imap_port": 993,
                   # "username": "kemricdc.rapidsms@gmail.com",
                   # "password": "P@55w0rd123",
                  #  "use_tls":  "True"},

}

to help you get started quickly, many django/rapidsms apps are enabled

by default. you may wish to remove some and/or add your own.

INSTALLED_APPS = [

the essentials.

"django_nose", "djtables", "rapidsms", "rapidsms_httprouter", "eav", "uni_form", "django_digest", "rapidsms_xforms", "mileage",

common dependencies (which don't clutter up the ui).

"rapidsms.contrib.handlers", "rapidsms.contrib.ajax",

enable the django admin using a little shim app (which includes

the required urlpatterns), and a bunch of undocumented apps that

the AdminSite seems to explode without.

"django.contrib.sites", "django.contrib.auth", "django.contrib.admin", "django.contrib.sessions", "django.contrib.contenttypes",

the rapidsms contrib apps.

"rapidsms.contrib.default", "rapidsms.contrib.export", "rapidsms.contrib.httptester", "rapidsms.contrib.locations", "rapidsms.contrib.messagelog", "rapidsms.contrib.messaging", "rapidsms.contrib.registration", "rapidsms.contrib.scheduler", "rapidsms.contrib.echo", ]

this rapidsms-specific setting defines which views are linked by the

tabbed navigation. when adding an app to INSTALLED_APPS, you may wish

to add it here, also, to expose it in the rapidsms ui.

RAPIDSMS_TABS = [ ("rapidsms.contrib.messagelog.views.message_log", "Message Log"), ("rapidsms.contrib.registration.views.registration", "Registration"), ("rapidsms.contrib.messaging.views.messaging", "Messaging"), ("rapidsms.contrib.locations.views.locations", "Map"), ("rapidsms.contrib.scheduler.views.index", "Event Scheduler"), ("rapidsms.contrib.httptester.views.generate_identity", "Message Tester"), ("httprouter-console", "Console"), ('xforms', 'XForms') ]

--------------------------------------------------------------------

BORING CONFIGURATION

--------------------------------------------------------------------

Time Zone Settings

TIME_ZONE = "Africa/Nairobi"

debug mode is turned on as default, since rapidsms is under heavy

development at the moment, and full stack traces are very useful

when reporting bugs. don't forget to turn this off in production.

DEBUG = TEMPLATE_DEBUG = True

after login (which is handled by django.contrib.auth), redirect to the

dashboard rather than 'accounts/profile' (the default).

LOGIN_REDIRECT_URL = "/"

set our login url to match RapidSMS; url patterns

LOGIN_URL="/account/login"

use django-nose to run tests. rapidsms contains lots of packages and

modules which django does not find automatically, and importing them

all manually is tiresome and error-prone.

TEST_RUNNER = "django_nose.NoseTestSuiteRunner"

for some reason this setting is blank in django's global_settings.py,

but it is needed for static assets to be linkable.

MEDIA_URL = "/static/"

If you are going to use XForms with ODK collect or another XForms

client,you need to #specify your host in your settings as well XFORMS_HOST = 'www.rapidsms-server.com'

this is required for the django.contrib.sites tests to run, but also

not included in global_settings.py, and is almost always 1.

see: http://docs.djangoproject.com/en/dev/ref/contrib/sites/

SITE_ID = 1

the default log settings are very noisy.

LOG_LEVEL = "DEBUG" LOG_FILE = "rapidsms.log" LOG_FORMAT = "[%(name)s]: %(message)s" LOG_SIZE = 8192 # 8192 bits = 8 kb LOG_BACKUPS = 256 # number of logs to keep

these weird dependencies should be handled by their respective apps,

but they're not, so here they are. most of them are for django admin.

TEMPLATE_CONTEXT_PROCESSORS = [ "django.core.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.core.context_processors.request", ]

--------------------------------------------------------------------

HERE BE DRAGONS!

these settings are pure hackery, and will go away soon

--------------------------------------------------------------------

rapidsms-httprouter also only pulls in the applications you specify for

SMS handling.

This lets you use the models from existing SMS application.So you'll

need to add an SMS_APPS list to your settings.py #

SMS_APPS = [

"myproject",

]

these apps should not be started by rapidsms in your tests, however,

the models and bootstrap will still be available through django.

TEST_EXCLUDED_APPS = [ "django.contrib.sessions", "django.contrib.contenttypes", "django.contrib.auth", "rapidsms", "rapidsms.contrib.ajax", "rapidsms.contrib.httptester", ]

the project-level url patterns

ROOT_URLCONF = "urls"

since we might hit the database from any thread during testing, the

in-memory sqlite database isn't sufficient. it spawns a separate

virtual database for each thread, and syncdb is only called for the

first. this leads to confusing "no such table" errors. We create

a named temporary instance instead.

import os import tempfile import sys

if 'test' in sys.argv: for db_name in DATABASES: DATABASES[db_name]['TEST_NAME'] = os.path.join( tempfile.gettempdir(), "%s.rapidsms.test.sqlite3" % db_name)

this is my url.py


from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',

Example:

(r'^my-project/', include('my_project.foo.urls')),

Uncomment the admin/doc line below to enable admin documentation:

(r'^admin/doc/', include('django.contrib.admindocs.urls')),

(r'^admin/', include(admin.site.urls)),

RapidSMS core URLs

(r'^account/', include('rapidsms.urls.login_logout')), url(r'^$', 'rapidsms.views.dashboard', name='rapidsms-dashboard'), ('', include('rapidsms_httprouter.urls')), ('', include('rapidsms_xforms.urls')),

RapidSMS contrib app URLs

(r'^ajax/', include('rapidsms.contrib.ajax.urls')), (r'^export/', include('rapidsms.contrib.export.urls')), (r'^httptester/', include('rapidsms.contrib.httptester.urls')), (r'^locations/', include('rapidsms.contrib.locations.urls')), (r'^messagelog/', include('rapidsms.contrib.messagelog.urls')), (r'^messaging/', include('rapidsms.contrib.messaging.urls')), (r'^registration/', include('rapidsms.contrib.registration.urls')), (r'^scheduler/', include('rapidsms.contrib.scheduler.urls')), )

if settings.DEBUG: urlpatterns += patterns('',

helper URLs file that automatically serves the 'static' folder

in

INSTALLED_APPS via the Django static media server (NOT for use

in

production)

   (r'^', include('rapidsms.urls.static_media')),

)

On Sat, Jun 9, 2012 at 2:16 AM, David McCann < reply@reply.github.com

wrote:

What do your main urls.py and settings.py look like? Possible it's some sort of wiring problem. Are you getting any errors from kannel now when it opens the new url? What is the response it gets? It should be a json object echoing the message contents.

On Fri, Jun 8, 2012 at 2:25 AM, sosewe < reply@reply.github.com

wrote:

am still not getting my way withi this even after implementing the changes,any other idea ?


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6195446


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6215077

stephen osewe websys software solutions www.websysltd.com +254-721-765 824 info@websysltd.com


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6235786


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6397312

stephen osewe websys software solutions www.websysltd.com +254-721-765 824 info@websysltd.com

sosewe commented 12 years ago

HI David,

Check out this feedback I got;

{"status": "Message handled.", "message": {"status": "H", "direction": "I", "contact": "8675309", "date": "2012-06-19T15:33:47.963550", "text": "test", "id": 2, "backend": "safaricom-modem"}, "responses": []}

Its a JSON response

On Tue, Jun 19, 2012 at 10:55 AM, stephen osewe stephenosewe@gmail.comwrote:

How can you make python listen to port 8081 ?

On Mon, Jun 18, 2012 at 5:31 PM, David McCann < reply@reply.github.com

wrote:

Everything here seems okay...it's difficult to diagnose further for me from here. Can you try one more thing? Point your browser at:

http://:<your port>/router/receive/?backend=safaricom-modem&sender=8675309&message=test

And see what the response is from the server, and what shows up in the message log? If you get a response with a json body, the rapidsms-httprouter is at least working properly.

On Mon, Jun 11, 2012 at 1:48 AM, sosewe < reply@reply.github.com

wrote:

Let me send you a copy of my settings.py

settings.py

!/usr/bin/env python

vim: ai ts=4 sts=4 et sw=4

encoding=utf-8

--------------------------------------------------------------------

MAIN CONFIGURATION

--------------------------------------------------------------------

you should configure your database here before doing any real work.

see: http://docs.djangoproject.com/en/dev/ref/settings/#databases

DATABASES = { "default": {

"ENGINE": "django.db.backends.sqlite3",

   "ENGINE": "django.db.backends.mysql",
   #"NAME": "rapidsms.sqlite3",
   "NAME": "RapidsmsDB",
   "HOST":"localhost",
   "PASSWORD":"admin",

} }

the rapidsms backend configuration is designed to resemble django's

database configuration, as a nested dict of (name, configuration).

#

the ENGINE option specifies the module of the backend; the most common

backend types (for a GSM modem or an SMPP server) are bundled with

rapidsms, but you may choose to write your own.

#

all other options are passed to the Backend when it is instantiated,

to configure it. see the documentation in those modules for a list of

the valid options for each.

INSTALLED_BACKENDS = {

"safaricom": {

  #"ENGINE": "rapidsms.backends.gsm",
  #"PORT": "/dev/ttyUSB0",
  #"baudrate": 115200,

"rtscts": 1

},

"message_tester": { "ENGINE": "rapidsms.backends.bucket", },

"safaricom-modem" : { "ENGINE": "rapidsms.backends.kannel", "host": "127.0.0.1", "port": 8080, "sendsms_url": "http://127.0.0.1:13013/cgi-bin/sendsms", "sendsms_params": { "smsc": "safaricom-modem", "from": "+254701062068", "username": "rapidsms", "password": "CHANGEME"}, "coding": 0, "charset": "ascii", "encode_errors": "ignore" },

#  "email": {
                   # "ENGINE":  "rapidsms.backends.email",
                   # "smtp_host": "smtp.gmail.com",
                    #"smtp_port": 587,
                   # "imap_host": "imap.gmail.com",
                   # "imap_port": 993,
                   # "username": "kemricdc.rapidsms@gmail.com",
                   # "password": "P@55w0rd123",
                  #  "use_tls":  "True"},

}

to help you get started quickly, many django/rapidsms apps are enabled

by default. you may wish to remove some and/or add your own.

INSTALLED_APPS = [

the essentials.

"django_nose", "djtables", "rapidsms", "rapidsms_httprouter", "eav", "uni_form", "django_digest", "rapidsms_xforms", "mileage",

common dependencies (which don't clutter up the ui).

"rapidsms.contrib.handlers", "rapidsms.contrib.ajax",

enable the django admin using a little shim app (which includes

the required urlpatterns), and a bunch of undocumented apps that

the AdminSite seems to explode without.

"django.contrib.sites", "django.contrib.auth", "django.contrib.admin", "django.contrib.sessions", "django.contrib.contenttypes",

the rapidsms contrib apps.

"rapidsms.contrib.default", "rapidsms.contrib.export", "rapidsms.contrib.httptester", "rapidsms.contrib.locations", "rapidsms.contrib.messagelog", "rapidsms.contrib.messaging", "rapidsms.contrib.registration", "rapidsms.contrib.scheduler", "rapidsms.contrib.echo", ]

this rapidsms-specific setting defines which views are linked by the

tabbed navigation. when adding an app to INSTALLED_APPS, you may wish

to add it here, also, to expose it in the rapidsms ui.

RAPIDSMS_TABS = [ ("rapidsms.contrib.messagelog.views.message_log", "Message Log"), ("rapidsms.contrib.registration.views.registration", "Registration"), ("rapidsms.contrib.messaging.views.messaging", "Messaging"), ("rapidsms.contrib.locations.views.locations", "Map"), ("rapidsms.contrib.scheduler.views.index", "Event Scheduler"), ("rapidsms.contrib.httptester.views.generate_identity", "Message Tester"), ("httprouter-console", "Console"), ('xforms', 'XForms') ]

--------------------------------------------------------------------

BORING CONFIGURATION

--------------------------------------------------------------------

Time Zone Settings

TIME_ZONE = "Africa/Nairobi"

debug mode is turned on as default, since rapidsms is under heavy

development at the moment, and full stack traces are very useful

when reporting bugs. don't forget to turn this off in production.

DEBUG = TEMPLATE_DEBUG = True

after login (which is handled by django.contrib.auth), redirect to the

dashboard rather than 'accounts/profile' (the default).

LOGIN_REDIRECT_URL = "/"

set our login url to match RapidSMS; url patterns

LOGIN_URL="/account/login"

use django-nose to run tests. rapidsms contains lots of packages and

modules which django does not find automatically, and importing them

all manually is tiresome and error-prone.

TEST_RUNNER = "django_nose.NoseTestSuiteRunner"

for some reason this setting is blank in django's global_settings.py,

but it is needed for static assets to be linkable.

MEDIA_URL = "/static/"

If you are going to use XForms with ODK collect or another XForms

client,you need to #specify your host in your settings as well XFORMS_HOST = 'www.rapidsms-server.com'

this is required for the django.contrib.sites tests to run, but also

not included in global_settings.py, and is almost always 1.

see: http://docs.djangoproject.com/en/dev/ref/contrib/sites/

SITE_ID = 1

the default log settings are very noisy.

LOG_LEVEL = "DEBUG" LOG_FILE = "rapidsms.log" LOG_FORMAT = "[%(name)s]: %(message)s" LOG_SIZE = 8192 # 8192 bits = 8 kb LOG_BACKUPS = 256 # number of logs to keep

these weird dependencies should be handled by their respective apps,

but they're not, so here they are. most of them are for django admin.

TEMPLATE_CONTEXT_PROCESSORS = [ "django.core.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.core.context_processors.request", ]

--------------------------------------------------------------------

HERE BE DRAGONS!

these settings are pure hackery, and will go away soon

--------------------------------------------------------------------

rapidsms-httprouter also only pulls in the applications you specify for

SMS handling.

This lets you use the models from existing SMS application.So you'll

need to add an SMS_APPS list to your settings.py #

SMS_APPS = [

"myproject",

]

these apps should not be started by rapidsms in your tests, however,

the models and bootstrap will still be available through django.

TEST_EXCLUDED_APPS = [ "django.contrib.sessions", "django.contrib.contenttypes", "django.contrib.auth", "rapidsms", "rapidsms.contrib.ajax", "rapidsms.contrib.httptester", ]

the project-level url patterns

ROOT_URLCONF = "urls"

since we might hit the database from any thread during testing, the

in-memory sqlite database isn't sufficient. it spawns a separate

virtual database for each thread, and syncdb is only called for the

first. this leads to confusing "no such table" errors. We create

a named temporary instance instead.

import os import tempfile import sys

if 'test' in sys.argv: for db_name in DATABASES: DATABASES[db_name]['TEST_NAME'] = os.path.join( tempfile.gettempdir(), "%s.rapidsms.test.sqlite3" % db_name)

this is my url.py


from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',

Example:

(r'^my-project/', include('my_project.foo.urls')),

Uncomment the admin/doc line below to enable admin documentation:

(r'^admin/doc/', include('django.contrib.admindocs.urls')),

(r'^admin/', include(admin.site.urls)),

RapidSMS core URLs

(r'^account/', include('rapidsms.urls.login_logout')), url(r'^$', 'rapidsms.views.dashboard', name='rapidsms-dashboard'), ('', include('rapidsms_httprouter.urls')), ('', include('rapidsms_xforms.urls')),

RapidSMS contrib app URLs

(r'^ajax/', include('rapidsms.contrib.ajax.urls')), (r'^export/', include('rapidsms.contrib.export.urls')), (r'^httptester/', include('rapidsms.contrib.httptester.urls')), (r'^locations/', include('rapidsms.contrib.locations.urls')), (r'^messagelog/', include('rapidsms.contrib.messagelog.urls')), (r'^messaging/', include('rapidsms.contrib.messaging.urls')), (r'^registration/', include('rapidsms.contrib.registration.urls')), (r'^scheduler/', include('rapidsms.contrib.scheduler.urls')), )

if settings.DEBUG: urlpatterns += patterns('',

helper URLs file that automatically serves the 'static' folder

in

INSTALLED_APPS via the Django static media server (NOT for use

in

production)

   (r'^', include('rapidsms.urls.static_media')),

)

On Sat, Jun 9, 2012 at 2:16 AM, David McCann < reply@reply.github.com

wrote:

What do your main urls.py and settings.py look like? Possible it's some sort of wiring problem. Are you getting any errors from kannel now when it opens the new url? What is the response it gets? It should be a json object echoing the message contents.

On Fri, Jun 8, 2012 at 2:25 AM, sosewe < reply@reply.github.com

wrote:

am still not getting my way withi this even after implementing the changes,any other idea ?


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6195446


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6215077

stephen osewe websys software solutions www.websysltd.com +254-721-765 824 info@websysltd.com


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6235786


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6397312

stephen osewe websys software solutions www.websysltd.com +254-721-765 824 info@websysltd.com

stephen osewe websys software solutions www.websysltd.com +254-721-765 824 info@websysltd.com

thedavidmccann commented 12 years ago

So at this point, everything is running properly from rapidsms_httprouter's perspective, provided this message also appears in the message log. From here I can only say that kannel isn't hitting your /router/receive url properly, so verifying that it is pointing to:

http://:/router/receive/?backend=safaricom-modem&sender=8675309&message=test

Would be the first test, followed by a more in-depth analysis of the logs, etc. I would also read through the django and kannel documentation, as there are lots of useful things there for getting a server set up and configured (including port numbers, etc). At this point, however, I am closing this issue, as it no longer seems to concern rapidsms_httprouter.

sosewe commented 12 years ago

Yeah,You can say that,What I have done is use the same port the server is listening in on,and that allows my messages to appear on the message log/console,problem am facing is I dont get feedback coming through to my phone,since I expect that when I send an unknown keyword it should tell me "rapidsms does not understand...blah blah...below check final result;

2012-06-19 15:42:19 [7995] [8] DEBUG: Octet string dump ends. 2012-06-19 15:42:19 [7995] [5] INFO: No reply sent, denied.

On Tue, Jun 19, 2012 at 3:45 PM, David McCann < reply@reply.github.com

wrote:

So at this point, everything is running properly from rapidsms_httprouter's perspective, provided this message also appears in the message log. From here I can only say that kannel isn't hitting your /router/receive url properly, so verifying that it is pointing to:

http://<your server>:/router/receive/?backend=safaricom-modem&sender=8675309&message=test

Would be the first test, followed by a more in-depth analysis of the logs, etc. I would also read through the django and kannel documentation, as there are lots of useful things there for getting a server set up and configured (including port numbers, etc). At this point, however, I am closing this issue, as it no longer seems to concern rapidsms_httprouter.


Reply to this email directly or view it on GitHub:

https://github.com/nyaruka/rapidsms-httprouter/issues/3#issuecomment-6423645

stephen osewe websys software solutions www.websysltd.com +254-721-765 824 info@websysltd.com