nitingautam / smslib

Automatically exported from code.google.com/p/smslib
0 stars 0 forks source link

Adding Bulksms Region as SMSServer config parameter #383

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi! assuming that BulkSmsHttpGateway enum Region is already public 
(http://code.google.com/p/smslib/source/detail?r=2233), I've modified 
BulkSmsHttp class in order to change region by adding a new parameter called 
region in bulksms section in SMSServer.conf (ej: myBulkSms.region=SPAIN). It 
can have same values than Region enum: INTERNATIONAL(default), UNITEDKINGDOM, 
SOUTHAFRICA, SPAIN, USA, GERMANY.

Changes needed are replace BulSmsHttp.java line 41 by the code bellow:

        if (getProperties().getProperty(propName + "region")==null)
        {
            setGateway(new org.smslib.http.BulkSmsHTTPGateway(getGatewayId(), getProperties().getProperty(propName + "username"), getProperties().getProperty(propName + "password")));
        }
        else
        {
            org.smslib.http.BulkSmsHTTPGateway.Regions Region = org.smslib.http.BulkSmsHTTPGateway.Regions.INTERNATIONAL;

            if (getProperties().getProperty(propName + "region").equalsIgnoreCase("UNITEDKINGDOM"))
                Region = org.smslib.http.BulkSmsHTTPGateway.Regions.UNITEDKINGDOM;
            else if (getProperties().getProperty(propName + "region").equalsIgnoreCase("SOUTHAFRICA"))
                Region = org.smslib.http.BulkSmsHTTPGateway.Regions.SOUTHAFRICA;
            else if (getProperties().getProperty(propName + "region").equalsIgnoreCase("SPAIN"))
                Region = org.smslib.http.BulkSmsHTTPGateway.Regions.SPAIN;
            else if (getProperties().getProperty(propName + "region").equalsIgnoreCase("USA"))
                Region = org.smslib.http.BulkSmsHTTPGateway.Regions.USA;
            else if (getProperties().getProperty(propName + "region").equalsIgnoreCase("GERMANY"))
                Region = org.smslib.http.BulkSmsHTTPGateway.Regions.GERMANY;

            setGateway(new org.smslib.http.BulkSmsHTTPGateway(getGatewayId(), getProperties().getProperty(propName + "username"), getProperties().getProperty(propName + "password"), Region));
        }

Hope that helps.

Original issue reported on code.google.com by rafa...@gmail.com on 30 Aug 2010 at 12:19

GoogleCodeExporter commented 9 years ago

Original comment by T.Delenikas on 30 Aug 2010 at 12:52

GoogleCodeExporter commented 9 years ago
r2239 - Thank you.

Original comment by T.Delenikas on 5 Sep 2010 at 11:50

GoogleCodeExporter commented 9 years ago

Original comment by T.Delenikas on 13 Nov 2010 at 8:16