本文整理汇总了C#中Twilio.TwiML.TwilioResponse.Hangup方法的典型用法代码示例。如果您正苦于以下问题:C# TwilioResponse.Hangup方法的具体用法?C# TwilioResponse.Hangup怎么用?C# TwilioResponse.Hangup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twilio.TwiML.TwilioResponse
的用法示例。
在下文中一共展示了TwilioResponse.Hangup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PingTeamMember
public TwilioResponse PingTeamMember(string teamId, string callingPartyId, int idx)
{
var response = new TwilioResponse();
Contact contact = directory.GetTeamMember(teamId, idx);
Team team = directory.GetTeam(teamId);
if (contact != null)
{
if (idx == 0)
{
response.Say(string.Format("Now attempting to connect you to {0}", team.Name));
}
else
{
response.Say("Trying next team member...");
}
response.Say("We are now contacting " + contact.Name + ", please hold the line");
response.Dial(new Number(contact.MobileNumber, new { url = string.Format("/Router/PreConnect?callingPartyId={0}", callingPartyId) }),
new { callerId = "+442033229301", timeLimit = 5, action = string.Format("/Router/NextTeamMember?callingPartyId={0}&TeamId={1}&Idx={2}", callingPartyId, teamId, idx) });
}
else
{
response.Say("Couldn't find a team member...");
response.Hangup();
}
return response;
}
示例2: Hangup
public ActionResult Hangup()
{
var response = new TwilioResponse();
response.Say(
"Your recording has been saved. Good bye");
response.Hangup();
return TwiML(response);
}
示例3: ManageAccount
public ActionResult ManageAccount(string CallSid, string Digits)
{
var call = GetCall(CallSid);
TwilioResponse response = new TwilioResponse();
response.Say("Sorry. Account management is currently down for repairs. Please try again in 6 to 8 weeks.");
response.Hangup();
return SendTwilioResult(response);
}
示例4: GoodByeMessage
public HttpResponseMessage GoodByeMessage(TwilioVoiceRequest twilioVoiceRequest)
{
var twilioResponse = new TwilioResponse();
twilioResponse.Say("Thank you for using VoxVoi. Goodbye!", _voicesettings);
twilioResponse.Hangup();
return Request.CreateResponse(HttpStatusCode.OK, twilioResponse.Element);
}
示例5: GetGreeting
public TwilioResponse GetGreeting(VoiceRequest request)
{
string culture = LanguageHelper.GetDefaultCulture();
var response = new TwilioResponse();
try
{
var lookupPhoneNumber = request.GetOriginatingNumber();
var knownNumber = profileManager.CheckNumber(lookupPhoneNumber);
if (knownNumber)
{
culture = profileManager.GetCulture(lookupPhoneNumber);
if (string.IsNullOrEmpty(culture))
{
culture = LanguageHelper.GetDefaultCulture();
}
else
{
culture = LanguageHelper.GetValidCulture(culture);
}
IVREntryLang.Culture = new System.Globalization.CultureInfo(culture);
twiMLHelper = new TwiMLHelper(culture, LanguageHelper.IsImplementedAsMP3(culture));
}
else
{
twiMLHelper = new TwiMLHelper(LanguageHelper.GetDefaultCulture(), false);
}
twiMLHelper.SayOrPlay(response, IVREntryLang.Welcome);
twiMLHelper.SayOrPlay(response, string.Format(IVREntryLang.PhoneLookup, string.Join(" ", lookupPhoneNumber.ToArray())));
if (!knownNumber)
{
twiMLHelper.SayOrPlay(response, IVREntryLang.PhoneNumberNotFound);
response.Hangup();
return response;
}
response.BeginGather(new { finishOnKey = "#", action = string.Format("/api/IVRAuthenticate?language={0}", culture) });
twiMLHelper.SayOrPlay(response, IVREntryLang.EnterPin);
response.EndGather();
}
catch (Exception ex)
{
twiMLHelper.SayOrPlay(response, string.Format(IVREntryLang.Error, ex.Message));
twiMLHelper.SayOrPlay(response, string.Format(IVREntryLang.Error, ex.Message));
twiMLHelper.SayOrPlay(response, string.Format(IVREntryLang.Error, ex.Message));
response.Hangup();
}
return response;
}
示例6: Post
public HttpResponseMessage Post(VoiceRequest request, string pin)
{
var user = AuthenticationService.GetUser(pin);
var response = new TwilioResponse();
response.Say(string.Format("Hello {0}", user.Name));
response.Pause(2);
response.Hangup();
return this.TwiMLResponse(response);
}
示例7: CallComplete
public ActionResult CallComplete(string CallSid)
{
LocationalCall call = (LocationalCall)GetCall(CallSid);
StateManager.CompletedCall(call);
StateManager.AddToLog(CallSid, "Call is completed.");
TwilioResponse response = new TwilioResponse();
response.Say("Goodbye baby cakes");
response.Hangup();
return SendTwilioResult(response);
}
示例8: Index
public TwiMLResult Index(VoiceRequest request)
{
var response = new TwilioResponse();
// Use <Say> to give the caller some instructions
response.Say("Hello. Please leave a message and I will transcribe it.");
// Use <Record> to record and transcribe the caller's message
response.Record(new { transcribe = true, maxLength = 30 });
// End the call with <Hangup>
response.Hangup();
return TwiML(response);
}
示例9: ReturnInstructions
private TwiMLResult ReturnInstructions()
{
var response = new TwilioResponse();
response.Say("To get to your extraction point, get on your bike and go down " +
"the street. Then Left down an alley. Avoid the police cars. Turn left " +
"into an unfinished housing development. Fly over the roadblock. Go " +
"passed the moon. Soon after you will see your mother ship.",
new {voice = "alice", language = "en-GB"});
response.Say("Thank you for calling the ET Phone Home Service - the " +
"adventurous alien's first choice in intergalactic travel");
response.Hangup();
return TwiML(response);
}
示例10: InitialOptions
public TwilioResponse InitialOptions(VoiceRequest request)
{
TwilioResponse response = new TwilioResponse();
var id = request.Digits;
if (!directory.ExtensionExists(id))
{
response.Say("We couldn't find your I D.");
response.Hangup();
}
response.BeginGather(new { finishOnKey = "#", action = string.Format("/Router/PingInital?callingPartyId={0}", id) });
response.Say("To contact an individual, enter their 4 digit I D and then press the hash button");
response.Say("To contact a team, enter star followed by the 4 digit I D and then press the hash button");
response.EndGather();
return response;
}
示例11: Post
public HttpResponseMessage Post(VoiceRequest request, string userId)
{
var response = new TwilioResponse();
var usernames = new Dictionary<string, string>
{
{ "12345", "Tom" },
{ "23456", "Dick" },
{ "34567", "Harry" }
};
var username = usernames[userId];
response.Say(string.Format("Hello {0}", username));
response.Pause(5);
response.Hangup();
return this.Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
}
示例12: Post
public HttpResponseMessage Post(VoiceRequest request)
{
var response = new TwilioResponse();
var validIds = new List<string> { "12345", "23456", "34567" };
var userId = request.Digits;
var authenticated = validIds.Contains(userId);
if (!authenticated)
{
response.Say("You entered an invalid ID. Goodbye.");
response.Hangup();
}
else
{
response.Say("ID is valid.");
response.Redirect(string.Format("/api/Name?userId={0}", userId));
}
return this.Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
}
示例13: GetAuthentication
public TwilioResponse GetAuthentication(VoiceRequest request, string language)
{
var response = new TwilioResponse();
if (string.IsNullOrEmpty(language))
{
language = LanguageHelper.GetDefaultCulture();
}
else
{
language = LanguageHelper.GetValidCulture(language);
}
IVRAuthLang.Culture = new System.Globalization.CultureInfo(language);
twiMLHelper = new TwiMLHelper(language, LanguageHelper.IsImplementedAsMP3(language));
string lookupPhoneNumber = request.GetOriginatingNumber();
var pin = request.Digits;
var result = profileManager.CheckPin(lookupPhoneNumber, pin);
string correctPin = profileManager.GetPin(lookupPhoneNumber);
if (result)
{
response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU, language), "POST");
}
else
{
twiMLHelper.SayOrPlay(response, IVRAuthLang.IncorrectPIN);
response.Hangup();
}
return response;
}
示例14: CallHangUpForDeferOrReSchedule
public TwiMLResult CallHangUpForDeferOrReSchedule(CallContextModel model)
{
var response = new TwilioResponse();
try
{
Services.Call.UpdateCallStatus(Request["CallSid"], CallStatus.Completed);
Services.Call.UpdateConferenceTime(model.CallId, false);
response.Hangup();
}
catch (Exception e)
{
// Log
Log.Error("Call hang up for defer or reschedule. Error: ", e);
// Error
response.Say(ConferenceConst.ErrorMessage, new { voice = VoiceInConference, language = LanguageInConference });
response.Hangup();
}
return new TwiMLResult(response);
}
示例15: WaiveFeeActionResponse
public TwiMLResult WaiveFeeActionResponse(CallContextModel model, string digits)
{
var response = new TwilioResponse();
try
{
switch (digits)
{
case "1":
// Check waive fee already
var invoice = Services.Invoices.GetByBookingIdAndUserId(model.BookingId, model.CallerId);
if (invoice != null)
{
if (!invoice.IsWaiveFee)
{
// Send waive fee request
SendWaiveFeeRequest(model);
response.Say(ConferenceConst.AcctionCompleted, new { voice = VoiceInConference, language = LanguageInConference });
}
else
{
// Say waive fee alreadly
response.Say(ConferenceConst.WaiveFeeAlready, new { voice = VoiceInConference, language = LanguageInConference });
}
}
break;
default:
response.Redirect(Url.Action("ConsultantAfterCall", model));
break;
}
}
catch (Exception e)
{
Log.Error("Waive fee action response. Error: ", e);
// Error
response.Say(ConferenceConst.ErrorMessage, new { voice = VoiceInConference, language = LanguageInConference });
response.Hangup();
}
response.Redirect(Url.Action("ConsultantAfterCall", model));
return new TwiMLResult(response);
}