Added message-ID parameter to prov-notify-script
This commit is contained in:
parent
96708be15c
commit
e652be1d62
|
@ -1376,9 +1376,12 @@ lists all the configuration directives. The column <b>Mode</b>
|
|||
database interface script 1: This script will be called by the gateway to
|
||||
notify the subscriber database of per-subscriber events such as when a
|
||||
subscriber sends a message, successfully fetches a message, etc. This script
|
||||
is called with 2-3 arguments. Argument 1 is one of fetched, sent,
|
||||
is called with 4 arguments. Argument 1 is one of fetched, sent,
|
||||
failedfetch; argument 2 is the subscriber MSISDN; argument 3, in case of a
|
||||
failed fetch provides a description of the error (e.g. message expired).
|
||||
failed fetch provides a description of the error (e.g. message
|
||||
expired); argument 4 is the message ID (if any). NOTE: Any missing
|
||||
argument is passed as a quoted empty string for ease of parsing in
|
||||
the script.
|
||||
</td>
|
||||
</tr>
|
||||
<tr >
|
||||
|
|
|
@ -532,17 +532,23 @@ int mms_ind_send(Octstr *prov_cmd, Octstr *to)
|
|||
return res;
|
||||
}
|
||||
|
||||
void notify_prov_server(char *cmd, char *from, char *event, char *arg)
|
||||
void notify_prov_server(char *cmd, char *from, char *event, char *arg, Octstr *msgid)
|
||||
{
|
||||
Octstr *s;
|
||||
Octstr *tmp;
|
||||
Octstr *tmp, *tmp2;
|
||||
|
||||
if (cmd == NULL || cmd[0] == '\0')
|
||||
return;
|
||||
tmp = octstr_create(from);
|
||||
escape_shell_chars(tmp);
|
||||
s = octstr_format("%s '%s' '%s' '%s'", cmd, event, octstr_get_cstr(tmp), arg);
|
||||
|
||||
tmp2 = msgid ? octstr_duplicate(msgid) : octstr_create("");
|
||||
escape_shell_chars(tmp2);
|
||||
|
||||
s = octstr_format("%s '%s' '%s' '%s' '%s'", cmd, event,
|
||||
octstr_get_cstr(tmp), arg, octstr_get_cstr(tmp2));
|
||||
octstr_destroy(tmp);
|
||||
octstr_destroy(tmp2);
|
||||
|
||||
if (s) {
|
||||
system(octstr_get_cstr(s));
|
||||
|
|
|
@ -117,7 +117,7 @@ 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);
|
||||
|
||||
void notify_prov_server(char *cmd, char *from, char *event, char *arg);
|
||||
void notify_prov_server(char *cmd, char *from, char *event, char *arg, Octstr *msgid);
|
||||
int mms_ind_send(Octstr *prov_cmd, Octstr *to);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -332,7 +332,7 @@ static int sendNotify(MmsEnvelope *e)
|
|||
} else if (send_ind == 0) { /* provisioned but does not support */
|
||||
Octstr *s = octstr_format(octstr_get_cstr(settings->mms_notify_txt),
|
||||
from);
|
||||
if (s && octstr_len(s) > 0) { /* Only send if the string was set. */
|
||||
if (settings->notify_unprovisioned && s && octstr_len(s) > 0) { /* Only send if the string was set. */
|
||||
List *pheaders;
|
||||
Octstr *sto = octstr_duplicate(phonenum);
|
||||
|
||||
|
@ -449,7 +449,8 @@ static int sendNotify(MmsEnvelope *e)
|
|||
notify_prov_server(octstr_get_cstr(settings->prov_notify),
|
||||
to ? octstr_get_cstr(to) : "unknown",
|
||||
prov_notify_event,
|
||||
rtype ? rtype : "");
|
||||
rtype ? rtype : "",
|
||||
e ? e->msgId : NULL);
|
||||
|
||||
if (msg) mms_destroy(msg);
|
||||
if (phonenum)
|
||||
|
|
|
@ -325,10 +325,10 @@ void fetchmms_proxy(MmsHTTPClientInfo *h)
|
|||
settings->system_user,MS_1_1);
|
||||
octstr_destroy(xx);
|
||||
|
||||
s = mms_tobinary(mr);
|
||||
notify_cmd = "fetchfailed";
|
||||
notify_arg = "message-too-large-for-device";
|
||||
goto failed;
|
||||
s = mms_tobinary(mr);
|
||||
notify_cmd = "fetchfailed";
|
||||
notify_arg = "message-too-large-for-device";
|
||||
goto failed;
|
||||
} else {
|
||||
mms_destroy(m);
|
||||
m = outmsg;
|
||||
|
@ -409,7 +409,7 @@ void fetchmms_proxy(MmsHTTPClientInfo *h)
|
|||
if (notify_cmd) /* Inform provisioning server */
|
||||
notify_prov_server(octstr_get_cstr(settings->prov_notify),
|
||||
h->base_client_addr ? octstr_get_cstr(h->base_client_addr) : "unknown",
|
||||
notify_cmd, notify_arg ? notify_arg : "");
|
||||
notify_cmd, notify_arg ? notify_arg : "", e ? e->msgId : NULL);
|
||||
|
||||
|
||||
http_destroy_headers(rh);
|
||||
|
@ -1497,7 +1497,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
|
|||
notify_prov_server(octstr_get_cstr(settings->prov_notify),
|
||||
h->base_client_addr ? octstr_get_cstr(h->base_client_addr) : "unknown",
|
||||
notify_cmd,
|
||||
"");
|
||||
"", NULL);
|
||||
|
||||
mms_destroy(m);
|
||||
/* Send reply. */
|
||||
|
|
Loading…
Reference in New Issue