wiki:Servicos/Funambol/pushMailSMSSender

Version 21 (modified by emersonfaria, 15 years ago) (diff)

--


PushMailSMSSender para o servidor Funambol versão 7.0.4:

O PushMailSMSSender é um módulo do Funambol que viabiliza o recebimento de novos e-mails nos dispositivos móveis em tempo quase real de forma automática. É um serviço análogo ao oferecido para dispositivos Blackberry.

Esse módulo (.sj4) envia um SMS, através de um gateway Gnokii, para o número de celular indicado em "Devices", que inicia uma sincronização de email.

Ao adotar esse módulo, deve-se levar em conta o preço que a operadora de telefonia móvel cobra pelo envio de cada SMS.


Funcionamento:

1- O Servidor Funambol detecta o recebimento de um e-mail para o usuário X e notifica o módulo pushMailSMSSender.
2- O PushMailSMSSender monta um SMS binário e envia para o gateway Gnokii via protocolo HTTP.
3- O gateway Gnokii inclui um cabeçalho no SMS e envia para o celular Nokia.
4- O celular Nokia envia o SMS binário para o celular do usuário X via operadora de telefonia móvel.
5- O celular do usuário X recebe o SMS binário solicitando a execução de seu cliente Funambol e inicialização de uma sincronização de e-mail.


Formato da mensagem SMS:

Pilha do protocolo WAP Push SMS:

Corpo

|

WSP+Corpo

|

WDP+WSP+Corpo

|

SMS_HEADER+WDP+WSP+Corpo

SMS_HEADER- O gateway SMS deve anexar esse cabeçalho à mensagem:

00 = Length of SMSC - 00 means Use the SMSC stored in phone;
51 = binary 01010001:

  • bit 7=0 means replay path don't exists,
  • bit 6=1 means User Data field starts with a header,
  • bit 5=0 means status report is NOT requested,
  • bits 4,3=10 means Validity Period Format is 1 octet,
  • bit 2=0 means Don't Reject duplicates,
  • bits 1,0=01 means PDU is an SMS-SUBMIT;

00 = phone set the message reference number itself;
0A = Address-Length. Length of phone number (10);
81 = Type-of-number + Numbering Plan;
1429129520 = Destination Phone number 4192215902;
0004A737 = Trail.

Udh(WDP-Wireless Datagram Protocol):

06 = Length;
05 = Identifier port number;
04 = Port number length;
0B84 = Destination port. This value is for Windows Mobile. If the client is JavaME, replace by C351;
C002 = Origination port.

Message Header(WSP-Wireless Session Protocol):

01 = Push ID;
06 = PDU type(Push);
03 = Headers length (content type + headers);
CE = Content type code is the constant CONTENT_TYPE_CODE_NOTIFICATION;
AF = X-WAP-Application-ID;
85 = Id for urn: x-wap-application:push.syncml.

Corpo da Mensagem:

70F45FF17B5ABD16CE29FA27D2F870C2 = MD5 Digest;
031 = Binary 000000110001, bits 0000001100 means "version 1.2", bits 01 means "Uimode background";
8 = Binary 1000, bit 1 means "server initiator", bits 000 means "future use";
000000 = Future use;
0000 = Session ID;
08 = Server identifier length;
66756E616D626F6C = The server identifier string "funambol";
1 = Num syncs;
0 = Future use;
6 = Sync type means "two-way";
0 = Future use;
000306 = Content-type - application/vnd.omads-email+xml - OMA Data Sync Email Data Obj(XML);
04 = Server uri length;
6D61696C = The server uri string "mail".


Instalação:

1- Crie o arquivo PushMailSMSSender.xml com o conteudo abaixo e adeque os parâmetros: gatewayIP, gatewayPort, user e pwd de acordo com seu gateway Gnokii.

<?xml version="1.0" encoding="UTF-8"?>
<java version="1.4.2_01" class="java.beans.XMLDecoder">
    <object class="br.gov.serpro.funambol.pushmail.PushMailSMSSender">
	<void property="gatewayIP">
	    <string>192.168.0.99</string>
	</void>
	<void property="gatewayPort">
	    <string>13013</string>
	</void>
        <void property="user">
            <string>tester</string>
        </void>
        <void property="pwd">
            <string>foobar</string>
        </void>
    </object>
</java>

2- Copie o arquivo PushMailSMSSender.xml para Funambol/config/com/funambol/server/notification .
3- Instale o módulo PushMailSMSSender:

a) Faça o download do  PushMailSMSSender-1.0.s4j e copie para Funambol/ds-server/modules .
b) Adicione, delimitado por vírgula, o PushMailSMSSeder-1.0 no parâmetro modules-to-install do Funambol/ds-server/install.properties (NÃO inclua a extensão .s4j).
c) Pare o servidor Funambol.
d) Execute Funambol/bin/install-modules e responda "n" para todas perguntas.
e) Inicie o servidor Funambol.

4- Edite o arquivo Funambol/config/com/funambol/server/inventory/PSDeviceInventory.xml e configure a propriedade defaultNotificationServer assim:

        <void property="defaultNotificationSender">
            <string>com/funambol/server/notification/PushMailSMSSender.xml</string>
        </void>

5- Reinicie o servidor do Funambol.
6- Em Funambol Administrator Tool -> "Devices", para cada registro, preencha o campo "Phone Number", (Exemplo para o DDD 11: 1199112233). O SMS nao será enviado se o "Phone Number" estiver em branco.


Código-fonte:

O código-fonte está disponível para checkout em:  http://trac.expressolivre.org/browser/contrib/funambol/PushMailSMSSender

Para alterar/recompilar esse código, utilize o procedimento:  http://trac.expressolivre.org/wiki/funambol_desenvolvimento_customizar