misc cleanups to mmsc
This commit is contained in:
parent
3789d199a7
commit
4ebf96552e
|
@ -33,7 +33,7 @@ static int mms_billingmodule_fini(void *module_data)
|
|||
return module_data ? fclose(module_data) : -1;
|
||||
}
|
||||
|
||||
static int mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data)
|
||||
static int mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, Octstr *msgid, void *module_data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ typedef struct MmsBillingFuncStruct {
|
|||
/* Bills a message. Returns >= 0 if billed ok, -1 if message should be rejected,
|
||||
* -2 on internal (temporary) error.
|
||||
*/
|
||||
int (*mms_billmsg)(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data);
|
||||
int (*mms_billmsg)(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, Octstr *msgid, void *module_data);
|
||||
|
||||
int (*mms_billingmodule_fini)(void *module_data);
|
||||
} MmsBillingFuncStruct;
|
||||
|
|
|
@ -33,7 +33,7 @@ static int mms_billingmodule_fini(void *module_data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data)
|
||||
static int mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, Octstr *msgid, void *module_data)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -41,7 +41,8 @@ static int mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *v
|
|||
return 0;
|
||||
for (i=0;i<gwlist_len(to);i++) {
|
||||
Octstr *s;
|
||||
s = octstr_format("%s '%s' '%s'", octstr_get_cstr(script), octstr_get_cstr(from), octstr_get_cstr(gwlist_get(to, i)));
|
||||
s = octstr_format("%s '%s' '%s' '%S'", octstr_get_cstr(script), octstr_get_cstr(from),
|
||||
octstr_get_cstr(gwlist_get(to, i)), msgid);
|
||||
if (s) {
|
||||
int ret = system(octstr_get_cstr(s));
|
||||
octstr_destroy(s);
|
||||
|
|
|
@ -26,19 +26,19 @@ typedef struct MmsDetokenizerFuncStruct {
|
|||
/* This function is called once to initialise the detokenizer module. Return 0 on succeful
|
||||
* initialization.
|
||||
*/
|
||||
int (*mms_detokenizer_init)(char *settings);
|
||||
int (*mms_detokenizer_init)(char *settings);
|
||||
|
||||
/* Looks up the token and returns the msisdn as a new Octstr.
|
||||
* Return NULL on error, otherwise an Octstr
|
||||
*/
|
||||
Octstr *(*mms_detokenize)(Octstr * token, Octstr *request_ip);
|
||||
|
||||
Octstr *(*mms_detokenize)(Octstr * token, Octstr *request_ip);
|
||||
|
||||
/* Given an msisdn, returns the token associated
|
||||
* Return NULL on error, otherwise an Octstr
|
||||
*/
|
||||
Octstr *(*mms_gettoken)(Octstr *msisdn);
|
||||
|
||||
int (*mms_detokenizer_fini)(void);
|
||||
Octstr *(*mms_gettoken)(Octstr *msisdn);
|
||||
|
||||
int (*mms_detokenizer_fini)(void);
|
||||
} MmsDetokenizerFuncStruct;
|
||||
|
||||
extern MmsDetokenizerFuncStruct mms_detokenizefuncs; /* The module must expose this symbol. */
|
||||
|
|
|
@ -479,10 +479,9 @@ Octstr *mms_find_sender_msisdn(Octstr *send_url,
|
|||
gwlist_get(l, gwlist_len(l) - 1) :
|
||||
send_url,
|
||||
xip);
|
||||
if (l)
|
||||
gwlist_destroy(l, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
if (xip)
|
||||
octstr_destroy(xip);
|
||||
|
||||
gwlist_destroy(l, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
octstr_destroy(xip);
|
||||
}
|
||||
|
||||
return phonenum;
|
||||
|
|
|
@ -77,14 +77,18 @@ static int sendMsg(MmsEnvelope *e)
|
|||
|
||||
for (i = 0, n = gwlist_len(e->to); i < n; i++) {
|
||||
MmsEnvelopeTo *to = gwlist_get(e->to, i);
|
||||
gwlist_append(l, to->rcpt);
|
||||
Octstr *s = octstr_duplicate(to->rcpt);
|
||||
|
||||
_mms_fixup_address(s, octstr_get_cstr(settings->unified_prefix));
|
||||
gwlist_append(l, s);
|
||||
}
|
||||
|
||||
amt = settings->mms_billfuncs->mms_billmsg(e->from, l,
|
||||
e->msize,
|
||||
e->vaspid,
|
||||
e->msgId,
|
||||
settings->mms_bill_module_data);
|
||||
gwlist_destroy(l, NULL);
|
||||
gwlist_destroy(l, (void *)octstr_destroy);
|
||||
|
||||
info(0, "Global Queue MMS Bill: From %s, to_count=%ld, msgid=%s, msgsize=%ld: returned=%.2f",
|
||||
octstr_get_cstr(e->from), gwlist_len(e->to), e->msgId ? octstr_get_cstr(e->msgId) : "",
|
||||
|
|
|
@ -136,8 +136,7 @@ int main(int argc, char *argv[])
|
|||
h.vasp = NULL;
|
||||
h.profile_url = NULL;
|
||||
h.ua = http_header_value(h.headers, octstr_imm("User-Agent"));
|
||||
|
||||
http_header_dump(h.headers);
|
||||
|
||||
/* Get the profile URL and store it. Has effect of fetching if missing. */
|
||||
if ((h.profile_url = http_header_value(h.headers,
|
||||
octstr_imm("X-Wap-Profile"))) == NULL)
|
||||
|
@ -215,17 +214,10 @@ int main(int argc, char *argv[])
|
|||
gwthread_create((gwthread_func_t *)sendmms_proxy, hx);
|
||||
|
||||
} else {
|
||||
octstr_destroy(h.ip);
|
||||
octstr_destroy(h.url);
|
||||
|
||||
if (h.body)
|
||||
octstr_destroy(h.body);
|
||||
if (h.headers)
|
||||
http_destroy_headers(h.headers);
|
||||
if (h.cgivars)
|
||||
http_destroy_headers(h.cgivars);
|
||||
|
||||
http_close_client(h.client);
|
||||
|
||||
free_clientInfo(&h, 0);
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -559,7 +551,8 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
|
|||
&deliveryt, settings->default_msgexpiry);
|
||||
|
||||
if (!h->client_addr) {
|
||||
mresp = mms_sendconf("Error-sending-address-unresolved", "None", octstr_get_cstr(otransid),0,
|
||||
mresp = mms_sendconf("Error-sending-address-unresolved", "None",
|
||||
octstr_get_cstr(otransid),0,
|
||||
menc);
|
||||
error(0, "MMS Send interface: failed to find sender address in request from %s!",
|
||||
octstr_get_cstr(h->ip));
|
||||
|
@ -1923,8 +1916,8 @@ static void mm7proxy(void *unused)
|
|||
else
|
||||
gwthread_create((gwthread_func_t *)mm7eaif_dispatch, hx);
|
||||
} else {
|
||||
free_clientInfo(&h, 0);
|
||||
http_close_client(h.client);
|
||||
free_clientInfo(&h, 0);
|
||||
}
|
||||
|
||||
debug("proxy", 0, "MM7 Shutting down...");
|
||||
|
|
Loading…
Reference in New Issue