[PATCH] sms level delivery reports for ppg
Aarno Syvänen <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi List, here is patch for sms level dlrs for wap push. Note that receiving one does not mean that the phone has understand the push, only that it has received it. You need confirmed push if you want a guaranteed delivery (and a phone supporting it, of course). Or an application level protocol having acks of its own. Here smsbox is sending dlr to pi. This means that you must define smsbox to get push dlrs. In addition of dlr-url and dlr-mask, you must define smsbox id and ppg service name. Aarno
dlr.patch
(application/octet-stream, 31.2 KB)
Index: gw/msg.h
===================================================================
RCS file: /home/cvs/gateway/gw/msg.h,v
retrieving revision 1.13
diff -u -r1.13 msg.h
--- gw/msg.h 14 Nov 2002 02:29:25 -0000 1.13
+++ gw/msg.h 5 Mar 2003 08:49:22 -0000
@@ -36,7 +36,8 @@
mo = 0,
mt_reply = 1,
mt_push = 2,
- report = 3
+ report = 3,
+ wap_push = 4
};
/* admin commands */
Index: gw/ota_compiler.c
===================================================================
RCS file: /home/cvs/gateway/gw/ota_compiler.c,v
retrieving revision 1.3
diff -u -r1.3 ota_compiler.c
--- gw/ota_compiler.c 29 Apr 2002 12:58:00 -0000 1.3
+++ gw/ota_compiler.c 5 Mar 2003 08:49:22 -0000
@@ -3,7 +3,7 @@
* defined in Over The Air Settings Specification (hereafter called ota),
* chapter 6. (See http://www.americas.nokia.com/messaging/default.asp)
*
- * By Aarno Syvänen for Wiral Ltd
+ * By Aarno Syvänen for Wiral Ltd and for Global Networks Inc
*/
#include <ctype.h>
@@ -252,6 +252,8 @@
break;
case -1: /* Something went wrong in the parsing. */
+ warning(0, "OTA_COMPILER: bad status, probably error with"
+ " parser");
return -1;
default:
warning(0,"OTA compiler: undefined return value in a parse function.");
@@ -286,6 +288,7 @@
name = octstr_create(node->name);
if (octstr_len(name) == 0) {
octstr_destroy(name);
+ warning(0, "OTA_COMPILER: empty element name, cannot parse");
return -1;
}
@@ -358,8 +361,11 @@
else
value = NULL;
- if (value == NULL)
+ if (value == NULL) {
+ warning(0, "no value for attribute %s, cannot parse",
+ octstr_get_cstr(name));
goto error;
+ }
i = 0;
valueos = NULL;
Index: gw/smsbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsbox.c,v
retrieving revision 1.218
diff -u -r1.218 smsbox.c
--- gw/smsbox.c 4 Mar 2003 15:16:08 -0000 1.218
+++ gw/smsbox.c 5 Mar 2003 08:49:23 -0000
@@ -66,6 +66,7 @@
static Numhash *black_list;
static unsigned long max_http_retries = HTTP_MAX_RETRIES;
static unsigned long http_queue_delay = HTTP_RETRY_DELAY;
+static Octstr *ppg_service_name = NULL;
static List *smsbox_requests = NULL; /* the inbound request queue */
static List *smsbox_http_requests = NULL; /* the outbound HTTP request queue */
@@ -249,7 +250,9 @@
unsigned long retries; /* number of performed retries */
};
-
+/*
+ * Again no urltranslation when we got an answer to wap push - it can only be dlr.
+ */
static void *remember_receiver(Msg *msg, URLTranslation *trans, int method,
Octstr *url, List *headers, Octstr *body,
unsigned int retries)
@@ -262,7 +265,10 @@
receiver->msg = msg_create(sms);
receiver->msg->sms.sender = octstr_duplicate(msg->sms.sender);
receiver->msg->sms.receiver = octstr_duplicate(msg->sms.receiver);
- receiver->msg->sms.service = octstr_duplicate(urltrans_name(trans));
+ if (octstr_compare(msg->sms.service, ppg_service_name) != 0)
+ receiver->msg->sms.service = octstr_duplicate(urltrans_name(trans));
+ else
+ receiver->msg->sms.service = octstr_duplicate(msg->sms.service);
receiver->msg->sms.udhdata = NULL;
receiver->msg->sms.mclass = 0;
receiver->msg->sms.alt_dcs = 0;
@@ -1063,7 +1069,9 @@
/*
* Perform the service requested by the user: translate the request into
* a pattern, if it is an URL, start its fetch and return 0, otherwise
- * return the string in `*result' and return 1. Return -1 for errors,
+ * return the string in `*result' and return 1. Return -1 for errors.
+ * If we are translating url for ppg dlr, we do not use trans data
+ * structure defined for sms services. This is indicated by trans = NULL.
*/
static int obey_request(Octstr **result, URLTranslation *trans, Msg *msg)
{
@@ -1126,13 +1134,18 @@
}
break;
+ /*
+ * No Kannel headers when we are sending dlrs to wap push
+ */
case TRANSTYPE_GET_URL:
request_headers = http_create_empty_headers();
http_header_add(request_headers, "User-Agent", GW_NAME "/" VERSION);
- if (urltrans_send_sender(trans)) {
- http_header_add(request_headers, "X-Kannel-From",
- octstr_get_cstr(msg->sms.receiver));
- }
+ if (trans != 0) {
+ if (urltrans_send_sender(trans)) {
+ http_header_add(request_headers, "X-Kannel-From",
+ octstr_get_cstr(msg->sms.receiver));
+ }
+ }
id = remember_receiver(msg, trans, HTTP_METHOD_GET, pattern, request_headers, NULL, 0);
http_start_request(caller, HTTP_METHOD_GET, pattern, request_headers,
@@ -1489,8 +1502,13 @@
reply_msg->ack.time = msg->sms.time;
reply_msg->ack.id = msg->sms.id;
+ /* no smsbox services when we are doing ppg dlr - so trans would be
+ * NULL in this case.*/
if (dreport) {
- trans = urltrans_find_service(translations, msg);
+ if (octstr_compare(msg->sms.service, ppg_service_name) != 0)
+ trans = urltrans_find_service(translations, msg);
+ else
+ trans = NULL;
info(0, "Starting delivery report <%s> from <%s>",
octstr_get_cstr(msg->sms.service),
@@ -3010,6 +3028,14 @@
}
}
+/*
+ * Reading the name we are using for ppg services from ppg core group
+ */
+ if ((grp = cfg_get_single_group(cfg, octstr_imm("ppg"))) != NULL) {
+ if ((ppg_service_name = cfg_get(grp, octstr_imm("service-name"))) == NULL)
+ ppg_service_name = octstr_format("%s", "ppg");
+ }
+
if (http_proxy_host != NULL && http_proxy_port > 0) {
http_use_proxy(http_proxy_host, http_proxy_port,
http_proxy_exceptions, http_proxy_username,
@@ -3132,7 +3158,8 @@
octstr_destroy(reply_requestfailed);
octstr_destroy(reply_couldnotfetch);
octstr_destroy(reply_couldnotrepresent);
- octstr_destroy(sendsms_interface);
+ octstr_destroy(sendsms_interface);
+ octstr_destroy(ppg_service_name);
numhash_destroy(black_list);
numhash_destroy(white_list);
cfg_destroy(cfg);
Index: gw/urltrans.c
===================================================================
RCS file: /home/cvs/gateway/gw/urltrans.c,v
retrieving revision 1.81
diff -u -r1.81 urltrans.c
--- gw/urltrans.c 5 Feb 2003 23:17:45 -0000 1.81
+++ gw/urltrans.c 5 Mar 2003 08:49:23 -0000
@@ -284,7 +284,10 @@
}
-
+/*
+ * Trans being NULL means that we are servicing ppg (doing dlr, but this does not
+ * concern us here).
+ */
Octstr *urltrans_get_pattern(URLTranslation *t, Msg *request)
{
Octstr *enc;
@@ -326,7 +329,7 @@
pattern = url;
if (octstr_len(pattern) == 0) {
- if (octstr_len(t->dlr_url)) {
+ if (t && octstr_len(t->dlr_url)) {
pattern = t->dlr_url;
} else {
list_destroy(word_list, octstr_destroy_item);
@@ -552,7 +555,7 @@
* this SHOULD be done in smsbox, not here, but well,
* much easier to do here
*/
- if ( (t->type == TRANSTYPE_POST_URL || t->type == TRANSTYPE_POST_XML)
+ if (t && (t->type == TRANSTYPE_POST_URL || t->type == TRANSTYPE_POST_XML)
&& t->strip_keyword)
strip_keyword(request);
Index: gw/wap_ppg_push_machine.def
===================================================================
RCS file: /home/cvs/gateway/gw/wap_ppg_push_machine.def,v
retrieving revision 1.5
diff -u -r1.5 wap_ppg_push_machine.def
--- gw/wap_ppg_push_machine.def 13 Feb 2003 10:31:36 -0000 1.5
+++ gw/wap_ppg_push_machine.def 5 Mar 2003 08:49:23 -0000
@@ -30,6 +30,9 @@
*
* j) Smsc used for pushing
*
+ * k) fields used for delivery reports: dlr_url, dlr_mask, smsbox_id,
+ * service_name
+ *
* By Aarno Syvänen for Wapit Ltd, for Wiral Ltd and for Global Networks Inc
*/
@@ -74,6 +77,10 @@
PPG */
INTEGER(trusted)
OPTIONAL_OCTSTR(smsc_id) /* smsc used for pushes */
+ OPTIONAL_OCTSTR(dlr_url) /* for delivery reports */
+ INTEGER(dlr_mask)
+ OPTIONAL_OCTSTR(smsbox_id)
+ OPTIONAL_OCTSTR(service_name)
)
#undef MACHINE
Index: gw/wap_push_ota.c
===================================================================
RCS file: /home/cvs/gateway/gw/wap_push_ota.c,v
retrieving revision 1.17
diff -u -r1.17 wap_push_ota.c
--- gw/wap_push_ota.c 13 Feb 2003 10:32:01 -0000 1.17
+++ gw/wap_push_ota.c 5 Mar 2003 08:49:23 -0000
@@ -220,6 +220,20 @@
octstr_duplicate(e->u.Pom_SessionRequest_Req.smsc_id);
else
wsp_event->u.S_Unit_Push_Req.smsc_id = NULL;
+ if (e->u.Pom_SessionRequest_Req.dlr_url != NULL)
+ wsp_event->u.S_Unit_Push_Req.dlr_url =
+ octstr_duplicate(e->u.Pom_SessionRequest_Req.dlr_url);
+ else
+ wsp_event->u.S_Unit_Push_Req.dlr_url = NULL;
+ wsp_event->u.S_Unit_Push_Req.dlr_mask = e->u.Pom_SessionRequest_Req.dlr_mask;
+ if (e->u.Pom_SessionRequest_Req.smsbox_id != NULL)
+ wsp_event->u.S_Unit_Push_Req.smsbox_id =
+ octstr_duplicate(e->u.Pom_SessionRequest_Req.smsbox_id);
+ else
+ wsp_event->u.S_Unit_Push_Req.smsbox_id = NULL;
+ wsp_event->u.S_Unit_Push_Req.service_name =
+ octstr_duplicate(e->u.Pom_SessionRequest_Req.service_name);
+
wsp_event->u.S_Unit_Push_Req.push_id =
e->u.Pom_SessionRequest_Req.push_id;
wsp_event->u.S_Unit_Push_Req.addr_tuple =
@@ -302,7 +316,19 @@
wsp_event->u.S_Unit_Push_Req.smsc_id =
octstr_duplicate(e->u.Po_Unit_Push_Req.smsc_id);
else
- wsp_event->u.S_Unit_Push_Req.smsc_id = NULL;
+ wsp_event->u.S_Unit_Push_Req.smsc_id = NULL;
+ if (e->u.Po_Unit_Push_Req.dlr_url != NULL)
+ wsp_event->u.S_Unit_Push_Req.dlr_url =
+ octstr_duplicate(e->u.Po_Unit_Push_Req.dlr_url);
+ else
+ wsp_event->u.S_Unit_Push_Req.dlr_url = NULL;
+ wsp_event->u.S_Unit_Push_Req.dlr_mask = e->u.Po_Unit_Push_Req.dlr_mask;
+ if (e->u.Po_Unit_Push_Req.smsbox_id != NULL)
+ wsp_event->u.S_Unit_Push_Req.smsbox_id =
+ octstr_duplicate(e->u.Po_Unit_Push_Req.smsbox_id);
+ else
+ wsp_event->u.S_Unit_Push_Req.smsbox_id = NULL;
+ wsp_event->u.S_Unit_Push_Req.service_name = e->u.Po_Unit_Push_Req.service_name;
if (e->u.Po_Unit_Push_Req.push_body != NULL)
wsp_event->u.S_Unit_Push_Req.push_body =
Index: gw/wap_push_ppg.c
===================================================================
RCS file: /home/cvs/gateway/gw/wap_push_ppg.c,v
retrieving revision 1.51
diff -u -r1.51 wap_push_ppg.c
--- gw/wap_push_ppg.c 15 Feb 2003 01:09:29 -0000 1.51
+++ gw/wap_push_ppg.c 5 Mar 2003 08:49:24 -0000
@@ -144,7 +144,9 @@
static Octstr *ssl_server_cert_file = NULL;
static Octstr *ssl_server_key_file = NULL;
#endif
-
+static Octstr *ppg_dlr_url = NULL;
+static Octstr *ppg_smsbox_id = NULL;
+static Octstr *service_name = NULL;
struct PAPEvent {
HTTPClient *client;
@@ -291,6 +293,17 @@
static Octstr *convert_sl_to_slc(struct content *content);
/*
+ * Setting values for controlling sms level. (Pap control document enables
+ * some control, but not enough.)
+ */
+
+static Octstr *set_smsc_id(List *cgivars, Octstr *username);
+static Octstr *set_dlr_url(List *cgivars, Octstr *username);
+static long set_dlr_mask(List *cgivars, Octstr *dlr_url);
+static Octstr *set_smsbox_id(List *cgivars, Octstr *username);
+static Octstr *set_service_name(void);
+
+/*
* Various utility functions
*/
static Octstr *set_time(void);
@@ -374,6 +387,7 @@
octstr_destroy(ppg_deny_ip);
octstr_destroy(ppg_allow_ip);
octstr_destroy(global_sender);
+ octstr_destroy(service_name);
gwthread_join_every(http_read_thread);
#ifdef HAVE_LIBSSL
@@ -461,8 +475,12 @@
ppg_deny_ip = cfg_get(grp, octstr_imm("ppg-deny-ip"));
ppg_allow_ip = cfg_get(grp, octstr_imm("ppg-allow-ip"));
if ((global_sender = cfg_get(grp, octstr_imm("global-sender"))) == NULL)
- global_sender = octstr_imm("1234");
+ global_sender = octstr_format("%s", "1234");
ppg_default_smsc = cfg_get(grp, octstr_imm("default-smsc"));
+ ppg_dlr_url = cfg_get(grp, octstr_imm("default-dlr-url"));
+ ppg_smsbox_id = cfg_get(grp, octstr_imm("ppg-smsbox-id"));
+ if ((service_name = cfg_get(grp, octstr_imm("service-name"))) == NULL)
+ service_name = octstr_format("%s", "ppg");
#ifdef HAVE_LIBSSL
cfg_get_integer(&ppg_ssl_port, grp, octstr_imm("ppg-ssl-port"));
@@ -680,7 +698,9 @@
*cgivars;
HTTPClient *client;
Octstr *smsc_id;
- Octstr *retos;
+ long dlr_mask;
+ Octstr *dlr_url;
+ long masklen;
http_status = 0;
@@ -834,21 +854,15 @@
debug("wap.push.ppg", 0, "PPG: http_read_thread: pap control"
" entity compiled ok");
- /* check if we have an explicit routing information */
- retos = http_cgi_variable(cgivars, "smsc");
- if (retos == NULL) {
- /* get the push user specific smsc routing */
- smsc_id = wap_push_ppg_pushuser_smsc_id_get(username);
- /* if there was no user specific, then set the ppg global */
- smsc_id = smsc_id ?
- smsc_id : (ppg_default_smsc ? octstr_duplicate(ppg_default_smsc) : NULL);
- } else {
- smsc_id = octstr_duplicate(retos);
- }
- ppg_event->u.Push_Message.push_headers =
- http_header_duplicate(push_headers);
+ ppg_event->u.Push_Message.push_headers = http_header_duplicate(push_headers);
ppg_event->u.Push_Message.push_data = octstr_duplicate(push_data);
- ppg_event->u.Push_Message.smsc_id = smsc_id ? octstr_duplicate(smsc_id) : NULL;
+ ppg_event->u.Push_Message.smsc_id = set_smsc_id(cgivars, username);
+ dlr_url = set_dlr_url(cgivars, username);
+ ppg_event->u.Push_Message.dlr_url = dlr_url;
+ ppg_event->u.Push_Message.dlr_mask = set_dlr_mask(cgivars, dlr_url);
+ ppg_event->u.Push_Message.smsbox_id = set_smsbox_id(cgivars, username);
+ ppg_event->u.Push_Message.service_name = set_service_name();
+
if (!handle_push_message(&client, ppg_event, http_status)) {
if (client == NULL)
break;
@@ -865,7 +879,6 @@
octstr_destroy(push_data);
octstr_destroy(rdf_content);
octstr_destroy(boundary);
- octstr_destroy(smsc_id);
continue;
no_transform:
@@ -878,7 +891,6 @@
octstr_destroy(push_data);
octstr_destroy(rdf_content);
octstr_destroy(boundary);
- octstr_destroy(smsc_id);
continue;
no_compile:
@@ -1297,6 +1309,16 @@
m->smsc_id = octstr_duplicate(e->u.Push_Message.smsc_id);
else
m->smsc_id = NULL;
+ if (e->u.Push_Message.dlr_url != NULL)
+ m->dlr_url = octstr_duplicate(e->u.Push_Message.dlr_url);
+ else
+ m->dlr_url = NULL;
+ m->dlr_mask = e->u.Push_Message.dlr_mask;
+ if (e->u.Push_Message.smsbox_id != NULL)
+ m->smsbox_id = octstr_duplicate(e->u.Push_Message.smsbox_id);
+ else
+ m->smsbox_id = NULL;
+ m->service_name = octstr_duplicate(e->u.Push_Message.service_name);
m->progress_notes_requested = e->u.Push_Message.progress_notes_requested;
if (e->u.Push_Message.progress_notes_requested)
@@ -1376,12 +1398,18 @@
WAPEvent *ota_event;
List *push_headers;
Octstr *smsc_id;
+ Octstr *dlr_url;
+ Octstr *smsbox_id;
+ Octstr *service_name;
gw_assert(e->type == Push_Message);
push_machine_assert(pm);
push_headers = http_header_duplicate(e->u.Push_Message.push_headers);
smsc_id = octstr_duplicate(e->u.Push_Message.smsc_id);
+ dlr_url = octstr_duplicate(e->u.Push_Message.dlr_url);
+ smsbox_id = octstr_duplicate(e->u.Push_Message.smsbox_id);
+ service_name = octstr_duplicate(e->u.Push_Message.service_name);
ota_event = wap_event_create(Pom_SessionRequest_Req);
ota_event->u.Pom_SessionRequest_Req.addr_tuple =
@@ -1390,10 +1418,22 @@
ota_event->u.Pom_SessionRequest_Req.push_headers = push_headers;
ota_event->u.Pom_SessionRequest_Req.push_id = pm->push_id;
ota_event->u.Pom_SessionRequest_Req.address_type = pm->address_type;
+
if (smsc_id != NULL)
ota_event->u.Pom_SessionRequest_Req.smsc_id = smsc_id;
else
ota_event->u.Pom_SessionRequest_Req.smsc_id = NULL;
+ if (dlr_url != NULL)
+ ota_event->u.Pom_SessionRequest_Req.dlr_url = dlr_url;
+ else
+ ota_event->u.Pom_SessionRequest_Req.smsc_id = NULL;
+ ota_event->u.Pom_SessionRequest_Req.dlr_mask = e->u.Push_Message.dlr_mask;
+ if (smsbox_id != NULL)
+ ota_event->u.Pom_SessionRequest_Req.smsbox_id = smsbox_id;
+ else
+ ota_event->u.Pom_SessionRequest_Req.smsbox_id = NULL;
+ ota_event->u.Pom_SessionRequest_Req.service_name = service_name;
+
dispatch_to_ota(ota_event);
}
@@ -1460,6 +1500,17 @@
ota_event->u.Po_Unit_Push_Req.smsc_id = octstr_duplicate(pm->smsc_id);
else
ota_event->u.Po_Unit_Push_Req.smsc_id = NULL;
+ if (pm->dlr_url != NULL)
+ ota_event->u.Po_Unit_Push_Req.dlr_url = octstr_duplicate(pm->dlr_url);
+ else
+ ota_event->u.Po_Unit_Push_Req.dlr_url = NULL;
+ ota_event->u.Po_Unit_Push_Req.dlr_mask = pm->dlr_mask;
+ if (pm->smsbox_id != NULL)
+ ota_event->u.Po_Unit_Push_Req.smsbox_id = octstr_duplicate(pm->smsbox_id);
+ else
+ ota_event->u.Po_Unit_Push_Req.smsbox_id = NULL;
+ ota_event->u.Po_Unit_Push_Req.service_name = octstr_duplicate(pm->service_name);
+
ota_event->u.Po_Unit_Push_Req.push_body = octstr_duplicate(pm->push_data);
dispatch_to_ota(ota_event);
@@ -3081,15 +3132,119 @@
*pos += octstr_len(os2) - 1;
}
+/*
+ * Check if we have an explicit routing information
+ * a) first check cgi variable
+ * b) then ppg user specific routing
+ * c) then global ppg routing
+ * d) if all these failed, return NULL
+ */
+static Octstr *set_smsc_id(List *cgivars, Octstr *username)
+{
+ Octstr *smscidos;
+ Octstr *smsc_id;
+ smscidos = http_cgi_variable(cgivars, "smsc");
+ if (smscidos != NULL) {
+ return octstr_duplicate(smscidos);
+ }
+ smsc_id = wap_push_ppg_pushuser_smsc_id_get(username);
+ smsc_id = smsc_id ?
+ smsc_id : (ppg_default_smsc ? octstr_duplicate(ppg_default_smsc) : NULL);
+ return smsc_id;
+}
+/*
+ * Checking for dlr url, using following order:
+ * a) first check cgi variable
+ * b) then ppg user specific dlr url
+ * c) then global ppg dlr url
+ * d) if all these failed, return NULL
+ */
+static Octstr *set_dlr_url(List *cgivars, Octstr *username)
+{
+ Octstr *dlrurlos;
+ Octstr *dlr_url;
+
+ dlrurlos = http_cgi_variable(cgivars, "dlrurl");
+ if (dlrurlos != NULL) {
+ return octstr_duplicate(dlrurlos);
+ }
+
+ dlr_url = wap_push_ppg_pushuser_dlr_url_get(username);
+ dlr_url = dlr_url ?
+ dlr_url : (ppg_dlr_url ? octstr_duplicate(ppg_dlr_url) : NULL);
+ return dlr_url;
+}
+/*
+ * Checking for dlr mask. Mask without dlr url is of course useless.
+ * We reject (some) non-meaningfull values of dlr_mask. Value indic-
+ * ating rejection is 0.
+ */
+static long set_dlr_mask(List *cgivars, Octstr *dlr_url)
+{
+ Octstr *dlrmaskos;
+ long dlr_mask;
+ long masklen;
+
+ if (dlr_url == NULL) {
+ debug("wap.push.ppg", 0, "no dlr url set, no dlr mask either");
+ return 0;
+ }
+
+ dlrmaskos = http_cgi_variable(cgivars, "dlrmask");
+ if (dlrmaskos == NULL) {
+ debug("wap.push.ppg", 0, "no dlr mask from cgi vars");
+ return 0;
+ }
+
+ if ((masklen = octstr_parse_long(&dlr_mask, dlrmaskos, 0, 10)) != -1 &&
+ masklen == octstr_len(dlrmaskos) &&
+ dlr_mask > 0 && dlr_mask < 32) {
+ return dlr_mask;
+ }
+
+ debug("wap.push.ppg", 0, "unparsable dlr mask, rejected");
+ return 0;
+}
+/*
+ * Checking for dlr smsbox id, using following order:
+ * a) first check cgi variable
+ * b) then ppg user specific smsbox id
+ * c) then global ppg smsbox id
+ * d) if all these failed, return NULL
+ */
+
+static Octstr *set_smsbox_id(List *cgivars, Octstr *username)
+{
+ Octstr *smsboxidos;
+ Octstr *smsbox_id;
+
+ smsboxidos = http_cgi_variable(cgivars, "smsbox-id");
+ if (smsboxidos != NULL) {
+ return octstr_duplicate(smsboxidos);
+ }
+
+ smsbox_id = wap_push_ppg_pushuser_smsbox_id_get(username);
+ smsbox_id = smsbox_id ?
+ smsbox_id : (ppg_smsbox_id ? octstr_duplicate(ppg_smsbox_id) : NULL);
+ return smsbox_id;
+}
+
+/*
+ * Service is ppg core group only configuration variable
+ */
+static Octstr *set_service_name(void)
+{
+ return octstr_duplicate(service_name);
+}
Index: gw/wap_push_ppg_pushuser.c
===================================================================
RCS file: /home/cvs/gateway/gw/wap_push_ppg_pushuser.c,v
retrieving revision 1.13
diff -u -r1.13 wap_push_ppg_pushuser.c
--- gw/wap_push_ppg_pushuser.c 15 Feb 2003 01:09:29 -0000 1.13
+++ gw/wap_push_ppg_pushuser.c 5 Mar 2003 08:49:24 -0000
@@ -30,6 +30,8 @@
Octstr *user_allow_ip; /* and denies them from these*/
Octstr *smsc_id; /* force push SMs to this smsc */
Octstr *default_smsc_id; /* use this smsc as a default for push SMs */
+ Octstr *dlr_url; /* default dlr url from this user */
+ Octstr *smsbox_id; /* use this smsbox for sending dlrs back*/
};
typedef struct WAPPushUser WAPPushUser;
@@ -323,6 +325,35 @@
return octstr_duplicate(smsc_id);
}
+/*
+ * Returns default dlr url for this user.
+ */
+Octstr *wap_push_ppg_pushuser_dlr_url_get(Octstr *username)
+{
+ WAPPushUser *u;
+ Octstr *dlr_url;
+
+ u = user_find_by_username(username);
+ dlr_url = u->dlr_url;
+
+ return octstr_duplicate(dlr_url);
+}
+
+/*
+ * Returns default dlr smsbox id for this user.
+ */
+Octstr *wap_push_ppg_pushuser_smsbox_id_get(Octstr *username)
+{
+ WAPPushUser *u;
+ Octstr *smsbox_id;
+
+ u = user_find_by_username(username);
+ smsbox_id = u->smsbox_id;
+
+ return octstr_duplicate(smsbox_id);
+}
+
+
/***************************************************************************
*
* Implementation of internal functions
@@ -404,6 +435,8 @@
u->denied_prefix = cfg_get(grp, octstr_imm("denied-prefix"));
u->smsc_id = cfg_get(grp, octstr_imm("forced-smsc"));
u->default_smsc_id = cfg_get(grp, octstr_imm("default-smsc"));
+ u->dlr_url = cfg_get(grp, octstr_imm("dlr-url"));
+ u->smsbox_id = cfg_get(grp, octstr_imm("smsbox-id"));
os = cfg_get(grp, octstr_imm("white-list"));
if (os != NULL) {
Index: gw/wap_push_ppg_pushuser.h
===================================================================
RCS file: /home/cvs/gateway/gw/wap_push_ppg_pushuser.h,v
retrieving revision 1.3
diff -u -r1.3 wap_push_ppg_pushuser.h
--- gw/wap_push_ppg_pushuser.h 13 Feb 2003 10:32:47 -0000 1.3
+++ gw/wap_push_ppg_pushuser.h 5 Mar 2003 08:49:24 -0000
@@ -6,11 +6,9 @@
* pi authentication. (See chapter 13.) So this is definitely left for
* implementors.
* Basic authentication is defined in rfc 2617. Note that https connections
- * are handled by our http module.
- * Smsc routing is, of course, a very specific to Kannel. It is very similar
- * to sendsms group routing.
+ * are handled by our http module.
*
- * By Aarno Syvänen for Wiral Ltd
+ * By Aarno Syvänen for Wiral Ltd and Global Networks Inc
*/
#ifndef WAP_PUSH_PPG_PUSHUSER_H
@@ -77,8 +75,17 @@
Octstr *needle, Octstr *list_sep, Octstr *ip_sep);
/*
- * Returns smsc pushes by this user must use, NULL when there was an error.
+ * Returns smsc pushes by this user must use, or NULL when error.
*/
Octstr *wap_push_ppg_pushuser_smsc_id_get(Octstr *username);
+/*
+ * Returns default dlr url for this user, or NULL when error.
+ */
+Octstr *wap_push_ppg_pushuser_dlr_url_get(Octstr *username);
+
+/*
+ * Returns default dlr smsbox id for this user, or NULL when error.
+ */
+Octstr *wap_push_ppg_pushuser_smsbox_id_get(Octstr *username);
#endif
Index: gw/wapbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/wapbox.c,v
retrieving revision 1.156
diff -u -r1.156 wapbox.c
--- gw/wapbox.c 4 Mar 2003 15:16:08 -0000 1.156
+++ gw/wapbox.c 5 Mar 2003 08:49:24 -0000
@@ -347,12 +347,22 @@
msg->sms.smsc_id = octstr_duplicate(dgram->u.T_DUnitdata_Req.smsc_id);
else
msg->sms.smsc_id = NULL;
- msg->sms.sms_type = mt_push;
+ msg->sms.dlr_mask = dgram->u.T_DUnitdata_Req.dlr_mask;
+ if (dgram->u.T_DUnitdata_Req.smsbox_id != NULL)
+ msg->sms.boxc_id = octstr_duplicate(dgram->u.T_DUnitdata_Req.smsbox_id);
+ else
+ msg->sms.boxc_id = NULL;
+ if (dgram->u.T_DUnitdata_Req.dlr_url != NULL)
+ msg->sms.dlr_url = octstr_duplicate(dgram->u.T_DUnitdata_Req.dlr_url);
+ else
+ msg->sms.dlr_url = NULL;
+ msg->sms.sms_type = wap_push;
msg->sms.mwi = MWI_UNDEF;
msg->sms.coding = DC_8BIT;
msg->sms.mclass = MC_UNDEF;
msg->sms.validity = 0;
msg->sms.deferred = 0;
+ msg->sms.service = octstr_duplicate(dgram->u.T_DUnitdata_Req.service_name);
return msg;
}
Index: gw/wapkannel.conf
===================================================================
RCS file: /home/cvs/gateway/gw/wapkannel.conf,v
retrieving revision 1.13
diff -u -r1.13 wapkannel.conf
--- gw/wapkannel.conf 15 Feb 2003 01:08:17 -0000 1.13
+++ gw/wapkannel.conf 5 Mar 2003 08:49:24 -0000
@@ -28,8 +28,8 @@
#admin-deny-ip = ""
#admin-allow-ip = ""
wdp-interface-name = "*"
-#log-file = "/tmp/bearerbox.log"
-#log-level = 0
+log-file = "/tmp/bearerbox.log"
+log-level = 0
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
#access-log = "/tmp/access.log"
@@ -40,8 +40,8 @@
group = wapbox
bearerbox-host = localhost
-#log-file = "/tmp/wapbox.log"
-#log-level = 0
+log-file = "/tmp/wapbox.log"
+log-level = 0
syslog-level = none
#access-log = "/tmp/wapaccess.log"
Index: gw/smsc/smsc_http.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_http.c,v
retrieving revision 1.7
diff -u -r1.7 smsc_http.c
--- gw/smsc/smsc_http.c 4 Mar 2003 15:16:09 -0000 1.7
+++ gw/smsc/smsc_http.c 5 Mar 2003 08:49:24 -0000
@@ -264,6 +264,12 @@
octstr_format_append(url, "&account=%E:%E", sms->sms.service, sms->sms.account);
if (sms->sms.smsc_id) /* proxy the smsc-id to the next instance */
octstr_format_append(url, "&smsc=%S", sms->sms.smsc_id);
+ if (sms->sms.dlr_url) {
+ octstr_url_encode(sms->sms.dlr_url);
+ octstr_format_append(url, "&dlrurl=%S", sms->sms.dlr_url);
+ }
+ if (sms->sms.dlr_mask)
+ octstr_format_append(url, "&drlmask=%d", sms->sms.dlr_mask);
headers = list_create();
debug("smsc.http.kannel", 0, "start request");
Index: gwlib/cfg.def
===================================================================
RCS file: /home/cvs/gateway/gwlib/cfg.def,v
retrieving revision 1.83
diff -u -r1.83 cfg.def
--- gwlib/cfg.def 4 Mar 2003 15:16:09 -0000 1.83
+++ gwlib/cfg.def 5 Mar 2003 08:49:24 -0000
@@ -100,6 +100,9 @@
OCTSTR(ssl-server-key-file)
OCTSTR(global-sender)
OCTSTR(default-smsc)
+ OCTSTR(default-dlr-url)
+ OCTSTR(ppg-smsbox-id)
+ OCTSTR(service-name)
)
@@ -116,6 +119,8 @@
OCTSTR(allow-ip)
OCTSTR(forced-smsc)
OCTSTR(default-smsc)
+ OCTSTR(dlr-url)
+ OCTSTR(smsbox-id)
)
Index: gwlib/http.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/http.c,v
retrieving revision 1.184
diff -u -r1.184 http.c
--- gwlib/http.c 4 Mar 2003 12:35:13 -0000 1.184
+++ gwlib/http.c 5 Mar 2003 08:49:24 -0000
@@ -2714,16 +2714,14 @@
void http_cgivar_dump(List *cgiargs)
{
long i;
- Octstr *arg;
+ HTTPCGIVar *v;
gwlib_assert_init();
debug("gwlib.http", 0, "Dumping %ld cgi variables:", list_len(cgiargs));
- for (i = 0; cgiargs != NULL && i < list_len(cgiargs); ++i) {
- if (octstr_len(arg = list_get(cgiargs, i)) != 0)
- octstr_dump(arg, 0);
- else
- debug("gwlib.http", 0, "Got an empty cgi arg");
+ while ((v = list_extract_first(cgiargs)) != NULL) {
+ octstr_dump(v->name, 0);
+ octstr_dump(v->value, 0);
}
debug("gwlib.http", 0, "End of dump.");
}
Index: wap/wap_events.def
===================================================================
RCS file: /home/cvs/gateway/wap/wap_events.def,v
retrieving revision 1.24
diff -u -r1.24 wap_events.def
--- wap/wap_events.def 13 Feb 2003 10:33:47 -0000 1.24
+++ wap/wap_events.def 5 Mar 2003 08:49:24 -0000
@@ -77,6 +77,10 @@
INTEGER(address_type)
OPTIONAL_OCTSTR(smsc_id)
+ INTEGER(dlr_mask)
+ OPTIONAL_OCTSTR(dlr_url)
+ OPTIONAL_OCTSTR(smsbox_id)
+ OPTIONAL_OCTSTR(service_name)
)
WAPEVENT(T_DUnitdata_Ind, "T-DUnitdata.ind",
@@ -549,6 +553,10 @@
INTEGER(address_type)
OPTIONAL_OCTSTR(smsc_id)
+ INTEGER(dlr_mask)
+ OPTIONAL_OCTSTR(dlr_url)
+ OPTIONAL_OCTSTR(smsbox_id)
+ OPTIONAL_OCTSTR(service_name)
)
WAPEVENT(S_Unit_Push_Ind, "S-Unit-Push.ind",
@@ -569,6 +577,10 @@
INTEGER(push_id)
INTEGER(address_type)
OPTIONAL_OCTSTR(smsc_id)
+ INTEGER(dlr_mask)
+ OPTIONAL_OCTSTR(dlr_url)
+ OPTIONAL_OCTSTR(smsbox_id)
+ OPTIONAL_OCTSTR(service_name)
)
WAPEVENT(Pom_Connect_Ind, "Pom-Connect.ind",
@@ -650,6 +662,10 @@
INTEGER(address_type)
OPTIONAL_OCTSTR(smsc_id)
+ INTEGER(dlr_mask)
+ OPTIONAL_OCTSTR(dlr_url)
+ OPTIONAL_OCTSTR(smsbox_id)
+ OPTIONAL_OCTSTR(service_name)
)
WAPEVENT(Po_PushAbort_Req, "Po-PushAbort.req",
@@ -698,6 +714,10 @@
OPTIONAL_OCTSTR(push_data)
CAPABILITIES(pi_capabilities)
OPTIONAL_OCTSTR(smsc_id)
+ INTEGER(dlr_mask)
+ OPTIONAL_OCTSTR(dlr_url)
+ OPTIONAL_OCTSTR(smsbox_id)
+ OPTIONAL_OCTSTR(service_name)
)
/*
Index: wap/wsp_unit.c
===================================================================
RCS file: /home/cvs/gateway/wap/wsp_unit.c,v
retrieving revision 1.12
diff -u -r1.12 wsp_unit.c
--- wap/wsp_unit.c 13 Feb 2003 10:34:09 -0000 1.12
+++ wap/wsp_unit.c 5 Mar 2003 08:49:24 -0000
@@ -260,6 +260,19 @@
octstr_duplicate(event->u.S_Unit_Push_Req.smsc_id);
else
datagram->u.T_DUnitdata_Req.smsc_id = NULL;
+ if (event->u.S_Unit_Push_Req.dlr_url != NULL)
+ datagram->u.T_DUnitdata_Req.dlr_url =
+ octstr_duplicate(event->u.S_Unit_Push_Req.dlr_url);
+ else
+ datagram->u.T_DUnitdata_Req.dlr_url = NULL;
+ datagram->u.T_DUnitdata_Req.dlr_mask = event->u.S_Unit_Push_Req.dlr_mask;
+ if (event->u.S_Unit_Push_Req.smsbox_id != NULL)
+ datagram->u.T_DUnitdata_Req.smsbox_id =
+ octstr_duplicate(event->u.S_Unit_Push_Req.smsbox_id);
+ else
+ datagram->u.T_DUnitdata_Req.smsbox_id = NULL;
+ datagram->u.T_DUnitdata_Req.service_name =
+ octstr_duplicate(event->u.S_Unit_Push_Req.service_name);
datagram->u.T_DUnitdata_Req.user_data = ospdu;
debug("wap.wsp.unit", 0, "WSP_UNIT: delivering to wdp");