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>
* Minor patches for better Solaris compatibility (Thanks to Benno Rice <benno@ekit-inc.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
&nbsp; &nbsp;</td>
<td valign=top >
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 <b>Mode</b>
String
&nbsp; &nbsp;</td>
<td valign=top >
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

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->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<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 *ip,
List *request_hdrs,
Octstr *msisdn_header,
Octstr *requestip_header,
List *msisdn_header,
List *requestip_header,
MmsDetokenizerFuncStruct* detokenizerfuncs)
{
/* 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);
Octstr *phonenum = xfind_one_header(request_hdrs,
msisdn_header);
if (phonenum == NULL || octstr_len(phonenum) == 0) {
List *l = octstr_split(send_url, octstr_imm("/"));
int len = gwlist_len(l);
Octstr *xip = http_header_value(request_hdrs,
requestip_header);
Octstr *xip = xfind_one_header(request_hdrs,
requestip_header);
if (xip == NULL)
xip = ip ? octstr_duplicate(ip) : NULL;
if (detokenizerfuncs && (len > 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);

View File

@ -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);