C#で通話ログを取得する
このガイドでは進行中 (In Progress) や完了済み (Completed) の通話についての情報をTwilioアカウントから取得する方法について触れていきます。
The code snippets in this guide are written using modern C# language features and require the .NET Framework version 4.5 or higher. They also make use of the Twilio C# SDK.
最初に取り掛かるべきことは、Twilioアカウントの認証情報についてです。
Twilioアカウントの認証情報を取得する
First, you'll need to get your Twilio account credentials. They consist of your AccountSid and your Auth Token. They can be found on the home page of the console.
アカウントの認証情報が得られたなら、Twilio C#ライブラリーを使用して通話ログを取得することができます。
通話ログを取得する
TwilioのREST APIを使用して、Twilioアカウントとの通話の発着信についてログを取得することができます。 しかし少数のログをチェックしたいだけの場合は、Twilioコンソールの音声通話ログをまず試してみる方がよいでしょう。
To list all phone calls for your Twilio account, just call CallResource.Read()
and iterate over it.
The Read
method automatically handles paging for you, fetching new pages as you iterate through through Call objects. For more information, visit the C#/.NET Helper Library page.
検索結果を絞り込むことも可能です。 この例では発信先電話番号が「+15558675309」の通話で、かつ通話ステータスが「busy(話中)」のもののみを返しますが、他の通話プロパティーで絞り込むことも可能です。
最後に、特定の通話についての情報のみが必要な場合は、そのCallSidを直接取得できます。
関連トピック
We learned how to retrieve Twilio call logs using C#. Check out our tutorials to see full implementations of Twilio Voice in C# with ASP.NET.
ヘルプが必要ですか?
誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。