Esempio n. 1
0
 public bool Mute(bool mute, twrap_media_type_t media)
 {
     if (this.MediaSessionMgr != null)
     {
         if (MediaSessionMgr.producerSetInt32(media, "mute", mute ? 1 : 0))
         {
             mMute = mute;
             return(true);
         }
     }
     return(false);
 }
Esempio n. 2
0
        public static MediaType ConvertFromNative(twrap_media_type_t mediaType)
        {
            MediaType t = MediaType.None;

            for (int i = 0; i < __media_type_binds.Length; ++i)
            {
                if ((__media_type_binds[i].tnative & mediaType) == __media_type_binds[i].tnative)
                {
                    t |= __media_type_binds[i].twrap;
                }
            }
            return(t);
        }
Esempio n. 3
0
        public static twrap_media_type_t ConvertToNative(MediaType mediaType)
        {
            twrap_media_type_t t = twrap_media_type_t.twrap_media_none;

            for (int i = 0; i < __media_type_binds.Length; ++i)
            {
                if ((__media_type_binds[i].twrap & mediaType) == __media_type_binds[i].twrap)
                {
                    t |= __media_type_binds[i].tnative;
                }
            }
            return(t);
        }
Esempio n. 4
0
        public static bool HandleMediaUpdate(long id, twrap_media_type_t newMediaType)
        {
            MyAVSession avSession = MyAVSession.GetSession(id);

            if (avSession != null)
            {
                if ((newMediaType & twrap_media_type_t.twrap_media_msrp) == twrap_media_type_t.twrap_media_msrp)
                {
                    return(false); // For now MSRP update is not suportted
                }
                avSession.mMediaType = MediaTypeUtils.ConvertFromNative(newMediaType);
                return(true);
            }

            return(false);
        }
Esempio n. 5
0
        public static MyAVSession TakeOutgoingTranferSession(MySipStack sipStack, CallSession session, twrap_media_type_t mediaType, SipMessage sipMessage)
        {
            MediaType media = MediaTypeUtils.ConvertFromNative(mediaType);

            if (media == MediaType.None)
            {
                return(null);
            }

            MyAVSession avSession = MyAVSession.CreateOutgoingSession(sipStack, session, media);

            if (sipMessage != null)
            {
                avSession.RemotePartyUri = sipMessage.getSipHeaderValue("refer-to");
            }
            return(avSession);
        }
Esempio n. 6
0
        public static MyAVSession TakeIncomingSession(MySipStack sipStack, CallSession session, twrap_media_type_t mediaType, SipMessage sipMessage)
        {
            MediaType media = MediaTypeUtils.ConvertFromNative(mediaType);

            if (media == MediaType.None)
            {
                return(null);
            }

            lock (MyAVSession.sessions)
            {
                MyAVSession avSession = new MyAVSession(sipStack, session, media, InviteState.INCOMING);
                if (sipMessage != null)
                {
                    avSession.RemotePartyUri = sipMessage.getSipHeaderValue("f");
                }
                MyAVSession.sessions.Add(avSession.Id, avSession);
                return(avSession);
            }
        }
Esempio n. 7
0
 public static MediaType ConvertFromNative(twrap_media_type_t mediaType)
 {
     MediaType t = MediaType.None;
     for (int i = 0; i < __media_type_binds.Length; ++i)
     {
         if ((__media_type_binds[i].tnative & mediaType) == __media_type_binds[i].tnative)
         {
             t |= __media_type_binds[i].twrap;
         }
     }
     return t;
 }
Esempio n. 8
0
 public media_type_bind_s(MediaType _twrap, twrap_media_type_t _tnative)
 {
     this.twrap = _twrap;
     this.tnative = _tnative;
 }
Esempio n. 9
0
 public media_type_bind_s(MediaType _twrap, twrap_media_type_t _tnative)
 {
     this.twrap   = _twrap;
     this.tnative = _tnative;
 }
Esempio n. 10
0
 public bool Mute(bool mute, twrap_media_type_t media)
 {
     if (this.MediaSessionMgr != null)
     {
         if (MediaSessionMgr.producerSetInt32(media, "mute", mute ? 1 : 0))
         {
             mMute = mute;
             return true;
         }
     }
     return false;
 }
Esempio n. 11
0
        public static MyAVSession TakeOutgoingTranferSession(MySipStack sipStack, CallSession session, twrap_media_type_t mediaType, SipMessage sipMessage)
        {
            MediaType media = MediaTypeUtils.ConvertFromNative(mediaType);
            if (media == MediaType.None)
            {
                return null;
            }

            MyAVSession avSession = MyAVSession.CreateOutgoingSession(sipStack, session, media);
            if (sipMessage != null)
            {
                avSession.RemotePartyUri = sipMessage.getSipHeaderValue("refer-to");
            }
            return avSession;
        }
Esempio n. 12
0
        public static MyAVSession TakeIncomingSession(MySipStack sipStack, CallSession session, twrap_media_type_t mediaType, SipMessage sipMessage)
        {
            MediaType media = MediaTypeUtils.ConvertFromNative(mediaType);
            if (media == MediaType.None)
            {
                return null;
            }

            lock (MyAVSession.sessions)
            {
                MyAVSession avSession = new MyAVSession(sipStack, session, media, InviteState.INCOMING);
                if (sipMessage != null)
                {
                    avSession.RemotePartyUri = sipMessage.getSipHeaderValue("f");
                }
                MyAVSession.sessions.Add(avSession.Id, avSession);
                return avSession;
            }
        }
Esempio n. 13
0
        public static bool HandleMediaUpdate(long id, twrap_media_type_t newMediaType)
        {
            MyAVSession avSession = MyAVSession.GetSession(id);
            if (avSession != null)
            {
                if ((newMediaType & twrap_media_type_t.twrap_media_msrp) == twrap_media_type_t.twrap_media_msrp)
                {
                    return false; // For now MSRP update is not suportted
                }
                avSession.mMediaType = MediaTypeUtils.ConvertFromNative(newMediaType);
                return true;
            }

            return false;
        }