Chat room and messaging

Exchanging text messages

Messages are sent using LinphoneChatRoom object. First step is to create a chat room from a peer sip uri.

LinphoneChatRoom* chat_room = linphone_core_get_chat_room(lc,"sip:joe@sip.linphone.org");

Once created, messages are sent using function linphone_chat_room_send_message().

linphone_chat_room_send_message(chat_room,"Hello world"); /*sending message*/

Incoming message are received from call back LinphoneCoreVTable.text_received

void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message) {
        printf(" Message [%s] received from [%s] \n",message,linphone_address_as_string (from));
}

See also

A complete tutorial can be found at “Chatroom and messaging” source code.