Exemplo n.º 1
0
        public bool SendBinaryMessage(String text, String SMSC)
        {
            String SMSCPhoneNumber;
            String dstPhoneNumber;
            String dstSipUri = base.ToUri;

            if ((SMSCPhoneNumber = UriUtils.GetValidPhoneNumber(SMSC)) != null && (dstPhoneNumber = UriUtils.GetValidPhoneNumber(dstSipUri)) != null)
            {
                base.ToUri = SMSC;
                this.session.addHeader("Content-Type", ContentType.SMS_3GPP);
                this.session.addHeader("Content-Transfer-Encoding", "binary");
                this.session.addCaps("+g.3gpp.smsip");

                RPMessage rpMessage;
                //if(ServiceManager.getConfigurationService().getBoolean(CONFIGURATION_SECTION.RCS, CONFIGURATION_ENTRY.HACK_SMS, false)){
                //    rpMessage = SMSEncoder.encodeDeliver(++ScreenSMSCompose.SMS_MR, SMSCPhoneNumber, dstPhoneNumber, new String(content));
                //    session.addHeader("P-Asserted-Identity", SMSC);
                //}
                //else{
                rpMessage = SMSEncoder.encodeSubmit(++MyMessagingSession.SMS_MR, SMSCPhoneNumber, dstPhoneNumber, text);
                //}

                long   rpMessageLen  = rpMessage.getPayloadLength();
                byte[] payload       = new byte[(int)rpMessageLen];
                uint   payloadLength = rpMessage.getPayload(payload, (uint)payload.Length);
                bool   ret           = this.session.send(payload, payloadLength);
                rpMessage.Dispose();
                if (MyMessagingSession.SMS_MR >= 255)
                {
                    MyMessagingSession.SMS_MR = 0;
                }

                return(ret);
            }
            else
            {
                LOG.Error(String.Format("SMSC={0} or RemoteUri={1} is invalid", SMSC, dstSipUri));
                return(this.SendTextMessage(text));
            }
        }
Exemplo n.º 2
0
        public bool SendBinaryMessage(string text, string SMSC)
        {
            bool result;

            if (text == null)
            {
                result = false;
            }
            else
            {
                string dstSipUri = base.ToUri;
                string SMSCPhoneNumber;
                string dstPhoneNumber;
                if ((SMSCPhoneNumber = UriUtils.GetValidPhoneNumber(SMSC)) != null && (dstPhoneNumber = UriUtils.GetValidPhoneNumber(dstSipUri)) != null)
                {
                    base.ToUri = SMSC;
                    this.session.addHeader("Content-Type", "application/vnd.3gpp.sms");
                    this.session.addHeader("Content-Transfer-Encoding", "binary");
                    this.session.addHeader("Contact", string.Format("<{0};transport=udp>", this.fromUri));
                    RPMessage rpMessage = SMSEncoder.encodeSubmit(++MyMessageSession.SMS_MR, SMSCPhoneNumber, dstPhoneNumber, text);
                    bool      ret       = this.session.send(rpMessage.getPayload());
                    rpMessage.Dispose();
                    if (MyMessageSession.SMS_MR >= 255)
                    {
                        MyMessageSession.SMS_MR = 0;
                    }
                    result = ret;
                }
                else
                {
                    MyMessageSession.LOG.Error(string.Format("SMSC={0} or RemoteUri={1} is invalid", SMSC, dstSipUri));
                    result = this.SendTextMessage(text);
                }
            }
            return(result);
        }