1

私はこの分野では新しいです。疑問に思う。電話会議中に電話をかけ、その参加者を現在の会議に追加したいと考えています。Javaで提供されているカンファレンスのサンプル コードを試してみました。入力を収集して番号に電話し、参加者を同じ会議に追加する方法はありますか。

これが私が試したものです。会議を作成しましたが、次の応答が返されます

<Response>
<Dial hangupOnStar="true">
<Conference startConferenceOnEnter="true" endConferenceOnExit="true">My Conference</Conference>
</Dial>
<Gather timeout="10" action="/twilio-tut/add/participant?confName=My%20Conference" finishOnKey="#">
<Say>Please enter the number you want to connect followed by hash key.</Say></Gather>
</Response>

ここで、会議の参加者の 1 人がA press*と言い、会議に追加したい別の人の番号にダイヤルしました。

動詞のアクションでGather、以下に示すコードの番号をダイヤルしています

Number number = 
                    new Number.Builder(some_valid_phone_number)
                    .statusCallback("https://xxxxxxx.ngrok.io/twilio-tut/to/conference")
                    .statusCallbackMethod(Method.POST)
                    .statusCallbackEvents(Arrays.asList(Event.ANSWERED))
                    .build();

            Dial dial = new Dial.Builder()
                    .number(number)
                    .conference(new Conference.Builder(conferenceName).build())
                    .build();

            twiml = new VoiceResponse.Builder().dial(dial)
                    .build();

statusCallback で、発信者と呼び出し先の両方の会議にリダイレクトするように呼び出しを更新しています。発信者は、*ie Aを押して会議を離れた人であり、呼び出し先はsome_valid_phone_numberです。コードは以下のとおりです

Call callee = Call.updater(callSid)
                    .setUrl("https://xxxxx.ngrok.io/twilio-tut/voice").setMethod(HttpMethod.POST).update();
            Call caller = Call.updater(parentCallSid)
                    .setUrl("https://xxxxx.ngrok.io/twilio-tut/voice").setMethod(HttpMethod.POST).update();

上記のコードは、呼び出し先を転送し、呼び出し元を例外で切断します

com.twilio.exception.ApiException: Call is not in-progress. Cannot redirect.

私がやりたいことは、別番号に電話をかけ、最終的に同じ会議に接続することです。また、Aは他の番号に発信し、それらを同じ会議に追加できる必要があります。番号を接続するために携帯電話を使用しています。

前もって感謝します。

4

2 に答える 2