Hello,
Please find attached a small patch against
gateway/gw/wap_push_ppg.c allowing to set the Wap Push
sender by using the 'X-Kannel-From' HTTP header when
submitting the Wap Push request to the Kannel PPG.
I'm not sure whether this is the best way to implement
this patch or this functionality. It is working fine
in conjunction with the SMPP connections we have.
So, this patch is provided as is. The user of this
patch is at his/her own risk.
If it's OK, I hope you'll be able to commit it to
kannel's cvs repository.
Many thanks in advance.
Kind regards.
Christian Boustany
Noor Entertainment, LLC
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Index: gateway/gw/wap_push_ppg.c
===================================================================
RCS file: /home/cvs/gateway/gw/wap_push_ppg.c,v
retrieving revision 1.69
diff -u -r1.69 wap_push_ppg.c
--- gateway/gw/wap_push_ppg.c 6 Oct 2005 12:48:26 -0000 1.69
+++ gateway/gw/wap_push_ppg.c 12 Jul 2006 08:30:59 -0000
@@ -373,8 +373,8 @@
static Octstr *describe_code(long code);
static long ota_abort_to_pap(long reason);
static int content_transformable(List *push_headers);
-static WAPAddrTuple *set_addr_tuple(Octstr *address, long cliport,
- long servport, long address_type);
+static WAPAddrTuple *set_addr_tuple(Octstr *address, long cliport, long servport,
+ long address_type, List *push_headers);
static WAPAddrTuple *addr_tuple_change_cliport(WAPAddrTuple *tuple, long port);
static void initialize_time_item_array(long time_data[], struct tm now);
static int date_item_compare(Octstr *before, long time_data, long pos);
@@ -1775,7 +1775,7 @@
}
address_type = (**e).u.Push_Message.address_type;
- *tuple = set_addr_tuple(cliaddr, cliport, servport, address_type);
+ *tuple = set_addr_tuple(cliaddr, cliport, servport, address_type, push_headers);
if (!content_transformable(push_headers))
goto no_transform;
@@ -2760,20 +2760,28 @@
* server address is global-sender.
*/
static WAPAddrTuple *set_addr_tuple(Octstr *address, long cliport,
- long servport, long address_type)
+ long servport, long address_type, List *push_headers)
{
Octstr *cliaddr;
+ Octstr *from = NULL;
WAPAddrTuple *tuple;
gw_assert(address);
- if (address_type == ADDR_PLMN)
- cliaddr = global_sender;
- else
- cliaddr = octstr_imm("0.0.0.0");
+ if (address_type == ADDR_PLMN) {
+ from = http_header_value(push_headers, octstr_imm("X-Kannel-From"));
+ cliaddr = from ? from : global_sender;
+ } else {
+ cliaddr = octstr_imm("0.0.0.0");
+ }
tuple = wap_addr_tuple_create(address, cliport, cliaddr, servport);
+ if (from) {
+ octstr_destroy(from);
+ http_header_remove_all(push_headers, "X-Kannel-From");
+ }
+
return tuple;
}