[svn-commits] may: branch may/smpp r401290 - /team/may/smpp/branches/10/addons/res_smpp.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Oct 19 11:47:24 CDT 2013


Author: may
Date: Sat Oct 19 11:47:23 2013
New Revision: 401290

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401290
Log:
correct sm_length on base64_body

Modified:
    team/may/smpp/branches/10/addons/res_smpp.c

Modified: team/may/smpp/branches/10/addons/res_smpp.c
URL: http://svnview.digium.com/svn/asterisk/team/may/smpp/branches/10/addons/res_smpp.c?view=diff&rev=401290&r1=401289&r2=401290
==============================================================================
--- team/may/smpp/branches/10/addons/res_smpp.c (original)
+++ team/may/smpp/branches/10/addons/res_smpp.c Sat Oct 19 11:47:23 2013
@@ -1244,7 +1244,8 @@
 			submit.esm_class = atoi(ast_msg_get_var(message, "esm_class")); \
 		} \
 		if(ast_msg_get_var(message, "base64_body")) { \
-			ast_base64decode(submit.short_message, ast_msg_get_var(message, "base64_body"), sizeof(submit.short_message) - 1); \
+			submit.sm_length = ast_base64decode(submit.short_message, ast_msg_get_var(message, "base64_body"), \
+								sizeof(submit.short_message) - 1); \
 		}
 
 		submit.source_addr_ton = 0;
@@ -1266,12 +1267,15 @@
 		submit.data_coding = 0;
 		submit.sm_default_msg_id = 0;
 
-		FILL_SMPP_HEADERS(message, submit);
-
 		if (submit.short_message[0] == 0) {
 			memcpy(submit.short_message, body, (strlen(body) < 254) ? strlen(body) : 254);
 		}
-		submit.sm_length = strlen((char *)submit.short_message);
+
+		FILL_SMPP_HEADERS(message, submit);
+
+		if (!submit.sm_length) {
+			submit.sm_length = strlen((char *)submit.short_message);
+		}
 		unpack = &submit;
 	} else {
 		deliver_sm_t deliver;
@@ -1281,8 +1285,6 @@
 		deliver.command_status = ESME_ROK;
 		deliver.sequence_number = sequence_number = smsc->seq++;
 
-		FILL_SMPP_HEADERS(message, deliver);
-
 		deliver.source_addr_ton = 0;
 		deliver.source_addr_npi = 0;
 		deliver.dest_addr_ton = 0;
@@ -1302,12 +1304,15 @@
 		deliver.data_coding = 0;
 		deliver.sm_default_msg_id = 0;
 
-		FILL_SMPP_HEADERS(message, deliver);
-
 		if (deliver.short_message[0] == 0) {
 			memcpy(deliver.short_message, body, (strlen(body) < 254) ? strlen(body) : 254);
 		}
-		deliver.sm_length = strlen((char *)deliver.short_message);
+
+		FILL_SMPP_HEADERS(message, deliver);
+
+		if (!deliver.sm_length) {
+			deliver.sm_length = strlen((char *)deliver.short_message);
+		}
 		unpack = &deliver;
 	}
 




More information about the svn-commits mailing list