/*
* Copyright (C) 2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of imsdroid Project (http://code.google.com/p/imsdroid)
*
* imsdroid is free software: you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* imsdroid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
package org.doubango.imsdroid.Services.Impl;
import java.nio.ByteBuffer;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList;
import org.doubango.imsdroid.CustomDialog;
import org.doubango.imsdroid.IMSDroid;
import org.doubango.imsdroid.R;
import org.doubango.imsdroid.Model.Configuration;
import org.doubango.imsdroid.Model.HistorySMSEvent;
import org.doubango.imsdroid.Model.Configuration.CONFIGURATION_ENTRY;
import org.doubango.imsdroid.Model.Configuration.CONFIGURATION_SECTION;
import org.doubango.imsdroid.Model.HistoryEvent.StatusType;
import org.doubango.imsdroid.Screens.ScreenAV;
import org.doubango.imsdroid.Screens.ScreenMsrpInc;
import org.doubango.imsdroid.Services.IConfigurationService;
import org.doubango.imsdroid.Services.INetworkService;
import org.doubango.imsdroid.Services.ISipService;
import org.doubango.imsdroid.events.EventHandler;
import org.doubango.imsdroid.events.IInviteEventHandler;
import org.doubango.imsdroid.events.IRegistrationEventHandler;
import org.doubango.imsdroid.events.ISubscriptionEventHandler;
import org.doubango.imsdroid.events.InviteEventArgs;
import org.doubango.imsdroid.events.InviteEventTypes;
import org.doubango.imsdroid.events.RegistrationEventArgs;
import org.doubango.imsdroid.events.RegistrationEventTypes;
import org.doubango.imsdroid.events.SubscriptionEventArgs;
import org.doubango.imsdroid.events.SubscriptionEventTypes;
import org.doubango.imsdroid.media.MediaType;
import org.doubango.imsdroid.sip.MyAVSession;
import org.doubango.imsdroid.sip.MyInviteSession;
import org.doubango.imsdroid.sip.MyMsrpSession;
import org.doubango.imsdroid.sip.MyPublicationSession;
import org.doubango.imsdroid.sip.MyRegistrationSession;
import org.doubango.imsdroid.sip.MySipStack;
import org.doubango.imsdroid.sip.MySubscriptionSession;
import org.doubango.imsdroid.sip.PresenceStatus;
import org.doubango.imsdroid.sip.MySipStack.STACK_STATE;
import org.doubango.imsdroid.sip.MySubscriptionSession.EVENT_PACKAGE_TYPE;
import org.doubango.imsdroid.utils.ContentType;
import org.doubango.imsdroid.utils.StringUtils;
import org.doubango.imsdroid.utils.UriUtils;
import org.doubango.tinyWRAP.CallSession;
import org.doubango.tinyWRAP.DDebugCallback;
import org.doubango.tinyWRAP.DialogEvent;
import org.doubango.tinyWRAP.InviteEvent;
import org.doubango.tinyWRAP.InviteSession;
import org.doubango.tinyWRAP.MessagingEvent;
import org.doubango.tinyWRAP.MessagingSession;
import org.doubango.tinyWRAP.MsrpSession;
import org.doubango.tinyWRAP.OptionsEvent;
import org.doubango.tinyWRAP.OptionsSession;
import org.doubango.tinyWRAP.PublicationEvent;
import org.doubango.tinyWRAP.RPMessage;
import org.doubango.tinyWRAP.RegistrationEvent;
import org.doubango.tinyWRAP.SMSData;
import org.doubango.tinyWRAP.SMSEncoder;
import org.doubango.tinyWRAP.SipCallback;
import org.doubango.tinyWRAP.SipMessage;
import org.doubango.tinyWRAP.SipSession;
import org.doubango.tinyWRAP.SipStack;
import org.doubango.tinyWRAP.StackEvent;
import org.doubango.tinyWRAP.SubscriptionEvent;
import org.doubango.tinyWRAP.SubscriptionSession;
import org.doubango.tinyWRAP.tinyWRAPConstants;
import org.doubango.tinyWRAP.tsip_invite_event_type_t;
import org.doubango.tinyWRAP.tsip_message_event_type_t;
import org.doubango.tinyWRAP.tsip_options_event_type_t;
import org.doubango.tinyWRAP.tsip_subscribe_event_type_t;
import org.doubango.tinyWRAP.twrap_media_type_t;
import org.doubango.tinyWRAP.twrap_sms_type_t;
import android.content.DialogInterface;
import android.os.ConditionVariable;
import android.util.Log;
import android.widget.Toast;
public class SipService extends Service
implements ISipService, tinyWRAPConstants {
private final static String TAG = SipService.class.getCanonicalName();
// Services
private final IConfigurationService configurationService;
private final INetworkService networkService;
// Event Handlers
private final CopyOnWriteArrayList<IRegistrationEventHandler> registrationEventHandlers;
private final CopyOnWriteArrayList<ISubscriptionEventHandler> subscriptionEventHandlers;
private final CopyOnWriteArrayList<IInviteEventHandler> inviteEventHandlers;
private byte[] reginfo;
private byte[] winfo;
private MySipStack sipStack;
private final MySipCallback sipCallback;
private MyRegistrationSession regSession;
private MySubscriptionSession subReg;
private MySubscriptionSession subWinfo;
private MySubscriptionSession subMwi;
//private MySubscriptionSession subDebug;
private MyPublicationSession pubPres;
private final CopyOnWriteArrayList<MySubscriptionSession> subPres;
private final SipPrefrences preferences;
private final DDebugCallback debugCallback;
private ConditionVariable condHack;
public SipService() {
super();
this.sipCallback = new MySipCallback(this);
// FIXME: to be set to null in the release version
this.debugCallback = new DDebugCallback();
this.registrationEventHandlers = new CopyOnWriteArrayList<IRegistrationEventHandler>();
this.subscriptionEventHandlers = new CopyOnWriteArrayList<ISubscriptionEventHandler>();
this.inviteEventHandlers = new CopyOnWriteArrayList<IInviteEventHandler>();
this.configurationService = ServiceManager.getConfigurationService();
this.networkService = ServiceManager.getNetworkService();
this.subPres = new CopyOnWriteArrayList<MySubscriptionSession>();
this.preferences = new SipPrefrences();
}
public boolean start() {
return true;
}
public boolean stop() {
if(this.sipStack != null && this.sipStack.getState() == STACK_STATE.STARTED){
this.sipStack.stop();
}
return true;
}
public boolean isRegistered() {
if (this.regSession != null) {
return this.regSession.isConnected();
}
return false;
}
public MySipStack getStack(){
return this.sipStack;
}
public byte[] getReginfo(){
return this.reginfo;
}
public byte[] getWinfo(){
return this.winfo;
}
public MySubscriptionSession createPresenceSession(String toUri, EVENT_PACKAGE_TYPE eventPackage){
MySubscriptionSession session = new MySubscriptionSession(this.sipStack, toUri, eventPackage);
this.subPres.add(session);
return session;
}
public void clearPresenceSessions(){
for(MySubscriptionSession session : this.subPres){
if(session.isConnected()){
session.unsubscribe();
}
}
//this.subPres.clear();
}
public void removePresenceSession(MySubscriptionSession session){
if(session.isConnected()){
session.unsubscribe();
}
//this.subPres.remove(session);
}
/* ===================== SIP functions ======================== */
public boolean stopStack(){
if(this.sipStack != null){
return this.sipStack.stop();
}
return true;
}
public boolean register() {
this.preferences.realm = this.configurationService.getString(
CONFIGURATION_SECTION.NETWORK, CONFIGURATION_ENTRY.REALM,
Configuration.DEFAULT_REALM);
this.preferences.impi = this.conf
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
IMSDroid是一个我认为不错的Android平台上的IMS Client(虽然我在模拟器环境下还不能成功建立语音和视频会话,不过Message是通的)。地址是:http://code.google.com/p/imsdroid/ 网站上有APK包下载,当然也可以通过SVN下载源码。我尝试过的是使用APK包安装,并使用。客户端界面还是比较人性化。刚开始在模拟器上运行时,通过[网站的指导]的信息可以比较快速学会配置和使客户端成功注册到IMS。在这期间碰到一些问题(主要是因为运行在模拟器上,而貌似在模拟器上运行这个程序是不被建议的),这些问题或许可以通过[点击这里]得到解决。 略读了一下IMSDroid的源码,学到了不少东西,其中包括SWIG,和simple framework等等。该项目似乎基于名为 doubango的项目。
资源推荐
资源详情
资源评论
收起资源包目录
Imsdroid源代码 (955个子文件)
resources.ap_ 782KB
imsdroid.apk 4.72MB
tinyWRAPJNI.class 30KB
SipService$MySipCallback.class 22KB
ScreenAV.class 21KB
SipService.class 20KB
ContactService.class 17KB
XcapService.class 15KB
MyMsrpSession.class 14KB
R$id.class 14KB
Main.class 13KB
MyAVSession.class 12KB
ServiceManager.class 12KB
ScreenContacts.class 11KB
ScreenHistory.class 9KB
ScreenPresence.class 9KB
ScreenFileTransferView.class 9KB
VideoProducer.class 8KB
ScreenQoS.class 8KB
ScreenAV$AVInviteEventHandler.class 8KB
HistoryService.class 7KB
Activities.class 7KB
ScreenHome.class 7KB
NetworkService.class 7KB
SipStack.class 7KB
ScreenMsrpInc.class 7KB
ScreenSMSCompose.class 7KB
Configuration.class 7KB
ScreenSecurity.class 6KB
ScreenHistory$ScreenHistoryAdapter.class 6KB
ScreenCodecs.class 6KB
ScreenGeneral.class 6KB
ContactService$1.class 6KB
ScreenRegistrations.class 6KB
Servcapstype.class 6KB
VideoProducer$Preview.class 6KB
ScreenNetwork.class 6KB
ScreenContacts$ScreenContactsAdapter.class 5KB
ConfigurationService.class 5KB
SipCallback.class 5KB
ScreenFileTransferQueue.class 5KB
ScreenService.class 5KB
MyMsrpSession$MsrpInviteEventHandler.class 5KB
ScreenNatt.class 5KB
VideoConsumer.class 5KB
MyMsrpSession$MyMsrpCallback.class 5KB
AudioConsumer.class 5KB
SoundService.class 5KB
Screen.class 5KB
ScreenOptionsContacts.class 5KB
Extensiontypes.class 4KB
ScreenContactEdit.class 4KB
Configuration$CONFIGURATION_ENTRY.class 4KB
R$drawable.class 4KB
ScreenIdentity.class 4KB
CallSession.class 4KB
XcapStack.class 4KB
ScreenMessaging.class 4KB
ScreenFileTransferQueue$ScreenFileTransAdapter.class 4KB
ScreenOptions.class 4KB
ScreenHome$ScreenHomeAdapter.class 4KB
ScreenDialer.class 4KB
tdav_codec_id_t.class 4KB
Xcap.class 4KB
UriUtils.class 4KB
ScreenRegistrations$ScreenRegistrationsAdapter.class 4KB
ScreenRegistrations$3.class 4KB
ProxyVideoConsumer.class 4KB
Methodtypes.class 4KB
MySubscriptionSession.class 4KB
AudioProducer.class 4KB
MyPublicationSession.class 4KB
ScreenHome$1.class 4KB
ProxyVideoProducer.class 4KB
Group$Contact.class 4KB
ScreenFileTransferQueue$MsrpInviteEventHandler.class 4KB
SipSession.class 3KB
Tuple.class 3KB
MySipSession.class 3KB
XcapSelector.class 3KB
XcapMessage.class 3KB
MySipStack.class 3KB
ProxyAudioConsumer.class 3KB
Eventtypes.class 3KB
MsrpMessage.class 3KB
ScreenHistory$1.class 3KB
SipMessage.class 3KB
tsip_invite_event_type_t.class 3KB
ScreenContactView.class 3KB
ProxyAudioProducer.class 3KB
SipService$SipPrefrences.class 3KB
ScreenPresence$3.class 3KB
Contact.class 3KB
Person.class 3KB
MsrpSession.class 3KB
Device.class 3KB
tsip_event_code_t.class 3KB
ScreenCodecs$ScreenCodecsAdapter.class 3KB
tmedia_chroma_t.class 3KB
VideoProducer$FFC.class 3KB
共 955 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
yangliyewoaini
- 粉丝: 31
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页