void OnFinish(NativeActivityContext context, Bookmark bookmark, object o) { var twilio = context.GetExtension <ITwilioContext>(); var r = (NameValueCollection)o; var result = r["QueueResult"]; var sid = r["QueueSid"]; var time = r["QueueTime"]; // set result values if (result != null) { Result.Set(context, ParseResult(result)); } if (sid != null) { Sid.Set(context, sid); } if (time != null) { Time.Set(context, TimeSpan.FromSeconds(int.Parse(time))); } // cancel all outstanding activities context.RemoveAllBookmarks(); context.CancelChildren(); }
protected override void SendMessage(NativeActivityContext context) { var number = base.From.Get(context); var number2 = base.To.Get(context); var text = base.Body.Get(context); PhoneNumber from = number; var body = text; var messageResource = MessageResource.Create(number2, null, from, null, body); Sid.Set(context, messageResource.Sid); Sucess.Set(context, value: true); }
protected override void SendMessage(NativeActivityContext context) { var number = base.From.Get(context); var number2 = base.To.Get(context); var text = base.Body.Get(context); var list = new List <Uri>(new Uri[] { new Uri(MediaUrl.Get(context)) }); var from = number; var body = text; var mediaUrl = list; MessageResource messageResource = MessageResource.Create(number2, null, from, null, body, mediaUrl); Sid.Set(context, messageResource.Sid); Sucess.Set(context, value: true); }
/// <summary> /// Invoked when digits are available. /// </summary> /// <param name="context"></param> /// <param name="bookmark"></param> /// <param name="o"></param> void OnAction(NativeActivityContext context, Bookmark bookmark, object o) { var r = (NameValueCollection)o; var sid = r["RecordingSid"]; var url = r["RecordingUrl"]; var duration = r["RecordingDuration"]; var digits = r["Digits"]; Sid.Set(context, sid); Url.Set(context, url != null ? new Uri(url, UriKind.RelativeOrAbsolute) : null); Duration.Set(context, duration != null ? TimeSpan.FromSeconds(int.Parse(duration)) : TimeSpan.Zero); Digits.Set(context, digits); Result.Set(context, Url.Get(context)); // cancel all children context.RemoveAllBookmarks(); context.CancelChildren(); }
/// <summary> /// Invoked when digits are available. /// </summary> /// <param name="context"></param> /// <param name="bookmark"></param> /// <param name="o"></param> void OnFinish(NativeActivityContext context, Bookmark bookmark, object o) { var r = (NameValueCollection)o; var status = r["DialCallStatus"]; var sid = r["DialCallSid"]; var duration = r["DialCallDuration"]; var recordingUrl = r["RecordingUrl"]; // set output arguments Result.Set(context, status != null ? ParseCallStatus(status) : DialCallStatus.Unknown); Status.Set(context, status != null ? ParseCallStatus(status) : DialCallStatus.Unknown); Sid.Set(context, sid); Duration.Set(context, duration != null ? TimeSpan.FromSeconds(int.Parse(duration)) : TimeSpan.Zero); RecordingUrl.Set(context, recordingUrl != null ? new Uri(recordingUrl) : null); // cancel all children context.RemoveAllBookmarks(); context.CancelChildren(); }