[svn-commits] may: branch may/smpp r401329 - /team/may/smpp/branches/10/addons/res_smpp.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Oct 21 14:57:05 CDT 2013
Author: may
Date: Mon Oct 21 14:57:03 2013
New Revision: 401329
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401329
Log:
fill & parse tlv tags from libsmpp
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=401329&r1=401328&r2=401329
==============================================================================
--- team/may/smpp/branches/10/addons/res_smpp.c (original)
+++ team/may/smpp/branches/10/addons/res_smpp.c Mon Oct 21 14:57:03 2013
@@ -75,7 +75,19 @@
static pthread_t listener = AST_PTHREADT_NULL;
static char system_id[16] = "asterisk";
AST_MUTEX_DEFINE_STATIC(smpp_lock);
-//
+
+
+#define OPERACION( p_tlv_id ) \
+ { .tlv = #p_tlv_id,\
+ .tlvid = p_tlv_id },
+
+static struct tlvdesc {
+ char *tlv;
+ uint16_t tlvid;
+} tlvs[] = {
+#include "def_list/tlv_id.list"
+ { .tlv = "", .tlvid = 0, }
+};
struct smpp_smsc;
@@ -128,8 +140,6 @@
static int send_bind_resp_fail(int socket, int sequence, int command_status);
//
-// return conference parameters to channel driver
-//
static char* generate_msgid(char *msgid)
{
@@ -315,7 +325,21 @@
while (tlv) { \
tlvnum++; \
snprintf(tmp2, sizeof(tmp2), "tlv.%d.tag", tlvnum); \
- snprintf(tmp, sizeof(tmp), "%d" , tlv->tag); \
+ tmp[0] = 0; \
+ int k; \
+ for (k = 0; tlvs[k].tlvid; k++) { \
+ if (tlvs[k].tlvid == tlv->tag) { \
+ strcpy(tmp, tlvs[k].tlv); \
+ char *space = strchr(tmp, ' '); \
+ if (space) { \
+ *space = 0; \
+ } \
+ break; \
+ } \
+ } \
+ if (!tmp[0]) { \
+ snprintf(tmp, sizeof(tmp), "%d" , tlv->tag); \
+ } \
ast_msg_set_var(msg, tmp2, tmp); \
snprintf(tmp2, sizeof(tmp2), "tlv.%d.length", tlvnum); \
snprintf(tmp, sizeof(tmp), "%d" , tlv->length); \
@@ -1293,6 +1317,16 @@
snprintf(tmp, sizeof(tmp), "tlv.%d.tag", tlvnum); \
if (ast_msg_get_var(message, tmp)) { \
tlv->tag = atoi(ast_msg_get_var(message, tmp)); \
+ if (!tlv->tag) { \
+ const char *tag = ast_msg_get_var(message, tmp); \
+ int k; \
+ for(k = 0; tlvs[k].tlvid; k++) { \
+ if (!strncmp(tag, tlvs[k].tlv, strlen(tag))) { \
+ tlv->tag = tlvs[k].tlvid; \
+ break; \
+ } \
+ } \
+ } \
} \
snprintf(tmp, sizeof(tmp), "tlv.%d.length", tlvnum); \
if (ast_msg_get_var(message, tmp)) { \
More information about the svn-commits
mailing list