royneary / mod_push

Other
68 stars 19 forks source link

Push event for local user, but user is not registered at local app server #21

Open alexsandbox opened 7 years ago

alexsandbox commented 7 years ago

I use ejabberd 15 with dev certs for apns.

Config:


...
    stream_management: true
    resume_timeout: 300
    resend_on_timeout: true
...
mod_pubsub: 
    host : "push.flash.intellin.ru"
    nodetree : "virtual"
    access_createnode: pubsub_createnode
    plugins: 
      - "flat"
      - "push"
      - "hometree"
      - "pep" 
  mod_push:
    include_senders: true
    include_message_count: true
    include_subscription_count: true
    access_backends: pubsub_createnode
    certfile: "--------wss.pem"
    backends:
      -
        type: apns
        app_name: "ru.intellin.hotline.intellin"
        register_host: "flash.intellin.ru"
        pubsub_host: "push.flash.intellin.ru"
        certfile: "------------------aps_final.pem"

In mnesia:

mnesia:dirty_select(push_user, [{'_',[],['$_']}]).
[{push_user,{<<"test">>,<<"freeswitch.intellin.ru">>},
            [{subscription,<<"chatsecure27345">>,true,
                           <<"D9AAAC89-624B-4111-84E5-AB803696EA19">>,
                           {local_reg,<<"push.freeswitch.intellin.ru">>,undefined}}],
            [{'include-senders',true},
             {'include-message-count',true},
             {'include-subscription-count',true},
             {'include-message-bodies',false}],
            [{'last-message-sender',<<"admin@freeswitch.intellin.ru/7014940389500472212350938932415206807710"...>>},
             {'message-count',3}]}]

mnesia:dirty_select(push_registration, [{'_',[],['$_']}]).
[{push_registration,<<"11757480041623978329">>,
                    {<<"test">>,<<"freeswitch.intellin.ru">>},
                    <<"chatsecure27345">>,<<"Home">>,
                    <<"çowñÝ5kw»wWµu®·k^ßÙ·=Ùý¼Ùß^í­"...>>,
                    <<"5813979049124036481">>,<<>>,96046766,
                    {1470,204379,304657}}]

mnesia:dirty_select(push_backend, [{'_',[],['$_']}]).
[{push_backend,96046766,<<"freeswitch.intellin.ru">>,
               <<"push.freeswitch.intellin.ru">>,apns,
               <<"ru.intellin.hotline.intellin">>,
               [ejabberd@localhost],
               'apns_freeswitch.intellin.ru'}]

Then I close app on ios Ejabberd log:

09:21:31.880 [debug] Received XML on stream = <<>>
09:21:31.880 [debug] State: {maxrate,1000,997.4535785964104,1470205275891251}, Size=0
M=0.0, I=15989.345
09:21:31.881 [info] Waiting for resumption of stream for test@freeswitch.intellin.ru/chatsecure27345
09:21:31.881 [debug] +++++ dispatch: found push_user
09:21:31.881 [debug] +++++ NewSubscrs = [{subscription,<<"chatsecure27345">>,true,<<"D9AAAC89-624B-4111-84E5-AB803696EA19">>,{local_reg,<<"push.freeswitch.intellin.ru">>,undefined}}]
09:21:31.881 [debug] +++++ dispatch: found subscription
09:21:31.882 [debug] +++++++ adjusting timeout to 8640000

and send message. Ejabberd log:


09:24:30.040 [debug] Received XML on stream = <<"<message type='chat' id='purple9958c57a' to='test@freeswitch.intellin.ru'><active xmlns='http://jabber.org/protocol/chatstates'/><body>wefwef</body></message>">>
09:24:30.041 [debug] State: {maxrate,1000,65.85948952159313,1470205465288562}, Size=158
M=81.69003189996725, I=4752.344
09:24:30.041 [debug] route
        from {jid,<<"admin">>,<<"freeswitch.intellin.ru">>,<<"7014940389500472212350938932415206807710941962853937282559">>,<<"admin">>,<<"freeswitch.intellin.ru">>,<<"7014940389500472212350938932415206807710941962853937282559">>}
        to {jid,<<"test">>,<<"freeswitch.intellin.ru">>,<<>>,<<"test">>,<<"freeswitch.intellin.ru">>,<<>>}
        packet {xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"id">>,<<"purple9958c57a">>},{<<"to">>,<<"test@freeswitch.intellin.ru">>}],[{xmlel,<<"active">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/chatstates">>}],[]},{xmlel,<<"body">>,[],[{xmlcdata,<<"wefwef">>}]}]}
09:24:30.042 [debug] local route
        from {jid,<<"admin">>,<<"freeswitch.intellin.ru">>,<<"7014940389500472212350938932415206807710941962853937282559">>,<<"admin">>,<<"freeswitch.intellin.ru">>,<<"7014940389500472212350938932415206807710941962853937282559">>}
        to {jid,<<"test">>,<<"freeswitch.intellin.ru">>,<<>>,<<"test">>,<<"freeswitch.intellin.ru">>,<<>>}
        packet {xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"id">>,<<...>>},{<<...>>,...}],[{xmlel,<<...>>,...},{xmlel,...}]}
09:24:30.042 [debug] session manager
        from {jid,<<"admin">>,<<"freeswitch.intellin.ru">>,<<"7014940389500472212350938932415206807710941962853937282559">>,<<"admin">>,<<"freeswitch.intellin.ru">>,<<"7014940389500472212350938932415206807710941962853937282559">>}
        to {jid,<<"test">>,<<"freeswitch.intellin.ru">>,<<>>,<<"test">>,<<"freeswitch.intellin.ru">>,<<>>}
        packet {xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"id">>,<<...>>},{<<...>>,...}],[{xmlel,<<...>>,...},{xmlel,...}]}
09:24:30.042 [debug] sending to process <0.550.0>
09:24:30.042 [debug] Recipient of message to bare JID has top priority: test@freeswitch.intellin.ru/chatsecure27345
09:24:30.045 [debug] ++++++++++++ Stored Stanza for {jid,<<"test">>,<<"freeswitch.intellin.ru">>,<<"chatsecure27345">>,<<"test">>,<<"freeswitch.intellin.ru">>,<<"chatsecure27345">>}: {xmlel,<<"message">>,[{<<"from">>,<<"admin@freeswitch.intellin.ru/7014940389500472212350938932415206807710941962853937282559">>},{<<"to">>,<<"test@freeswitch.intellin.ru">>},{<<"type">>,<<"chat">>},{<<"id">>,<<"purple9958c57a">>}],[{xmlel,<<"archived">>,[{<<"by">>,<<"freeswitch.intellin.ru">>},{<<"xmlns">>,<<"urn:xmpp:mam:tmp">>},{<<"id">>,<<"1470205470042943">>}],[]},{xmlel,<<"stanza-id">>,[{<<"by">>,<<"freeswitch.intellin.ru">>},{<<"xmlns">>,<<"urn:xmpp:sid:0">>},{<<"id">>,<<"1470205470042943">>}],[]},{xmlel,<<"active">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/chatstates">>}],[]},{xmlel,<<"body">>,[],[{xmlcdata,<<"wefwef">>}]}]}
09:24:30.046 [debug] +++++ dispatch: found push_user
09:24:30.046 [debug] +++++ NewSubscrs = [{subscription,<<"chatsecure27345">>,true,<<"D9AAAC89-624B-4111-84E5-AB803696EA19">>,{local_reg,<<"push.freeswitch.intellin.ru">>,undefined}}]
09:24:30.046 [debug] +++++ dispatch: found subscription
09:24:30.046 [info] push event for local user {<<"test">>,<<"freeswitch.intellin.ru">>}, but user is not registered at local app server

Notification is not sent. What I miss? Please need help.