C# .NET CallFire SOAP API

问题描述 投票:0回答:1

有人熟悉在 .NET 中使用 CallFire 的 SOAP API 吗? 除了 PHP 之外,我还没有找到该 API 的任何可用示例。

.net soap callfire
1个回答
0
投票

CallFire API 提供适用于各种用例的功能——语音和短信广播、入站和出站 IVR、呼叫跟踪等。所请求的示例将取决于预期结果。以下是出站广播中使用的几个基本示例,这似乎是大多数人正在做的事情:

列出已配置的广播:

var client = new CallfireClient("api-login", "api-password", CallfireClients.Rest);
var broadcastClient = client.Broadcasts;

var cfQueryBroadcasts = new CfQueryBroadcasts();
var cfBroadcastQueryResult = broadcastClient.QueryBroadcasts(cfQueryBroadcasts);

if (cfBroadcastQueryResult.Broadcast != null)
{
    var broadcastList = new string[cfBroadcastQueryResult.Broadcast.Count()];
    for (var i = 0; i < cfBroadcastQueryResult.Broadcast.Count(); i++)
    {
        var cfBroadcast = cfBroadcastQueryResult.Broadcast[i];
        broadcastList[i] = string.Format("{0} {1} - Status: {2} Last Modified: {3} Type: {4}",
            cfBroadcast.Name, cfBroadcast.Id, cfBroadcast.Status, cfBroadcast.LastModified, cfBroadcast.Type);
    }
}

开始现有广播

var client = new CallfireClient("api-login", "api-password", CallfireClients.Rest);
var broadcastClient = client.Broadcasts;

var broadcastId = 1234567890;
var cfControlBroadcast = new CfControlBroadcast(broadcastId, null, CfBroadcastCommand.Start, null);
broadcastClient.ControlBroadcast(ControlBroadcast);

将联系人添加到广播

var client = new CallfireClient("api-login", "api-password", CallfireClients.Rest);
var broadcastClient = client.Broadcasts;

var broadcastId = 1234567890;
var batchName = "My Contact Batch";

var contact_1 = new CfContact();
contact_1.Id = 15551231234;
contact_1.FirstName = "John";
contact_1.LastName = "Doe";

var contact_2 = new CfContact();
contact_2.Id = 15551231235;
contact_2.FirstName = "Jane";
contact_2.LastName = "Smith";

object[] contactList = { contact_1,  contact_2};

var client = new CallfireClient("api-login", "api-password", CallfireClients.Rest);
var broadcastClient = client.Broadcasts;

CreateContactBatch = new CfCreateContactBatch(null, broadcastId, batchName, contactList, false);
var id = broadcastClient.CreateContactBatch(CreateContactBatch);
© www.soinside.com 2019 - 2024. All rights reserved.