Tropo和RapidSMS集成不起作用

时间:2013-10-31 18:17:35

标签: python django heroku sms-gateway tropo

我按照http://docs.rapidsms.org/en/develop/tutorial/tutorial04.html详细说明的所有步骤使用tropo在Django的RapidSMS中发送和接收短信并将其部署在heroku上。然后我试着做两件事。

1)使用tropo发送短信 - 我注册了一个电话号码,在选择后端时,我认为Tropo(my-tropo-backend)将成为后端选择中的一个选项。但我没有看到tropo作为后端选项,只是message_tester。

2)使用tropo接收短信 - 我发送短信到我的tropo电话号码,我可以看到tropo日志中的消息,但我没有看到来自tropo日志的Django URL https://yourhost.example.com/tropo/的响应(使用乒乓球示例)。

我对RapidSMS和Tropo的Django设置如下:

INSTALLED_BACKENDS = {
    "my-tropo-backend": {
    "ENGINE": "rtropo.outgoing.TropoBackend",
    'config': {
        # Your Tropo application's outbound token for messaging (required)
        'messaging_token': '244e51db5424c3438f122753b8947dee70803dshlfhdfdsdkjfdfd455466565e8e620c05f75323c17864',
        # Your Tropo application's voice/messaging phone number, starting
        # with "+" and the country code (required)
        'number': '+1-000-200-6007',
    },
    },
    "message_tester": {
    "ENGINE": "rapidsms.backends.database.DatabaseBackend",
    },
}

urls.py有

url(r"^tropo/$",
        views.message_received,
        kwargs={'backend_name': 'my-tropo-backend'},
        name='tropo'),

和'rtropo'已添加到INSTALLED_APPS

我错过了什么,之前有人这么做并面对这个问题?请告诉我。

谢谢。

1 个答案:

答案 0 :(得分:0)

问题是我没有在Tropo设置中的URL末尾添加尾部斜杠。例: 我给了https://yourhost.example.com/tropo它应该是https://yourhost.example.com/tropo/

结尾处有斜杠,Django在添加尾部斜杠后重定向到同一个URL,这次数据是由GET而不是POST发送的。