[Top][All Lists]

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

Re: [Linphone-developers] [Linphone] Presence in iOS iPhone App not work

From: Vicky Dhas
Subject: Re: [Linphone-developers] [Linphone] Presence in iOS iPhone App not working
Date: Wed, 25 Jun 2014 12:19:12 +0800
User-agent: Microsoft-MacOutlook/

Hello Developers,

Can I get any updated help on this query I raised.


Vicky Dhas
Please consider the impact to the environment before printing this email

From: Vicky Dhas <address@hidden>
Date: Tuesday, 24 June, 2014 3:36 PM
To: BIENKOWSKI Guillaume <address@hidden>, "address@hidden" <address@hidden>
Subject: [Linphone] Presence in iOS iPhone App not working

Hello Bienkowiski,

I am trying to do the presence in the SIP server for iOS App. I a struggling with an examples over net since they are more focus towards C. 

Honestly not sharp at C usage more on objective C side. 

I have some how use the Linphone manager to get the information to call the presence delegate but there are issues as I always get offline.

Here is my code snippet. Of linphone manager I did.

//This function is called from view controllers and all the SIP ID are passed in this function to add a friend to get presence status




    //NOT Implemented



    NSArray *_buddyContacts = contacts;


    for (int counter=0; counter < [_buddyContacts count]; counter++) {

        NSLog(@"Buddy Contact for presence are : [%d] %@",counter,nil);


        NSDictionary *personContact = [_buddyContacts objectAtIndex:counter];


        NSString *sipAddress = [NSString stringWithFormat:@"sip:%@@%@:5060",[personContact objectForKey:@"sipid"],kDomain];


LinphoneFriend* friend=linphone_friend_new_with_address([sipAddress UTF8String]);





//Adding friend here

linphone_core_add_friend([LinphoneManager getLc],friend);




    LinphoneProxyConfig* proxy ;

LinphonePresenceModel* presence;


linphone_core_get_default_proxy([LinphoneManager getLc],&proxy);





presence =linphone_presence_model_new_with_activity(LinphonePresenceActivityOnline,NULL);

linphone_core_set_presence_model([LinphoneManager getLc],presence);




//This function gets called but the status is always send offline 

static void notify_presence_recv_updated (LinphoneCore *lc,  LinphoneFriend *friend) {

const LinphonePresenceModel* model = linphone_friend_get_presence_model(friend);

const LinphoneAddress* friend_address = linphone_friend_get_address(friend);

LinphonePresenceActivity *activity = linphone_presence_model_get_activity(model);

char *activity_str = linphone_presence_activity_to_string(activity);

printf("New state state [%s] for user id [%s] \n"


           ,linphone_address_as_string (friend_address));


    NSLog(@"New state state [%s] for user id [%s] \n"


          ,linphone_address_as_string (friend_address));


//This function as seen from internet to get the call back once anyone request for the adding friend to get its presence in buddy list. But this delegate don't get called ever

static void new_subscription_requested (LinphoneCore *lc,  LinphoneFriend *friend, const char* url) {

const LinphoneAddress* friend_address = linphone_friend_get_address(friend);

printf(" [%s] wants to see your status, accepting\n"

           ,linphone_address_as_string (friend_address));


linphone_friend_edit(friend); /* start editing friend */

linphone_friend_set_inc_subscribe_policy(friend,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/

linphone_friend_done(friend); /*commit change*/

linphone_core_add_friend(lc,friend); /* add this new friend to the buddy list*/



Is there anything missing in my implementation. Also checked on Wireshark the logs for the PUBLISH Call for Presence the response id always given as BAD REQUEST. 

Your kind help is much appreciated.


Vicky Dhas

Please consider the impact to the environment before printing this email

reply via email to

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