Re: Re: [Users] Mbuni: getting MSISDN from Cisco AS5300 access

2005-09-29 Thread Alexander Simakov



Message: 1
Date: Tue, 27 Sep 2005 19:33:47 +0300
From: Paul Bagyenda <[EMAIL PROTECTED]>
Subject: Re: [Users] Mbuni: getting MSISDN from Cisco AS5300 access
server
To: Mbuni MMS Gateway Users List 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

Alexander,

 This is very welcome indeed and am sure a lot of people will find  
it handy.


 I would suggest the following: This more properly fits within the  
detokenizer module framework. That is, one needs to add a library  
that one can call. It's arguments (passed in config file) would  
include the the path to the script, etc.


 


Surely this will much more handy than a separate patch :)

 The only gap so far is the detokenizer module is not being sent the  
client IP. This is easy to add (I shall do so in CVS). Your patch  
would then be an additional module (much like mms_detokenize_shell)  
that would do what you describe.
 


Ok.


P.



___
Users mailing list
Users@mbuni.org
http://mbuni.org/mailman/listinfo/users_mbuni.org


[Users] Mbuni: getting MSISDN from Cisco AS5300 access server

2005-09-27 Thread Alexander Simakov

Hello Users!

Here is the story. I`m working in mobile telecommunications company.
We are using Kannel WAP and SMS gateway for serving our customers.
For some newer phones we also run squid http-proxy. WAP-aware phones
are served by our dedicated Cisco AS5300 network access server.

A few month ago we decided to run Mbuni MMS gateway. Almost everything
works good, but one problem: MSISDN! By default, incoming MMS messages
are signed with IP-address of sender, not the MSISDN. It is unacceptable 
for us.


Mbuni expects special http-header (X-WAP-Network-Client) to be set by 
Kannel.
This header contains user MSISDN. The Kannel configuration, in its turn, 
must

be RADIUS-aware. So, Kannel get`s MSISDN from the RADIUS server and passes
special http-header toward Mbuni.

Looks fine? But what about "some newer phones", which use squid instead
of Kannel`s wapbox? Squid is unable to set a magic MSISDN header for us.

May be there is a better way to solve this problem (e.g. see Mbuni 
detokenizer

library), but I have my own. It consists of three pieces. They are

1. Patch for Mbuni 1.0.0
2. Tiny perl script with RSH Cisco commands
3. Snippet of Cisco configuration to work with Remote shell (RSH)

The main idea is very simple. Suppose that WAP-phone is currently
connected to the Cisco.

# show call calltracker active

This Cisco command shows active calls.
Command output (phone numbers are changed):

-- call handle=  2154 --
status=Active, service=PPP, origin=Answer, category=Modem
DS0 slot/port/ds1/chan=0/0/0/1, called=123, calling=123456789
userid=wap, ip=aaa.bbb.ccc.ddd, mask=0.0.0.0
setup=09/27/2005 15:01:59, conn=0.10, phys=22.77, service=36.59, 
authen=36.59

init rx/tx b-rate=33600/31200, rx/tx chars=193160/1155850
resource slot/port=1/47, mp bundle=0, charged units=0, account id=0
idb handle=0x61EED7E8, tty handle=0x619C4C84, tcb handle=0x0


We see that user with MSISDN '123456789' called the number 123.
User IP-address is aaa.bbb.ccc.ddd. This is exactly we want: mapping
between IP-address and MSISDN!

Using this patch, Mbuni will run RSH command 'show call calltracker active'
to find MSISDN of a user with a given IP-address.

To run RSH commands on Cisco you need something like this:

=8<===
no ip rcmd domain-lookup
ip rcmd rsh-enable
ip rcmd remote-host Cisco_user aaa.bbb.ccc.ddd mbuni enable
=8<===

First lines are used to enable RSH on Cisco.
Last line permits RSH for user 'mbuni' from host aaa.bbb.ccc.ddd.
Cisco_user is a valid user on Cisco NAS.

--
Good luck!
Alexander Simakov.



get_msisdn.pl
Description: Perl program
diff -Naur mbuni-orig/mmlib/mms_util.c mbuni-1.0.0/mmlib/mms_util.c
--- mbuni-orig/mmlib/mms_util.c 2005-07-26 08:44:58.0 +0400
+++ mbuni-1.0.0/mmlib/mms_util.c2005-09-12 17:10:51.0 +0400
@@ -26,6 +26,8 @@
 #include "mms_queue.h"
 #include "mms_uaprof.h"
 
+#define GET_MSISDN "/usr/local/bin/get_msisdn.pl"
+
 #define MAXQTRIES 100
 #define BACKOFF_FACTOR 5*60   /* In seconds */
 #define QUEUERUN_INTERVAL 15*60   /* 15 minutes. */
@@ -422,28 +424,30 @@
 }
 
 
-Octstr *mms_find_sender_msisdn(Octstr *send_url, List *request_hdrs, Octstr 
*msisdn_header, 
-  MmsDetokenizerFuncStruct* detokenizerfuncs)
+Octstr *mms_find_sender_msisdn(List *request_hdrs, Octstr *ip_header)
 {
- /* Either we have a WAP gateway header as defined, or we look for 
-  * last part of url, pass it to detokenizer lib if defined, and back 
comes our number.
-  */
- 
- Octstr *phonenum = http_header_value(request_hdrs, 
- msisdn_header);
- 
- if (!phonenum || octstr_len(phonenum) == 0) {
- List *l  = octstr_split(send_url, octstr_imm("/"));
-
- if (l && list_len(l) > 1) {
-  if (detokenizerfuncs) 
-   phonenum = detokenizerfuncs->mms_detokenize(list_get(l, 
list_len(l) - 1));
+ Octstr *ip = http_header_value(request_hdrs, ip_header);
+ Octstr *cmd = NULL, *msisdn = NULL;
+ FILE *fp;
+ char buf[4096];
+
+ info(0, "Resolving user MSISDN");
+
+ cmd = octstr_format("%s %s", GET_MSISDN, octstr_get_cstr(ip));
+ info(0, "Calling \"%s\"", octstr_get_cstr(cmd));
+ if ((fp = popen(octstr_get_cstr(cmd), "r"))) {
+ if (fgets(buf, sizeof buf, fp) != NULL) {
+  msisdn = octstr_create(buf);
+  octstr_strip_crlfs(msisdn);
  }
- if (l)
-  list_destroy(l, (list_item_destructor_t *)octstr_destroy);
+ pclose(fp);
  }
- 
- return phonenum; 
+ info(0, "%s \"%s\", returned msisdn = %s", 
+ fp ? "Called" : "Fail

[Users] Kannel + MBuni and Samsung X100 problem

2005-07-05 Thread Alexander Simakov

Hello!

I`m working on SMS, WAP and MMS gateway using Kannel-1.4.0
and Mbuni-0.9.8 software. Currently I`m tesing MM1 interface.
Almost everything works good, but one problem. I can send MMS
messages FROM Samsung X100, but I cannot send messages TO it.

MMSPROXY successfully receive the message (via Kannel`s wapbox)
destined for Samsung X100 and then (MMSRELAY?) send notification.
Samsung tries to fetch new MMS but after the moment says "Network fail".
The same happens with Samsung X600.

Here is fragment from my mms-access.log:

2005-07-05 16:01:16 Received MMS [INT:MM1] [ACT:] [MMSC:] 
[from:192.168.0.3/TYPE=IPv6] [to:+7xx/TYPE=PLMN] 
[msgid:[EMAIL PROTECTED] [size=441] 
[UA:SAMSUNG-SGH-X100/PEARL UP.Browser/6.1.0.6 (GUI) MMP/1.0] [MMBox:]


2005-07-05 16:01:39 Notify MMS [INT:MM1] [ACT:] [MMSC:] [from:system] 
[to:+7xx/TYPE=PLMN] [msgid:[EMAIL PROTECTED] 
[size=-1] [UA:] [MMBox:]


2005-07-05 16:02:36 Fetched MMS [INT:MM1] [ACT:] [MMSC:] 
[from:192.168.0.3/TYPE=IPv6] [to:192.168.0.3/TYPE=IPv6] 
[msgid:[EMAIL PROTECTED] [size=477] 
[UA:SAMSUNG-SGH-X100/PEARL UP.Browser/6.1.0.6 (GUI) MMP/1.0] [MMBox:]


WAP-push link:

http://127.0.0.1:13013/cgi-bin/sendsms?username=xxx&password=xxx&from=901&;
text=%15%06%03%BE%AF%84%8C%82%982-qf1120564898.6.x3221879%40mmsc%00%8D%90%89%17
%80192.168.0.3%2FTYPE%3DIPv6%00%8A%80%8E%02%01%DD%88%04%81%02%5E%83%83http%3A%2F%2F
mmsc%2F2-qf1120564898.6.x3221879%402%2Fwx19%00&to=%2B79087150222&udh=%06%05%04%0B%84%23%F0

Documentation (http://mbuni.org/status.shtml) says that Mbuni was 
successfully

tested with Samsung X100.

Here is my configuration stuff:

=== mbuni.conf ===

group = core
log-file = /var/log/mbuni/mmsbox.log
access-log = /var/log/mbuni/mms-access.log
log-level = 0

group = mmsbox
name = "Indigo MMSC"
hostname = mmsc.parmamobile.ru
host-alias = mmsc
local-prefixes = "+7;8"
max-send-threads = 5
maximum-send-attempts = 5
default-message-expiry = 3600
queue-run-interval = 30
send-attempt-back-off = 60
mms-port = 8191
send-mail-prog = /usr/sbin/sendmail -f '%f' '%t'
storage-directory = /var/spool/mms
sendsms-url = http://127.0.0.1:13013/cgi-bin/sendsms
sendsms-username = xxx
sendsms-password = xxx
sendsms-global-sender = 901
allow-ip = 127.0.0.1
notify-unprovisioned = yes
mms-notify-text = "You have received a multimedia message from %S, go to 
XXX to view it"

mm-box-host = localhost
mms-notify-unprovisioned-text = "Unprovisioned MMS"
mms-to-email-txt = "This is a multimedia message (HTML suppressed)"
mms-to-email-html = "This is a multimedia message powered by 
Digital Solutions"
mms-message-too-large-txt = "You have received a multimedia message from 
%S that is too large for your phone. Go to xxx to view it"


=== kannel.conf ===

# BEARERBOX setup

group = core
admin-port = 13000
admin-password = yyy
admin-deny-ip = "*.*.*.*"
admin-allow-ip = "127.0.0.1"
wapbox-port = 13002
smsbox-port = 13012
wdp-interface-name = "*"
log-file = "/var/log/kannel/bearerbox.log"
access-log = "/var/log/kannel/bearer-access.log"
log-level = 0
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"

# WAPBOX setup

group = wapbox
bearerbox-host = localhost
log-file = "/var/log/kannel/wapbox.log"
access-log = "/var/log/kannel/wap-access.log"
map-url = "http://mmsc/* http://xxx.xxx.xxx.xxx:8191/*";
timer-freq = 10
log-level = 0

# SMS center setup

group = smsc
smsc = smpp
host = yyy.yyy.yyy.yyy
port = 2000
receive-port = 2000
smsc-username = xxx
smsc-password = xxx
system-type = "xander"
address-range = ""
source-addr-ton = 0
source-addr-npi = 1
dest-addr-ton = 1
dest-addr-npi = 1

# SMSBOX setup

group = smsbox
bearerbox-host = localhost
sendsms-port = 13013
sendsms-chars = "0123456789+ "
global-sender = 901
log-file = "/var/log/kannel/smsbox.log"
access-log = "/var/log/kannel/sms-access.log"
log-level = 0

# SENDSMS user account

group = sendsms-user
username = xxx
password = xxx

# PPG setup

group = ppg
ppg-url = /wappush
ppg-port = 8080
global-sender = 901
concurrent-pushes = 5
trusted-pi = true
users = 1024
ppg-allow-ip = "127.0.0.1"

# PPG user account

group = wap-push-user
wap-push-user = xxx
ppg-username = xxx
ppg-password = xxx
allow-ip = "127.0.0.1"

# SMS SERVICE Default

group = sms-service
keyword = default
text = "Hello world"

=== end ===

Any idea?

Regards,
Alexander Siamkov



___
Users mailing list
Users@mbuni.org
http://mbuni.org/mailman/listinfo/users_mbuni.org