1
0
Fork 0

Added X-Carrier ID header

This commit is contained in:
bagyenda 2012-04-09 23:45:30 +00:00
parent 628fc0c744
commit 5208b4311f
8 changed files with 41 additions and 5 deletions

View File

@ -1,3 +1,5 @@
2012-04-10 P. A. Bagyenda <bagyenda@dsmagic.com>
* Added ability to receive carrier ID info via special HTTP header in SOAP request to mmsbox (a la OpenMarket)
2011-10-11 P. A. Bagyenda <bagyenda@dsmagic.com>
* Fixed mem leaks in mmsc uaprof module
* Fixed mem leak in get_content_type function

View File

@ -3234,7 +3234,7 @@ string
String
</td>
<td valign=top >
HTTP USer Agent String to send to MMSC in HTTP requests (e.g. &quot;Mozilla/5.0 (SymbianOS/9.4;U;
HTTP User Agent String to send to MMSC in HTTP requests (e.g. &quot;Mozilla/5.0 (SymbianOS/9.4;U;
Series60/5.0 Nokia5800d-1/52.50.2008.24;
Profile/MIDP-2.1Configuration/CLDC-1.1 )
AppleWebKit/413 (KHTML, like Gecko)
@ -3244,6 +3244,20 @@ string
</td>
</tr>
<tr>
<td valign=top >
<tt>carrier-id-header</tt>
</td>
<td valign=top >
String
</td>
<td valign=top >
HTTP Header used by Carrier to send us a special identifying ID
for the subscriber. This is passed on as is to the mms service
in a <tt>X-Mbuni-CarrierID</tt> header.
</td>
</tr>
1
</table>

View File

@ -206,6 +206,7 @@ MULTI_GROUP(mmsc,
OCTSTR(mm1-sms-off-command)
OCTSTR(mm1-msisdn)
OCTSTR(mm1-ua-string)
OCTSTR(carrier-id-header)
)
MULTI_GROUP(mms-service,

View File

@ -172,6 +172,7 @@ static int mm7soap_receive(MmsBoxHTTPClientInfo *h)
Octstr *qf = NULL, *mmc_id = NULL, *qdir = NULL;
List *qhdr = http_create_empty_headers();
Octstr *r, *s, *transid = NULL, *value = NULL;
Octstr *carrier_id = NULL;
if (h->body)
mreq = mm7_parse_soap(h->headers, h->body);
@ -198,6 +199,8 @@ static int mm7soap_receive(MmsBoxHTTPClientInfo *h)
if (!from)
from = octstr_create("anon@anon");
if (h->m->carrier_id_header)
carrier_id = http_header_value(h->headers, h->m->carrier_id_header);
qdir = get_mmsbox_queue_dir(from, to, h->m, &mmc_id); /* get routing info. */
@ -232,6 +235,9 @@ static int mm7soap_receive(MmsBoxHTTPClientInfo *h)
http_header_add(qh, "X-Mbuni-Timestamp", octstr_get_cstr(sx));
octstr_destroy(sx);
}
if (carrier_id)
http_header_add(qh, "X-Mbuni-CarrierID", octstr_get_cstr(carrier_id));
MOD_SUBJECT(m, h->m, from);
@ -291,7 +297,10 @@ static int mm7soap_receive(MmsBoxHTTPClientInfo *h)
octstr_destroy(value2);
value2 = NULL;
}
if (carrier_id)
http_header_add(qhdr, "X-Mbuni-CarrierID", octstr_get_cstr(carrier_id));
m = mm7_soap_to_mmsmsg(mreq, from);
value2 = mmsbox_get_report_info(m, h->m, mmc_id, "delivery-report",
value, qhdr, uaprof, uaprof_tstamp, msgid);
@ -327,6 +336,9 @@ static int mm7soap_receive(MmsBoxHTTPClientInfo *h)
value2 = mmsbox_get_report_info(m, h->m, mmc_id, "read-report", value, qhdr, uaprof, uaprof_tstamp, msgid);
if (carrier_id)
http_header_add(qhdr, "X-Mbuni-CarrierID", octstr_get_cstr(carrier_id));
qf = qfs->mms_queue_add(from, to, NULL,
h->m->id, mmc_id,
0, time(NULL) + default_msgexpiry, m, NULL,

View File

@ -177,6 +177,11 @@ static int fetch_serviceurl(MmsEnvelope *e,
http_header_add(rh, "X-Mbuni-Message-Date", octstr_get_cstr(s));
octstr_destroy(s);
}
if ((s = http_header_value(e->hdrs, octstr_imm("X-Mbuni-CarrierID"))) != NULL) {
http_header_add(rh, "X-Mbuni-CarrierID", octstr_get_cstr(s));
octstr_destroy(s);
}
s = date_format_http(e->created);
http_header_add(rh, "X-Mbuni-Received-Date", octstr_get_cstr(s));

View File

@ -620,7 +620,8 @@ static MmscGrp *start_mmsc_from_conf(mCfg *cfg, mCfgGrp *x, List *warnings, List
m->incoming.allow_ip = mms_cfg_get(cfg, x, octstr_imm("allow-ip"));
m->incoming.deny_ip = mms_cfg_get(cfg, x, octstr_imm("deny-ip"));
m->carrier_id_header = mms_cfg_get(cfg,x,octstr_imm("carrier-id-header"));
if (mms_cfg_get_bool(cfg, x, octstr_imm("strip-domain"), &m->strip_domain) < 0)
m->strip_domain = 1;
@ -1283,7 +1284,7 @@ static void free_mmsc_struct (MmscGrp *m)
octstr_destroy(m->group_id);
octstr_destroy(m->vasp_id);
octstr_destroy(m->mmsc_url);
octstr_destroy(m->carrier_id_header);
octstr_destroy(m->incoming.user);
octstr_destroy(m->incoming.pass);
octstr_destroy(m->incoming.allow_ip);

View File

@ -50,6 +50,7 @@ typedef struct MmscGrp {
} incoming; /* user, pass, port (and whether SSL) that MMSC uses to connect to us. */
Octstr *allowed_prefix, *denied_prefix;
Octstr *allowed_sender_prefix, *denied_sender_prefix;
Octstr *carrier_id_header; /* http header that has carrier id */
enum {UNKNOWN_MMSC = -1, CUSTOM_MMSC, SOAP_MMSC, EAIF_MMSC, MM4_MMSC, HTTP_MMSC, MM1_MMSC} type; /* type of connection. */
double throughput; /* Max send rate. */
long threadid; /* handler thread. */

View File

@ -673,7 +673,7 @@ static int mm7soap_send(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgId,
*error = octstr_format("Failed to convert SOAP message 2 HTTP Msg!");
goto done1;
}
hstatus = mms_url_fetch_content(HTTP_METHOD_POST, vasp->vasp_url, rh, body, &ph, &rbody);
*got_conn_error = (hstatus < 0);
if (http_status_class(hstatus) != HTTP_STATUS_SUCCESSFUL) {