Commit 675f7bcd authored by Simon Morlat's avatar Simon Morlat

major redesign of liblinphone in progress

parent 725638c7
......@@ -32,7 +32,6 @@ liblinphone_la_SOURCES=\
authentication.c \
lpconfig.c lpconfig.h \
chat.c \
general_state.c \
linphonecall.c \
sipsetup.c sipsetup.h \
siplogin.c \
......
This diff is collapsed.
......@@ -29,37 +29,37 @@
const char *linphone_online_status_to_string(LinphoneOnlineStatus ss){
const char *str=NULL;
switch(ss){
case LINPHONE_STATUS_ONLINE:
case LinphoneStatusOnline:
str=_("Online");
break;
case LINPHONE_STATUS_BUSY:
case LinphoneStatusBusy:
str=_("Busy");
break;
case LINPHONE_STATUS_BERIGHTBACK:
case LinphoneStatusBeRightBack:
str=_("Be right back");
break;
case LINPHONE_STATUS_AWAY:
case LinphoneStatusAway:
str=_("Away");
break;
case LINPHONE_STATUS_ONTHEPHONE:
case LinphoneStatusOnThePhone:
str=_("On the phone");
break;
case LINPHONE_STATUS_OUTTOLUNCH:
case LinphoneStatusOutToLunch:
str=_("Out to lunch");
break;
case LINPHONE_STATUS_NOT_DISTURB:
case LinphoneStatusDoNotDisturb:
str=_("Do not disturb");
break;
case LINPHONE_STATUS_MOVED:
case LinphoneStatusMoved:
str=_("Moved");
break;
case LINPHONE_STATUS_ALT_SERVICE:
case LinphoneStatusAltService:
str=_("Using another messaging service");
break;
case LINPHONE_STATUS_OFFLINE:
case LinphoneStatusOffline:
str=_("Offline");
break;
case LINPHONE_STATUS_PENDING:
case LinphoneStatusPending:
str=_("Pending");
break;
default:
......@@ -138,7 +138,7 @@ void __linphone_friend_do_subscribe(LinphoneFriend *fr){
}else from=linphone_core_get_primary_contact(fr->lc);
if (fr->outsub==NULL){
/* people for which we don't have yet an answer should appear as offline */
fr->status=LINPHONE_STATUS_OFFLINE;
fr->status=LinphoneStatusOffline;
/*
if (fr->lc->vtable.notify_recv)
fr->lc->vtable.notify_recv(fr->lc,(LinphoneFriend*)fr);
......@@ -157,7 +157,7 @@ void __linphone_friend_do_subscribe(LinphoneFriend *fr){
LinphoneFriend * linphone_friend_new(){
LinphoneFriend *obj=ms_new0(LinphoneFriend,1);
obj->pol=LinphoneSPAccept;
obj->status=LINPHONE_STATUS_OFFLINE;
obj->status=LinphoneStatusOffline;
obj->subscribe=TRUE;
return obj;
}
......@@ -243,37 +243,37 @@ int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscri
SalPresenceStatus linphone_online_status_to_sal(LinphoneOnlineStatus os){
switch(os){
case LINPHONE_STATUS_OFFLINE:
case LinphoneStatusOffline:
return SalPresenceOffline;
break;
case LINPHONE_STATUS_ONLINE:
case LinphoneStatusOnline:
return SalPresenceOnline;
break;
case LINPHONE_STATUS_BUSY:
case LinphoneStatusBusy:
return SalPresenceBusy;
break;
case LINPHONE_STATUS_BERIGHTBACK:
case LinphoneStatusBeRightBack:
return SalPresenceBerightback;
break;
case LINPHONE_STATUS_AWAY:
case LinphoneStatusAway:
return SalPresenceAway;
break;
case LINPHONE_STATUS_ONTHEPHONE:
case LinphoneStatusOnThePhone:
return SalPresenceOnthephone;
break;
case LINPHONE_STATUS_OUTTOLUNCH:
case LinphoneStatusOutToLunch:
return SalPresenceOuttolunch;
break;
case LINPHONE_STATUS_NOT_DISTURB:
case LinphoneStatusDoNotDisturb:
return SalPresenceDonotdisturb;
break;
case LINPHONE_STATUS_MOVED:
case LinphoneStatusMoved:
return SalPresenceMoved;
break;
case LINPHONE_STATUS_ALT_SERVICE:
case LinphoneStatusAltService:
return SalPresenceAltService;
break;
case LINPHONE_STATUS_PENDING:
case LinphoneStatusPending:
return SalPresenceOffline;
break;
default:
......@@ -347,7 +347,7 @@ void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc){
if (fr->inc_subscribe_pending){
switch(fr->pol){
case LinphoneSPWait:
linphone_friend_notify(fr,LINPHONE_STATUS_PENDING);
linphone_friend_notify(fr,LinphoneStatusPending);
break;
case LinphoneSPAccept:
if (fr->lc!=NULL)
......@@ -356,7 +356,7 @@ void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc){
}
break;
case LinphoneSPDeny:
linphone_friend_notify(fr,LINPHONE_STATUS_OFFLINE);
linphone_friend_notify(fr,LinphoneStatusOffline);
break;
}
fr->inc_subscribe_pending=FALSE;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -497,10 +497,10 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
lc->vtable.display_status(lc,_("Stun lookup in progress..."));
/*create the two audio and video RTP sockets, and send STUN message to our stun server */
sock1=create_socket(linphone_core_get_audio_port(lc));
sock1=create_socket(call->audio_port);
if (sock1<0) return;
if (video_enabled){
sock2=create_socket(linphone_core_get_video_port(lc));
sock2=create_socket(call->video_port);
if (sock2<0) return ;
}
sendStunRequest(sock1,(struct sockaddr*)&ss,ss_len,11,TRUE);
......
......@@ -92,36 +92,36 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeState ss, Sal
char *tmp;
LinphoneFriend *lf;
LinphoneAddress *friend=NULL;
LinphoneOnlineStatus estatus=LINPHONE_STATUS_OFFLINE;
LinphoneOnlineStatus estatus=LinphoneStatusOffline;
switch(sal_status){
case SalPresenceOffline:
estatus=LINPHONE_STATUS_OFFLINE;
estatus=LinphoneStatusOffline;
break;
case SalPresenceOnline:
estatus=LINPHONE_STATUS_ONLINE;
estatus=LinphoneStatusOnline;
break;
case SalPresenceBusy:
estatus=LINPHONE_STATUS_BUSY;
estatus=LinphoneStatusBusy;
break;
case SalPresenceBerightback:
estatus=LINPHONE_STATUS_AWAY;
estatus=LinphoneStatusBeRightBack;
break;
case SalPresenceAway:
estatus=LINPHONE_STATUS_AWAY;
estatus=LinphoneStatusAway;
break;
case SalPresenceOnthephone:
estatus=LINPHONE_STATUS_ONTHEPHONE;
estatus=LinphoneStatusOnThePhone;
break;
case SalPresenceOuttolunch:
estatus=LINPHONE_STATUS_OUTTOLUNCH;
estatus=LinphoneStatusOutToLunch;
break;
case SalPresenceDonotdisturb:
estatus=LINPHONE_STATUS_BUSY;
estatus=LinphoneStatusDoNotDisturb;
break;
case SalPresenceMoved:
case SalPresenceAltService:
estatus=LINPHONE_STATUS_AWAY;
estatus=LinphoneStatusMoved;
break;
}
lf=linphone_find_friend_by_out_subscribe(lc->friends,op);
......
......@@ -54,12 +54,6 @@
#endif
#endif
/* private: set a new state */
void gstate_new_state(struct _LinphoneCore *lc, gstate_t new_state, LinphoneGeneralStateContext context, const char *message);
/*private*/
void gstate_initialize(struct _LinphoneCore *lc);
struct _LinphoneCall
{
struct _LinphoneCore *core;
......@@ -76,28 +70,32 @@ struct _LinphoneCall
time_t media_start_time; /*time at which it was accepted, media streams established*/
LinphoneCallState state;
int refcnt;
bool_t media_pending;
void * user_pointer;
int audio_port;
int video_port;
struct _AudioStream *audiostream; /**/
struct _VideoStream *videostream;
bool_t media_pending;
bool_t audio_muted;
};
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to);
LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op);
void linphone_call_set_terminated(LinphoneCall *call);
void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const char *message);
/* private: */
LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, LinphoneAddress *local, LinphoneAddress * remote);
void linphone_call_log_completed(LinphoneCallLog *calllog, LinphoneCall *call, LinphoneCallStatus status);
void linphone_call_log_destroy(LinphoneCallLog *cl);
void linphone_core_init_media_streams(LinphoneCore *lc, LinphoneCall *call);
void linphone_auth_info_write_config(struct _LpConfig *config, LinphoneAuthInfo *obj, int pos);
void linphone_core_update_proxy_register(LinphoneCore *lc);
void linphone_core_refresh_subscribes(LinphoneCore *lc);
int linphone_core_abort_call(LinphoneCore *lc, LinphoneCall *call, const char *error);
int linphone_proxy_config_send_publish(LinphoneProxyConfig *cfg, LinphoneOnlineStatus os);
void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState rstate, const char *message);
int linphone_online_status_to_eXosip(LinphoneOnlineStatus os);
void linphone_friend_close_subscriptions(LinphoneFriend *lf);
......@@ -172,8 +170,11 @@ int linphone_proxy_config_normalize_number(LinphoneProxyConfig *cfg, const char
void linphone_core_text_received(LinphoneCore *lc, const char *from, const char *msg);
void linphone_core_start_media_streams(LinphoneCore *lc, struct _LinphoneCall *call);
void linphone_core_stop_media_streams(LinphoneCore *lc, struct _LinphoneCall *call);
void linphone_call_init_media_streams(LinphoneCall *call);
void linphone_call_start_media_streams(LinphoneCall *call);
void linphone_call_set_media_streams_dir(LinphoneCall *call, SalStreamDir dir);
void linphone_call_stop_media_streams(LinphoneCall *call);
const char * linphone_core_get_identity(LinphoneCore *lc);
const char * linphone_core_get_route(LinphoneCore *lc);
bool_t linphone_core_is_in_communication_with(LinphoneCore *lc, const char *to);
......@@ -372,8 +373,6 @@ struct _LinphoneCore
MSList *chatrooms;
int max_call_logs;
int missed_calls;
struct _AudioStream *audiostream; /**/
struct _VideoStream *videostream;
struct _VideoStream *previewstream;
struct _MSEventQueue *msevq;
RtpTransport *a_rtp,*a_rtcp;
......@@ -381,7 +380,6 @@ struct _LinphoneCore
MSList *subscribers; /* unknown subscribers */
int minutes_away;
LinphoneOnlineStatus presence_mode;
LinphoneOnlineStatus prev_mode;
char *alt_contact;
void *data;
char *play_file;
......@@ -392,9 +390,6 @@ struct _LinphoneCore
int dw_video_bw;
int up_video_bw;
int audio_bw;
gstate_t gstate_power;
gstate_t gstate_reg;
gstate_t gstate_call;
LinphoneWaitingCallback wait_cb;
void *wait_ctx;
bool_t use_files;
......@@ -404,16 +399,16 @@ struct _LinphoneCore
bool_t preview_finished;
bool_t auto_net_state_mon;
bool_t network_reachable;
bool_t audio_muted;
};
bool_t linphone_core_can_we_add_call(LinphoneCore *lc);
int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call);
int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call);
int linphone_core_set_as_current_call(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_unset_the_current_call(LinphoneCore *lc);
int linphone_core_get_calls_nb(const LinphoneCore *lc);
void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
#define HOLD_OFF (0)
#define HOLD_ON (1)
......
......@@ -262,10 +262,8 @@ static char *guess_contact_for_register(LinphoneProxyConfig *obj){
}
static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
LinphoneGeneralStateContext gctx;
const char *id_str;
gctx.proxy=obj;
if (obj->reg_identity!=NULL) id_str=obj->reg_identity;
else id_str=linphone_core_get_primary_contact(obj->lc);
if (obj->reg_sendregister){
......@@ -277,10 +275,10 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
sal_op_set_contact(obj->op,contact);
ms_free(contact);
sal_op_set_user_pointer(obj->op,obj);
if (!sal_register(obj->op,obj->reg_proxy,obj->reg_identity,obj->expires)) {
gstate_new_state(obj->lc,GSTATE_REG_PENDING, gctx, NULL);
if (sal_register(obj->op,obj->reg_proxy,obj->reg_identity,obj->expires)==0) {
linphone_proxy_config_set_state(obj,LinphoneRegistrationProgress,"Registration in progress");
} else {
gstate_new_state(obj->lc,GSTATE_REG_FAILED, gctx, NULL);
linphone_proxy_config_set_state(obj,LinphoneRegistrationFailed,"Registration failed");
}
}
}
......@@ -799,6 +797,12 @@ void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr) {
return cr->user_data;
}
void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *message){
LinphoneCore *lc=cfg->lc;
if (lc && lc->vtable.registration_state_changed){
lc->vtable.registration_state_changed(lc,cfg,state,message);
}
}
......@@ -1782,13 +1782,9 @@ int sal_address_get_port_int(const SalAddress *uri) {
}
}
/**
/*
* Send a re-Invite used to hold the current call
*
* @ingroup call_control
* @param lc the LinphoneCore object
* @param url the destination of the call (sip address).
**/
*/
int sal_call_hold(SalOp *h, bool_t holdon)
{
int err=0;
......
mediastreamer2 @ 04be0f4c
Subproject commit 4b5164714c2cf77a284f0213fc79e9b147e8563a
Subproject commit 04be0f4c3eac2d30828963b3617497bb9337e3bc
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment