liblinphone  3.5.0
Typedefs | Functions
Chat room and Messaging

Typedefs

typedef struct _LinphoneChatRoom LinphoneChatRoom

Functions

LinphoneChatRoomlinphone_core_create_chat_room (LinphoneCore *lc, const char *to)
void linphone_chat_room_destroy (LinphoneChatRoom *cr)
const LinphoneAddresslinphone_chat_room_get_peer_address (LinphoneChatRoom *cr)
void linphone_chat_room_send_message (LinphoneChatRoom *cr, const char *msg)

Detailed Description

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


A complete tutorial can be found at : Chat room tutorial


Typedef Documentation

typedef struct _LinphoneChatRoom LinphoneChatRoom

A chat room is the place where text messages are exchanged.
Can be created by linphone_core_create_chat_room().


Function Documentation

Create a new chat room for messaging from a sip uri like sip:joe@sip.linphone.org

Parameters:
lcLinphoneCore object
todestination address for messages
Returns:
LinphoneChatRoom where messaging can take place.

Destructor

Parameters:
crLinphoneChatRoom object

get peer address associated to this LinphoneChatRoom

Parameters:
crLinphoneChatRoom object
Returns:
LinphoneAddress peer address
void linphone_chat_room_send_message ( LinphoneChatRoom cr,
const char *  msg 
)

send a message to peer member of this chat room.

Parameters:
crLinphoneChatRoom object
msgmessage to be sent