Android2.3 Sip简单分析( 二 )


以上是针对net目录下Sip的分析 , 好了我们转到目录下Sip的分析 。目录下有六个目标文件(、、、oxy、、) 。
class SipHelperSIP协议栈相关的类和各种低级别的SIP任务 , 如发送消息的Helper类 , 产生会话需要的消息头/体的各种信息 , 定义如下:private FromHeader createFromHeader(SipProfile profile, String tag) //构造来自源头信息private ToHeader createToHeader(SipProfile profile) throws ParseException { //构造去向源信息private ToHeader createToHeader(SipProfile profile, String tag) //构造去向源信息private CallIdHeader createCallIdHeader() {//构造会话id信息private CSeqHeader createCSeqHeader(String method) //构造会话CSeq信息private MaxForwardsHeader createMaxForwardsHeader() //构造会话MaxForwards信息private List createViaHeaders() //构造通道信息private ContactHeader createContactHeader(SipProfile profile) //构造联系头private ContactHeader createWildcardContactHeader() { //创建通配符private SipURI createSipUri(String username, String transport,ListeningPoint lp) throws ParseException { //构造sip地址public ClientTransaction sendOptions(SipProfile caller, SipProfile callee,String tag) throws SipException {//发送选择public ClientTransaction sendRegister(SipProfile userProfile, String tag,int expiry) throws SipException { //发送注册private Request createRequest(String requestType, SipProfile userProfile,String tag) throws ParseException, SipException { //创建请求public ClientTransaction handleChallenge(ResponseEvent responseEvent,AccountManager accountManager) throws SipException { //处理请求private Request createRequest(String requestType, SipProfile caller,SipProfile callee, String tag) throws ParseException, SipException {//创建请求public ClientTransaction sendInvite(SipProfile caller, SipProfile callee,String sessionDescription, String tag, ReferredByHeader referredBy,String replaces) throws SipException {//发送邀请public ClientTransaction sendReinvite(Dialog dialog,String sessionDescription) throws SipException { //发送再次邀请public ServerTransaction getServerTransaction(RequestEvent event)throws SipException { //得到服务器中交易信息public ServerTransaction sendRinging(RequestEvent event, String tag)throws SipException { //发送响铃public ServerTransaction sendInviteOk(RequestEvent event,SipProfile localProfile, String sessionDescription,ServerTransaction inviteTransaction, String externalIp,int externalPort) throws SipException {//邀请OKpublic void sendInviteBusyHere(RequestEvent event,ServerTransaction inviteTransaction) throws SipException { //邀请忙public void sendInviteAck(ResponseEvent event, Dialog dialog)throws SipException { //发送邀请ackpublic void sendReferNotify(Dialog dialog, String content)throws SipException { //发送参阅通知public void sendInviteRequestTerminated(Request inviteRequest,ServerTransaction inviteTransaction) throws SipException { //发送邀请终止public final class SipService extends ISipService.Stub管理Sip的服务class SipSessionGroup implements SipListener管理的一个SIP帐户class SipSessionListenerProxy extends ISipSessionListener.Stub以帮助安全地运行在不同的线程中的回调 , 实现会话过程中事件class SipWakeLock 定义了sip同步锁 class SipWakeupTimer extends BroadcastReceiver 定时器 , 它可安排事件的发生 , 甚至当设备处于睡眠 。该类是继承了广播 , 类中还定义了private static class MyEvent事件以及回调private static class MyEventComparator implements Comparator用于对准的事件与较大的期间 , 对事件排序
以上是针对目录下Sip的分析 , 好了我们转到目录下Sip的分析 。目录下有六个目标文件(、、、、、) 。
public class SipPhoneFactorysip电话生成厂abstract class SipPhoneBase extends PhoneBase 记录/管理Sip电话状态类public class SipPhone extends SipPhoneBase同上abstract class SipConnectionBase extends Connection 记录Sip电话时间等信息class SipCommandInterface extends BaseCommands implements CommandsInterface SIP不需要CommandsInterface的 。类什么也不做 , 但PhoneBase的构造函数所做的工作 。abstract class SipCallBase extends Call 抽象类 , 记录连接信息 。