|
|
|
@ -1112,6 +1112,30 @@ void mmsc_receive_func(MmscGrp *m)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* This function check if there is custom retry statuses list setup for mmc,
|
|
|
|
|
* if not it returns -1,
|
|
|
|
|
* if it is set check if current status should be retried (returns 1) or not (returns 0)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int check_custom_retry_statuses(MmscGrp *mmc, int hstatus) {
|
|
|
|
|
int retry_sending = -1, i, n;
|
|
|
|
|
Octstr *res_str = octstr_format("%d", hstatus);
|
|
|
|
|
if (mmc && mmc->retry_statuses != NULL) {
|
|
|
|
|
retry_sending = 0;
|
|
|
|
|
for (i = 0, n = gwlist_len(mmc->retry_statuses); i<n; i++) {
|
|
|
|
|
Octstr *retry_status = gwlist_get(mmc->retry_statuses, i);
|
|
|
|
|
if (octstr_compare(res_str, retry_status) == 0) {
|
|
|
|
|
retry_sending = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
octstr_destroy(res_str);
|
|
|
|
|
|
|
|
|
|
return retry_sending;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* XXX Returns msgid in mmsc or NULL if error. Caller uses this for DLR issues.
|
|
|
|
|
* Caller must make sure throughput issues
|
|
|
|
|
* are observed!
|
|
|
|
@ -1137,6 +1161,7 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, List *lto,
|
|
|
|
|
Octstr *s, *r, *status_details = NULL;
|
|
|
|
|
char *xvasid = vasid ? vasid : (mmc->default_vasid ? octstr_get_cstr(mmc->default_vasid) : NULL);
|
|
|
|
|
Octstr *to;
|
|
|
|
|
int retry_sending = -1;
|
|
|
|
|
|
|
|
|
|
LINEARISE_STR_LIST(to,lto,", ");
|
|
|
|
|
|
|
|
|
@ -1173,6 +1198,10 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, List *lto,
|
|
|
|
|
mmc->mmsc_url, hstatus);
|
|
|
|
|
if (hstatus < 0)
|
|
|
|
|
MMSC_ISSUE_ALARM(mmc, MMSBOX_ALARM_SOCKET_CONNECT_FAILED, 3);
|
|
|
|
|
|
|
|
|
|
/* Now check if we should retry */
|
|
|
|
|
retry_sending = check_custom_retry_statuses(mmc, hstatus);
|
|
|
|
|
|
|
|
|
|
MMSC_ISSUE_ALARM(mmc, MMSBOX_ALARM_MM7_NON_200_RESULT, 3);
|
|
|
|
|
goto done1;
|
|
|
|
|
} else {
|
|
|
|
@ -1227,6 +1256,9 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, List *lto,
|
|
|
|
|
tstatus = MM7_SOAP_FORMAT_CORRUPT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now check if we should retry */
|
|
|
|
|
retry_sending = check_custom_retry_statuses(mmc, tstatus);
|
|
|
|
|
|
|
|
|
|
if (!MM7_SOAP_STATUS_OK(tstatus) && tstatus != MM7_SOAP_COMMAND_REJECTED) {
|
|
|
|
|
char *tmp = (char *)mms_soap_status_to_cstr(tstatus);
|
|
|
|
|
|
|
|
|
@ -1263,7 +1295,10 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, List *lto,
|
|
|
|
|
if (ret)
|
|
|
|
|
mms_log2("Sent", from, to, -1, ret, NULL, mmc->id, "MMSBox", NULL, NULL);
|
|
|
|
|
done1:
|
|
|
|
|
*retry = (ret == NULL && (!MM7_SOAP_CLIENT_ERROR(tstatus) || tstatus < 0));
|
|
|
|
|
//DEFAULT when retry_sending < 0
|
|
|
|
|
//otherwise we rely on retry_status list
|
|
|
|
|
if (retry_sending < 0) *retry = (ret == NULL && (!MM7_SOAP_CLIENT_ERROR(tstatus) || tstatus < 0));
|
|
|
|
|
else *retry = retry_sending;
|
|
|
|
|
|
|
|
|
|
mm7_soap_destroy(mreq);
|
|
|
|
|
mm7_soap_destroy(mresp);
|
|
|
|
@ -1295,6 +1330,7 @@ static Octstr *mm7eaif_send(MmscGrp *mmc, Octstr *from, List *lto,
|
|
|
|
|
MmsMsg *mresp = NULL;
|
|
|
|
|
int mresp_type = -1, i;
|
|
|
|
|
Octstr *to;
|
|
|
|
|
int retry_sending = -1;
|
|
|
|
|
|
|
|
|
|
LINEARISE_STR_LIST(to,lto,", ");
|
|
|
|
|
|
|
|
|
@ -1351,6 +1387,10 @@ static Octstr *mm7eaif_send(MmscGrp *mmc, Octstr *from, List *lto,
|
|
|
|
|
mmc->mmsc_url, hstatus);
|
|
|
|
|
if (hstatus < 0)
|
|
|
|
|
MMSC_ISSUE_ALARM(mmc, MMSBOX_ALARM_SOCKET_CONNECT_FAILED, 3);
|
|
|
|
|
|
|
|
|
|
/* Now check if we should retry */
|
|
|
|
|
retry_sending = check_custom_retry_statuses(mmc, hstatus);
|
|
|
|
|
|
|
|
|
|
MMSC_ISSUE_ALARM(mmc, MMSBOX_ALARM_MM7_NON_200_RESULT, 3);
|
|
|
|
|
} else {
|
|
|
|
|
MMSC_CLEAR_ALARM(mmc, MMSBOX_ALARM_MM7_NON_200_RESULT);
|
|
|
|
@ -1377,7 +1417,11 @@ static Octstr *mm7eaif_send(MmscGrp *mmc, Octstr *from, List *lto,
|
|
|
|
|
else if (!ret)
|
|
|
|
|
ret = http_header_value(ph, octstr_imm("X-Nokia-MMSC-Message-Id"));
|
|
|
|
|
}
|
|
|
|
|
*retry = (ret == NULL && (hstatus == HTTP_STATUS_SERVER_ERROR || hstatus < 0));
|
|
|
|
|
|
|
|
|
|
//DEFAULT when retry_sending < 0
|
|
|
|
|
//otherwise we rely on retry_status list
|
|
|
|
|
if (retry_sending < 0) *retry = (ret == NULL && (hstatus == HTTP_STATUS_SERVER_ERROR || hstatus < 0));
|
|
|
|
|
else *retry = retry_sending;
|
|
|
|
|
|
|
|
|
|
mmsbox_event_cb(mmc->id,
|
|
|
|
|
mm7_msgtype_to_soaptype(mresp_type,1), 0, xver, hstatus,
|
|
|
|
@ -1423,6 +1467,7 @@ static Octstr *mm7http_send(MmscGrp *mmc,
|
|
|
|
|
Octstr *transid = e ? octstr_create(e->xqfname) : NULL;
|
|
|
|
|
int mm7type = mm7_msgtype_to_soaptype(mtype,1);
|
|
|
|
|
Octstr *to;
|
|
|
|
|
int retry_sending = -1;
|
|
|
|
|
|
|
|
|
|
LINEARISE_STR_LIST(to,lto," ");
|
|
|
|
|
|
|
|
|
@ -1453,6 +1498,10 @@ static Octstr *mm7http_send(MmscGrp *mmc,
|
|
|
|
|
mmc->mmsc_url, hstatus);
|
|
|
|
|
if (hstatus < 0)
|
|
|
|
|
MMSC_ISSUE_ALARM(mmc, MMSBOX_ALARM_SOCKET_CONNECT_FAILED, 3);
|
|
|
|
|
|
|
|
|
|
/* Now check if we should retry */
|
|
|
|
|
retry_sending = check_custom_retry_statuses(mmc, hstatus);
|
|
|
|
|
|
|
|
|
|
MMSC_ISSUE_ALARM(mmc, MMSBOX_ALARM_MM7_NON_200_RESULT, 3);
|
|
|
|
|
} else {
|
|
|
|
|
ret = rbody ? octstr_duplicate(rbody) : NULL;
|
|
|
|
@ -1467,7 +1516,10 @@ static Octstr *mm7http_send(MmscGrp *mmc,
|
|
|
|
|
0, e->attempts, e->from,
|
|
|
|
|
to, ret, transid, hdrs, NULL);
|
|
|
|
|
|
|
|
|
|
*retry = (ret == NULL && (http_status_class(hstatus) == HTTP_STATUS_SERVER_ERROR || hstatus < 0));
|
|
|
|
|
//DEFAULT when retry_sending < 0
|
|
|
|
|
//otherwise we rely on retry_status list
|
|
|
|
|
if (retry_sending < 0) *retry = (ret == NULL && (http_status_class(hstatus) == HTTP_STATUS_SERVER_ERROR || hstatus < 0));
|
|
|
|
|
else *retry = retry_sending;
|
|
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
|
mms_log2("Sent", from, to, -1, ret, NULL, mmc->id, "MMSBox", NULL, NULL);
|
|
|
|
|