public void OutDialCommandToJsonTest() { OutDial outdial = new OutDial("+18475971234", "http://foo.com/callConnectUrl"); outdial.setActionUrl("http://foo.com/actionUrl"); outdial.setIfMachine(EIfMachine.Hangup); outdial.setSendDigits("12{2}34{4}#"); outdial.setTimeout(1000); outdial.setIfMachineUrl("http://foo.com/ifMachineUrl"); outdial.setStatusCallbackUrl("http://foo.com/statusCallbackUrl"); string json = outdial.toJson(); Assert.IsNotNull(json); Assert.AreEqual(json, "{\"OutDial\":{\"destination\":\"+18475971234\",\"callConnectUrl\":\"http://foo.com/callConnectUrl\",\"sendDigits\":\"12{2}34{4}#\",\"timeout\":1000,\"ifMachine\":\"hangup\",\"actionUrl\":\"http://foo.com/actionUrl\",\"ifMachineUrl\":\"http://foo.com/ifMachineUrl\",\"statusCallbackUrl\":\"http://foo.com/statusCallbackUrl\"}}"); }
public ActionResult ConferenceCreated(ConferenceStatusCallback request) { // Make OutDial request once conference has been created PerCLScript script = new PerCLScript(); Say say = new Say(); say.setText("Please wait while we attempt to connect you to an agent."); script.Add(say); string confId = request.getConferenceId; // implementation of lookupAgentPhoneNumber() is left up to the developer string agentPhoneNumber = lookupAgentPhoneNumber(); // Make OutDial request once conference has been created var outdialActionUrl = AppUrl + $"/voice/OutboundCallMade?conferenceId={confId}"; var outdialConnectedUrl = AppUrl + $"/voice/OutboundCallConnected?conferenceId={confId}"; OutDial outDial = new OutDial(agentPhoneNumber, outdialConnectedUrl); outDial.setCallingNumber(request.getFrom); outDial.setActionUrl(outdialActionUrl); outDial.setIfMachine(com.freeclimb.EIfMachine.Hangup); script.Add(outDial); return(Content(script.toJson(), "application/json")); }