linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] An issue about presence subscription


From: Amin Alinezhad
Subject: [Linphone-developers] An issue about presence subscription
Date: Sun, 7 Jan 2024 16:54:35 +0330

Hi
I am programming a UWP c# test project with LibLinPhone. After spending much time on the internet to find a document or forum or sample code to guide me on my issue, I have to share with you.
I 'd like to create a subscription to a telephone extension and get presence data of that.
I follow up your c# samples code to initialize Factory and Core and doing necessarily instruction as you said in your documentation.
I have a procedure to create subscription:
        private void SetPresence()
        {
            var addr = Factory.Instance.CreateAddress("sip:222@192.168.102.20");
            addr.DisplayName = "Alinezhad";
            
            Friend friend = StoredCore.CreateFriendWithAddress("sip:222@192.168.102.20");
            FriendList friendList = StoredCore.CreateFriendList();
            friend.Listener.OnPresenceReceived += OnPresenceReceived;

            friendList.AddFriend(friend);

            StoredCore.AddFriendList(friendList);

            StoredCore.AddContentTypeSupport("application/pidf+xml");
            Event evt = StoredCore.CreateSubscribe(addr, "presence", 3600);
            evt.AddCustomHeader("Accept", "application/pidf+xml");

            evt.Listener.OnNotifyResponse += OnNotifyResponse;
            evt.SendSubscribe(null);
        }

        private void OnNotifyPresenceReceived(Core core, Friend linphoneFriend)
        {
            txt_Log.Text += "OnNotifyPresenceReceived\r";
        }
The problem is the OnNotifyPresenceReceived is invoked only once when the first SIP NOTIFY message is received. If the status of the "222" extension will be changed (like Ringing) the event will not be triggered. Did I do something wrong?
Tanx a lot for your attention.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]