[OpenSIPS-Users] Presence issue

Dan Pascu dan at ag-projects.com
Fri Oct 19 13:39:15 EDT 2018


On 17 Oct 2018, at 23:33, Bogdan-Andrei Iancu wrote:

> Hi Dan,
> 
> What I failed so far was to reproduced it in a controlled environment. Do you have a setup, special cfg + SIP UAC , instructions to reproduce this issue ?

I use Blink as the client. I see this every time the proxy receives a PUBLISH request:

Oct 19 19:29:55 node15 ./opensips[23510]: [CONFIG] PUBLISH for presence sip:dan at test.sip2sip.info origin 86.120.12.1
64:41062 from sip:dan at test.sip2sip.info to sip:dan at test.sip2sip.info (243988a9-511e-4108-8950-5ab6edf82c3c)
Oct 19 19:29:55 node15 ./opensips[23510]: CRITICAL:db_mysql:wrapper_single_mysql_real_query: driver error (1062): Du
plicate entry 'dan-test.sip2sip.info-presence-a.1539700118.23510.517.1' for key 'presentity_idx'
Oct 19 19:29:55 node15 ./opensips[23510]: ERROR:core:db_do_update: error while submitting query
Oct 19 19:29:55 node15 ./opensips[23510]: ERROR:presence:update_presentity: updating published info in database
Oct 19 19:29:55 node15 ./opensips[23510]: ERROR:presence:handle_publish: when updating presentity

or this:

Oct 19 19:29:55 node15 ./opensips[23508]: [CONFIG] PUBLISH for presence sip:dan at test.sip2sip.info origin 86.120.12.1
64:39673 from sip:dan at test.sip2sip.info to sip:dan at test.sip2sip.info (cc4704d0-a5e7-4c78-89ae-4c31b6cb6246)
Oct 19 19:29:55 node15 ./opensips[23508]: INFO:presence:update_presentity: *** found in db but not in htable [a.1539
700118.23508.2291.0]

Below is the relevant part of my configuration (I included all the presence related modules I load and their configuration as they may be relevant):

# The address on which OpenSIPS will listen
define(`SERVER_IP', esyscmd(`echo -n $(hostname -i)'))
define(`SERVER_UDP_PORT', `5060')
define(`SERVER_TCP_PORT', `5060')
define(`SERVER_TLS_PORT', `5061')

# The server contact address
define(`SERVER_ADDRESS', `ifelse(SERVER_UDP_PORT, `5060', `SERVER_IP', `SERVER_IP:SERVER_UDP_PORT')')
# Contact used by the presence server
define(`PRESENCE_SERVER_ADDRESS', `sip:presence at SERVER_ADDRESS')
# Contact used by the resource list server
define(`RLS_SERVER_ADDRESS', `sip:rls at SERVER_ADDRESS')


loadmodule "presence.so"
loadmodule "xcap.so"
loadmodule "presence_xml.so"
loadmodule "presence_mwi.so"
loadmodule "pua.so"
loadmodule "pua_mi.so"
loadmodule "rls.so"
loadmodule "presence_xcapdiff.so"


modparam("presence", "db_url", "MySQL_URI")
modparam("presence", "server_address", "PRESENCE_SERVER_ADDRESS")
modparam("presence", "fallback2db", 1)
modparam("presence", "clean_period", 30)
modparam("presence", "notify_offline_body", 0)

modparam("presence_xml", "pres_rules_auid", "org.openmobilealliance.pres-rules")
modparam("presence_xml", "force_active", 0)
modparam("presence_xml", "pidf_manipulation", 1)
modparam("presence_xml", "generate_offline_body", 0)

modparam("pua", "db_url", "MySQL_URI")

modparam("xcap", "db_url", "MySQL_URI")
modparam("xcap", "integrated_xcap_server", 1)

modparam("rls", "server_address", "RLS_SERVER_ADDRESS")
modparam("rls", "to_presence_code", 5)
modparam("rls", "waitn_time", 10)

route {
    if ($rm == "PUBLISH") {
        if (is_from_local()) {
            if (!proxy_authorize("", "SUBSCRIBER_TABLE")) {
                proxy_challenge("", "0");
                return;
            } else if ($au != $fU) {
                sl_send_reply("403", "Username!=From not allowed ($au!=$fU)");
                return;
            }

            if ($rd == "") {
                $rd = $fd;
            }

            if (avp_check("$hdr(Event)", "fm/presence*/i") && ($au != $rU || $ar != $rd)) {
                sl_send_reply("403", "Publishing $hdr(Event) events for others is forbidden");
                return;
            }

            # Hide auth credentials to downstream routers
            consume_credentials();
        } else {
            sl_send_reply("403", "PUBLISH forbidden for outside domains");
            return;
        }

        if (t_newtran()) {
            handle_publish();
        } else {
            sl_reply_error();
        }
        exit;
    }
}


--
Dan







More information about the Users mailing list