linphone使用SIP消息在聊天室中发送消息

问题描述 投票:1回答:1

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

我读了很多博客,最后,我得到了一个使用LinPhone Lib进行音频/视频通话的EasyLinphone GitHub代码。我读了这段代码,因为我还在做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的帮助。

如何开始聊天室?

如何在该chatRoom中发送消息?

linphone sip-server linphone-sdk voip-android
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();
    }
© www.soinside.com 2019 - 2024. All rights reserved.