Reporting the number of message parts sent for long messages.
"Oded Arbel" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi list. For some purposes (for example - billing) the application behind Kannel may need to know how messages Kannel actually sent for each message that the application sent to Kannel (as Kannel will split long messages into parts). for this prurpose I wrote this hack - it's very simple and not well written, but it allowes the application to analyze the response from smsbox in order to learn how many msg parts the message was splitted to. I would like the opinion of the developers on the usefullnes of this behaviour, and how do you think it should be cleaned/standardized. -- Oded Arbel m-Wise Inc. [email protected] Dogs believe they are human. Cats believe they are God. <<smsbox.patch>>
smsbox.patch
(application/octet-stream, 1.8 KB)
--- gw/smsbox.c 2002-04-10 14:24:02.000000000 +0300
+++ gw/smsbox.c 2002-04-10 14:37:16.000000000 +0300
@@ -127,7 +127,7 @@
*/
static int send_message(URLTranslation *trans, Msg *msg)
{
- int max_msgs;
+ int max_msgs, msg_count;
Octstr *header, *footer, *suffix, *split_chars;
int catenate, msg_sequence;
List *list;
@@ -176,13 +176,14 @@
list = sms_split(msg, header, footer, suffix, split_chars, catenate,
msg_sequence, max_msgs, sms_max_length);
+ msg_count = list_len(list);
debug("sms", 0, "message length %ld, sending %ld messages",
octstr_len(msg->sms.msgdata), list_len(list));
while ((part = list_extract_first(list)) != NULL)
write_to_bearerbox(part);
list_destroy(list, NULL);
- return 0;
+ return msg_count;
}
@@ -1300,7 +1301,7 @@
Msg *msg = NULL;
Octstr *newfrom, *returnerror, *receiv;
List *receiver, *failed_id, *allowed, *denied;
- int no_recv, ret, i;
+ int no_recv, ret, i, msg_count = 0;
long del;
/*
@@ -1518,7 +1519,7 @@
msg->sms.receiver = octstr_duplicate(receiv);
msg->sms.time = time(NULL);
- ret = send_message(t, msg);
+ msg_count = ret = send_message(t, msg);
if (ret == -1) {
/* add the receiver to the failed list */
@@ -1561,6 +1562,7 @@
}
}
list_destroy(denied, octstr_destroy_item);
+ octstr_format_append(returnerror," msgs sent: %d",msg_count);
return returnerror;
@@ -1595,6 +1597,7 @@
octstr_destroy(receiv);
list_destroy(failed_id, octstr_destroy_item);
list_destroy(denied, octstr_destroy_item);
+ octstr_format_append(returnerror," msgs sent: %d",msg_count);
return returnerror;
}