Knowledge Base > Article [0026]

Add an additional SMS provider (Guideline)

Deepnet Authentication Server(since v3.4x) has a good design on the support of additional SMS providers. It is very flexible to do the customization (in theory), you can add any SMS provider you like. It is a very good feature, as the domestic SMS providers are always cheaper.

Then how? It really depends on how much you understand the SMS sending-out interface of your own provider, also how lucky you can find a very similar template we have already provided.

The following example is merely as a reference, we do not guarantee that you will be able to figure out yours after reading this example.

It is a challenge. If you like a challenge, read further, as we all know it is going to be a fun if you conquer it in the end. If you can't be bothered to spend time on that, you can still ask us for the help, as long as you can obtain the SMS API document from your provider, aslo pay some minor fee for the job. We should be able to make it work, please contact our sales for the pricing.


OK, let us move on the topic. First of all, you have to get the SMS API document from your SMS provider, make sure what protocol they are using, HTTP, SMTP, or SMPP etc.

Next, study our built-in SMS provider templates. You can find them in the folder "$INSTALL_PATH/Tomcat/conf/dgs" ("$INSTALL_PATH/smsproviders" if you are using DualShield).

Congratulations if you find your provider operates as same as one of the built-in SMS providers.

Assume you are going to use "txtmail.co.nz" as your SMS provider in DualShield. This company provides SMTP protocol, so we copy the built-in provider "gin.xml" which uses SMTP as well, and save the new file as txtmail.xml, open the file "txtmail.xml" and change the provider name etc. At the end, the file content shoull look like as the following



<?xml version="1.0" encoding="UTF-8"?>
<provider name="txtmail">
<sms>
<smtp>
<email>${to}@txtmail.co.nz</email>
<format>text</format>
<from>${from}</from>
<subject>${subject}</subject>
<body><![CDATA[${text}]]></body>
</smtp>
</sms>
</provider>

Finally, add an entry in the file "sms_providers.xml",

<provider name="TXTMail" file="txtmail.xml" />


Access the management console of DualShield, you should see the newly added provider in SMS Gateway Settings. You may need to restart DualShield service for it to take effect.


Pretty easy, isn't it? Here is another example, mollie.nl, which can send SMS via HTTP.


Accrding to its API document, the syntax of sending the request is,

http://www.mollie.nl/xml/sms/?username=[username] &password=[password]&originator=[originator]&recipients=[recipient(s)]&message=[message]


And the response is something like


<?xml version="1.0" ?>
<response>
<item type="sms">
<recipients>1</recipients>
<success>true</success>
<resultcode>10</resultcode>
<resultmessage>Message successfully sent.</resultmessage>
</item>
</response>


As it is a HTTP protocol, you can refer to the built-in template ClickAtell. The response is XML format, so you can use xmlPath to extract the result, otherwise, you may need a regular expression which is complicated. However you can find the regular expression example in the built-in templates. The final mollie template would be




<provider name="Mollie">
<sms>
<http>
<method>GET</method>
<url>http://www.mollie.nl/xml/sms/</url>
<query>username=${userName}&password=${password}&originator=${from}&recipients=${to}&message=${body}</query>
<variables>
<variable name="flash"/>
<variable name="dlr_url"/>
</variables>
<mappings>
<mapping name="replace_sms" type="boolean">
<true>1</true>
<false>0</false>
</mapping>
</mappings>
<response type="http_body" regexp="true" format="xml">
<pattern success="true" xmlPath="//response/item/success">true</pattern>
</response>
</http>
<smtp>
<email>${to}@mobiel.mollie.nl</email>
<format>text</format>
<from>${from}</from>
<subject>username=${userName}&password=${password}&sender=${subject}</subject>
<body><![CDATA[${text}]]></body>
</smtp>
</sms>
</provider>

mollie.nl also supports SMTP. It is quite interesting to see how it does the authentication - credentials in Subject!