Initiates an outbound call or a text conversation. Note that this action is only valid when there is no active WebAPI call.
Наследование: TropoBase
Пример #1
0
        private static void ConvertCall(global::VoiceModel.Call model, ref Tropo tmodel)
        {
            List <string> toList = new List <string>();

            toList.Add(model.to);

            TropoCSharp.Tropo.Call call = new TropoCSharp.Tropo.Call()
            {
                To   = toList,
                From = model.from
            };
            tmodel.Call(call);
        }
        public void testCallUsingCallObject()
        {
            Tropo tropo = new Tropo();

            IDictionary<string, string> headers = new Dictionary<String, String>();
            headers.Add("foo", "bar");
            headers.Add("bling", "baz");

            StartRecording recording = new StartRecording(AudioFormat.Mp3, Method.Post, "http://blah.com/recordings/1234.wav", "jose", "password");

            List<String> to = new List<String>(1);
            to.Add("3055195825");

            Call call = new Call();
            call.Recording = recording;
            call.Headers = headers;
            call.Timeout = 10;
            call.AnswerOnMedia = false;
            call.Channel = Channel.Text;
            call.Network = Network.SMS;
            call.To = to;
            call.From = "3055551212";

            tropo.Call(call);
            Assert.AreEqual(this.callJsonAllOptions, tropo.RenderJSON());
        }
Пример #3
0
 /// <summary>
 /// Overload for call that allows a Call object to be passed.
 /// </summary>
 /// <param name="call">A Call object.</param>
 public void Call(Call call)
 {
     Call(call.To, call.From, call.Network, call.Channel, call.AnswerOnMedia, call.Timeout, call.Headers, call.Recording);
 }
Пример #4
0
 /// <summary>
 /// Overload for call that allows multiple calls to be made with one parmameter.
 /// </summary>
 /// <param name="to">An ArryList containing recipients to call.</param>
 public void Call(IEnumerable<String> to)
 {
     Call call = new Call(to);
     Serialize(call, "call");
 }
Пример #5
0
 /// <summary>
 /// Overload for Call that allows one parameter.
 /// </summary>
 /// <param name="to">The number of the person to call.</param>
 public void Call(String to)
 {
     Call call = new Call(to);
     Serialize(call, "call");
 }
Пример #6
0
        /// <summary>
        /// Overload for Call that allows events to be set via allowSignals.
        /// </summary>
        /// <param name="to"></param>
        /// <param name="allowSignals">Allows for the assignment of an interruptable signal for this Tropo function</param>
        /// <param name="from"></param>
        /// <param name="network"></param>
        /// <param name="channel"></param>
        /// <param name="answerOnMedia"></param>
        /// <param name="timeout"></param>
        /// <param name="headers"></param>
        /// <param name="recording"></param>
        public void Call(String to, Array allowSignals, string from, string network, string channel, bool? answerOnMedia, float? timeout, IDictionary<String, String> headers, StartRecording recording)
        {
            Call call = new Call
            {
                To = new List<String> { to },
                allowSignals = allowSignals,
                From = from,
                Network = network,
                Channel = channel,
                AnswerOnMedia = answerOnMedia,
                Timeout = timeout,
                Headers = headers,
                Recording = recording
            };

            Serialize(call, "call");
        }
Пример #7
0
        /// <summary>
        /// Places a call or sends an an IM, Twitter, or SMS message. To start a call, use the Session API to tell Tropo to launch your code.
        /// </summary>
        /// <param name="to">The party(ies)to call.</param>
        /// <param name="from">A string representing who the call is from.</param>
        /// <param name="network">Network is used mainly by the text channels; values can be SMS when sending a text message, or a valid IM network name such as AIM, MSN, JABBER, YAHOO and GTALK.</param>
        /// <param name="channel">This defines the channel used to place new calls.</param>
        /// <param name="answerOnMedia">If this is set to true, the call will be considered "answered" and audio will begin playing as soon as media is received from the far end </param>
        /// <param name="timeout">The amount of time Tropo will wait, in seconds, after sending or playing the prompt for the user to begin a response.</param>
        /// <param name="headers">This contains the Session Initiation Protocol (SIP) Headers for the current session.</param>
        /// <param name="recording">This is a shortcut to allow you to start call recording as soon as the call is answered. </param>      
        public void Call(IEnumerable<String> to, string from, string network, string channel, bool? answerOnMedia, float? timeout, IDictionary<String, String> headers, StartRecording recording)
        {
            Call call = new Call();
            call.To = to;
            call.From = from;
            call.Network = network;
            call.Channel = channel;
            call.AnswerOnMedia = answerOnMedia;
            call.Timeout = timeout;
            call.Headers = headers;
            call.Recording = recording;

            Serialize(call, "call");
        }
Пример #8
0
 /// <summary>
 /// Overload for call that allows a Call object to be passed.
 /// </summary>
 /// <param name="call">A Call object.</param>
 public void call(Call call)
 {
     this.call(call.to, call.from, call.network, call.channel, call.answerOnMedia, call.timeout, call.headers, call.recording);
 }
Пример #9
0
 /// <summary>
 /// Overload for call that allows multiple calls to be made with one parmameter.
 /// </summary>
 /// <param name="to">An ArryList containing recipients to call.</param>
 public void call(ArrayList to)
 {
     Call call = new Call(to);
     serialize(call, "call");
 }
Пример #10
0
        /// <summary>
        /// Overload for Call that allows the To parameter to be passed as a String.
        /// </summary>
        /// <param name="to">A String containing the recipient to call.</param>
        /// <param name="from">An Endpoint object representing who the call is from.</param>
        /// <param name="network">Network is used mainly by the text channels; values can be SMS when sending a text message, or a valid IM network name such as AIM, MSN, JABBER, YAHOO and GTALK.</param>
        /// <param name="channel">This defines the channel used to place new calls.</param>
        /// <param name="answerOnMedia">If this is set to true, the call will be considered "answered" and audio will begin playing as soon as media is received from the far end.</param>
        /// <param name="timeout">The amount of time Tropo will wait, in seconds, after sending or playing the prompt for the user to begin a response.</param>
        /// <param name="headers">This contains the Session Initiation Protocol (SIP) Headers for the current session.</param>
        /// <param name="recording">This is a shortcut to allow you to start call recording as soon as the call is answered. </param>      
        public void call(String to, string from, string network, string channel, bool? answerOnMedia, float? timeout, Hashtable headers, StartRecording recording)
        {
            Call call = new Call();
            ArrayList _to = new ArrayList();
            _to.Add(to);
            call.to = _to;
            call.from = new Endpoint(from, null, null, null);
            call.network = network;
            call.channel = channel;
            call.answerOnMedia = answerOnMedia;
            call.timeout = timeout;
            call.headers = headers;
            call.recording = recording;

            serialize(call, "call");
        }
Пример #11
0
        /// <summary>
        /// Places a call or sends an an IM, Twitter, or SMS message. To start a call, use the Session API to tell Tropo to launch your code.
        /// </summary>
        /// <param name="to">An ArryList containing recipients to call.</param>
        /// <param name="from">An Endpoint object representing who the call is from.</param>
        /// <param name="network">Network is used mainly by the text channels; values can be SMS when sending a text message, or a valid IM network name such as AIM, MSN, JABBER, YAHOO and GTALK.</param>
        /// <param name="channel">This defines the channel used to place new calls.</param>
        /// <param name="answerOnMedia">If this is set to true, the call will be considered "answered" and audio will begin playing as soon as media is received from the far end </param>
        /// <param name="timeout">The amount of time Tropo will wait, in seconds, after sending or playing the prompt for the user to begin a response.</param>
        /// <param name="headers">This contains the Session Initiation Protocol (SIP) Headers for the current session.</param>
        /// <param name="recording">This is a shortcut to allow you to start call recording as soon as the call is answered. </param>      
        public void call(ArrayList to, Endpoint from, string network, string channel, bool? answerOnMedia, float? timeout, Hashtable headers, StartRecording recording)
        {
            Call call = new Call();
            call.to = to;
            call.from = from;
            call.network = network;
            call.channel = channel;
            call.answerOnMedia = answerOnMedia;
            call.timeout = timeout;
            call.headers = headers;
            call.recording = recording;

            serialize(call, "call");
        }
Пример #12
0
        public void testCallUsingCallObject()
        {
            Tropo tropo = new Tropo();

            Hashtable headers = new Hashtable();
            headers.Add("foo", "bar");
            headers.Add("bling", "baz");

            StartRecording recording = new StartRecording(AudioFormat.mp3, Method.post, "http://blah.com/recordings/1234.wav", "jose", "password");

            ArrayList to = new ArrayList(1);
            to.Add("3055195825");

            Call call = new Call();
            call.recording = recording;
            call.headers = headers;
            call.timeout = 10;
            call.answerOnMedia = false;
            call.channel = Channel.text;
            call.network = Network.sms;
            call.to = to;
            call.from = new Endpoint("3055551212", null, null, null);

            tropo.call(call);
            Assert.AreEqual(this.callJsonAllOptions, TropoJSON.render(tropo));
        }