11package org .restcomm .connect .sms .smpp ;
22
3+ import org .apache .log4j .Logger ;
4+
35import com .cloudhopper .commons .charset .Charset ;
46import com .cloudhopper .commons .charset .CharsetUtil ;
57import com .cloudhopper .smpp .SmppBindType ;
1315 */
1416public class Smpp {
1517
16- private static final String DEFAULT_SMPP_ENCODING = "UTF-8" ;
18+ private static final Logger logger = Logger .getLogger (Smpp .class );
19+
20+ private static final String DEFAULT_SMPP_INBOUND_ENCODING = "MODIFIED-UTF8" ;
21+ private static final String DEFAULT_SMPP_OUTBOUND_ENCODING = "GSM7" ;
1722 private String name ;
1823 private String systemId ;
1924 private String peerIp ;
@@ -51,7 +56,7 @@ public class Smpp {
5156 public Smpp (String name , String systemId , String peerIp , int peerPort , SmppBindType smppBindType , String password ,
5257 String systemType , byte interfaceVersion , Address address , long connectTimeout , int windowSize ,
5358 long windowWaitTimeout , long requestExpiryTimeout , long windowMonitorInterval , boolean countersEnabled ,
54- boolean logBytes , long enquireLinkDelay , String incomingCharacterEncoding , String outgoingCharacterEncoding ) {
59+ boolean logBytes , long enquireLinkDelay , String inboundCharacterEncoding , String outboundCharacterEncoding ) {
5560 super ();
5661 this .name = name ;
5762 this .systemId = systemId ;
@@ -71,14 +76,20 @@ public Smpp(String name, String systemId, String peerIp, int peerPort, SmppBindT
7176 this .logBytes = logBytes ;
7277 this .enquireLinkDelay = enquireLinkDelay ;
7378 try {
74- this .inboundCharacterEncoding = CharsetUtil .map (incomingCharacterEncoding );
79+ this .inboundCharacterEncoding = CharsetUtil .map (inboundCharacterEncoding );
7580 } catch (Exception e ) {
76- this .inboundCharacterEncoding = CharsetUtil .map (DEFAULT_SMPP_ENCODING );
81+ this .inboundCharacterEncoding = CharsetUtil .map (DEFAULT_SMPP_INBOUND_ENCODING );
82+ if (logger .isInfoEnabled ()) {
83+ logger .info ("Charset " + inboundCharacterEncoding + " does not exist. Inbound encoding is set to default " + DEFAULT_SMPP_INBOUND_ENCODING + "\n " + e .getMessage ());
84+ }
7785 }
7886 try {
79- this .outboundCharacterEncoding = CharsetUtil .map (outgoingCharacterEncoding );
87+ this .outboundCharacterEncoding = CharsetUtil .map (outboundCharacterEncoding );
8088 } catch (Exception e ) {
81- this .outboundCharacterEncoding = CharsetUtil .map (DEFAULT_SMPP_ENCODING );
89+ this .outboundCharacterEncoding = CharsetUtil .map (DEFAULT_SMPP_OUTBOUND_ENCODING );
90+ if (logger .isInfoEnabled ()) {
91+ logger .info ("Charset " + outboundCharacterEncoding + " does not exist. Outbound encoding is set to default " + DEFAULT_SMPP_OUTBOUND_ENCODING + "\n " + e .getMessage ());
92+ }
8293 }
8394 }
8495
0 commit comments