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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Oct 19 02:47:44 CDT 2013


Author: may
Date: Sat Oct 19 02:47:41 2013
New Revision: 401280

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401280
Log:
fix place of FILL_MSG_HEADERS macro
display connected host ip for esme connections instead of configured

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=401280&r1=401279&r2=401280
==============================================================================
--- team/may/smpp/branches/10/addons/res_smpp.c (original)
+++ team/may/smpp/branches/10/addons/res_smpp.c Sat Oct 19 02:47:41 2013
@@ -108,6 +108,7 @@
 	int enquire;
 	time_t lastenq;
 	char host[MAXHOSTNAMELEN];
+	char connected_host[MAXHOSTNAMELEN];
 	int port;
 	struct ast_sockaddr addr;
 	int socket;
@@ -459,6 +460,7 @@
 				ast_log(LOG_WARNING, "ESME %s already connected\n", smsc->name);
 				break;
 			}
+			strncpy(smsc->connected_host, host, sizeof(smsc->connected_host));
 			smsc->socket = socket;
 			smsc->seq = 1;
 			return smsc;
@@ -1245,8 +1247,6 @@
 			ast_base64decode(submit.short_message, ast_msg_get_var(message, "base64_body"), sizeof(submit.short_message) - 1); \
 		}
 
-		FILL_SMPP_HEADERS(message, submit);
-
 		submit.source_addr_ton = 0;
 		submit.source_addr_npi = 0;
 		submit.dest_addr_ton = 0;
@@ -1265,6 +1265,9 @@
 
 		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);
 		}
@@ -1298,6 +1301,9 @@
 
 		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);
 		}
@@ -1486,13 +1492,17 @@
 	ast_mutex_lock(&smpp_lock);
 	struct smpp_smsc* smsc = smsc_list;
 	while (smsc) {
+		char *host = smsc->host;
 		char port[9];
 		if (smsc->port) {
 			snprintf(port, sizeof(port), "%d", smsc->port);
 		} else {
 			strcpy(port, "any");
 		}
-		ast_cli(a->fd, FORMAT2, smsc->name, smsc->host, port, (smsc->esme) ? "esme" : "smsc",
+		if (smsc->esme && smsc->socket) {
+			host = smsc->connected_host;
+		}
+		ast_cli(a->fd, FORMAT2, smsc->name, host, port, (smsc->esme) ? "esme" : "smsc",
 				(smsc->socket) ? "connected" : "not connect", smsc->seq);
 		smsc = smsc->next;
 	}




More information about the asterisk-commits mailing list