[OpenSIPS-Users] pua_xmpp sip-xmpp gateway - works one way, not other way

mani sivaraman mani.opensips at gmail.com
Thu Jun 25 16:53:11 CEST 2009


Hi Anca
I am using 1.5.1 version of opensips and I have pua_xmpp_req_winfo call in
my cfg file. I get NOTIFY for Watcher Info with the watcherinfo+xml payoad.
But there is no presence state communication sent from Jabber2 server to
opensips. Did you look at the debug output document that I sent you ?. That
should have it all.

Here is my config file.


# main request routing logic

route{

        # initial sanity checks -- messages with
        # max_forwards==0, or excessively long requests
        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                exit;
        };

        #if (msg:len >=  2048 ) {
        #       sl_send_reply("513", "Message too big");
        #       exit;
        #};

        # we record-route all messages -- to make sure that
        # subsequent messages will go through our proxy; that's
        # particularly good if upstream and downstream entities
        # use different transport protocol
        if (!method=="REGISTER")
                record_route();

        # subsequent messages withing a dialog should take the
        # path determined by record-routing
        if (loose_route()) {
                # mark routing logic in request
                append_hf("P-hint: rr-enforced\r\n");
                route(1);
        };
        if(method == "INVITE")
                setflag(5);

        if( uri=~"sip:.+ at sip-xmpp.smithmicro.com<sip%3A.%2B at sip-xmpp.smithmicro.com>"
||

uri=~"sip:.+ at sip-xmpp.smithmicro.com<sip%3A.%2B at sip-xmpp.smithmicro.com>"
||

uri=~"sip:.+ at sips01.smithmicro.com<sip%3A.%2B at sips01.smithmicro.com>
")
        {
                if( is_method("PUBLISH|SUBSCRIBE|NOTIFY"))
                        route(2);
        }

        if( uri=~"sip:.+ at sip-xmpp.smithmicro.com<sip%3A.%2B at sip-xmpp.smithmicro.com>
")
        {
                # absorb retransmissions ###
                if (!t_newtran()) {
                        sl_reply_error();
                        return;
                }
        if (method == "MESSAGE") {
                        log("*** xmpp-handled MESSAGE message.\n");
                        if (xmpp_send_message()) {
                                t_reply("200", "Accepted");
                        } else {
                                t_reply("404", "Not found");
                        }
                        return;
                }else {
                        t_reply("403","not supported");
                        exit;
                }

        }

        if (!uri==myself) {
                # mark routing logic in request
                append_hf("P-hint: outbound\r\n");
                # if you have some interdomain connections via TLS
                #if(uri=~"@tls_domain1.net") {
                #       t_relay("tls:domain1.net");
                #       exit;
                #} else if(uri=~"@tls_domain2.net") {
                #       t_relay("tls:domain2.net");
                #       exit;
                #}
                route(1);
        };

        # if the request is for other domain use UsrLoc
        # (in case, it does not work, use the following command
        # with proper names and addresses in it)
        if (uri==myself) {

                if( is_method("PUBLISH|SUBSCRIBE|NOTIFY"))
                        route(2);

                if (method=="REGISTER") {

                        if (!www_authorize("", "subscriber"))
                        {
                                www_challenge("", "0");
                                exit;
                        }

                        if (!check_to())
                        {
                                sl_send_reply("403","Forbidden auth ID");
                                exit;
                        }

                        if (!save("location"))
                                sl_reply_error();

                        exit;
                };

                # native SIP destinations are handled using our USRLOC DB
                if (!lookup("location")) {
                        sl_send_reply("404", "Not Found");
                        exit;
                };
                append_hf("P-hint: usrloc applied\r\n");
        };

        route(1);
}

route[1] {
        # send it out now; use stateful forwarding as it works reliably
        # even for UDP2TCP
        if (!t_relay()) {
                sl_reply_error();
        };
        exit;
}

route[2]
{
        if ( !t_newtran() ){
        sl_reply_error();
        exit;
     };

        if( is_method("NOTIFY") &&
uri=~"sip:.+ at sip-xmpp.smithmicro.com<sip%3A.%2B at sip-xmpp.smithmicro.com>
"){
                pua_xmpp_notify();
                t_reply("200", "OK");
                exit;
        }

        if(is_method("PUBLISH")){
                handle_publish();
                #t_release();
                /* the call to t_release is no longer needed in 1.5 */
        }
        else
        if( is_method("SUBSCRIBE")){
                handle_subscribe();
                if(
uri=~"sip:.+ at sip-xmpp.smithmicro.com<sip%3A.%2B at sip-xmpp.smithmicro.com>"
&& $hdr(Event)== "pres
ence"){
                        pua_xmpp_req_winfo("$ruri", "$hdr(Expires)");
                }
                #t_release();
                /* the call to t_release is no longer needed in 1.5 */
        }
        exit;
}


On Thu, Jun 25, 2009 at 7:26 AM, Anca Vamanu <anca at opensips.org> wrote:

> Hi Mani,
>
> I order to have opensips send subscribe messages to jabber, you need to
> call 'pua_xmpp_req_winfo("$ruri", "$hdr(Expires)");' when you see from the
> script that a Subscribe request is sent to a jabber contact. This is the
> function responsible for sending subscribe messages to jabber.
>
> What opensips version are you using?
>
> regards,
> Anca
>
> mani sivaraman wrote:
>
>> Hi Anca
>> I do not see any xmpp subscribe packet request sent from opensips to
>> jabber server. That's the reason why jabber server is not sending any
>> presence notify to opensips. Jabber sends the xmpp status to other clients
>> like pidgin.
>>
>> When I add a xmpp buddy to sip client, I get the Subscriber/200 OK
>> response. I can see the output saying subscribe sent in behalf of xmpp
>> buddy.. etc. But this is just a sip subscribe output. I do not see any xmpp
>> subscribe sent to jabber server from opensips. What is blocking opensips
>> from sendsing the xmpp subscribes to jabber server ?
>>
>> Please let me know.
>>
>> On Wed, Jun 24, 2009 at 11:12 AM, mani sivaraman <mani.opensips at gmail.com<mailto:
>> mani.opensips at gmail.com>> wrote:
>>
>>    Oh wait, this xml packet is destined to "jabb2 at xmpp.smithmicro.com
>>    <http://jabb2@xmpp.smithmicro.com/275c37159368>" , not opensips
>>    c2s interface. Since all status goes out from 5347 to all xmpp
>>    clients, I have to separate out the opensips port connected to
>>    5347 and then try. I found it to be dynamic port 59284. After
>>    doing ngrep on that port I see opensips sending all status update
>>    to 5347, but not other way. The only packet from 5347 to 59284 is
>>    a probe to know if the an offline sip buddy is available (last
>>    couple of packets)
>>
>>    Here is the ngrep output
>>
>>    sips01:/etc/jabberd2# ngrep -d lo port 59284
>>    interface: lo (127.0.0.0/255.0.0.0 <http://127.0.0.0/255.0.0.0>)
>>    filter: (ip or ip6) and ( port 59284 )
>>    #
>>    T 172.16.0.139:59284 <http://172.16.0.139:59284> ->
>>    172.16.0.139:5347 <http://172.16.0.139:5347> [AP]
>>      <presence to="jabb2 at xmpp.smithmicro.com
>>    <mailto:jabb2 at xmpp.smithmicro.com>"
>>    from="rboxall*sips01.smithmicro.com
>>    <http://sips01.smithmicro.com>@xmpp-sip.smithmicro.com
>>    <http://xmpp-sip.smithmicro.com>"
>>      type="unavailable"/>
>>    ##
>>    T 172.16.0.139:59284 <http://172.16.0.139:59284> ->
>>    172.16.0.139:5347 <http://172.16.0.139:5347> [AP]
>>      <presence to="jabb1 at xmpp.smithmicro.com
>>    <mailto:jabb1 at xmpp.smithmicro.com>"
>>    from="rboxall*sips01.smithmicro.com
>>    <http://sips01.smithmicro.com>@xmpp-sip.smithmicro.com
>>    <http://xmpp-sip.smithmicro.com>"
>>      type="unavailable"/>
>>    ##
>>    T 172.16.0.139:59284 <http://172.16.0.139:59284> ->
>>    172.16.0.139:5347 <http://172.16.0.139:5347> [AP]
>>      <presence to="jabb2 at xmpp.smithmicro.com
>>    <mailto:jabb2 at xmpp.smithmicro.com>"
>>    from="rboxall*sips01.smithmicro.com
>>    <http://sips01.smithmicro.com>@xmpp-sip.smithmicro.com
>>    <http://xmpp-sip.smithmicro.com>">
>>      .    <status>hi there !!!</status>.      <priority>0.00</priority>.
>>  </presence>
>>    ##
>>    T 172.16.0.139:59284 <http://172.16.0.139:59284> ->
>>    172.16.0.139:5347 <http://172.16.0.139:5347> [AP]
>>      <presence to="jabb1 at xmpp.smithmicro.com
>>    <mailto:jabb1 at xmpp.smithmicro.com>"
>>    from="rboxall*sips01.smithmicro.com
>>    <http://sips01.smithmicro.com>@xmpp-sip.smithmicro.com
>>    <http://xmpp-sip.smithmicro.com>">
>>      .    <status>hi there !!!</status>.      <priority>0.00</priority>.
>>  </presence>
>>    ##
>>    T 172.16.0.139:5347 <http://172.16.0.139:5347> ->
>>    172.16.0.139:59284 <http://172.16.0.139:59284> [AP]
>>      <presence xmlns='jabber:client' type='probe'
>>    to='rboxall*sips01.smithmicro.com
>>    <http://sips01.smithmicro.com>@xmpp-sip.smithmicro.com
>>    <http://xmpp-sip.smithmicro.com>' from='jabb1
>>      @xmpp.smithmicro.com <http://xmpp.smithmicro.com>'/>
>>    ##
>>    T 172.16.0.139:59284 <http://172.16.0.139:59284> ->
>>    172.16.0.139:5347 <http://172.16.0.139:5347> [AP]
>>      <presence to="jabb1 at xmpp.smithmicro.com
>>    <mailto:jabb1 at xmpp.smithmicro.com>"
>>    from="rboxall*sips01.smithmicro.com
>>    <http://sips01.smithmicro.com>@xmpp-sip.smithmicro.com
>>    <http://xmpp-sip.smithmicro.com>">.    <status>
>>      hi there !!!</status>.    <priority>0.00</priority>.  </presence>
>>    ##
>>    T 172.16.0.139:5347 <http://172.16.0.139:5347> ->
>>    172.16.0.139:59284 <http://172.16.0.139:59284> [AP]
>>      <presence xmlns='jabber:client' type='probe'
>>    to='msivaraman*sips01.smithmicro.com
>>    <http://sips01.smithmicro.com>@xmpp-sip.smithmicro.com
>>    <http://xmpp-sip.smithmicro.com>' from='ja
>>      bb1 at xmpp.smithmicro.com <mailto:bb1 at xmpp.smithmicro.com>'/>
>>    #
>>    T 172.16.0.139:59284 <http://172.16.0.139:59284> ->
>>    172.16.0.139:5347 <http://172.16.0.139:5347> [AP]
>>      <presence to="jabb1 at xmpp.smithmicro.com
>>    <mailto:jabb1 at xmpp.smithmicro.com>"
>>    from="msivaraman*sips01.smithmicro.com
>>    <http://sips01.smithmicro.com>@xmpp-sip.smithmicro.com
>>    <http://xmpp-sip.smithmicro.com>" type="unav
>>      ailable"/>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20090625/dbd63cee/attachment-0001.htm 


More information about the Users mailing list