Commits

Matthew Schinckel committed 76f68d7 Merge

Merge

Comments (0)

Files changed (5)

   * Add ``sms`` to your project's ``settings.INSTALLED_APPS``.
 
   * Run ``./manage.py migrate`` or ``./manage.py syncdb``
-  
+
+
 Configuration
 --------------
 
 There are three django models: ``sms.Message``, ``sms.Gateway``, and ``sms.Reply``.
 
-Before you are able to send any messages, you will need to configure at least one gateway. There is some sample data for some gateway providers. You can adapt one of these for your own purposes.
+Before you are able to send any messages, you will need to configure at least one gateway. Currently, there are gateways for:
+    
+* `Clickatell`_ : *clickatell*
+* `SMSGlobal`_ : *sms_global*
+* `iTagg`_ (UK only): *itagg*
+    
+To load a gateway, you use: ``./manage.py loaddata <gateway>``, where ``<gateway>`` is replaced by the term in italics above.
+
+You will then need to edit the Gateway in the admin, and add your username, password and sender id. Anything with ``__<something>__`` should be replaced with whatever value is appropriate.
+
+You will need to have registered with the gateway of your choice.
+
+.. _Clickatell: http://www.clickatell.com
+.. _SMSGlobal: http://www.smsglobal.com
+.. _iTagg: http://www.itagg.com
 
 Usage
 ------

sms/fixtures/clickatell.json

+$ django-admin.py makefixture Gateway[1] --indent=2
+[
+  {
+    "pk": null,
+    "model": "sms.gateway",
+    "fields": {
+      "check_number_response_format": null,
+      "reply_sender": "",
+      "content_keyword": "text",
+      "query_balance_response_format": "",
+      "status_msg_id": "apiMsgId",
+      "charge_keyword": "charge",
+      "success_format": "ID: (?P<gateway_message_id>.+)",
+      "base_url": "https://api.clickatell.com/http/sendmsg",
+      "reply_content": "",
+      "error_format": "",
+      "query_balance_url": "",
+      "status_status": "status",
+      "check_number_field": null,
+      "status_date": "timestamp",
+      "status_error_code": "status",
+      "recipient_keyword": "to",
+      "reply_date_format": "%Y-%m-%d %H:%M:%S",
+      "status_mapping": {
+        "002": "Sent",
+        "003": "Delivered",
+        "011": "Sent",
+        "007": "Failed",
+        "005": "Failed",
+        "004": "Delivered",
+        "009": "Failed",
+        "008": "Sent"
+      },
+      "check_number_status_mapping": null,
+      "query_balance_params": [],
+      "status_date_format": "",
+      "name": "Clickatell",
+      "settings": {
+        "from": "__SENDER_ID__",
+        "api_id": "__API_ID__",
+        "callback": "3",
+        "user": "__USERNAME__",
+        "password": "__PASSWORD__",
+        "concat": "3"
+      },
+      "check_number_url": null,
+      "reply_date": "",
+      "uuid_keyword": "climsgid"
+    }
+  }
+]

sms/fixtures/example_gateways.json

-[
-    {
-        "pk": null, 
-        "model": "sms.gateway", 
-        "fields": {
-            "content_keyword": "text", 
-            "success_format": "ID: (?P<gateway_message_id>.+)", 
-            "name": "Clickatell", 
-            "status_status": "status", 
-            "settings": {
-                "api_id": "_API_ID_", 
-                "password": "_PASSWORD_", 
-                "from": "_SENDER_ID_", 
-                "user": "_USERNAME_", 
-                "concat": "3"
-            }, 
-            "status_date": "timestamp", 
-            "reply_sender": "", 
-            "base_url": "https://api.clickatell.com/http/sendmsg", 
-            "status_error_code": "status", 
-            "reply_date": "", 
-            "recipient_keyword": "to", 
-            "status_msg_id": "apiMsgId", 
-            "reply_date_format": "%Y-%m-%d %H:%M:%S", 
-            "status_mapping": {
-                "002": "Sent",
-                "003": "Delivered",
-                "004": "Delivered",
-                "011": "Sent",
-                "008": "Sent"
-            }, 
-            "uuid_keyword": "climsgid", 
-            "reply_content": "", 
-            "status_date_format": ""
-        }
-    }, 
-    {
-        "pk": null, 
-        "model": "sms.gateway", 
-        "fields": {
-            "content_keyword": "text", 
-            "success_format": "OK: 0; .*SMSGlobalMsgID:(?P<gateway_message_id>.+)\r", 
-            "name": "SMS Global", 
-            "status_status": "dlrstatus", 
-            "settings": {
-                "from": "_SENDER_ID_", 
-                "maxsplit": "3", 
-                "api": 1, 
-                "user": "_USERNAME_", 
-                "action": "sendsms", 
-                "password": "_PASSWORD_"
-            }, 
-            "status_date": "donedate", 
-            "reply_sender": "from", 
-            "base_url": "http://www.smsglobal.com/http-api.php", 
-            "status_error_code": "dlr_err", 
-            "reply_date": "date", 
-            "recipient_keyword": "to", 
-            "status_msg_id": "msgid", 
-            "reply_date_format": "%Y-%m-%d %H:%M:%S", 
-            "status_mapping": {
-                "EXPIRED": "Failed", 
-                "UNDELIV": "Failed", 
-                "DELIVRD": "Delivered"
-            }, 
-            "uuid_keyword": "userfield", 
-            "reply_content": "msg", 
-            "status_date_format": "%y%m%d%H%M"
-        }
-    }
-]

sms/fixtures/itagg.json

+[
+    {
+        "fields": {
+            "base_url": "https://secure.itagg.com/smsg/sms.mes",
+            "content_keyword": "txt",
+            "error_format": "(?P<status_code>[0-9]+)|(?P<status_message>.+)|(?P<gateway_message_id>[a-zA-Z0-9-]+)",
+            "name": "iTagg",
+            "recipient_keyword": "to",
+            "reply_content": "",
+            "reply_date": "",
+            "reply_date_format": "%Y-%m-%d %H:%M:%S",
+            "reply_sender": "",
+            "settings": {
+                "from": "__SENDER_ID__",
+                "pwd": "__PASSWORD__",
+                "usr": "__USERNAME__"
+            },
+            "status_date": "timestamp",
+            "status_date_format": "",
+            "status_error_code": "status",
+            "status_mapping": {
+                "0": "Sent",
+                "1": "Failed",
+                "100": "Failed",
+                "101": "Failed",
+                "102": "Failed",
+                "2": "Failed",
+                "201": "Failed",
+                "202": "Failed",
+                "3": "Failed",
+                "301": "Failed"
+            },
+            "status_msg_id": "apiMsgId",
+            "status_status": "status",
+            "success_format": "(.*\n)(?P<status_code>[0-9]+)\|(?P<status_message>[^|]+)\|(?P<gateway_message_id>.+)",
+            "uuid_keyword": "climsgid"
+        },
+        "model": "sms.gateway",
+        "pk": null
+    }
+]

sms/fixtures/sms_global.json

+[
+  {
+    "pk": null,
+    "model": "sms.gateway",
+    "fields": {
+      "check_number_response_format": null,
+      "reply_sender": "from",
+      "content_keyword": "text",
+      "query_balance_response_format": null,
+      "status_msg_id": "msgid",
+      "charge_keyword": null,
+      "success_format": "OK: 0; .*SMSGlobalMsgID:(?P<gateway_message_id>.+)\r",
+      "base_url": "http://www.smsglobal.com/http-api.php",
+      "reply_content": "msg",
+      "error_format": null,
+      "query_balance_url": null,
+      "status_status": "dlrstatus",
+      "check_number_field": null,
+      "status_date": "donedate",
+      "status_error_code": "dlr_err",
+      "recipient_keyword": "to",
+      "reply_date_format": "%Y-%m-%d %H:%M:%S",
+      "status_mapping": {
+        "EXPIRED": "Failed",
+        "UNDELIV": "Failed",
+        "DELIVRD": "Delivered"
+      },
+      "check_number_status_mapping": null,
+      "query_balance_params": [],
+      "status_date_format": "%y%m%d%H%M",
+      "name": "SMS Global",
+      "settings": {
+        "from": "__SENDER_ID__",
+        "maxsplit": "3",
+        "api": 1,
+        "user": "__USERNAME__",
+        "action": "sendsms",
+        "password": "__PASSWORD__"
+      },
+      "check_number_url": null,
+      "reply_date": "date",
+      "uuid_keyword": "userfield"
+    }
+  }
+]