This program is able to receive chat message in real time on port 5060.
#include "linphone/core.h"
#include <signal.h>
static bool_t running = TRUE;
static void stop(int signum) {
running = FALSE;
}
switch (cstate) {
case LinphoneCallIncomingReceived:
printf("It is now ringing remotely !\n");
break;
case LinphoneCallReleased:
printf("call terminated, exit...\n");
running = FALSE;
break;
default:
printf("Unhandled notification %i\n", cstate);
}
}
ms_free(from);
}
}
int main(int argc, char *argv[]) {
signal(SIGINT, stop);
#ifdef DEBUG_LOGS
linphone_core_enable_logs(NULL);
#endif
while (running) {
ms_usleep(50000);
}
printf("Shutting down...\n");
printf("Exited\n");
return 0;
}
const LinphoneCallParams * linphone_call_get_current_params(const LinphoneCall *call)
Returns current parameters associated to the call.
MS2_DEPRECATED LinphoneStatus linphone_core_accept_call(LinphoneCore *core, LinphoneCall *call)
Accept an incoming call.
struct _LinphoneCall LinphoneCall
This object represents a call issued or received by the LinphoneCore.
Definition c-types.h:299
enum _LinphoneCallState LinphoneCallState
LinphoneCallState enum represents the different states a call can reach into.
LinphoneCall * linphone_chat_room_get_call(const LinphoneChatRoom *chat_room)
Gets the current call associated to this chatroom if any To commit a message, use linphone_chat_messa...
const LinphoneAddress * linphone_chat_room_get_peer_address(LinphoneChatRoom *chat_room)
Get the peer address associated to this chat room.
struct _LinphoneChatRoom LinphoneChatRoom
A chat room is the place where LinphoneChatMessage are exchanged.
Definition c-types.h:468
uint32_t linphone_chat_room_get_char(LinphoneChatRoom *chat_room)
When realtime text is enabled in a LinphoneCall (see linphone_call_params_realtime_text_enabled()),...
MS2_DEPRECATED const char * linphone_chat_message_get_text(const LinphoneChatMessage *message)
Get text part of this message.
struct _LinphoneChatMessage LinphoneChatMessage
A LinphoneChatMessage represents an instant message that can be send or received through a LinphoneCh...
Definition c-types.h:429
void linphone_core_iterate(LinphoneCore *core)
Main loop integration.
MS2_DEPRECATED LinphoneCore * linphone_core_new(const LinphoneCoreVTable *vtable, const char *config_path, const char *factory_config_path, void *userdata)
Instanciates a LinphoneCore object.
struct _LinphoneCore LinphoneCore
Main object to instantiate and on which to keep a reference.
Definition types.h:487
MS2_DEPRECATED void linphone_core_destroy(LinphoneCore *core)
Destroys a LinphoneCore.
char * linphone_address_as_string(const LinphoneAddress *address)
Returns the address as a string.
This structure holds all callbacks that the application should implement.
Definition core.h:197
LinphoneCoreCbsMessageReceivedCb message_received
Notifies when a message is received (can be text or external body)
Definition core.h:217
LinphoneCoreCallStateChangedCb call_state_changed
Notifies when call state changes.
Definition core.h:200
LinphoneCoreIsComposingReceivedCb is_composing_received
Notifies when an is-composing notification is received.
Definition core.h:224