Beispiel #1
0
        public static String GetDisplayName(String uri)
        {
            String displayname = null;
            if (!String.IsNullOrEmpty(uri))
            {
                Contact contact = UriUtils.ServiceManager.ContactService.ContactFind(uri);
                if (contact != null && (displayname = contact.DisplayName) != null)
                {
                    return displayname;
                }

                SipUri sipUri = new SipUri(uri);
                if (sipUri.isValid())
                {
                    displayname = sipUri.getUserName();
                }
                sipUri.Dispose();
            }

            return (displayname == null ? uri : displayname);
        }
Beispiel #2
0
 public bool call(SipUri remoteUri, twrap_media_type_t media, ActionConfig config) {
   bool ret = tinyWRAPPINVOKE.CallSession_call__SWIG_2(swigCPtr, SipUri.getCPtr(remoteUri), (int)media, ActionConfig.getCPtr(config));
   return ret;
 }
Beispiel #3
0
 public bool callMsrp(SipUri remoteUri) {
   bool ret = tinyWRAPPINVOKE.MsrpSession_callMsrp__SWIG_3(swigCPtr, SipUri.getCPtr(remoteUri));
   return ret;
 }
Beispiel #4
0
 public bool setToUri(SipUri toUri)
 {
     return(tinyWRAPPINVOKE.SipSession_setToUri__SWIG_1(this.swigCPtr, SipUri.getCPtr(toUri)));
 }
Beispiel #5
0
 internal static HandleRef getCPtr(SipUri obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Beispiel #6
0
        // very dirty
        public static String GetValidPhoneNumber(String uri)
        {
            if (uri != null && (uri.StartsWith("sip:") || uri.StartsWith("sip:") || uri.StartsWith("tel:")))
            {
                SipUri sipUri = new SipUri(uri);
                if (sipUri.isValid())
                {
                    String userName = sipUri.getUserName();
                    if (userName != null)
                    {
                        try
                        {
                            String scheme = sipUri.getScheme();
                            if (scheme != null && scheme.Equals("tel"))
                            {
                                userName = userName.Replace("-", "");
                            }

                            long result = Convert.ToInt64(userName.StartsWith("+") ? userName.Substring(1) : userName);
                            if (result < UriUtils.MAX_PHONE_NUMBER)
                            {
                                return userName;
                            }
                        }
                        catch (FormatException ) { }
                        catch (Exception e)
                        {
                            LOG.Error(e);
                        }
                    }
                }
                sipUri.Dispose();
            }
            else
            {
                try
                {
                    uri = uri.Replace("-", "");
                    long result = Convert.ToInt64(uri.StartsWith("+") ? uri.Substring(1) : uri);
                    if (result < UriUtils.MAX_PHONE_NUMBER)
                    {
                        return uri;
                    }
                }
                catch (FormatException ) { }
                catch (Exception e)
                {
                    LOG.Error(e);
                }
            }
            return null;
        }
Beispiel #7
0
        public bool setToUri(SipUri toUri)
        {
            bool ret = tinyWRAPPINVOKE.SipSession_setToUri__SWIG_1(swigCPtr, SipUri.getCPtr(toUri));

            return(ret);
        }
Beispiel #8
0
 public bool callVideo(SipUri remoteUri, ActionConfig config) {
   bool ret = tinyWRAPPINVOKE.CallSession_callVideo__SWIG_2(swigCPtr, SipUri.getCPtr(remoteUri), ActionConfig.getCPtr(config));
   return ret;
 }
Beispiel #9
0
 public bool callVideo(SipUri remoteUri, int mediaAttr, ActionConfig config)
 {
     return(tinyWRAPPINVOKE.CallSession_callVideo__SWIG_2(this.swigCPtr, SipUri.getCPtr(remoteUri), mediaAttr, ActionConfig.getCPtr(config)));
 }
Beispiel #10
0
 public bool callAudioVideo(SipUri remoteUri, int mediaAttr)
 {
     return(tinyWRAPPINVOKE.CallSession_callAudioVideo__SWIG_3(this.swigCPtr, SipUri.getCPtr(remoteUri), mediaAttr));
 }
Beispiel #11
0
 public bool call(SipUri remoteUri, twrap_media_type_t media, int mediaAttr)
 {
     return(tinyWRAPPINVOKE.CallSession_call__SWIG_3(this.swigCPtr, SipUri.getCPtr(remoteUri), (int)media, mediaAttr));
 }
Beispiel #12
0
        public bool callAudioVideo(SipUri remoteUri, ActionConfig config)
        {
            bool ret = tinyWRAPPINVOKE.CallSession_callAudioVideo__SWIG_2(swigCPtr, SipUri.getCPtr(remoteUri), ActionConfig.getCPtr(config));

            return(ret);
        }
Beispiel #13
0
        public bool callAudio(SipUri remoteUri)
        {
            bool ret = tinyWRAPPINVOKE.CallSession_callAudio__SWIG_3(swigCPtr, SipUri.getCPtr(remoteUri));

            return(ret);
        }
Beispiel #14
0
        public bool call(SipUri remoteUri, twrap_media_type_t media)
        {
            bool ret = tinyWRAPPINVOKE.CallSession_call__SWIG_3(swigCPtr, SipUri.getCPtr(remoteUri), (int)media);

            return(ret);
        }
Beispiel #15
0
 public bool call(SipUri remoteUri, twrap_media_type_t media) {
   bool ret = tinyWRAPPINVOKE.CallSession_call__SWIG_3(swigCPtr, SipUri.getCPtr(remoteUri), (int)media);
   return ret;
 }
Beispiel #16
0
 public bool callMsrp(SipUri remoteUri, ActionConfig config)
 {
     return(tinyWRAPPINVOKE.MsrpSession_callMsrp__SWIG_2(this.swigCPtr, SipUri.getCPtr(remoteUri), ActionConfig.getCPtr(config)));
 }
Beispiel #17
0
 public bool callAudioVideo(SipUri remoteUri) {
   bool ret = tinyWRAPPINVOKE.CallSession_callAudioVideo__SWIG_3(swigCPtr, SipUri.getCPtr(remoteUri));
   return ret;
 }
Beispiel #18
0
 public bool callMsrp(SipUri remoteUri)
 {
     return(tinyWRAPPINVOKE.MsrpSession_callMsrp__SWIG_3(this.swigCPtr, SipUri.getCPtr(remoteUri)));
 }
Beispiel #19
0
        private rlsservices CreateRLSDocument()
        {
            rlsservices rls = new rlsservices();

            rls.service = new serviceType[]
            {
                // RCS service
                this.CreatePresenceService(SpecialNames.SHARED_RCS),
                // OMA services
                this.CreatePresenceService(SpecialNames.SHARED_OMA_BUDDYLIST),
                this.CreatePresenceService(SpecialNames.SHARED_OMA_POCBUDDYLIST)
            };

            String documentUrl;
            lock (this.xcapSelector)
            {
                this.xcapSelector.reset();
                this.xcapSelector.setAUID(XcapService.XCAP_AUID_IETF_RLS_SERVICES_ID);
                documentUrl = this.xcapSelector.getString();
            }

            byte[] payload = this.Serialize(rls, true, true, this.GetSerializerNSFromAUID(XcapService.XCAP_AUID_IETF_RLS_SERVICES_ID));
            MyXcapMessage xcapMessage = this.xcapStack.PutDocument(documentUrl, payload, (uint)payload.Length, XcapService.XCAP_AUID_IETF_RLS_SERVICES_MIME_TYPE);

            if (xcapMessage != null)
            {
                if (XcapService.IsSuccessCode(xcapMessage.Code))
                {
                    return rls;
                }
                else if (xcapMessage.Content != null && xcapMessage.Code == 409/*Conflict*/ || xcapMessage.Code == 415/*Unsupported Media Type*/)
                {
                    object content = this.Deserialize(xcapMessage.Content, typeof(xcaperror));
                    xcaperror xerror;

                    if (content != null && ((xerror = content as xcaperror) != null))
                    {
                        LOG.Error(String.Format("XCAP Error={0}", xerror.ErrorPhrase));
                        if (xerror.ErrorType == xcaperror.xcaperrorItemType.ErrorElementUniquenessfailure)
                        {
                            xcaperrorErrorelementUniquenessfailure errorUniquenessfailure = xerror.Item as xcaperrorErrorelementUniquenessfailure;
                            if (errorUniquenessfailure != null && errorUniquenessfailure.exists != null && errorUniquenessfailure.exists.Length > 0)
                            {
                                xcaperrorErrorelementUniquenessfailureExists errorUniquenessfailureExists = errorUniquenessfailure.exists[0];
                                if (errorUniquenessfailureExists != null)
                                {
                                    String field = errorUniquenessfailureExists.field;
                                    String altvalue = (errorUniquenessfailureExists.altvalue != null && errorUniquenessfailureExists.altvalue.Length > 0) ? errorUniquenessfailureExists.altvalue[0] : null;

                                    if (String.IsNullOrEmpty(altvalue))
                                    {
                                        SipUri sipUri = new SipUri(this.xcapStack.XUI);
                                        if (sipUri.isValid())
                                        {
                                            altvalue = String.Format(CultureInfo.CurrentCulture,
                                                "{0}:{1}_alt{2}",
                                                sipUri.getScheme(), sipUri.getUserName(), DateTime.Now.Ticks);
                                        }
                                        else
                                        {
                                            altvalue = "sip:[email protected]";
                                        }
                                    }
                                    rls.service[0].uri = altvalue;

                                    payload = this.Serialize(rls, true, true, this.GetSerializerNSFromAUID(XcapService.XCAP_AUID_IETF_RLS_SERVICES_ID));
                                    xcapMessage = this.xcapStack.PutDocument(documentUrl, payload, (uint)payload.Length, XcapService.XCAP_AUID_IETF_RLS_SERVICES_MIME_TYPE);
                                    if (xcapMessage != null && XcapService.IsSuccessCode(xcapMessage.Code))
                                    {
                                        return rls;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return null;
        }
Beispiel #20
0
 internal static HandleRef getCPtr(SipUri obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Beispiel #21
0
 public bool setToUri(SipUri toUri) {
   bool ret = tinyWRAPPINVOKE.SipSession_setToUri__SWIG_1(swigCPtr, SipUri.getCPtr(toUri));
   return ret;
 }
Beispiel #22
0
        public bool callMsrp(SipUri remoteUri)
        {
            bool ret = tinyWRAPPINVOKE.MsrpSession_callMsrp__SWIG_3(swigCPtr, SipUri.getCPtr(remoteUri));

            return(ret);
        }