SignalWire.Relay.CallingAPI
This represents the API interface for the Calling Relay Service. This object is used to make requests related to managing end to end calls.
Methods
DialPhone
Make an outbound PhoneCall and waits until it has been answered, times out, busy, or some other error occurs.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
to | string | required | The phone number of the party you are attempting to call. |
from | string | required | The phone number the call is coming from. Must be a SignalWire number or SIP endpoint that you own. |
timeout | int | optional | The time, in seconds, the call will ring before going to voicemail. Default: 30 |
Returns
SignalWire.Relay.Calling.DialResult
- The result object to interact with.
Examples
Make an outbound PhoneCall and obtain the Call object after it was answered.
DialResult resultDial = client.Calling.DialPhone("+1XXXXXXXXXX", "+1YYYYYYYYYY", timeout: 30);
if (resultDial.Successful)
{
// Call has been answered, it is available through resultDial.Call
}
NewPhoneCall
Create a new PhoneCall
object. The call has not started, but you can attach event listeners on it.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
to | string | required | The phone number of the party you are attempting to call. |
from | string | required | The phone number the call is coming from. Must be a SignalWire number or SIP endpoint that you own. |
timeout | int | optional | The time, in seconds, the call will ring before going to voicemail. Default: 30 |
Returns
SignalWire.Relay.Calling.PhoneCall
- A new call object.
Examples
Create a new PhoneCall object and Dial it.
PhoneCall call = client.Calling.NewPhoneCall("+1XXXXXXXXXX", "+1YYYYYYYYYY", timeout: 30);
call.OnEnded += (a, c, e, p) =>
{
// Call has been ended
};
DialResult resultDial = call.Dial();
if (resultDial.Successful)
{
call.Hangup();
}