linphone-developers
[Top][All Lists]
Advanced

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

[Linphone-developers] How to Implement Presence using Phone book's numbe


From: Maulik
Subject: [Linphone-developers] How to Implement Presence using Phone book's number in iPhone ?
Date: Mon, 5 Aug 2013 19:26:28 +0530

Hello,

I wanted to implement Presence using phone book's contact of iPhone. I wanted to show whether the contact number is on our SIP network or not ? 

What I have done so far is :

1) I am reading each contact from phone book and send subscription request 

LinphoneFriend* linphoneFriend = linphone_friend_new_with_addr([sipUri UTF8String]);

                            

if (!linphone_friend_in_list(linphoneFriend))
{
          NSLog(@"Contact %@ not in linphone friend list, subscribing....", number);
          NSLog(@"Subscribing To .... %@", sipUri);
          linphone_friend_enable_subscribes(linphoneFriend,TRUE);
          linphone_friend_set_inc_subscribe_policy(linphoneFriend,LinphoneSPAccept);
          linphone_core_add_friend([LinphoneManager getLc],linphoneFriend);
}

and get callback by :

static void notify_presence_recv_updated (LinphoneCore *lc,  LinphoneFriend *friend)
{
    //const LinphoneAddress* friend_address = linphone_friend_get_address(friend);
    [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneFriendStatusUpdate object:[NSValue valueWithPointer:friend] userInfo:nil];
}

but callback doesn't work each time I changed the status by :

linphone_core_set_presence_info([LinphoneManager getLc],0,NULL,LinphoneStatusOffline);

It only get called when I logged in successfully.


Any suggestions to implement it through easy and efficient way ?


Thanks

reply via email to

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