Exemple #1
0
        public static MyMsrpSession CreateOutgoingSession(MySipStack sipStack, MediaType mediaType, string remoteUri)
        {
            MyMsrpSession result;

            if (mediaType == MediaType.FileTransfer || mediaType == MediaType.Chat)
            {
                MyMsrpSession msrpSession = new MyMsrpSession(sipStack, null, mediaType, remoteUri);
                MyMsrpSession.sSessions.Add(msrpSession.Id, msrpSession);
                result = msrpSession;
            }
            else
            {
                result = null;
            }
            return(result);
        }
Exemple #2
0
 public MyMsrpSession(MySipStack sipStack, MsrpSession session, MediaType mediaType, string remoteUri) : base(sipStack)
 {
     this.mCallback      = new MyMsrpSession.MyMsrpCallback(this);
     this.mMediaType     = mediaType;
     this.remotePartyUri = remoteUri;
     if (session == null)
     {
         this.outgoing = true;
         this.mSession = new MsrpSession(sipStack.WrappedStack, this.mCallback);
     }
     else
     {
         this.outgoing = false;
         this.mSession = session;
         this.mSession.setCallback(this.mCallback);
     }
     base.init();
     base.SigCompId = sipStack.SigCompId;
     this.mSession.addHeader("Subject", "FIXME");
 }
Exemple #3
0
 public MyAVSession(MySipStack sipStack, CallSession session, MediaType mediaType, InviteState callState, TrunkCallParam callParam) : base(sipStack)
 {
     this.mSession   = ((session == null) ? new CallSession(sipStack.WrappedStack) : session);
     this.mMediaType = mediaType;
     this.mState     = callState;
     this.mMute      = false;
     base.init();
     base.SigCompId = sipStack.SigCompId;
     if (callParam != null)
     {
         this.strCallType      = callParam.strCallType;
         this.strPrioAttribute = callParam.strPrioAttribute;
         this.stre2ee          = callParam.stre2ee;
         this.strduplex        = callParam.strduplex;
         this.strfoaoroacsu    = callParam.strfoaoroacsu;
         this.strpriority      = callParam.strpriority;
         this.strcallerUDN     = callParam.strcallerUDN;
         this.strOnlineCallID  = callParam.strOnlineCallID;
         this.strCalledType    = callParam.strCalledType;
     }
 }
Exemple #4
0
 protected MyInviteSession(MySipStack sipStack) : base(sipStack)
 {
     this.mState = InviteState.NONE;
 }
Exemple #5
0
        public static MyMsrpSession TakeIncomingSession(MySipStack sipStack, MsrpSession session, SipMessage message)
        {
            SdpMessage    sdp     = message.getSdpMessage();
            string        fromUri = message.getSipHeaderValue("f");
            MyMsrpSession result;

            if (string.IsNullOrEmpty(fromUri))
            {
                MyMsrpSession.LOG.Error("Invalid fromUri");
                result = null;
            }
            else if (sdp == null)
            {
                MyMsrpSession.LOG.Error("Invalid Sdp content");
                result = null;
            }
            else
            {
                string        fileSelector = sdp.getSdpHeaderAValue("message", "file-selector");
                MediaType     mediaType    = string.IsNullOrEmpty(fileSelector) ? MediaType.Chat : MediaType.FileTransfer;
                MyMsrpSession msrpSession;
                if (mediaType == MediaType.Chat)
                {
                    msrpSession = MyMsrpSession.CreateIncomingSession(sipStack, session, mediaType, fromUri);
                }
                else
                {
                    string type           = null;
                    int    nameIndexStart = fileSelector.IndexOf("name:\"");
                    if (nameIndexStart == -1)
                    {
                        MyMsrpSession.LOG.Error("No name attribute");
                        result = null;
                        return(result);
                    }
                    int nameIndexEnd = fileSelector.IndexOf("\"", nameIndexStart + 6);
                    if (nameIndexEnd == -1)
                    {
                        MyMsrpSession.LOG.Error("Invalid name attribute");
                        result = null;
                        return(result);
                    }
                    string name = fileSelector.Substring(nameIndexStart + 6, nameIndexEnd - nameIndexStart - 6).Trim();
                    fileSelector = fileSelector.Substring(0, nameIndexStart) + fileSelector.Substring(nameIndexEnd + 1, fileSelector.Length - nameIndexEnd - 1);
                    string[] attributes = fileSelector.Split(" ".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);
                    string[] array      = attributes;
                    for (int i = 0; i < array.Length; i++)
                    {
                        string   attribute = array[i];
                        string[] avp       = attribute.Split(":".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);
                        if (avp.Length >= 2)
                        {
                            if (string.Equals(avp[0], "type", System.StringComparison.InvariantCultureIgnoreCase) && avp[1] != null)
                            {
                                type = avp[1];
                            }
                        }
                    }
                    msrpSession           = MyMsrpSession.CreateIncomingSession(sipStack, session, mediaType, fromUri);
                    msrpSession.mFilePath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), string.Format("{0}/{1}", "Doubango\\SharedContent", name));
                    msrpSession.mFileType = type;
                }
                result = msrpSession;
            }
            return(result);
        }
 public MyPublicationSession(MySipStack sipStack, string toUri) : base(sipStack)
 {
 }
Exemple #7
0
        public MySubscriptionSession(MySipStack sipStack, string toUri, MySubscriptionSession.EVENT_PACKAGE_TYPE eventPackage) : base(sipStack)
        {
            this.session      = new SubscriptionSession(sipStack.WrappedStack);
            this.eventPackage = eventPackage;
            base.init();
            base.SigCompId = sipStack.SigCompId;
            switch (eventPackage)
            {
            case MySubscriptionSession.EVENT_PACKAGE_TYPE.CONFERENCE:
                this.session.addHeader("Event", "conference");
                this.session.addHeader("Accept", "application/conference-info+xml");
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.DIALOG:
                this.session.addHeader("Event", "dialog");
                this.session.addHeader("Accept", "application/dialog-info+xml");
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.MESSAGE_SUMMARY:
                this.session.addHeader("Event", "message-summary");
                this.session.addHeader("Accept", "application/simple-message-summary");
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.PRESENCE:
            case MySubscriptionSession.EVENT_PACKAGE_TYPE.PRESENCE_LIST:
                this.session.addHeader("Event", "presence");
                if (eventPackage == MySubscriptionSession.EVENT_PACKAGE_TYPE.PRESENCE_LIST)
                {
                    this.session.addHeader("Supported", "eventlist");
                }
                this.session.addHeader("Accept", string.Format("{0}, {1}, {2}, {3}", new object[]
                {
                    "multipart/related",
                    "application/pidf+xml",
                    "application/rlmi+xml",
                    "application/rpid+xml"
                }));
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.REG:
                this.session.addHeader("Event", "reg");
                this.session.addHeader("Accept", "application/reginfo+xml");
                this.session.setSilentHangup(true);
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.SIP_PROFILE:
                this.session.addHeader("Event", "sip-profile");
                this.session.addHeader("Accept", "application/vnd.oma.im.deferred-list+xml");
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.UA_PROFILE:
                this.session.addHeader("Event", "ua-profile");
                this.session.addHeader("Accept", "application/xcap-diff+xml");
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.WINFO:
                this.session.addHeader("Event", "presence.winfo");
                this.session.addHeader("Accept", "application/watcherinfo+xml");
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.XCAP_DIFF:
                this.session.addHeader("Event", "xcap-diff");
                this.session.addHeader("Accept", "application/xcap-diff+xml");
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.PTT_MEMBRELATION_SUB:
                this.session.addHeader("Event", "MembershipAttributes");
                this.session.addHeader("Accept", "application/pttmembershipinfo+xml");
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.PTT_REG_SUB:
                this.session.addHeader("Event", "UERegisterStatus");
                this.session.addHeader("Accept", "application/pttuereginfo+xml");
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.PTT_UECALL_SUB:
                this.session.addHeader("Event", "UECallStatus");
                this.session.addHeader("Accept", "application/pttuecallinfo+xml");
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.PTT_GRCALL_SUB:
                this.session.addHeader("Event", "GroupCallStatus");
                this.session.addHeader("Accept", "application/pttgroupcallinfo+xml");
                break;

            case MySubscriptionSession.EVENT_PACKAGE_TYPE.PTT_ONLINECALL_SUB:
                this.session.addHeader("Event", "OnLineCallStatus");
                this.session.addHeader("Accept", "application/pttsysonlinecallinfo+xml");
                break;
            }
            base.ToUri = UriUtils.GetValidSipUri(toUri);
        }
Exemple #8
0
 public MySipSession(MySipStack sipStack)
 {
     this.sipStack = sipStack;
     this.outgoing = false;
     this.time     = System.DateTime.Now;
 }