[Freeswitch-dev] Question about sofia_presence.c

Gerald Weber gerald.weber at besharp.at
Sat Oct 27 13:11:14 MSD 2012


It skips exactly at line 4213 in sofia_presence.c
.. if (count != 1) { ..

count is initialized with 1 and never overwritten because the check in line 4204
... if (sofia_test_pflag(profile, PFLAG_MULTIREG) && !open) { ...
always evaluates to false because var open is initialized to 1 and never overwritten after the init.
This seems like a bug or is it intentional ?

However, looking at the code brings me to one question:
Is the table sip_presence intended to be filled when only one phone registred to one user changes its presence (so no multi registration is used) ?

Thanks
gw


Von: freeswitch-dev-bounces at lists.freeswitch.org [mailto:freeswitch-dev-bounces at lists.freeswitch.org] Im Auftrag von Anthony Minessale
Gesendet: Freitag, 26. Oktober 2012 19:34
An: freeswitch-dev at lists.freeswitch.org
Betreff: Re: [Freeswitch-dev] Question about sofia_presence.c

Well add some debug lines and try to see why it doesn't work.  Probably the xml is not the same as the other supported phones or something silly.  Just put log printf all over the place in the function to see where it skips.

On Fri, Oct 26, 2012 at 3:21 AM, Gerald Weber <gerald.weber at besharp.at<mailto:gerald.weber at besharp.at>> wrote:
I set presence debug to 10 and posted the output to pastebin:

http://pastebin.freeswitch.com/20131

Von: freeswitch-dev-bounces at lists.freeswitch.org<mailto:freeswitch-dev-bounces at lists.freeswitch.org> [mailto:freeswitch-dev-bounces at lists.freeswitch.org<mailto:freeswitch-dev-bounces at lists.freeswitch.org>] Im Auftrag von Gerald Weber
Gesendet: Freitag, 26. Oktober 2012 09:36

An: freeswitch-dev at lists.freeswitch.org<mailto:freeswitch-dev at lists.freeswitch.org>
Betreff: Re: [Freeswitch-dev] Question about sofia_presence.c

I had that alread set in sip_profiles/internal.xml together with these values:

<param name="manage-presence" value="true"/>
<param name="send-presence-on-register" value="true"/>
<param name="presence-probe-on-register" value="true"/>
<param name="presence-proto-lookup" value="true"/>
<param name="manage-shared-appearance" value="true"/>
<param name="dbname" value="share_presence"/>
<param name="presence-hosts" value="$${domain}"/>

Still no rows in sip_presence


Von: freeswitch-dev-bounces at lists.freeswitch.org<mailto:freeswitch-dev-bounces at lists.freeswitch.org> [mailto:freeswitch-dev-bounces at lists.freeswitch.org] Im Auftrag von Anthony Minessale
Gesendet: Freitag, 26. Oktober 2012 00:46
An: freeswitch-dev at lists.freeswitch.org<mailto:freeswitch-dev at lists.freeswitch.org>
Betreff: Re: [Freeswitch-dev] Question about sofia_presence.c

err in sofia profile.

<param name="multiple-registrations" value="true"/>
On Thu, Oct 25, 2012 at 5:45 PM, Anthony Minessale <anthony.minessale at gmail.com<mailto:anthony.minessale at gmail.com>> wrote:
then enable the multiple-registrations param in your sofia-presence

On Thu, Oct 25, 2012 at 1:40 AM, Gerald Weber <gerald.weber at besharp.at<mailto:gerald.weber at besharp.at>> wrote:
So you mean a sip packet like this ?

No.     Time           Source                Destination           Protocol Length Info
     74 4.780876000    192.168.20.150        192.168.20.73         SIP/XML  1174   Request: PUBLISH sip:2001 at 192.168.20.73<mailto:sip%3A2001 at 192.168.20.73>

Frame 74: 1174 bytes on wire (9392 bits), 1174 bytes captured (9392 bits) on interface 0
Ethernet II, Src: HewlettP_33:a8:77 (e8:39:35:33:a8:77), Dst: Vmware_8c:00:1c (00:50:56:8c:00:1c)
Internet Protocol Version 4, Src: 192.168.20.150 (192.168.20.150), Dst: 192.168.20.73 (192.168.20.73)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
    Total Length: 1160
    Identification: 0x1de8 (7656)
    Flags: 0x02 (Don't Fragment)
    Fragment offset: 0
    Time to live: 128
    Protocol: UDP (17)
    Header checksum: 0x0000 [incorrect, should be 0x2e4d (may be caused by "IP checksum offload"?)]
    Source: 192.168.20.150 (192.168.20.150)
    Destination: 192.168.20.73 (192.168.20.73)
    [Source GeoIP: Unknown]
    [Destination GeoIP: Unknown]
User Datagram Protocol, Src Port: 16066 (16066), Dst Port: sip (5060)
Session Initiation Protocol
    Request-Line: PUBLISH sip:2001 at 192.168.20.73<mailto:sip%3A2001 at 192.168.20.73> SIP/2.0
    Message Header
    Message Body
        eXtensible Markup Language
            <?xml
            <presence
                xmlns='urn:ietf:params:xml:ns:pidf'
                xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model'
                xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid'
                xmlns:c='urn:ietf:params:xml:ns:pidf:cipid'
                xmlns:lt='urn:ietf:params:xml:ns:location-type'
                xmlns:caps='urn:ietf:params:xml:ns:pidf:caps'
                entity='sip:2001 at 192.168.20.73<mailto:sip%3A2001 at 192.168.20.73>'>
                <tuple
                    id='t7301aa0d'>
                    <status>
                        <basic>
                        </status>
                    </tuple>
                <dm:person
                    id='p74c68736'>
                    <rpid:activities>
                        <rpid:busy/>
                        </rpid:activities>
                    <dm:note>
                        Do not disturb
                        </dm:note>
                    </dm:person>
                </presence>


This i sent from a bria3 client to fs but i dont get any entry in sip_presence because of the check in line 4204.


Von: freeswitch-dev-bounces at lists.freeswitch.org<mailto:freeswitch-dev-bounces at lists.freeswitch.org> [mailto:freeswitch-dev-bounces at lists.freeswitch.org<mailto:freeswitch-dev-bounces at lists.freeswitch.org>] Im Auftrag von Anthony Minessale
Gesendet: Mittwoch, 24. Oktober 2012 20:01
An: freeswitch-dev at lists.freeswitch.org<mailto:freeswitch-dev at lists.freeswitch.org>
Betreff: Re: [Freeswitch-dev] Question about sofia_presence.c

it has to send a publish to update sip_presence using the pidf method.

On Wed, Oct 24, 2012 at 10:55 AM, Gerald Weber <gerald.weber at besharp.at<mailto:gerald.weber at besharp.at>> wrote:
Hi all,

i'm currently extending my list_users command to show the presence status of registered sip devices.
I have a snom 360 and a bria softphone here to test with, calling one from the other shows 2 rows in sip_dialogs table so presence
is basically working.

Both phones have the ability to set the presence to, e.g. busy or meeting or whatever.

The only problem i have is, that there is no line in sip_presence table when i change the presence on the phone (or using presence in)
Digging through the code, i found that this is  because of the if statement in src/mod/endpoints/mod_sofia/sofia_presence.c line 4204
Looks like a check for multiple registrations, but how is this intended to work with only one registration per user ?
I changed the if to if (count > 0)  for testing and i can see the correct entries in sip_registrations.

I'm not quite sure if i understand the purpose of this code so i didn't raise a jira.
Is this a bug ? If not, does the sip_presence table only get filled when there are more than one registration per user ?

Thanks
gw






_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org<mailto:consulting at freeswitch.org>
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-dev mailing list
FreeSWITCH-dev at lists.freeswitch.org<mailto:FreeSWITCH-dev at lists.freeswitch.org>
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com<mailto:MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<mailto:PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net<http://irc.freenode.net> #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org<mailto:sip%3A888 at conference.freeswitch.org>
googletalk:conf+888 at conference.freeswitch.org<mailto:googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:+19193869900<tel:%2B19193869900>

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org<mailto:consulting at freeswitch.org>
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-dev mailing list
FreeSWITCH-dev at lists.freeswitch.org<mailto:FreeSWITCH-dev at lists.freeswitch.org>
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com<mailto:MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<mailto:PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net<http://irc.freenode.net> #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org<mailto:sip%3A888 at conference.freeswitch.org>
googletalk:conf+888 at conference.freeswitch.org<mailto:googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:+19193869900<tel:%2B19193869900>



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com<mailto:MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<mailto:PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net<http://irc.freenode.net> #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org<mailto:sip%3A888 at conference.freeswitch.org>
googletalk:conf+888 at conference.freeswitch.org<mailto:googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:+19193869900<tel:%2B19193869900>

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org<mailto:consulting at freeswitch.org>
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-dev mailing list
FreeSWITCH-dev at lists.freeswitch.org<mailto:FreeSWITCH-dev at lists.freeswitch.org>
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com<mailto:MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<mailto:PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net<http://irc.freenode.net> #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org<mailto:sip%3A888 at conference.freeswitch.org>
googletalk:conf+888 at conference.freeswitch.org<mailto:googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20121027/509dbe56/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list