Re: how to send PUSH in CDMA network
Aarno Syvänen <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
There is the patch again, against current cvs. Aarno On Friday, May 30, 2003, at 11:23 PM, Stipe Tolj wrote: > Aarno Syvänen wrote : >> >> Or you can ask ppg delivery reports; There is a patch implementing >> this >> on the list. > > can you point me to this one, I'd like to have a peak? ;) > > BTW, I'll do some patching and commiting this week-end. I'll keep the > list informed. > > Stipe > > [email protected] > ------------------------------------------------------------------- > Wapme Systems AG > > Vogelsanger Weg 80 > 40470 Düsseldorf > > Tel: +49-211-74845-0 > Fax: +49-211-74845-299 > > E-Mail: [email protected] > Internet: http://www.wapme-systems.de > ------------------------------------------------------------------- > wapme.net - wherever you are >
cvs.diff
(application/octet-stream, 32.1 KB)
Index: gw/smsbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsbox.c,v
retrieving revision 1.222
diff -u -B -b -r1.222 smsbox.c
--- gw/smsbox.c 27 May 2003 02:36:40 -0000 1.222
+++ gw/smsbox.c 2 Jun 2003 08:44:42 -0000
@@ -69,6 +69,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 */
@@ -270,7 +271,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)
@@ -283,7 +286,10 @@
receiver->msg = msg_create(sms);
receiver->msg->sms.sender = octstr_duplicate(msg->sms.sender);
receiver->msg->sms.receiver = octstr_duplicate(msg->sms.receiver);
+ 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;
@@ -1084,7 +1090,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)
{
@@ -1147,13 +1155,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 (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,
@@ -1509,8 +1522,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) {
+ 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),
@@ -3034,6 +3052,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,
@@ -3157,6 +3183,7 @@
octstr_destroy(reply_couldnotfetch);
octstr_destroy(reply_couldnotrepresent);
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 -B -b -r1.81 urltrans.c
--- gw/urltrans.c 5 Feb 2003 23:17:45 -0000 1.81
+++ gw/urltrans.c 2 Jun 2003 08:44:42 -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 -B -b -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 2 Jun 2003 08:44:42 -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 -B -b -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 2 Jun 2003 08:44:43 -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 =
@@ -286,8 +300,21 @@
{
WAPEvent *wsp_event;
List *push_headers;
+ Octstr *smsc_id;
+ Octstr *dlr_url;
+ Octstr *smsbox_id;
+ Octstr *push_body;
+ Octstr *service_name;
gw_assert(e->type == Po_Unit_Push_Req);
+ gw_assert(e->u.Po_Unit_Push_Req.addr_tuple);
+ gw_assert(e->u.Po_Unit_Push_Req.service_name);
+
+ smsc_id = octstr_duplicate(e->u.Po_Unit_Push_Req.smsc_id);
+ dlr_url = octstr_duplicate(e->u.Po_Unit_Push_Req.dlr_url);
+ smsbox_id = octstr_duplicate(e->u.Po_Unit_Push_Req.smsbox_id);
+ push_body = octstr_duplicate(e->u.Po_Unit_Push_Req.push_body);
+ service_name = octstr_duplicate(e->u.Po_Unit_Push_Req.service_name);
push_headers = add_push_flag(e);
wsp_event = wap_event_create(S_Unit_Push_Req);
@@ -298,15 +325,24 @@
wsp_event->u.S_Unit_Push_Req.address_type =
e->u.Po_Unit_Push_Req.address_type;
- if (e->u.Po_Unit_Push_Req.smsc_id != NULL)
- wsp_event->u.S_Unit_Push_Req.smsc_id =
- octstr_duplicate(e->u.Po_Unit_Push_Req.smsc_id);
+ if (smsc_id != NULL)
+ wsp_event->u.S_Unit_Push_Req.smsc_id = smsc_id;
else
wsp_event->u.S_Unit_Push_Req.smsc_id = NULL;
-
- if (e->u.Po_Unit_Push_Req.push_body != NULL)
- wsp_event->u.S_Unit_Push_Req.push_body =
- octstr_duplicate(e->u.Po_Unit_Push_Req.push_body);
+ if (dlr_url != NULL)
+ wsp_event->u.S_Unit_Push_Req.dlr_url = 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 (smsbox_id != NULL)
+ wsp_event->u.S_Unit_Push_Req.smsbox_id = smsbox_id;
+ else
+ wsp_event->u.S_Unit_Push_Req.smsbox_id = NULL;
+ wsp_event->u.S_Unit_Push_Req.service_name = service_name;
+ if (push_body != NULL)
+ wsp_event->u.S_Unit_Push_Req.push_body = push_body;
+ else
+ wsp_event->u.S_Unit_Push_Req.push_body = NULL;
dispatch_to_wsp_unit(wsp_event);
debug("wap.push.ota", 0, "OTA: made connectionless session service"
Index: gw/wap_push_ppg.c
===================================================================
RCS file: /home/cvs/gateway/gw/wap_push_ppg.c,v
retrieving revision 1.53
diff -u -B -b -r1.53 wap_push_ppg.c
--- gw/wap_push_ppg.c 20 Mar 2003 14:11:49 -0000 1.53
+++ gw/wap_push_ppg.c 2 Jun 2003 08:44:43 -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"));
@@ -679,7 +697,10 @@
ders */
*cgivars;
HTTPClient *client;
- Octstr *smsc_id = NULL;
+ Octstr *smsc_id;
+ long dlr_mask;
+ Octstr *dlr_url;
+ long masklen;
Octstr *retos;
http_status = 0;
@@ -833,24 +854,16 @@
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) {
- /* if we have a valid username, get the user specific routing */
- if (username && octstr_len(username) > 0)
- smsc_id = wap_push_ppg_pushuser_smsc_id_get(username);
- /* if there was no user specific or the user didn't exist,
- * 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_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;
@@ -867,7 +880,6 @@
octstr_destroy(push_data);
octstr_destroy(rdf_content);
octstr_destroy(boundary);
- octstr_destroy(smsc_id);
continue;
no_transform:
@@ -880,7 +892,6 @@
octstr_destroy(push_data);
octstr_destroy(rdf_content);
octstr_destroy(boundary);
- octstr_destroy(smsc_id);
continue;
no_compile:
@@ -1299,6 +1310,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)
@@ -1378,12 +1399,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 =
@@ -1396,6 +1424,17 @@
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);
}
@@ -1462,6 +1501,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);
@@ -3083,15 +3133,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.14
diff -u -B -b -r1.14 wap_push_ppg_pushuser.c
--- gw/wap_push_ppg_pushuser.c 20 Mar 2003 14:11:49 -0000 1.14
+++ gw/wap_push_ppg_pushuser.c 2 Jun 2003 08:44:43 -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;
@@ -328,6 +330,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
@@ -409,6 +440,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 -B -b -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 2 Jun 2003 08:44:43 -0000
@@ -7,10 +7,8 @@
* 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.
*
- * 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.157
diff -u -B -b -r1.157 wapbox.c
--- gw/wapbox.c 27 Mar 2003 08:55:01 -0000 1.157
+++ gw/wapbox.c 2 Jun 2003 08:44:43 -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;
}
@@ -396,11 +406,12 @@
} else {
msg = pack_sms_datagram(dgram);
msg_sequence = counter_increase(sequence_counter) & 0xff;
- msg_len = octstr_len(msg->sms.msgdata);
- max_msgs = (msg_len / MAX_SMS_OCTETS) + 1;
+ /*msg_len = octstr_len(msg->sms.msgdata);
+ max_msgs = (msg_len / MAX_SMS_OCTETS) + 1;*/
sms_datagrams = sms_split(msg, NULL, NULL, NULL, NULL, 1,
- msg_sequence, max_msgs, MAX_SMS_OCTETS);
-
+ msg_sequence, 10, MAX_SMS_OCTETS);
+ debug("wap", 0, "WDP (wapbox): delivering %ld segments to bb",
+ list_len(sms_datagrams));
while ((part = list_extract_first(sms_datagrams)) != NULL)
write_to_bearerbox(part);
Index: gw/smsc/smsc_http.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_http.c,v
retrieving revision 1.20
diff -u -B -b -r1.20 smsc_http.c
--- gw/smsc/smsc_http.c 28 May 2003 17:41:44 -0000 1.20
+++ gw/smsc/smsc_http.c 2 Jun 2003 08:44:44 -0000
@@ -297,6 +297,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, "HTTP[%s]: Start request",
Index: gwlib/cfg.def
===================================================================
RCS file: /home/cvs/gateway/gwlib/cfg.def,v
retrieving revision 1.85
diff -u -B -b -r1.85 cfg.def
--- gwlib/cfg.def 3 Apr 2003 12:18:18 -0000 1.85
+++ gwlib/cfg.def 2 Jun 2003 08:44:44 -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)
)
@@ -422,7 +429,41 @@
OCTSTR(field-source)
OCTSTR(field-destination)
OCTSTR(field-service)
+SINGLE_GROUP(imic,
+ OCTSTR(smscbox-host)
+ OCTSTR(smscbox-port)
+ OCTSTR(smscbox-user)
+ OCTSTR(smscbox-pass)
+ OCTSTR(mmscbox-host)
+ OCTSTR(mmscbox-port)
+ OCTSTR(mmscsql-host)
+ OCTSTR(mmscsql-port)
+ OCTSTR(mmscsql-db)
+ OCTSTR(mmscsql-user)
+ OCTSTR(mmscsql-pass)
+ OCTSTR(imic-port)
+ OCTSTR(pid-file)
+ OCTSTR(log-file)
+ OCTSTR(log-level)
+)
OCTSTR(field-url)
+SINGLE_GROUP(imic,
+ OCTSTR(smscbox-host)
+ OCTSTR(smscbox-port)
+ OCTSTR(smscbox-user)
+ OCTSTR(smscbox-pass)
+ OCTSTR(mmscbox-host)
+ OCTSTR(mmscbox-port)
+ OCTSTR(mmscsql-host)
+ OCTSTR(mmscsql-port)
+ OCTSTR(mmscsql-db)
+ OCTSTR(mmscsql-user)
+ OCTSTR(mmscsql-pass)
+ OCTSTR(imic-port)
+ OCTSTR(pid-file)
+ OCTSTR(log-file)
+ OCTSTR(log-level)
+)
OCTSTR(field-mask)
OCTSTR(field-status)
OCTSTR(field-boxc-id)
Index: gwlib/http.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/http.c,v
retrieving revision 1.190
diff -u -B -b -r1.190 http.c
--- gwlib/http.c 3 Apr 2003 12:18:36 -0000 1.190
+++ gwlib/http.c 2 Jun 2003 08:44:45 -0000
@@ -2782,16 +2782,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.25
diff -u -B -b -r1.25 wap_events.def
--- wap/wap_events.def 20 Mar 2003 11:45:45 -0000 1.25
+++ wap/wap_events.def 2 Jun 2003 08:44:45 -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)
OPTIONAL_OCTSTR(product_name)
)
Index: wap/wsp_unit.c
===================================================================
RCS file: /home/cvs/gateway/wap/wsp_unit.c,v
retrieving revision 1.12
diff -u -B -b -r1.12 wsp_unit.c
--- wap/wsp_unit.c 13 Feb 2003 10:34:09 -0000 1.12
+++ wap/wsp_unit.c 2 Jun 2003 08:44:46 -0000
@@ -86,7 +86,7 @@
event = NULL;
os = octstr_duplicate(datagram->u.T_DUnitdata_Ind.user_data);
- if (octstr_len(os) == 0) {
+ if (os && octstr_len(os) == 0) {
warning(0, "WSP UNIT: Empty datagram.");
goto error;
}
@@ -162,6 +162,7 @@
WAPEvent *newevent;
while (run_status == running && (e = list_consume(queue)) != NULL) {
+ debug("wap.wsp.unit", 0, "WSP (UNIT): event arrived");
wap_event_assert(e);
switch (e->type) {
case T_DUnitdata_Ind:
@@ -179,6 +180,7 @@
newevent = pack_into_push_datagram(e);
if (newevent != NULL)
dispatch_to_wdp(newevent);
+ debug("wsp.unit", 0, "WSP (UNIT): delivering to wdp");
break;
default:
@@ -235,7 +237,6 @@
unsigned char push_id;
gw_assert(event->type == S_Unit_Push_Req);
- debug("wap.wsp.unit", 0, "WSP_UNIT: Connectionless push accepted");
pdu = wsp_pdu_create(Push);
pdu->u.Push.headers = wsp_headers_pack(
event->u.S_Unit_Push_Req.push_headers, 1);
@@ -260,9 +261,21 @@
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");
return datagram;
}