Ok, so we could have something like this :
--- /gateway-cvs/gw/smsc/smsc_http.c 2006-04-19 13:03:21.000000000 +0200
+++ /gateway/gw/smsc/smsc_http.c 2006-05-04 16:10:28.000000000 +0200
@@ -396,9 +396,20 @@
octstr_case_compare(body, octstr_imm("Ok.")) == 0 ||
octstr_ncompare(body, octstr_imm("Result: OK"),10) == 0)) {
bb_smscconn_sent(conn, msg, NULL);
+ } else if ((status == HTTP_INTERNAL_SERVER_ERROR || status ==
HTTP_NOT_IMPLEMENTED
+ || status == HTTP_BAD_GATEWAY || status == HTTP_SERVICE_UNAVAILABLE)
+ && (octstr_case_compare(body, octstr_imm("Try again later.")) == 0)) {
+ ConnData *conndata = conn->data;
+ conn->status = SMSCCONN_RECONNECTING;
+ debug("smsc.http.kannel", 0, "HTTP[%s]: Server is busy/unavailable,
re-sending request",
+ octstr_get_cstr(conn->id));
+ bb_smscconn_send_failed(conn, msg,
+ SMSCCONN_FAILED_TEMPORARILY, NULL);
} else {
+ error(0, "HTTP[%s]: Message was rejected. SMSC reponse was: <%s>",
+ octstr_get_cstr(conn->id), octstr_get_cstr(body));
bb_smscconn_send_failed(conn, msg,
- SMSCCONN_FAILED_MALFORMED, octstr_duplicate(body));
+ SMSCCONN_FAILED_REJECTED, octstr_duplicate(body));
}
}
--
Telemaque - NICE - (FR)
Service Technique - Developpement
http://www.telemaque.fr/
[EMAIL PROTECTED]
Tel : +33 4 93 97 71 64 (fax 68)
----- Original Message -----
From: "Alexander Malysh" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, May 04, 2006 2:30 PM
Subject: Re: (unknown)
> Hi,
>
> I don't think that sleep in that case the best approach.
> You could just call:
> bb_smscconn_send_failed(...,...,SMSCCONN_FAILED_TEMPORARILY,...)
>
> and smscconn core will take care of resending.
>
> Thanks,
> Alex
>
--- /gateway-cvs/gw/smsc/smsc_http.c 2006-04-19 13:03:21.000000000 +0200
+++ /gateway/gw/smsc/smsc_http.c 2006-05-04 16:10:28.000000000 +0200
@@ -396,9 +396,20 @@
octstr_case_compare(body, octstr_imm("Ok.")) == 0 ||
octstr_ncompare(body, octstr_imm("Result: OK"),10) == 0)) {
bb_smscconn_sent(conn, msg, NULL);
+ } else if ((status == HTTP_INTERNAL_SERVER_ERROR || status ==
HTTP_NOT_IMPLEMENTED
+ || status == HTTP_BAD_GATEWAY || status == HTTP_SERVICE_UNAVAILABLE)
+ && (octstr_case_compare(body, octstr_imm("Try again later.")) == 0)) {
+ ConnData *conndata = conn->data;
+ conn->status = SMSCCONN_RECONNECTING;
+ debug("smsc.http.kannel", 0, "HTTP[%s]: Server is busy/unavailable,
re-sending request",
+ octstr_get_cstr(conn->id));
+ bb_smscconn_send_failed(conn, msg,
+ SMSCCONN_FAILED_TEMPORARILY, NULL);
} else {
+ error(0, "HTTP[%s]: Message was rejected. SMSC reponse was: <%s>",
+ octstr_get_cstr(conn->id), octstr_get_cstr(body));
bb_smscconn_send_failed(conn, msg,
- SMSCCONN_FAILED_MALFORMED, octstr_duplicate(body));
+ SMSCCONN_FAILED_REJECTED, octstr_duplicate(body));
}
}