This program just send chat message in real time to dest uri.
This program just send chat message in real time to dest uri.
Use realtimetext_receiver to receive message. usage: ./realtimetext_sender sip:localhost:5060
#include "linphone/core.h"
#include <signal.h>
static bool_t running=TRUE;
static void stop(int signum){
running=FALSE;
}
int main(int argc, char *argv[]){
const char *dest=NULL;
LCSipTransports tp;
if (argc>1){
dest=argv[1];
}
signal(SIGINT,stop);
#ifdef DEBUG_LOGS
linphone_core_enable_logs(NULL);
#endif
if (dest){
if (call==NULL){
printf("Could not place call to %s\n",dest);
goto end;
}else printf("Call to %s is in progress...",dest);
}
ms_usleep(50000);
}
case LinphoneCallError:
case LinphoneCallReleased:
case LinphoneCallEnd:
printf("Could not place call to %s\n",dest);
goto end;
break;
default:
break;
}
while(running){
int character;
if (system ("/bin/stty raw") == -1){
ms_error("/bin/stty error");
}
character = getchar();
if (system("/bin/stty cooked") == -1){
ms_error("/bin/stty error");
}
if (character==0x03) {
running=0;
break;
}
if (character != EOF) {
if (chat_message == NULL) {
}
if (character == '\r') {
chat_message = NULL;
} else {
}
}
ms_usleep(50000);
}
printf("Terminating the call...\n");
}
end:
printf("Shutting down...\n");
printf("Exited\n");
return 0;
}
LinphoneCall * linphone_core_invite_with_params(LinphoneCore *core, const char *url, const LinphoneCallParams *params)
Initiates an outgoing call according to supplied call parameters The application doesn't own a refere...
MS2_DEPRECATED LinphoneStatus linphone_core_terminate_call(LinphoneCore *core, LinphoneCall *call)
Terminates a call.
LinphoneCallParams * linphone_core_create_call_params(LinphoneCore *core, LinphoneCall *call)
Create a LinphoneCallParams suitable for linphone_core_invite_with_params(), linphone_core_accept_cal...
void linphone_call_params_unref(LinphoneCallParams *call_params)
Release a reference to the call params.
LinphoneCallState linphone_call_get_state(const LinphoneCall *call)
Retrieves the call's current state.
struct _LinphoneCallParams LinphoneCallParams
An object containing various parameters of a LinphoneCall.
Definition c-types.h:284
struct _LinphoneCall LinphoneCall
This object represents a call issued or received by the LinphoneCore.
Definition c-types.h:254
LinphoneCall * linphone_call_ref(LinphoneCall *call)
Acquire a reference to the call.
void linphone_call_unref(LinphoneCall *call)
Release reference to the call.
LinphoneChatRoom * linphone_call_get_chat_room(LinphoneCall *call)
Create a new chat room for real time messaging from a call if not already existing,...
LinphoneStatus linphone_chat_message_put_char(LinphoneChatMessage *message, uint32_t character)
Fulfill a chat message char by char.
struct _LinphoneChatRoom LinphoneChatRoom
A chat room is the place where LinphoneChatMessage are exchanged.
Definition c-types.h:385
MS2_DEPRECATED LinphoneChatMessage * linphone_chat_room_create_message(LinphoneChatRoom *chat_room, const char *message)
Creates a message attached to the given chat room with a plain text content filled with the given mes...
struct _LinphoneChatMessage LinphoneChatMessage
An chat message is the object that is sent or received through a LinphoneChatRoom.
Definition c-types.h:359
MS2_DEPRECATED void linphone_chat_room_send_chat_message(LinphoneChatRoom *chat_room, LinphoneChatMessage *message)
Send a message to peer member of this chat room.
void linphone_core_iterate(LinphoneCore *core)
Main loop function.
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 instanciate and on which to keep a reference.
Definition types.h:479
MS2_DEPRECATED void linphone_core_destroy(LinphoneCore *core)
Destroys a LinphoneCore.
#define LC_SIP_TRANSPORT_RANDOM
Randomly chose a sip port for this transport Use with LinphoneSipTransports.
Definition misc.h:51
MS2_DEPRECATED LinphoneStatus linphone_core_set_sip_transports(LinphoneCore *core, const LinphoneSipTransports *transports)
Sets the ports to be used for each of transport (UDP or TCP) A zero value port for a given transport ...
This structure holds all callbacks that the application should implement.
Definition core.h:215