예제 #1
0
 private void Channel_UnsolicitedEvent(object sender, UnsolicitedEventArgs e)
 {
     if (e.Line1 == "RING")
     {
         IncomingCall?.Invoke(this, new IncomingCallEventArgs());
     }
     else if (e.Line1.StartsWith("VOICE CALL: BEGIN"))
     {
         CallStarted?.Invoke(this, new CallStartedEventArgs());
     }
     else if (e.Line1.StartsWith("VOICE CALL: END"))
     {
         CallEnded?.Invoke(this, CallEndedEventArgs.CreateFromResponse(e.Line1));
     }
     else if (e.Line1.StartsWith("MISSED_CALL: "))
     {
         MissedCall?.Invoke(this, MissedCallEventArgs.CreateFromResponse(e.Line1));
     }
     else if (e.Line1.StartsWith("+CMTI: "))
     {
         SmsReceived?.Invoke(this, SmsReceivedEventArgs.CreateFromResponse(e.Line1));
     }
     else if (e.Line1.StartsWith("+CUSD: "))
     {
         UssdResponseReceived?.Invoke(this, UssdResponseEventArgs.CreateFromResponse(e.Line1));
     }
     else if (e.Line1.StartsWith("+CME ERROR:"))
     {
         ErrorReceived?.Invoke(this, ErrorEventArgs.CreateFromCmeResponse(e.Line1));
     }
     else if (e.Line1.StartsWith("+CMS ERROR:"))
     {
         ErrorReceived?.Invoke(this, ErrorEventArgs.CreateFromCmsResponse(e.Line1));
     }
 }
예제 #2
0
 protected void OnMissedCall(string str)
 {
     MissedCall?.Invoke(this, str);
 }