Index: gw/smppbox.c
===================================================================
--- gw/smppbox.c	(revision 47)
+++ gw/smppbox.c	(working copy)
@@ -114,6 +114,7 @@
 static int smpp_autodetect_addr = 0;
 static long smpp_dest_addr_ton = -1;
 static long smpp_dest_addr_npi = -1;
+static long smpp_direct_acks = 1;
 
 static Octstr *smppbox_id;
 static Octstr *our_system_id;
@@ -1487,10 +1488,13 @@
 					octstr_destroy(msg2->sms.service);
 					msg2->sms.service = hold_service;
 				}
-				uuid_unparse(msg2->sms.id, id);
-				msgid = octstr_create(id);
-				dict_put(box->msg_acks, msgid, resp);
-				resp = NULL;
+				if (!smpp_direct_acks) {
+					uuid_unparse(msg2->sms.id, id);
+					msgid = octstr_create(id);
+					dict_put(box->msg_acks, msgid, resp);
+					octstr_destroy(msgid);
+					resp = NULL;
+				}
 				send_msg(box->bearerbox_connection, box, msg2);
 				if (parts_list) {
 					/* destroy values */
@@ -1528,11 +1532,13 @@
 					octstr_destroy(msg2->sms.service);
 					msg2->sms.service = hold_service;
 				}
-				uuid_unparse(msg2->sms.id, id);
-				msgid = octstr_create(id);
-				dict_put(box->msg_acks, msgid, resp);
-				octstr_destroy(msgid);
-				resp = NULL;
+				if (!smpp_direct_acks) {
+					uuid_unparse(msg2->sms.id, id);
+					msgid = octstr_create(id);
+					dict_put(box->msg_acks, msgid, resp);
+					octstr_destroy(msgid);
+					resp = NULL;
+				}
 				send_msg(box->bearerbox_connection, box, msg2);
 				if (parts_list) {
 					/* destroy values */
@@ -1542,18 +1548,20 @@
 		}
 		break;
 	case deliver_sm_resp:
-		msgid = octstr_format("%ld", pdu->u.deliver_sm_resp.sequence_number);
-		mack = dict_get(box->deliver_acks, msgid);
-		if (mack) {
-			msg = msg_duplicate(mack);
-			/* TODO: ack_failed_tmp */
-			if (pdu->u.deliver_sm_resp.command_status != 0) {
-				msg->ack.nack = ack_failed;
+		if (!smpp_direct_acks) {
+			msgid = octstr_format("%ld", pdu->u.deliver_sm_resp.sequence_number);
+			mack = dict_get(box->deliver_acks, msgid);
+			if (mack) {
+				msg = msg_duplicate(mack);
+				/* TODO: ack_failed_tmp */
+				if (pdu->u.deliver_sm_resp.command_status != 0) {
+					msg->ack.nack = ack_failed;
+				}
+				send_msg(box->bearerbox_connection, box, msg);
+				dict_put(box->deliver_acks, msgid, NULL);
 			}
-			send_msg(box->bearerbox_connection, box, msg);
-			dict_put(box->deliver_acks, msgid, NULL);
+			octstr_destroy(msgid);
 		}
-		octstr_destroy(msgid);
 		break;
 	case unbind_resp:
 		box->logged_in = 0;
@@ -1780,7 +1788,7 @@
             msg_destroy(msg);
             continue;
         }
-	if (msg_type(msg) == ack) {
+	if (msg_type(msg) == ack && !smpp_direct_acks) {
 	    uuid_unparse(msg->ack.id, id);
 	    msgid = octstr_create(id);
 	    pdu = dict_get(box->msg_acks, msgid);
@@ -1902,9 +1910,14 @@
 		if (pdulist != NULL) {
 			while ((pdu = gwlist_extract_first(pdulist)) != NULL) {
 				if (NULL == msgid) {
-					/* Put ack in dict. We will send it as soon as we received a deliver_sm_resp */
 					msgid = octstr_format("%ld", pdu->u.deliver_sm.sequence_number);
-					dict_put(receiver_box->deliver_acks, msgid, mack);
+					if (smpp_direct_acks) {
+						send_msg(receiver_box->bearerbox_connection, receiver_box, mack);
+					}
+					else {
+						/* Put ack in dict. We will send it as soon as we received a deliver_sm_resp */
+						dict_put(receiver_box->deliver_acks, msgid, mack);
+					}
 				}
 				send_pdu(receiver_box->smpp_connection, box->boxc_id, pdu);
 				smpp_pdu_destroy(pdu);
