Add SIP contacts list and their online status.

1,041 views
Skip to first unread message

Langyue

unread,
Apr 19, 2012, 4:55:02 AM4/19/12
to csipsim...@googlegroups.com
I am learning to add one SIP contacts list on Csipsimple. and I am looking for how to get online status of contacts throug pjsip.
 
in org.pjsip.pjsua.pjsipJNI.java, I read these lines. Could I use them to get someone's online status from SIP server?
  public final static native int pjsua_acc_info_online_status_get(long jarg1, pjsua_acc_info jarg1_);
  public final static native long pjsua_acc_info_online_status_text_get(long jarg1, pjsua_acc_info jarg1_);
 
Of course, I also read these lines in org.pjsip.pjsua.pjsua_acc_info. but I did not know how should I use because It seems not for read one contact's status.
public int getOnline_status() {
    return pjsuaJNI.pjsua_acc_info_online_status_get(swigCPtr, this);
  }
  public void setOnline_status_text(pj_str_t value) {
    pjsuaJNI.pjsua_acc_info_online_status_text_set(swigCPtr, this, pj_str_t.getCPtr(value), value);
  }
 
could you help me!
 

Langyue

unread,
Apr 19, 2012, 5:04:55 AM4/19/12
to csipsim...@googlegroups.com

在 2012年4月19日星期四UTC+8下午4时55分02秒,Langyue写道:

Régis Montoya

unread,
Apr 19, 2012, 5:59:20 AM4/19/12
to csipsim...@googlegroups.com
Hi,


All org.pjsip.pjsua package is generated automatically by swig.
So it's not something good to read/modify.
You should have a look to pjsip documentation first for this kind of things.

Then, about presence sharing, you should rather have a look to what is already implemented and working in csipsimple.
It's in com.csipsimple.
http://code.google.com/p/csipsimple/source/browse/trunk/CSipSimple/src/com/csipsimple/service/SipService.java#555

What are you trying to do actually??? If you tell exactly the purpose of your modification I could help you better.

Also, if not already done, read the wiki : http://code.google.com/p/csipsimple/wiki/Licensing?wl=en this page is very important to understand before starting any modification because if you plan to build on the top of csipsimple or contribute to it, you have to be aware of the licensing model.

Regards,
Régis

Langyue

unread,
Apr 19, 2012, 9:10:56 AM4/19/12
to csipsim...@googlegroups.com
Hi,
 
    I am just the begainer of android programmer. If I can contribute sth for the project, that must be my honor.
    At this moment, I hope to add one tab on main frame, and set it to manage local contacts and SIP contacts like Xlite can do. For SIP contacts, I want to show online status on server's presence service. 
    Mabye it is not neccessary on your plan. I also read SipService.java,.the fuction getPresence(long accountId) , you did not write it actully. I hope it could connet to SIP server to get status of input sip account.
 
Hope my problem is clear.
 
Thanks.
 

在 2012年4月19日星期四UTC+8下午5时59分20秒,r3gis写道:

Régis Montoya

unread,
Apr 19, 2012, 9:34:34 AM4/19/12
to csipsim...@googlegroups.com
Hi,

Ok, so what you are trying to do is already being developed.

Have a look to the favorites tab. It's exactly what you are trying to do ;)

Unlike other sip apps, it will entirely rely on android contact management system which is in my opinion really really better. In fact in csipsimple each sip account will link and android contact group. This will allow to support xcap, or any other kind of contact provider backend through any plugin that just does support contact and integrate it to stock android app.

Then csipsimple will display this group and automatically share presence with contact in this group.

This is already almost all done. It lacks just some user interface part to configure which android contact group each sip account will link on and what are the info in contact to use for sip uri. For now, it's not configurable and based on account name == android contact group name and sip uri == a custom "csip" im address in contact.
So if you want to contribute this part and implement the missing step to configure from user interface group name and to automatically generate from phone numbers or from sip address of contacts of this group the "csip" custom protocol entry, it will be very welcome :)
But it will require you really dive in the code and learn a lot of things on android. What I plan to do is pretty complicated and requires good skills on how android manage contacts.
Unlike other app that just re-invent the wheel and do that with very few feature, I plan to reuse the powerful android contact system and take advantage of it and of its openness :)


Regards,
Régis

Langyue

unread,
Apr 19, 2012, 10:07:09 AM4/19/12
to csipsim...@googlegroups.com
Hi,
     So, conclude this subject:
     1, you plan to add one more IM named "csip"  in local contacts, and I can set csip ID for my contacts list.
     2, you will read contacts with csip ID to Favorates tab, which is displaying my first SIP account at this moment. 
     3, You alrady finished setting and getting presence information(I saw in Expert account wizard, there is "publish presence".It works well ) .  
 
    I have some knowledge on android contacts, such as how to query,update,etc. How should I begain my job under your instruct now. For example, which package should I read, or develop.
 

在 2012年4月19日星期四UTC+8下午9时34分34秒,r3gis写道:

Régis Montoya

unread,
Apr 19, 2012, 2:00:01 PM4/19/12
to csipsim...@googlegroups.com
On 19/04/2012 16:07, Langyue wrote:
Hi,
     So, conclude this subject:
     1, you plan to add one more IM named "csip"  in local contacts, and I can set csip ID for my contacts list.
Actually it will be transparent for users. But yes, some groups of contact will probably be enriched by a csip IM entry. This entry will allow to give feedback on user presence and to make direct sip call using csipsimple.

     2, you will read contacts with csip ID to Favorates tab, which is displaying my first SIP account at this moment.
Contacts from a specific contact group actually. It will be possible to have contacts without sip uris.
Just try that :
in your stock android app, create a group with a name that is *exactly* the name of your sip account. (the display name of sip account). Add some contacts to it, and return in csipsimple fav tabs.

     3, You alrady finished setting and getting presence information(I saw in Expert account wizard, there is "publish presence".It works well ) .  
 
Yes, and in the fav tab you can set the current presence (for now only between online and offline, but DND and away should be there soon).

The contacts in the list (so in the corresponding group) that have a csip IM entry will be subscribed and the presence will be shared (it currently already support online, offline, dnd and away for this way).


    I have some knowledge on android contacts, such as how to query,update,etc. How should I begain my job under your instruct now. For example, which package should I read, or develop.

Great,
so you should start having a look to the Favorites tab implementation. I think that the next step is to add some way to configure the matching between the sip account and the android contact group name. I have already added in sip account a field in database to store this name. The missing step is to add a user interface to configure that, and to actually use that in PresenceManager (in service) instead of sip account display name.

Langyue

unread,
Apr 20, 2012, 4:04:57 AM4/20/12
to csipsim...@googlegroups.com
Hello,
     I read the favorate package and understand its design.  get new questions for you.
 
    1, where is the procedure to get presence of contacts ?
 
    2, for the contacts status, do you want to save presence to Contacts database, then query and display to view, or fill to view directedly once changed.
 
    3, I download the latest source codes, and start new project, all files is with same error message on the line import com.csipsimple.R; (the import can not be resolved) . That is very strange. I used the version Mar,29, it work rightly.
 
 

Langyue

unread,
Apr 22, 2012, 10:38:00 PM4/22/12
to csipsim...@googlegroups.com
hi,
   could you reply my latest questions.
   And  I tested Csipsimple with Ekiga account for call. the network was 3G. I could make call but not sound totally on both side. How could I know where is the problem.
 
Thanks.

Régis Montoya

unread,
Apr 23, 2012, 6:40:24 AM4/23/12
to csipsim...@googlegroups.com
Hi,

On 20/04/2012 10:04, Langyue wrote:
> Hello,
> I read the favorate package and understand its design. get new
> questions for you.
> 1, where is the procedure to get presence of contacts ?
It's made by addBuddy here :
http://code.google.com/p/csipsimple/source/browse/trunk/CSipSimple/src/com/csipsimple/service/PresenceManager.java#102
It's transmitted to pjsip stack behind which subscribe correctly.
> 2, for the contacts status, do you want to save presence
> to Contacts database, then query and display to view, or fill to view
> directedly once changed.
Yes it already saves it to contact database and query it from contact
database as well.
See
http://code.google.com/p/csipsimple/source/browse/trunk/CSipSimple/src/com/csipsimple/service/PresenceManager.java#235
It's transmitted to backward compatible module ContactWrapper that saves
and allow to retrive from contact db (maybe in older version the backend
will be some local db instead of contact db).

> 3, I download the latest source codes, and start new project, all
> files is with same error message on the line import com.csipsimple.R;
> (the import can not be resolved) . That is very strange. I used the
> version Mar,29, it work rightly.

Try to clean the project. It's usually due to some bad compilation of
eclipse. Also check errors listed by eclipse it's always very useful to
have the first error log. The com.csipsimple.R is just a consequence of
the fact eclipse doesn't build android autogenerated resources.


Regards,
Régis



Reply all
Reply to author
Forward
0 new messages