Steps for delivering SMS application

You need kannel SMS/WAP gateway to deliver SMS application using LightArmy. Here are your steps:

  • Install and configure Kannel SMS/WAP gateway. See Kannel documentation. You can use this for many services. Kannel website: http://www.kannel.org/

  • Create Kannel interface for LightArmy and configure the settings. You can use this for many services.
    Here is for an example:


    <?xml version="1.0" encoding="UTF-8"?>
    <configuration id="kannel">
    <section name="core">
    <!--Gateway Configuration -->
    <config name="description">KANNEL MBUNI SMS/MMS Service</config>
    <config name="handler"></config>
    <config name="serviceresponse"></config>

    <config name="auth">
    <config name="username">kannel</config>
    <config name="password">lennak</config>
    </config>

    <config name="path">
    <config name="bearerbox">bearerbox</config>
    <config name="smsbox">smsbox</config>
    <config name="wapbox">wapbox</config>
    <config name="mmsbox">mmsbox</config>
    <config name="mmsrelay">mmsrelay</config>
    <config name="mmsproxy">mmsproxy</config>
    <config name="mmsfromemail">mmsfromemail</config>
    </config>

    <config name="interface">
    <config name="smsposturl"><![CDATA[http://localhost/admin/Restricted/kannel.php?processstage=incoming&message-mime=sms]]></config>
    <config name="smsgeturl"><![CDATA[http://localhost/admin/Restricted/kannel.php?processstage=incoming&message-mime=sms]]></config>
    <config name="smsxmlurl"></config>
    <config name="smsexec"><![CDATA[/System/Kannel/kannel.php processstage=incoming\&message-mime=sms]]></config>
    <config name="smssend"><![CDATA[http://localhost:13013/cgi-bin/sendsms]]></config>
    <config name="smsdlr"><![CDATA[http://localhost/admin/Restricted/kannel.php?processstage=delivery&message-mime=sms]]></config>

    <config name="mmsposturl"><![CDATA[http://localhost/admin/Restricted/kannel.php?processstage=incoming&message-mime=mms]]></config>
    <config name="mmsdlr"><![CDATA[http://localhost/admin/Restricted/kannel.php?processstage=delivery&message-mime=sms]]></config>
    <config name="mmssend"><![CDATA[http://localhost:13014/cgi-bin/sendmms]]></config>
    </config>

    </section>
    </configuration>



  • Create manifest of kannel handler you what (direct reply, stomp, or queue)
    If you choose stomp you need ActiveMQ queue server. ActiveMQ website: http://activemq.apache.org/
    If you choose queue you need queue.
    Here is for an example:


    <?xml version="1.0" encoding="UTF-8"?>
    <configuration id="queue_handler">
    <section name="core">
    <!-- Service Handler Configuration-->
    <config name="handler">
    <config name="type">queue_handler</config>
    <config name="name"><![CDATA[SMSPasswordService]]></config>
    <config name="description"><![CDATA[SMS Password Service]]></config>
    <config name="start"></config>
    <config name="end"></config>

    <config name="disableincoming">0</config>
    <config name="disableoutgoing">0</config>
    <config name="disabledelivery">1</config>
    </config>

    <!-- Queue Storage -->
    <config name="connections">
    <config name="mainqueue">
    <config name="type">QUEUE</config>
    <config name="storages">
    <config name="smsincoming">
    <config name="ref">QUEUEBOX:QUEUE:SMSPasswordService:inbox</config>
    </config>
    <config name="smsoutgoing">
    <config name="ref">QUEUEBOX:QUEUE:SMSPasswordService:outbox</config>
    </config>
    <config name="smsdelivery">
    <config name="ref">QUEUEBOX:QUEUE:SMSPasswordService:delivery</config>
    </config>
    <config name="mmsincoming">
    <config name="ref">QUEUEBOX:QUEUE:SMSPasswordService:inbox</config>
    </config>
    <config name="mmsoutgoing">
    <config name="ref">QUEUEBOX:QUEUE:SMSPasswordService:outbox</config>
    </config>
    <config name="mmsdelivery">
    <config name="ref">QUEUEBOX:QUEUE:SMSPasswordService:delivery</config>
    </config>
    </config>
    </config>
    </config>

    <!-- Database Connection -->
    <config name="connections">
    <config name="kanneldb">
    <config name="type">DATABASE</config>
    <config name="dbtype">mysql</config>
    <config name="host">172.16.250.129</config>
    <config name="username">ciisonline</config>
    <config name="password"></config>
    <config name="dbname">ciisonline</config>
    </config>
    </config>

    <!-- Database Tables -->
    <config name="connections">
    <config name="kanneldb">
    <config name="tables">
    <config name="smsincoming">sms_inbox</config>
    <config name="smsoutgoing">sms_oubox</config>
    <config name="mmsincoming">sms_inbox</config>
    <config name="mmsoutgoing">sms_oubox</config>
    </config>
    </config>
    </config>

    </section>
    </configuration>



  • Create manifest of Kannel Service as appropriate. Use kannel_stompservice for stomp handler. Use kannel_queueservice for queue.
    Here is for an example:


    <?xml version="1.0" encoding="UTF-8"?>
    <configuration id="kannel_queueservice">
    <section name="core">
    <!-- Process Configuration-->
    <config name="process">
    <config name="type">kannel_queueservice</config>
    <config name="name">KANNEL_QUEUESERVICE_PASSWORD</config>
    <config name="start"></config>
    <config name="end"></config>
    </config>

    <!--Service Configuration-->
    <config name="service">
    <config name="responder">
    <config name="name">Password</config>
    <config name="directory">Application/SMS/Responder/</config>
    </config>
    <config name="log">
    <config name="incoming">smsincoming</config>
    <config name="outgoing">smsoutgoing</config>
    </config>
    <config name="queue">
    <config name="incoming">smsincoming</config>
    <config name="outgoing">smsoutgoing</config>
    <config name="delivery">smsdelivery</config>
    </config>
    </config>

    <!--Kannel Configuration-->
    <config name="kannel">
    <config name="validate">1</config>
    <config name="name"></config>
    <config name="service">Password</config>
    <config name="auth">
    <config name="username">kannel</config>
    <config name="password">lennak</config>
    </config>
    </config>

    </section>
    </configuration>



  • Create database for logging messages as you need.

  • Create manifest of Kannel Sender as appropriate. Use kannel_stompsender for stomp handler. Use kannel_queuesender for queue.
    Here is for an example:


    <?xml version="1.0" encoding="UTF-8"?>
    <configuration id="kannel_queuesender">
    <section name="core">
    <!-- Process Configuration-->
    <config name="process">
    <config name="type">kannel_queuesender</config>
    <config name="name">KANNEL_QUEUESENDER_PASSWORD</config>
    <config name="start"></config>
    <config name="end"></config>
    </config>

    <!--Sender Configuration-->
    <config name="sender">
    <config name="updatestatus">1</config>
    </config>

    <!--Delivery Configuration-->
    <config name="delivery">
    <config name="disable">0</config>
    <config name="interface"></config>
    </config>

    <!--Service Configuration-->
    <config name="service">
    <config name="log">
    <config name="incoming">smsincoming</config>
    <config name="outgoing">smsoutgoing</config>
    </config>
    <config name="queue">
    <config name="incoming">smsincoming</config>
    <config name="outgoing">smsoutgoing</config>
    <config name="delivery">smsdelivery</config>
    </config>
    </config>

    <!--Kannel Configuration-->
    <config name="kannel">
    <config name="validate">1</config>
    <config name="name"></config>
    <config name="service">Password</config>
    <config name="auth">
    <config name="username">kannel</config>
    <config name="password">lennak</config>
    </config>
    </config>

    </section>
    </configuration>



  • If you want to know the status of delivery, create manifest of Kannel delivery status as appropriate. Use kannel_stompdeliverystatus for stomp handler. Use kannel_queuedeliverystatus for queue.
    Here is for an example:


    <?xml version="1.0" encoding="UTF-8"?>
    <configuration id="kannel_queuedeliverystatus">
    <section name="core">
    <!-- Process Configuration-->
    <config name="process">
    <config name="type">kannel_queuedeliverystatus</config>
    <config name="name">KANNEL_QUEUEDELIVERYSTATUS_PASSWORD</config>
    <config name="start"></config>
    <config name="end"></config>
    </config>

    <!--Service Configuration-->
    <config name="service">
    <config name="log">
    <config name="incoming">smsincoming</config>
    <config name="outgoing">smsoutgoing</config>
    </config>
    <config name="queue">
    <config name="incoming">smsincoming</config>
    <config name="outgoing">smsoutgoing</config>
    <config name="delivery">smsdelivery</config>
    </config>
    </config>

    <!--Kannel Configuration-->
    <config name="kannel">
    <config name="validate">1</config>
    <config name="name"></config>
    <config name="service">Password</config>
    <config name="auth">
    <config name="username">kannel</config>
    <config name="password">lennak</config>
    </config>
    </config>

    </section>
    </configuration>



  • Create your responder for your service. Responder is the only program (code) you need to create for your specific purpose. You can use any available responder if appropriate.
    Here is for an example:


    <?php

    class Password {

    static function handle($headers,$body,$addheaders=null) {
    $statement = $body;
    while (strpos($statement,' ')!==false) {
    $statement = str_replace(' ',' ',$statement);
    }

    $words = explode(' ',$statement);
    if (isset($headers['from']) && count($words)==3 && strtolower($words[0])=='password' && false!==($pos=strpos($words[1],'@'))) {
    $from = $headers['from'];
    $email = $words[1];
    $password = $words[2];
    return 'test only..';
    // check for sender and email and response if successful only
    }

    return 'another';
    }
    }

    ?>





After all of that, you just start all of that manifests.
Now SMS service is available for serving.

If you want to change your service you may only change the last step and make/change code as appropriate or even no programming needed.

Note:
You can integrate SMS application with any other applications easily. You can shutting down computer using SMS as for example. Another example is sending you an SMS if a process is terminated. You can also sending SMS by email and so on.

No comments:

Post a Comment

CommentLuv Enabled

Followers