[PATCH] msisdn-accounting

Paul P Komkoff Jr <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Department of Fish & Wildlife
Message-ID <[email protected]>
attached
-- 
Paul P 'Stingray' Komkoff Jr // http://stingr.net/key <- my pgp key
 This message represents the official view of the voices in my head
msisdn-accounting (text/plain, 3.4 KB)
Index: gateway.A9/gw/wap-appl.c
===================================================================
--- gateway.A9.orig/gw/wap-appl.c	2004-11-06 17:46:21.819002008 +0300
+++ gateway.A9/gw/wap-appl.c	2004-11-06 17:46:42.757818824 +0300
@@ -160,6 +160,7 @@
     Octstr *url;
     long x_wap_tod;
     List *request_headers;
+    Octstr* msisdn;
 };
 
 #ifdef CURL_SUPPORT
@@ -926,7 +927,7 @@
 static void return_reply(int status, Octstr *content_body, List *headers,
     	    	    	 long sdu_size, WAPEvent *orig_event, long session_id, 
                          Octstr *method, Octstr *url, int x_wap_tod,
-                         List *request_headers)
+                         List *request_headers, Octstr* msisdn)
 {
     struct content content;
     int converted;
@@ -970,8 +971,9 @@
 
     /* log the access */
     /* XXX make this configurable in the future */
-    alog("%s %s <%s> (%s, charset='%s') %ld %d <%s> <%s>", 
+    alog("%s (%s) %s <%s> (%s, charset='%s') %ld %d <%s> <%s>", 
          octstr_get_cstr(addr_tuple->remote->address), 
+         msisdn ? octstr_get_cstr(msisdn) : "-",
          octstr_get_cstr(method), octstr_get_cstr(url), 
          content.type ? octstr_get_cstr(content.type) : "", 
          content.charset ? octstr_get_cstr(content.charset) : "",
@@ -1303,7 +1305,9 @@
 
         return_reply(status, body, headers, p->client_SDU_size,
                      p->event, p->session_id, p->method, p->url, p->x_wap_tod,
-                     p->request_headers);
+                     p->request_headers, p->msisdn);
+        if (p->msisdn)
+            octstr_destroy(p->msisdn);
 
         wap_event_destroy(p->event);
         http_destroy_headers(p->request_headers);
@@ -1342,6 +1346,7 @@
     struct request_data *p;
     Octstr *send_msisdn_query, *send_msisdn_header, *send_msisdn_format;
     int accept_cookies;
+    Octstr* msisdn = NULL;
     
     counter_increase(fetches);
     
@@ -1373,6 +1378,10 @@
         method = p->method;
     }
     info(0, "Fetching <%s>", octstr_get_cstr(url));
+    msisdn = radius_acct_get_msisdn(addr_tuple->remote->address);
+    if (msisdn != NULL) {
+        info(0, "Detected msisdn <%s>", octstr_get_cstr(msisdn));
+    }
 
     /* 
      * XXX this URL mapping needs to be rebuild! st. 
@@ -1445,7 +1454,8 @@
         content_body = octstr_create(HEALTH_DECK);
         octstr_destroy(request_body);
         return_reply(ret, content_body, resp_headers, client_SDU_size,
-                     event, session_id, method, url, x_wap_tod, actual_headers);
+                     event, session_id, method, url, x_wap_tod, actual_headers, msisdn);
+        if (msisdn) octstr_destroy(msisdn);
         wap_event_destroy(event);
         http_destroy_headers(actual_headers);
     } 
@@ -1496,6 +1506,7 @@
         p->url = url;
         p->x_wap_tod = x_wap_tod;
         p->request_headers = actual_headers;
+        p->msisdn = msisdn;
 
         /* issue the request to the HTTP server */
 #ifdef CURL_SUPPORT
@@ -1515,7 +1526,8 @@
         ret = HTTP_NOT_IMPLEMENTED;
         octstr_destroy(request_body);
         return_reply(ret, content_body, resp_headers, client_SDU_size,
-                     event, session_id, method, url, x_wap_tod, actual_headers);
+                     event, session_id, method, url, x_wap_tod, actual_headers, msisdn);
+        if (msisdn) octstr_destroy(msisdn);
         wap_event_destroy(event);
         http_destroy_headers(actual_headers);
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.