[PATCH] SM field in EMI UCP reply to OT 01

Colin Pitrat <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Bull
Message-ID <[email protected]>
Hi
here is a patch that fill the SM field in positive reply to call input 
operation.

Regards,
-- 
Colin Pitrat (Bull Services Telco)
Bull,  Architect of an Open World (TM)
Tél : +33 (0)  1 30 80 72 93
www.bull.com
emi_ot01reply_SM.patch (text/plain, 1.4 KB)
--- gateway/gw/smsc/smsc_emi.c  2006-08-18 14:58:05.000000000 +0200
+++ gateway-new/gw/smsc/smsc_emi.c      2006-08-18 15:51:45.000000000 +0200
@@ -609,6 +609,7 @@
 		    warning(0, "EMI2[%s]: Couldn't decode message text",
 			    octstr_get_cstr(privdata->name));
 
+		//else if (octstr_get_char(emimsg->fields[E01_MT], 0) == '3') 
 		msg->sms.msgdata = emimsg->fields[E01_AMSG];
 		emimsg->fields[E01_AMSG] = NULL; /* So it's not freed */
 
@@ -652,6 +653,30 @@
 	msg->sms.smsc_id = octstr_duplicate(conn->id);
 	bb_smscconn_receive(conn, msg);
 	reply = emimsg_create_reply(01, emimsg->trn, 1, privdata->name);
+	/* 
+	 * Reply should contain SM as field 2 which is AdC:SCTS with :
+	 * AdC = Address code recipient, max 16 digits
+	 * SCTS = Service center time stamp DDMMYYhhmmss
+	 */
+	{
+	    time_t t_time;
+	    struct tm tm_time;
+	    // 13 because the timestamp format is DDMMYYhhmmss
+	    char timestamp[13];
+	    Octstr *tmpstr;
+	    Octstr *tmpstr2;
+
+	    time(&t_time);
+	    tmpstr = octstr_create(":");
+	    tmpstr2 = octstr_cat(emimsg->fields[E01_ADC], tmpstr);
+	    octstr_destroy(tmpstr); 
+	    gw_strftime(timestamp, sizeof(timestamp), "%d%m%y%H%M%S", localtime_r(&t_time, &tm_time));
+	    tmpstr = octstr_create(timestamp);
+	    reply->fields[1] = octstr_cat(tmpstr2, tmpstr);
+	    octstr_destroy(tmpstr);
+	    octstr_destroy(tmpstr2);
+	}
+
 	if (emi2_emimsg_send(conn, server, reply) < 0) {
 	    emimsg_destroy(reply);
 	    return -1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.