[OpenSIPS-Users] sip-xmpp gateway - presence notification does not work

mani sivaraman mani.opensips at gmail.com
Tue Jun 23 15:34:36 CEST 2009


Hi Anca
I do not see any error, but I see some warning in tm module. Not sure if
they are of concern. I have also pasted the full config file for your
review. Yes I did follow the instruction from the opensips example link.
Note that I'm using kamailio 1.5.1 because I tried purple initially and then
I swityched to pua_xmpp since purple is still new and needs more work. Hope
it is ok to use Kamailio for pua_xmpp as well.

I have one question about tls and non-tls. Is it a must that I should use
only tls version if I want opensips to talk to other publisc xmpp servers
like gtalk etc. I know that jabberd2 has the required tls support to talk to
gtalk etc, but should the opensips be also use tls version ?


Listening on
             udp: 172.16.0.141 [172.16.0.141]:5060
Aliases:
             udp: xmpp1.smithmicro.com:5060

Jun 23 08:28:23 [2675] INFO:core:init_tcp: using epoll_lt as the TCP io
watch method (auto detected)
Jun 23 08:28:23 [2677] NOTICE:core:main: version: kamailio 1.5.1-tls
(i386/linux)
Jun 23 08:28:23 [2677] INFO:core:main: using 32 Mb shared memory
Jun 23 08:28:23 [2677] INFO:core:main: using 4 Mb private memory per process
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module db_mysql
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module mi_fifo
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module sl
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module tm
kmilo:/usr/local/etc/kamailio# Jun 23 08:28:23 [2677] INFO:tm:mod_init:
fr_inv_timer_next value is <30>
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module rr
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module pv
Jun 23 08:28:23 [2677] INFO:pv:shvar_init_locks: locks array size 16
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module maxfwd
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module usrloc
Jun 23 08:28:23 [2677] INFO:usrloc:ul_init_locks: locks array size 512
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module registrar
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module textops
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module uri_db
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module siputils
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module xlog
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module acc
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module auth
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module auth_db
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module presence
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module presence_xml
Jun 23 08:28:23 [2677] INFO:core:init_mod: initializing module pua
Jun 23 08:28:24 [2677] INFO:core:init_mod: initializing module xmpp
Jun 23 08:28:24 [2677] INFO:core:init_mod: initializing module pua_xmpp
Jun 23 08:28:24 [2677] INFO:core:probe_max_receive_buffer: using a UDP
receive buffer of 255 kb
Jun 23 08:28:30 [2681] INFO:presence:send_notify_request: NOTIFY
sip:msivaraman at 172.16.0.141 <sip%3Amsivaraman at 172.16.0.141> via
sip:msivaraman at 172.16.1.125:7489;transport=udp on behalf of
sip:msivaraman at 172.16.0.141 <sip%3Amsivaraman at 172.16.0.141> for event
presence.winfo
Jun 23 08:28:30 [2678] INFO:presence:send_notify_request: NOTIFY
sip:msivaraman at 172.16.0.141 <sip%3Amsivaraman at 172.16.0.141> via
sip:msivaraman at 172.16.1.125:7489;transport=udp on behalf of
sip:msivaraman at 172.16.0.141 <sip%3Amsivaraman at 172.16.0.141> for event
presence.winfo
Jun 23 08:28:30 [2678] INFO:presence:send_notify_request: NOTIFY
sip:msivaraman at 172.16.0.141 <sip%3Amsivaraman at 172.16.0.141> via
sip:msivaraman at 172.16.1.125:7489;transport=udp on behalf of
sip:msivaraman at 172.16.0.141 <sip%3Amsivaraman at 172.16.0.141> for event
presence
Jun 23 08:28:30 [2678] INFO:presence:send_notify_request: NOTIFY
sip:msivaraman at 172.16.0.141 <sip%3Amsivaraman at 172.16.0.141> via
sip:msivaraman at 172.16.1.125:7489;transport=udp on behalf of
sip:rboxall at 172.16.0.141 <sip%3Arboxall at 172.16.0.141> for event presence
Jun 23 08:28:30 [2678] INFO:presence:send_notify_request: NOTIFY
sip:msivaraman at 172.16.0.141 <sip%3Amsivaraman at 172.16.0.141> via
sip:msivaraman at 172.16.1.125:7489;transport=udp on behalf of sip:jabb2*
xmpp1.smithmicro.com at sip-xmpp1.smithmicro.com for event presence
Jun 23 08:28:30 [2680] INFO:presence:send_notify_request: NOTIFY sip:jabb2*
xmpp1.smithmicro.com at sip-xmpp1.smithmicro.com via sip:172.16.0.141:5060 on
behalf of sip:jabb2*xmpp1.smithmicro.com at sip-xmpp1.smithmicro.com for event
presence.winfo
Jun 23 08:28:30 [2679] WARNING:tm:t_unref: script writer didn't release
transaction
Jun 23 08:28:31 [2680] INFO:presence:send_notify_request: NOTIFY
sip:msivaraman at 172.16.0.141 <sip%3Amsivaraman at 172.16.0.141> via
sip:msivaraman at 172.16.1.125:7489;transport=udp on behalf of sip:jabb1*
xmpp1.smithmicro.com at sip-xmpp1.smithmicro.com for event presence
Jun 23 08:28:31 [2681] INFO:presence:send_notify_request: NOTIFY sip:jabb1*
xmpp1.smithmicro.com at sip-xmpp1.smithmicro.com via sip:172.16.0.141:5060 on
behalf of sip:jabb1*xmpp1.smithmicro.com at sip-xmpp1.smithmicro.com for event
presence.winfo
Jun 23 08:28:31 [2679] WARNING:tm:t_unref: script writer didn't release
transaction
Jun 23 08:28:31 [2679] INFO:presence:send_notify_request: NOTIFY
sip:msivaraman at 172.16.0.141 <sip%3Amsivaraman at 172.16.0.141> via
sip:msivaraman at 172.16.1.125:7489;transport=udp on behalf of
sip:smvasagam2000*gmail.com at sip-xmpp1.smithmicro.com for event presence
Jun 23 08:28:31 [2679] INFO:presence:send_notify_request: NOTIFY
sip:smvasagam2000*gmail.com at sip-xmpp1.smithmicro.com via sip:
172.16.0.141:5060 on behalf of sip:smvasagam2000*gmail.com@
sip-xmpp1.smithmicro.com for event presence.winfo
Jun 23 08:28:31 [2681] WARNING:tm:t_unref: script writer didn't release
transaction
Jun 23 08:28:34 [2678] INFO:presence:send_notify_request: NOTIFY
sip:msivaraman at 172.16.0.141 <sip%3Amsivaraman at 172.16.0.141> via
sip:msivaraman at 172.16.1.125:7489;transport=udp on behalf of
sip:msivaraman at 172.16.0.141 <sip%3Amsivaraman at 172.16.0.141> for event
presence
Jun 23 08:28:38 [2681] WARNING:tm:t_unref: script writer didn't release
transaction
Jun 23 08:28:38 [2679] WARNING:tm:t_unref: script writer didn't release
transaction
Jun 23 08:28:38 [2681] WARNING:tm:t_unref: script writer didn't release
transaction
Jun 23 08:28:46 [2678] WARNING:tm:t_unref: script writer didn't release
transaction
Jun 23 08:28:46 [2680] WARNING:tm:t_unref: script writer didn't release
transaction
Jun 23 08:28:46 [2678] WARNING:tm:t_unref: script writer didn't release
transaction
Jun 23 08:28:54 [2679] WARNING:tm:t_unref: script writer didn't release
transaction
Jun 23 08:28:54 [2680] WARNING:tm:t_unref: script writer didn't release
transaction
Jun 23 08:28:54 [2679] WARNING:tm:t_unref: script writer didn't release
transaction


config File :
---------------------

#
# $Id: kamailio.cfg 5800 2009-04-20 11:01:49Z miconda $
#
# Kamailio (OpenSER) SIP Server - basic configuration script
#     - web: http://www.kamailio.org
#     - svn: http://openser.svn.sourceforge.net/viewvc/openser/
#
# Direct your questions about this file to: <users at lists.kamailio.org>
#
# Refer to the Core CookBook at http://www.kamailio.org/dokuwiki/doku.php
# for an explanation of possible statements, functions and parameters.
#
# There are comments showing how to enable different features in th econfig
# file. Such commented code starts with #X# where X is a letter to identify
# a feature. Delete entire #X# if you want to enable that feature. Next are
# sed commands that help you enable such features.
#
####### Global Parameters #########

debug=3
log_stderror=no
log_facility=LOG_LOCAL0

fork=yes
children=4

/* uncomment the following lines to enable debugging */
#debug=6
#fork=no
log_stderror=yes

/* uncomment the next line to disable TCP (default on) */
#disable_tcp=yes

/* uncomment the next line to enable the auto temporary blacklisting of
   not available destinations (default disabled) */
#disable_dns_blacklist=no

/* uncomment the next line to enable IPv6 lookup after IPv4 dns
   lookup failures (default disabled) */
#dns_try_ipv6=yes

/* uncomment the next line to disable the auto discovery of local aliases
   based on revers DNS on IPs (default on) */
#auto_aliases=no

/* uncomment the following lines to enable TLS support  (default off) */
#disable_tls = no
#listen = tls:your_IP:5061
#tls_verify_server = 1
#tls_verify_client = 1
#tls_require_client_certificate = 0
#tls_method = TLSv1
#tls_certificate = "/usr/local/etc/kamailio/tls/user/user-cert.pem"
#tls_private_key = "/usr/local/etc/kamailio/tls/user/user-privkey.pem"
#tls_ca_list     = "/usr/local/etc/kamailio/tls/user/user-calist.pem"


port=5060

/* uncomment and configure the following line if you want Kamailio to
   bind on a specific interface/port/proto (default bind on all available)
*/
listen=udp:172.16.0.141:5060

####### Modules Section ########

#set module path
mpath="/usr/local/lib/kamailio/modules/"

/* uncomment next line for MySQL DB support */
loadmodule "db_mysql.so"
loadmodule "mi_fifo.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "uri_db.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "acc.so"
/* uncomment next lines for MySQL based authentication support
   NOTE: a DB (like db_mysql) module must be also loaded */
loadmodule "auth.so"
loadmodule "auth_db.so"

/* uncomment next line for aliases support
   NOTE: a DB (like db_mysql) module must be also loaded */
#loadmodule "alias_db.so"
/* uncomment next line for multi-domain support
   NOTE: a DB (like db_mysql) module must be also loaded
   NOTE: be sure and enable multi-domain support in all used modules
         (see "multi-module params" section ) */
#loadmodule "domain.so"
/* uncomment the next two lines for presence server support
   NOTE: a DB (like db_mysql) module must be also loaded */
loadmodule "presence.so"
loadmodule "presence_xml.so"
loadmodule "pua.so"
loadmodule "xmpp.so"
loadmodule "pua_xmpp.so"
#loadmodule "purple.so"

#n#loadmodule "nathelper.so"

# ----------------- setting module-specific parameters ---------------


# ----- mi_fifo params -----
modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")


# ----- rr params -----
# add value to ;lr param to cope with most of the UAs
modparam("rr", "enable_full_lr", 1)
# do not append from tag to the RR (no need for this script)
modparam("rr", "append_fromtag", 0)


# ----- rr params -----
modparam("registrar", "method_filtering", 1)
/* uncomment the next line to disable parallel forking via location */
# modparam("registrar", "append_branches", 0)
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)


# ----- uri_db params -----
/* by default we disable the DB support in the module as we do not need it
   in this configuration */
modparam("uri_db", "use_uri_table", 0)
modparam("uri_db", "db_url", "")


# ----- acc params -----
/* what sepcial events should be accounted ? */
modparam("acc", "early_media", 1)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
/* by default ww do not adjust the direct of the sequential requests.
   if you enable this parameter, be sure the enable "append_fromtag"
   in "rr" module */
modparam("acc", "detect_direction", 0)
/* account triggers (flags) */
modparam("acc", "failed_transaction_flag", 3)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 2)
modparam("acc", "log_extra",

"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
/* uncomment the following lines to enable DB accounting also */
#c#modparam("acc", "db_flag", 1)
#c#modparam("acc", "db_missed_flag", 2)
#c#modparam("domain", "db_url",
#c#     "mysql://openser:openserrw@172.16.0.141/openser")
#c#modparam("acc", "db_extra",
#c#
"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")


# ----- usrloc params -----
/* uncomment the following lines if you want to enable DB persistency
   for location entries */
modparam("usrloc", "db_mode",   2)
modparam("usrloc", "db_url",
        "mysql://openser:openserrw@172.16.0.141/openser")

# ----- auth_db params -----
/* uncomment the following lines if you want to enable the DB based
   authentication */
modparam("auth_db", "calculate_ha1", no)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "db_url",
        "mysql://openser:openserrw@172.16.0.141/openser")
modparam("auth_db", "load_credentials", "")


# ----- alias_db params -----
/* uncomment the following lines if you want to enable the DB based
   aliases */
#modparam("alias_db", "db_url",
#       "mysql://openser:openserrw@172.16.0.141/openser")


# ----- domain params -----
/* uncomment the following lines to enable multi-domain detection
   support */
#modparam("domain", "db_url",
#       "mysql://openser:openserrw@172.16.0.141/openser")
#modparam("domain", "db_mode", 1)   # Use caching


# ----- multi-module params -----
/* uncomment the following line if you want to enable multi-domain support
   in the modules (dafault off) */
#modparam("alias_db|auth_db|usrloc|uri_db", "use_domain", 1)


# ----- presence params -----
/* uncomment the following lines if you want to enable presence */
modparam("presence|presence_xml", "db_url",
        "mysql://openser:openserrw@172.16.0.141/openser")
modparam("presence_xml", "force_active", 1)
modparam("presence", "server_address", "sip:172.16.0.141:5060")

# -- pua  and pua_xmpp params -- # new params mani added
modparam("pua", "db_url", "mysql://openser:openserrw@172.16.0.141/openser")
modparam("pua_xmpp", "server_address", "sip:172.16.0.141:5060")

# -- xmpp parameters -- # new params mani added
modparam("xmpp", "backend", "component")
modparam("xmpp", "domain_separator", "*")
modparam("xmpp", "gateway_domain", "sip-xmpp1.mydomain.com")
modparam("xmpp", "xmpp_domain", "xmpp-sip1.mydomain.com")
modparam("xmpp", "xmpp_host", "xmpp1.mydomain.com")
modparam("xmpp", "xmpp_password", "secret")

# ---- purple params -----
#modparam("purple", "db_url", "mysql://
openser:openserrw at 172.16.0.141/openser")
#modparam("purple", "db_table", "purplemap")
#modparam("purple", "httpProxy_host", "10.26.52.12")
#modparam("purple", "httpProxy_port", 3128)


# -- nathelper
#n#modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:7722")
#n#modparam("nathelper", "natping_interval", 30)
#n#modparam("nathelper", "ping_nated_only", 1)
#n#modparam("nathelper", "sipping_bflag", 7)
#n#modparam("nathelper", "sipping_from",
"sip:pinger at kamailio.org<sip%3Apinger at kamailio.org>
")
#n#modparam("registrar|nathelper", "received_avp", "$avp(i:80)")
#n#modparam("usrloc", "nat_bflag", 6)


####### Routing Logic ########

# 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-xmpp1.mydomain.com<sip%3A.%2B at sip-xmpp1.mydomain.com>"
||

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

        if( uri=~"sip:.+ at sip-xmpp1.mydomain.com<sip%3A.%2B at sip-xmpp1.mydomain.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-xmpp1.mydomain.com<sip%3A.%2B at sip-xmpp1.mydomain.com>
"){
                        log("*** calling pua_xmpp_notify() NOTIFY
message.\n");
                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-xmpp1.mydomain.com<sip%3A.%2B at sip-xmpp1.mydomain.com>"
&& $hdr(Event)== "presence"){
                        log("*** calling  pua_xmpp_req_winfo SUBSCRIBE
message.\n");
                        pua_xmpp_req_winfo("$ruri", "$hdr(Expires)");
                }
                #t_release();
                /* the call to t_release is no longer needed in 1.5 */
        }

        exit;
}




On Tue, Jun 23, 2009 at 5:01 AM, Anca Vamanu <anca at opensips.org> wrote:

> Hi Mani,
>
> Have you followed the config example from this link
> http://www.opensips.org/Resources/PuaXmppConfig ?
> You must call  'pua_xmpp_req_winfo' for subscriptions to xmpp buddies.
>
> Do you see any error in the config file?
>
> regards,
> Anca
>
> mani sivaraman wrote:
>
>> Hello
>> After a whole week of trying to connect sip and xmpp through opensips I'm
>> not able to add a xmpp buddy in a sip client and vice versa.I'm able to send
>> and receive messages between a sip and xmpp buddy. However the Presence
>> Notification does not work either way. I get NOTIFY for "presence.winfo"
>> event, but NO Notify for "presence" event.
>>
>> ANy one succesfully recevied presence event for an xmpp buddy ? Please
>> help
>>
>> I'm using Jabberd2 server as my xmpp server on the same physical box as
>> that of opensips.
>>
>> Thanks in advance.
>> Mani
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20090623/ce9cf759/attachment-0001.htm 


More information about the Users mailing list