使用Twilio在会议中添加人员

时间:2016-09-21 09:00:46

标签: php codeigniter twilio twilio-php

我在Twilio会议上遇到了问题。当座席在同一会议中时,是否可以在会议中添加参与者?我试着抓住参与者并拨打电话。举办会议是成功的,但我在会议期间无法拨号。以下代码是让与会者参加会议。

function HoldConference_group($roomName, $muteCallSid, $muteStatus)
{
    $client = $this->InitializeTwillio();
    $conferenceSid = "";
    foreach ($client->account->conferences->getIterator(0, 50, array("Status" => "in-progress", "FriendlyName" => $roomName)) as $conference)
    {
        $conferenceSid = $conference->sid;
    }

    $participant = $client->account->conferences->get($conferenceSid)->participants->get($muteCallSid);
    $participant->update(array("Hold" => $muteStatus));
}

这是我在控制器中的代码,我在codeigniter中使用php

public function redirect_to_conference()
{
    $client = $this->init_client();

    //The Call sid that i pass is the parent call sid which is me so i will be transferred to the conference
    $call = $client->account->calls->get($_POST["CallSid"]);
    $call->update(array(
        "Url" => HTTP_BASE_URL."agent/call_controls/forward_conference",
        "Method" => "POST"
    ));

}

这是我传递房间名称的地方,以便房间名称是会议名称

function GroupConference($roomName)
{
    //NEED TO CHANGE IT TO INPUT BY AGENT
    $response = new Services_Twilio_Twiml;
    $response->say(
        'You have joined the conference.',
        ['voice' => 'alice', 'language' => 'en-GB']
    );
    $dial = $response->dial();
    $dial->conference(
            $roomName, 
            array(
                'startConferenceOnEnter' => 'true',
                'endConferenceOnExit' => 'false',
                'muted' => 'false',
                'record' => 'record-from-start',
                'waitUrl' => 'http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient',
            )
        );

    print $response;
}

0 个答案:

没有答案