使用ToneController获取多个数字

时间:2016-03-17 17:46:30

标签: voip lync-2013 ucma dtmf

我是UCMA的新手,我在UCMA sdk 4.0中阅读了Tone Controller示例。 我知道这是你录制用户播放音调的方式:

void toneController_ToneReceived(object sender, ToneControllerEventArgs e)
    {
        Console.WriteLine("Tone Received: " + (ToneId)e.Tone + " (" + e.Tone + ")");
        if ((ToneId)e.Tone == ToneId.Tone0)
        {
            _waitForToneReceivedEventCompleted.Set();
        }
        else
        {
            ToneController tc = (ToneController)sender;
            tc.Send(e.Tone);
        }
    }

我想知道是否有办法找到从用户收到的一系列音调而不仅仅是一个(例如10位数),我想用它来直接拨号。

1 个答案:

答案 0 :(得分:0)

你可以简单地循环:

string tone_received = "";
int number_of_tone_received = 0;
while(number_of_tone_received++ < 10)
        {
            //Sync; wait for ToneReceivedEvent
            _waitForToneReceivedEventCompleted.WaitOne();
            _waitForToneReceivedEventCompleted.Reset();
        }
        _waitForToneReceivedEventCompleted.WaitOne();


 void toneController_ToneReceived(object sender, ToneControllerEventArgs e)
    {
        tone_received =  tone_received + e.Tone;
        _waitForToneReceivedEventCompleted.Set();

    }