smsc_emi patch - system message field
William Eder <[email protected]> Thu, 16 Nov 2017 08:08:22 +0100 (CET)
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, I followed instructions at here http://www.kannel.org/pipermail/devel/2009-June/002734.html and made a patch to work kannel with T-Mobile integrations. I tested and it works. The differences between the original patch under the topic that I mentioned before that need to send an UCP53 ack messages too. If you think it should works with another systems too, please merge this patch to the svn tree otherwise it should be extending this addons with a configurable options which can enable or disable this UCP52/53 ack messages. I'm not know the source code specifications so if somebody can help me on this, I am very appreciate it. Thank you in advance. Willam
pull_request.diff
(x-unknown/octet-stream, 2.5 KB)
Index: gw/smsc/smsc_emi.c
===================================================================
--- gw/smsc/smsc_emi.c (revision 5190)
+++ gw/smsc/smsc_emi.c (working copy)
@@ -586,6 +586,8 @@
int st_code;
PrivData *privdata = conn->data;
+ struct tm tm;
+ char p[20];
switch(emimsg->ot) {
@@ -833,6 +835,24 @@
msg->sms.smsc_id = octstr_duplicate(conn->id);
bb_smscconn_receive(conn, msg);
reply = emimsg_create_reply(52, emimsg->trn, 1, privdata->name);
+
+ /*
+ * Create a system message field for UCP52 ack message.
+ * The system message has the recipient's address + a timestamp.
+ * Some SMSC (eg. T-Mobile) requires it.
+ */
+ Octstr *tmpstr;
+ tmpstr = octstr_create("");
+ /* Get the recipient's address. */
+ octstr_append(tmpstr, emimsg->fields[E50_ADC]);
+ octstr_append_char(tmpstr, ':');
+ /* Create a timestamp. */
+ tm = gw_localtime(time(NULL) + msg->sms.deferred * 60);
+ sprintf(p, "%02d%02d%02d%02d%02d%02d", tm.tm_mday, tm.tm_mon + 1, tm.tm_year % 100, tm.tm_hour, tm.tm_min, tm.tm_sec);
+ octstr_append(tmpstr, octstr_create(p));
+ /* Concatenate and insert the fields (number + timestamp) above. */
+ reply->fields[2] = tmpstr;
+
if (emi2_emimsg_send(conn, server, reply) < 0) {
emimsg_destroy(reply);
return -1;
@@ -885,6 +905,24 @@
bb_smscconn_receive(conn, msg);
}
reply = emimsg_create_reply(53, emimsg->trn, 1, privdata->name);
+
+ /*
+ * Create a system message field for UCP53 ack message.
+ * The system message has the recipient's address + a timestamp.
+ * Some SMSC (eg. T-Mobile) requires it.
+ */
+ Octstr *tmhactresp;
+ tmhactresp = octstr_create("");
+ /* Get the recipient's address. */
+ octstr_append(tmhactresp, emimsg->fields[E50_ADC]);
+ octstr_append_char(tmhactresp, ':');
+ /* Create a timestamp. */
+ tm = gw_localtime(time(NULL) + msg->sms.deferred * 60);
+ sprintf(p, "%02d%02d%02d%02d%02d%02d", tm.tm_mday, tm.tm_mon + 1, tm.tm_year % 100, tm.tm_hour, tm.tm_min, tm.tm_sec);
+ octstr_append(tmhactresp, octstr_create(p));
+ /* Concatenate and insert the fields (number + timestamp) above. */
+ reply->fields[2] = tmhactresp;
+
if (emi2_emimsg_send(conn, server, reply) < 0) {
emimsg_destroy(reply);
return -1;