linphone use SIP message for sending message in chat room

1.7k Views Asked by At

I am building an android application where I am using LinPhone Lib for audio/ video and sending a message using VoIP.

I read a lot of blogs and finally, I got an EasyLinphone GitHub Code that is using LinPhone Lib for audio/ Video calling. I read this code as I am yet doing RND How LinPhone SDK work.

I have perfectly done with audio and video calling feature. Now I am stuck How to send a message on a chatroom.

Below code As per my RND should work but I am phasing a small problem. If someone has any Idea on it please help me in it.

  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;
}

Below point where I need help to work regarding linPhone lib.

How to start a chatRoom?

How to send messages in that chatRoom?

1

There are 1 best solutions below

0
On BEST ANSWER
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();
    }