1

我正在构建一个 android 应用程序,我在其中使用 LinPhone Lib 进行音频/视频并使用 VoIP 发送消息。

我阅读了很多博客,最后,我得到了一个 EasyLinphone GitHub 代码,它使用 LinPhone Lib 进行音频/视频通话。我在做 RND 时阅读了这段代码 LinPhone SDK 是如何工作的。

我已经完美地完成了音频和视频通话功能。现在我被卡住了如何在聊天室上发送消息。

下面的代码根据我的 RND 应该可以工作,但我正在解决一个小问题。如果有人对此有任何想法,请帮助我。

  public LinphoneChatRoom startSingleMessageTo(PhoneBean bean, String messageString, boolean isVideoCall) {

    LinphoneChatRoom chat_room = mLinphoneCore.getChatRoom(bean.getUserName() + "@" + bean.getHost()); //lc is object of LinphoneCore
    chat_room.sendMessage(messageString);

    return chat_room;
}

下面我需要帮助来处理 linPhone lib。

如何开始聊天室?

如何在该聊天室中发送消息?

4

1 回答 1

1
LinphoneChatRoom chatRoom = null;
try {
chatRoom = sLinphoneUtils.getLc().getOrCreateChatRoom("sip:"+bean.getUserName()+"@sip.linphone.org");
        LinphoneChatMessage msg = chatRoom.createLinphoneChatMessage(messageString);
        chatRoom.sendChatMessage(msg);
    }
    catch (Exception e)
    {
        e.getMessage();
    }
于 2019-04-09T18:28:38.907 回答