diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index a4a85cb..7cd399a 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2008-12-09 P. A. Bagyenda + * MSISDN and IP request headers now list (MMSC) 2008-12-04 P. A. Bagyenda * Minor patches for better Solaris compatibility (Thanks to Benno Rice ) 2008-12-01 P. A. Bagyenda diff --git a/mbuni/doc/userguide.shtml b/mbuni/doc/userguide.shtml index be8aeea..7e6fa13 100644 --- a/mbuni/doc/userguide.shtml +++ b/mbuni/doc/userguide.shtml @@ -1180,8 +1180,9 @@ lists all the configuration directives. The column Mode String     - Name of HTTP - Header sent/inserted by WAP gateway as part of MMS request to indicate MSISDN + Comma-separated list of HTTP + request headers MMSC should look for to determine sender MSISDN. + WAP gateway should insert one of these headers as part of MMS request to indicate MSISDN of sender. Note that typically the MMS client does not indicate its MSISDN in the MMS message, it is up to the gateway to discover this and insert it. We rely on the WAP gateway to provide the MSISDN as an HTTP request header @@ -1202,8 +1203,10 @@ lists all the configuration directives. The column Mode String     - Name of HTTP - Header sent/inserted by WAP gateway as part of MMS request to + Comma-separated list of HTTP + request headers MMSC should look for to determine sender IP + address. WAP gateway or HTTP proxy should insert one of these + headers as part of MMS request to indicate IP Address of sender. Similar to the above, if the MSISDN is not set, then we assume that the client is identified by IP address, which we extract diff --git a/mbuni/mmsc/mmsc_cfg.c b/mbuni/mmsc/mmsc_cfg.c index 5e3fe65..e188551 100644 --- a/mbuni/mmsc/mmsc_cfg.c +++ b/mbuni/mmsc/mmsc_cfg.c @@ -244,11 +244,16 @@ MmscSettings *mms_load_mmsc_settings(Octstr *fname, List **proxyrelays) m->mms_toolarge = _mms_cfg_getx(cfg, grp, octstr_imm("mms-message-too-large-txt")); - m->wap_gw_msisdn_header = mms_cfg_get(cfg, grp, octstr_imm("mms-client-msisdn-header")); - if (!m->wap_gw_msisdn_header) m->wap_gw_msisdn_header = octstr_imm(XMSISDN_HEADER); + + if ((s = mms_cfg_get(cfg, grp, octstr_imm("mms-client-msisdn-header"))) == NULL) + s = octstr_imm(XMSISDN_HEADER); + m->wap_gw_msisdn_header = octstr_split(s, octstr_imm(" ,;")); + octstr_destroy(s); - m->wap_gw_ip_header = mms_cfg_get(cfg, grp, octstr_imm("mms-client-ip-header")); - if (!m->wap_gw_ip_header) m->wap_gw_ip_header = octstr_imm(XIP_HEADER); + if ((s = mms_cfg_get(cfg, grp, octstr_imm("mms-client-ip-header"))) == NULL) + s = octstr_imm(XIP_HEADER); + m->wap_gw_ip_header = octstr_split(s, octstr_imm(" ,;")); + octstr_destroy(s); mms_cfg_get_bool(cfg, grp, octstr_imm("notify-unprovisioned"), &m->notify_unprovisioned); @@ -606,26 +611,40 @@ Octstr *mms_makefetchurl(char *qf, Octstr *token, int loc, return url; } +static Octstr *xfind_one_header(List *req_hdrs, List *hdr_names) +{ + + int i; + + for (i = 0; i 1 || xip)) @@ -639,11 +658,11 @@ Octstr *mms_find_sender_msisdn(Octstr *send_url, return phonenum; } -Octstr *mms_find_sender_ip(List *request_hdrs, Octstr *ip_header, Octstr *ip, int *isv6) +Octstr *mms_find_sender_ip(List *request_hdrs, List *ip_header, Octstr *ip, int *isv6) { Octstr *xip; /* Look in the headers, if none is defined, return actual IP */ - Octstr *client_ip = http_header_value(request_hdrs, ip_header); + Octstr *client_ip = xfind_one_header(request_hdrs, ip_header); char *s; xip = client_ip ? client_ip : octstr_duplicate(ip); diff --git a/mbuni/mmsc/mmsc_cfg.h b/mbuni/mmsc/mmsc_cfg.h index e2d1b94..e9b6c25 100644 --- a/mbuni/mmsc/mmsc_cfg.h +++ b/mbuni/mmsc/mmsc_cfg.h @@ -113,8 +113,8 @@ typedef struct MmscSettings { Octstr *mms_email_txt; Octstr *mms_email_html; Octstr *mms_email_subject; - Octstr *wap_gw_msisdn_header; - Octstr *wap_gw_ip_header; + List *wap_gw_msisdn_header; + List *wap_gw_ip_header; Dict *vasp_list; /* of MmsVasp *, indexed by ID */ @@ -149,13 +149,13 @@ extern Octstr *mms_makefetchurl(char *qf, Octstr *token, int loc, Octstr *mms_find_sender_msisdn(Octstr *send_url, Octstr *ip, List *request_hdrs, - Octstr *msisdn_header, - Octstr *requestip_header, + List *msisdn_header, + List *requestip_header, MmsDetokenizerFuncStruct *detokenizerfuncs); extern int mms_decodefetchurl(Octstr *fetch_url, Octstr **qf, Octstr **token, int *loc); -Octstr *mms_find_sender_ip(List *request_hdrs, Octstr *ip_header, Octstr *ip, int *isv6); +Octstr *mms_find_sender_ip(List *request_hdrs, List *ip_header, Octstr *ip, int *isv6); void notify_prov_server(char *cmd, char *from, char *event, char *arg, Octstr *msgid, Octstr *ua, Octstr *uaprof);