[asterisk-commits] may: branch may/smpp r401123 - /team/may/smpp/branches/10/addons/res_smpp.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 17 11:11:13 CDT 2013
Author: may
Date: Thu Oct 17 11:11:11 2013
New Revision: 401123
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401123
Log:
fill MESSAGE_DATA(base64_body) on incoming messages
put MESSAGE_DATA(base64_body) to message body more prefer than MESSAGE(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=401123&r1=401122&r2=401123
==============================================================================
--- team/may/smpp/branches/10/addons/res_smpp.c (original)
+++ team/may/smpp/branches/10/addons/res_smpp.c Thu Oct 17 11:11:11 2013
@@ -25,6 +25,8 @@
// empty system_id in bind_resp (unpack failed, libsmpp error??)
// 0.0.0.0 in 'smpp show peers' if esme allowed to connect from any
// must be connected ip instead
+// UDHI parsing (libsmpp???)
+//
#include "asterisk.h"
#include <pthread.h>
@@ -294,7 +296,9 @@
snprintf(tmp, sizeof(tmp), "%s", deliver->service_type); \
ast_msg_set_var(msg, "service_type", tmp); \
snprintf(tmp, sizeof(tmp), "%d", deliver->esm_class); \
- ast_msg_set_var(msg, "esm_class", tmp);
+ ast_msg_set_var(msg, "esm_class", tmp); \
+ ast_base64encode(tmp, deliver->short_message, deliver->sm_length, sizeof(tmp)); \
+ ast_msg_set_var(msg, "base64_body", tmp);
FILL_MSG_HEADERS(msg, deliver, tmp);
ast_msg_set_var(msg, "smpp_type", "MO");
@@ -1236,6 +1240,9 @@
} \
if(ast_msg_get_var(message, "esm_class")) { \
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); \
}
FILL_SMPP_HEADERS(message, submit);
@@ -1258,8 +1265,10 @@
submit.data_coding = 0;
submit.sm_default_msg_id = 0;
- submit.sm_length = strlen(body);
- memcpy(submit.short_message, body, (strlen(body) < 254) ? strlen(body) : 254);
+ 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);
unpack = &submit;
} else {
deliver_sm_t deliver;
@@ -1289,8 +1298,10 @@
deliver.data_coding = 0;
deliver.sm_default_msg_id = 0;
- deliver.sm_length = strlen(body);
- memcpy(deliver.short_message, body, (strlen(body) < 254) ? strlen(body) : 254);
+ 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);
unpack = &deliver;
}
More information about the asterisk-commits
mailing list