1
0
Fork 0

fix for msisdn and ip request headers in mmsc

This commit is contained in:
bagyenda 2008-12-09 03:35:26 +00:00
parent 1a1b8ba5e5
commit 5247c97695
4 changed files with 45 additions and 21 deletions

View File

@ -1,3 +1,5 @@
2008-12-09 P. A. Bagyenda <bagyenda@dsmagic.com>
* MSISDN and IP request headers now list (MMSC)
2008-12-04 P. A. Bagyenda <bagyenda@dsmagic.com> 2008-12-04 P. A. Bagyenda <bagyenda@dsmagic.com>
* Minor patches for better Solaris compatibility (Thanks to Benno Rice <benno@ekit-inc.com>) * Minor patches for better Solaris compatibility (Thanks to Benno Rice <benno@ekit-inc.com>)
2008-12-01 P. A. Bagyenda <bagyenda@dsmagic.com> 2008-12-01 P. A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -1180,8 +1180,9 @@ lists all the configuration directives. The column <b>Mode</b>
String String
&nbsp; &nbsp;</td> &nbsp; &nbsp;</td>
<td valign=top > <td valign=top >
Name of HTTP Comma-separated list of HTTP
Header sent/inserted by WAP gateway as part of MMS request to indicate MSISDN 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 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 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 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 <b>Mode</b>
String String
&nbsp; &nbsp;</td> &nbsp; &nbsp;</td>
<td valign=top > <td valign=top >
Name of HTTP Comma-separated list of HTTP
Header sent/inserted by WAP gateway as part of MMS request to 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 indicate IP Address
of sender. Similar to the above, if the MSISDN is not set, then we 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 assume that the client is identified by IP address, which we extract

View File

@ -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->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 ((s = mms_cfg_get(cfg, grp, octstr_imm("mms-client-ip-header"))) == NULL)
if (!m->wap_gw_ip_header) m->wap_gw_ip_header = octstr_imm(XIP_HEADER); 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); 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; return url;
} }
static Octstr *xfind_one_header(List *req_hdrs, List *hdr_names)
{
int i;
for (i = 0; i<gwlist_len(hdr_names); i++) {
Octstr *s = gwlist_get(hdr_names, i);
Octstr *x = s ? http_header_value(req_hdrs, s) : NULL;
if (x)
return x;
}
return NULL;
}
Octstr *mms_find_sender_msisdn(Octstr *send_url, Octstr *mms_find_sender_msisdn(Octstr *send_url,
Octstr *ip, Octstr *ip,
List *request_hdrs, List *request_hdrs,
Octstr *msisdn_header, List *msisdn_header,
Octstr *requestip_header, List *requestip_header,
MmsDetokenizerFuncStruct* detokenizerfuncs) MmsDetokenizerFuncStruct* detokenizerfuncs)
{ {
/* Either we have a WAP gateway header as defined, or we look for /* 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. * last part of url, pass it to detokenizer lib if defined, and back comes our number.
*/ */
Octstr *phonenum = http_header_value(request_hdrs, Octstr *phonenum = xfind_one_header(request_hdrs,
msisdn_header); msisdn_header);
if (phonenum == NULL || octstr_len(phonenum) == 0) { if (phonenum == NULL || octstr_len(phonenum) == 0) {
List *l = octstr_split(send_url, octstr_imm("/")); List *l = octstr_split(send_url, octstr_imm("/"));
int len = gwlist_len(l); int len = gwlist_len(l);
Octstr *xip = http_header_value(request_hdrs, Octstr *xip = xfind_one_header(request_hdrs,
requestip_header); requestip_header);
if (xip == NULL) if (xip == NULL)
xip = ip ? octstr_duplicate(ip) : NULL; xip = ip ? octstr_duplicate(ip) : NULL;
if (detokenizerfuncs && (len > 1 || xip)) if (detokenizerfuncs && (len > 1 || xip))
@ -639,11 +658,11 @@ Octstr *mms_find_sender_msisdn(Octstr *send_url,
return phonenum; 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; Octstr *xip;
/* Look in the headers, if none is defined, return actual IP */ /* 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; char *s;
xip = client_ip ? client_ip : octstr_duplicate(ip); xip = client_ip ? client_ip : octstr_duplicate(ip);

View File

@ -113,8 +113,8 @@ typedef struct MmscSettings {
Octstr *mms_email_txt; Octstr *mms_email_txt;
Octstr *mms_email_html; Octstr *mms_email_html;
Octstr *mms_email_subject; Octstr *mms_email_subject;
Octstr *wap_gw_msisdn_header; List *wap_gw_msisdn_header;
Octstr *wap_gw_ip_header; List *wap_gw_ip_header;
Dict *vasp_list; /* of MmsVasp *, indexed by ID */ 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 *mms_find_sender_msisdn(Octstr *send_url,
Octstr *ip, Octstr *ip,
List *request_hdrs, List *request_hdrs,
Octstr *msisdn_header, List *msisdn_header,
Octstr *requestip_header, List *requestip_header,
MmsDetokenizerFuncStruct *detokenizerfuncs); MmsDetokenizerFuncStruct *detokenizerfuncs);
extern int mms_decodefetchurl(Octstr *fetch_url, extern int mms_decodefetchurl(Octstr *fetch_url,
Octstr **qf, Octstr **token, int *loc); 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, void notify_prov_server(char *cmd, char *from, char *event, char *arg, Octstr *msgid,
Octstr *ua, Octstr *uaprof); Octstr *ua, Octstr *uaprof);