2017-12-19 15 views
0

私のC#asp.netコアWeb APIプロジェクトでは、Twilioの電話番号から着信音声をキャプチャするためにwebhooksを使用しています。通話を処理することに加えて、私は電子メールを介して着信のための管理者に通知したいと思います。これを行うには、着信電話番号を取得する必要があります。それ、どうやったら出来るの?ここでTwilio - C#で受信電話番号を取得

は私のコードです:

[HttpPost("incomingVoice")] 
public async Task<IActionResult> IncomingVoice(string digits) 
{ 
    var response = new VoiceResponse(); 

    if (!string.IsNullOrEmpty(digits)) 
    { 
     ... Handle the user selection 
    } 

    response.Append(new Gather(numDigits: 1).Say("Welcome to ...! For sales, press 1. For marketing, press 2. For support press 3", voice: "alice", language: "en-GB")); 

    //handle the lack of response 
    response.Say("Please leave a message after the tone. Hang up when finished.", voice: "alice", language: "en-GB"); 
    response.Record(); 
    response.Hangup(); 

    string phoneNumber = <??? INCOMING PHONE NUMBER ???> 

    IRestResponse mgresp = await SendMGMessage(phoneNumber); 

    return Content(response.ToString(), "application/xml"); 
} 

ありがとうございました。

答えて

0

は、いくつかの周り掘り後、私は、このリンクが見つかりました:それは​​

を、TwiML要求は、パラメータの全体の様々なが含まれていることを指定されています。そこから、私は電話番号を以下のように抽出することができました:

string phoneNumber = Request.Form["From"]; 

希望の研究時間があります。

関連する問題