示例#1
0
        private void SkypeOnCallReceived(object sender, SkypeCall skypeCall)
        {
            // rtbOutput.AppendText("Call Received: " + skypeCall.Id + " [" + skypeCall.TimeStamp.ToString("yyyy-MM-dd HH:mm:ss") + "] > " + skypeCall.Status + " > " + skypeCall.Duration + "\n");
            //rtbOutput.AppendText("Call Received: " + skypeCall.Id + " [" + skypeCall.TimeStamp + "] > " + skypeCall.Status + " > " + skypeCall.Duration + "\n");

            block_unauthorized_video();
        }
示例#2
0
        public static Bitmap Call(TextBox tb_skype)
        {
            SkypeCall generator = new SkypeCall(tb_skype.Text);
            String    payload   = generator.ToString();

            QRCodeGenerator QR    = new QRCodeGenerator();
            QRCodeData      data  = QR.CreateQrCode(payload, QRCodeGenerator.ECCLevel.H);
            QRCode          code  = new QRCode(data);
            Bitmap          image = code.GetGraphic(50, Color.FromArgb(34, 112, 147), Color.FromArgb(245, 245, 245), (Bitmap)Image.FromFile("C:\\Users\\bruno\\Downloads\\skype.png"), 25);

            return(image);
        }
        protected void OnCallChanged(SkypeCall call, SkypeCallState state)
        {
            if (_prevCall != null)
            {
                if (call.CallId.Equals(_prevCall.CallId) && state == _prevCallState)
                {
                    return;
                }
            }

            _prevCall      = call;
            _prevCallState = state;
            CallChanged?.Invoke(this, call, state);
        }
示例#4
0
        private void HandleCallMessage(string callId, string property, string value)
        {
            // Attempt to locate the call message in all the calls available
            // if not found then we create a new one and raise the newCall event otherwise we invoke the call updated event
            SkypeCall call;
            bool      isUpdate = _calls.TryGetValue(callId, out call);

            if (!isUpdate)
            {
                // If the property is STATUS and value is UNPLACED then check to see if we have a pending call
                // in that case we associate that pending call with this information and continue
                if (_pendingCall != null && property == "STATUS" && value == "UNPLACED")
                {
                    call         = _pendingCall;
                    call.Id      = callId;
                    _pendingCall = null;
                }
                else
                {
                    call = new SkypeCall {
                        Id = callId
                    };
                }

                // Add the call to the list of all known calls
                call.RequestCallUpdate -= call_RequestCallUpdate_ToSendMessageToSkypeForData;
                call.RequestCallUpdate += call_RequestCallUpdate_ToSendMessageToSkypeForData;
                _calls.Add(callId, call);
            }


            // Update the property value if it is set
            if (property != null)
            {
                SkypeSerializer.Update(call, property, value);
            }

            // Raise the correct events
            if (isUpdate)
            {
                OnCallUpdated(call);
            }
            else
            {
                OnCallReceived(call);
            }
        }
示例#5
0
        /// <summary>
        /// Initiates a call to one or more targets
        /// </summary>
        /// <param name="targets">
        /// targets to be called. In case of multiple targets conference is created. Available target types:
        /// USERNAME – Skype username, e.g. “pamela”, “echo123”
        /// PSTN – PSTN phone number, e.g. “+18005551234”, “003725555555”
        /// SPEED DIAL CODE – 1 or 2 character speeddial code
        /// </param>
        public void Call(params string[] targets)
        {
            if (targets == null || targets.Length <= 0)
            {
                throw new ArgumentNullException("targets", "You must specify at least one target for your call");
            }
            if (_pendingCall != null)
            {
                throw new ServiceAccessException("You already have a pending outgoing call. Please either wait for that to complete or hang up");
            }

            _pendingCall = new SkypeCall()
            {
                Targets = targets
            };

            SendMessage("CALL " + string.Join(", ", targets));
        }
示例#6
0
 private void OnCallUpdated( SkypeCall call )
 {
     CallUpdated.Raise(this, call);
 }
示例#7
0
 private void OnCallReceived( SkypeCall call )
 {
     CallReceived.Raise(this, call);
 }
示例#8
0
        private void HandleCallMessage(string callId, string property, string value)
        {
            // Attempt to locate the call message in all the calls available
            // if not found then we create a new one and raise the newCall event otherwise we invoke the call updated event
            SkypeCall call;
            bool isUpdate = _calls.TryGetValue(callId, out call);

            if (!isUpdate)
            {
                // If the property is STATUS and value is UNPLACED then check to see if we have a pending call
                // in that case we associate that pending call with this information and continue
                if (_pendingCall != null && property == "STATUS" && value == "UNPLACED")
                {
                    call = _pendingCall;
                    call.Id = callId;
                    _pendingCall = null;
                }
                else
                {
                    call = new SkypeCall {Id = callId};
                }

                // Add the call to the list of all known calls
                call.RequestCallUpdate -= call_RequestCallUpdate_ToSendMessageToSkypeForData;
                call.RequestCallUpdate += call_RequestCallUpdate_ToSendMessageToSkypeForData;
                _calls.Add(callId, call);
            }

            // Update the property value if it is set
            if (property != null)
                SkypeSerializer.Update(call, property, value);

            // Raise the correct events
            if (isUpdate)
                OnCallUpdated(call);
            else
                OnCallReceived(call);
        }
示例#9
0
        /// <summary>
        /// Initiates a call to one or more targets
        /// </summary>
        /// <param name="targets">
        /// targets to be called. In case of multiple targets conference is created. Available target types:
        /// USERNAME – Skype username, e.g. “pamela”, “echo123”
        /// PSTN – PSTN phone number, e.g. “+18005551234”, “003725555555”
        /// SPEED DIAL CODE – 1 or 2 character speeddial code
        /// </param>
        public void Call(params string[] targets)
        {
            if (targets == null || targets.Length <= 0) throw new ArgumentNullException("targets", "You must specify at least one target for your call");
            if( _pendingCall != null ) throw new ServiceAccessException("You already have a pending outgoing call. Please either wait for that to complete or hang up");

            _pendingCall = new SkypeCall() { Targets = targets};

            SendMessage("CALL " + string.Join(", ", targets));
        }
示例#10
0
        protected virtual void ParseCall(string call)
        {
            try
            {
                var doc = new XmlDocument();
                doc.LoadXml(call);

                var nodes = doc.GetElementsByTagName("partlist");
                if (nodes.Count > 0)
                {
                    var rootNote = nodes[0];
                    var type     = rootNote.Attributes["type"].Value;
                    var callId   = rootNote.Attributes["callId"].Value;

                    var users = new List <SkypeUser>();

                    foreach (XmlNode partNode in rootNote.ChildNodes)
                    {
                        if ("part".Equals(partNode.Name))
                        {
                            var skypeId = partNode.Attributes["identity"].Value;
                            var user    = new SkypeUser()
                            {
                                SkypeId = skypeId
                            };

                            foreach (XmlNode nameNode in partNode.ChildNodes)
                            {
                                if ("name".Equals(nameNode.Name))
                                {
                                    user.DisplayName = nameNode.InnerText;
                                    break;
                                }
                            }

                            users.Add(user);
                        }
                    }

                    var skypeCall = new SkypeCall()
                    {
                        CallId = callId,
                        From   = users.Count > 0 ? users[0] : null,
                        To     = users.Count > 1 ? users[1] : null
                    };

                    SkypeCallState state = SkypeCallState.Unknown;
                    if ("started".Equals(type))
                    {
                        state = SkypeCallState.Started;
                    }
                    else if ("missed".Equals(type))
                    {
                        state = SkypeCallState.Missed;
                    }
                    else if ("ended".Equals(type))
                    {
                        state = SkypeCallState.Finished;
                    }

                    if (state != SkypeCallState.Started || IsNewCall(callId))
                    {
                        OnCallChanged(skypeCall, state);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error($"Error parsing call: {call}", ex);
            }
        }
示例#11
0
 private void SkypeOnCallUpdated(object sender, SkypeCall skypeCall)
 {
     //rtbOutput.AppendText("Call Updated: " + skypeCall.Id +" [" + skypeCall.TimeStamp.ToString("yyyy-MM-dd HH:mm:ss") + "] > " + skypeCall.Status + " > " + skypeCall.Duration + "\n");
     rtbOutput.AppendText("Call Updated: " + skypeCall.Id +" [" + skypeCall.TimeStamp + "] > " + skypeCall.Status + " > " + skypeCall.Duration + "\n");
 }
示例#12
0
 private void OnCallUpdated(SkypeCall call)
 {
     CallUpdated.Raise(this, call);
 }
示例#13
0
 private void OnCallReceived(SkypeCall call)
 {
     CallReceived.Raise(this, call);
 }
示例#14
0
 private void SkypeOnCallUpdated(object sender, SkypeCall skypeCall)
 {
     //rtbOutput.AppendText("Call Updated: " + skypeCall.Id +" [" + skypeCall.TimeStamp.ToString("yyyy-MM-dd HH:mm:ss") + "] > " + skypeCall.Status + " > " + skypeCall.Duration + "\n");
     rtbOutput.AppendText("Call Updated: " + skypeCall.Id + " [" + skypeCall.TimeStamp + "] > " + skypeCall.Status + " > " + skypeCall.Duration + "\n");
 }