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

major redesign of liblinphone in progress

parent 725638c7
...@@ -32,7 +32,6 @@ liblinphone_la_SOURCES=\ ...@@ -32,7 +32,6 @@ liblinphone_la_SOURCES=\
authentication.c \ authentication.c \
lpconfig.c lpconfig.h \ lpconfig.c lpconfig.h \
chat.c \ chat.c \
general_state.c \
linphonecall.c \ linphonecall.c \
sipsetup.c sipsetup.h \ sipsetup.c sipsetup.h \
siplogin.c \ siplogin.c \
......
...@@ -30,19 +30,14 @@ static void linphone_connect_incoming(LinphoneCore *lc, LinphoneCall *call){ ...@@ -30,19 +30,14 @@ static void linphone_connect_incoming(LinphoneCore *lc, LinphoneCall *call){
lc->vtable.show(lc); lc->vtable.show(lc);
if (lc->vtable.display_status) if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Connected.")); lc->vtable.display_status(lc,_("Connected."));
if (lc->vtable.connected_recv) linphone_call_set_state(call,LinphoneCallConnected,"Connected");
lc->vtable.connected_recv(lc,call);
call->state=LinphoneCallAVRunning;
if (lc->ringstream!=NULL){ if (lc->ringstream!=NULL){
ring_stop(lc->ringstream); ring_stop(lc->ringstream);
lc->ringstream=NULL; lc->ringstream=NULL;
} }
if(!linphone_core_in_call(lc))
{ linphone_call_start_media_streams(call);
linphone_core_set_as_current_call(lc,call); linphone_call_set_state (call,LinphoneCallStreamsRunning,"Connected (streams running)");
}
if(call == linphone_core_get_current_call(lc))
linphone_core_start_media_streams(lc,call);
} }
static void call_received(SalOp *h){ static void call_received(SalOp *h){
...@@ -52,25 +47,20 @@ static void call_received(SalOp *h){ ...@@ -52,25 +47,20 @@ static void call_received(SalOp *h){
const char *from,*to; const char *from,*to;
char *tmp; char *tmp;
LinphoneAddress *from_parsed; LinphoneAddress *from_parsed;
LinphoneGeneralStateContext gctx;
/* first check if we can answer successfully to this invite */ /* first check if we can answer successfully to this invite */
if (lc->presence_mode!=LINPHONE_STATUS_ONLINE){ if (lc->presence_mode==LinphoneStatusBusy ||
ms_message("Not present !! presence mode : %d\n",lc->presence_mode); lc->presence_mode==LinphoneStatusOffline ||
if (lc->presence_mode==LINPHONE_STATUS_BUSY) lc->presence_mode==LinphoneStatusDoNotDisturb ||
lc->presence_mode==LinphoneStatusMoved){
if (lc->presence_mode==LinphoneStatusBusy )
sal_call_decline(h,SalReasonBusy,NULL); sal_call_decline(h,SalReasonBusy,NULL);
else if (lc->presence_mode==LINPHONE_STATUS_AWAY else if (lc->presence_mode==LinphoneStatusOffline)
||lc->presence_mode==LINPHONE_STATUS_BERIGHTBACK
||lc->presence_mode==LINPHONE_STATUS_ONTHEPHONE
||lc->presence_mode==LINPHONE_STATUS_OUTTOLUNCH
||lc->presence_mode==LINPHONE_STATUS_OFFLINE)
sal_call_decline(h,SalReasonTemporarilyUnavailable,NULL); sal_call_decline(h,SalReasonTemporarilyUnavailable,NULL);
else if (lc->presence_mode==LINPHONE_STATUS_NOT_DISTURB) else if (lc->presence_mode==LinphoneStatusDoNotDisturb)
sal_call_decline(h,SalReasonTemporarilyUnavailable,NULL); sal_call_decline(h,SalReasonTemporarilyUnavailable,NULL);
else if (lc->alt_contact!=NULL && lc->presence_mode==LINPHONE_STATUS_MOVED) else if (lc->alt_contact!=NULL && lc->presence_mode==LinphoneStatusMoved)
sal_call_decline(h,SalReasonRedirect,lc->alt_contact); sal_call_decline(h,SalReasonRedirect,lc->alt_contact);
else
sal_call_decline(h,SalReasonBusy,NULL);
sal_op_release(h); sal_op_release(h);
return; return;
} }
...@@ -84,12 +74,6 @@ static void call_received(SalOp *h){ ...@@ -84,12 +74,6 @@ static void call_received(SalOp *h){
call=linphone_call_new_incoming(lc,linphone_address_new(from),linphone_address_new(to),h); call=linphone_call_new_incoming(lc,linphone_address_new(from),linphone_address_new(to),h);
if(linphone_core_get_current_call(lc)!=NULL) //we are already in call just inform that an incoming call is going on
{
char temp[256];
snprintf(temp,sizeof(temp)-1,"A new incoming call from %s during call",from);
lc->vtable.display_status(lc,temp);
}
sal_call_set_local_media_description(h,call->localdesc); sal_call_set_local_media_description(h,call->localdesc);
call->resultdesc=sal_call_get_final_media_description(h); call->resultdesc=sal_call_get_final_media_description(h);
if (call->resultdesc) if (call->resultdesc)
...@@ -111,8 +95,7 @@ static void call_received(SalOp *h){ ...@@ -111,8 +95,7 @@ static void call_received(SalOp *h){
linphone_address_clean(from_parsed); linphone_address_clean(from_parsed);
tmp=linphone_address_as_string(from_parsed); tmp=linphone_address_as_string(from_parsed);
linphone_address_destroy(from_parsed); linphone_address_destroy(from_parsed);
gctx.call=call; linphone_call_set_state(call,LinphoneCallIncomingProgress,"Incoming call");
gstate_new_state(lc, GSTATE_CALL_IN_INVITE, gctx, tmp);
barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"), barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"),
(sal_call_autoanswer_asked(h)) ?_(" and asked autoanswer."):_(".")); (sal_call_autoanswer_asked(h)) ?_(" and asked autoanswer."):_("."));
if (lc->vtable.show) lc->vtable.show(lc); if (lc->vtable.show) lc->vtable.show(lc);
...@@ -131,12 +114,10 @@ static void call_received(SalOp *h){ ...@@ -131,12 +114,10 @@ static void call_received(SalOp *h){
ms_message("the local ring is already started"); ms_message("the local ring is already started");
} }
} }
call->state=LinphoneCallRinging;
sal_call_notify_ringing(h); sal_call_notify_ringing(h);
#if !(__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000) #if !(__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000)
linphone_core_init_media_streams(lc,call); linphone_call_init_media_streams(call);
#endif #endif
if (lc->vtable.inv_recv) lc->vtable.inv_recv(lc,call);
ms_free(barmesg); ms_free(barmesg);
ms_free(tmp); ms_free(tmp);
} }
...@@ -145,15 +126,12 @@ static void call_ringing(SalOp *h){ ...@@ -145,15 +126,12 @@ static void call_ringing(SalOp *h){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h)); LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h));
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(h); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(h);
SalMediaDescription *md; SalMediaDescription *md;
LinphoneGeneralStateContext gctx;
if (call==NULL) return; if (call==NULL) return;
gctx.call=call;
if (lc->vtable.display_status) if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Remote ringing.")); lc->vtable.display_status(lc,_("Remote ringing."));
if (lc->vtable.ringing_recv)
lc->vtable.ringing_recv(lc,call);
md=sal_call_get_final_media_description(h); md=sal_call_get_final_media_description(h);
if (md==NULL){ if (md==NULL){
if (lc->ringstream!=NULL) return; /*already ringing !*/ if (lc->ringstream!=NULL) return; /*already ringing !*/
...@@ -161,12 +139,11 @@ static void call_ringing(SalOp *h){ ...@@ -161,12 +139,11 @@ static void call_ringing(SalOp *h){
MSSndCard *ringcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard; MSSndCard *ringcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
ms_message("Remote ringing..."); ms_message("Remote ringing...");
lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,ringcard); lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,ringcard);
linphone_call_set_state(call,LinphoneCallOutgoingRinging,"Remote ringing");
gstate_new_state(lc, GSTATE_CALL_OUT_RINGING, gctx, NULL);
} }
}else{ }else{
/*accept early media */ /*accept early media */
if (lc->audiostream && lc->audiostream->ticker!=NULL){ if (call->audiostream && call->audiostream->ticker!=NULL){
/*streams already started */ /*streams already started */
ms_message("Early media already started."); ms_message("Early media already started.");
return; return;
...@@ -176,17 +153,15 @@ static void call_ringing(SalOp *h){ ...@@ -176,17 +153,15 @@ static void call_ringing(SalOp *h){
if (lc->vtable.show) lc->vtable.show(lc); if (lc->vtable.show) lc->vtable.show(lc);
if (lc->vtable.display_status) if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Early media.")); lc->vtable.display_status(lc,_("Early media."));
gstate_new_state(lc, GSTATE_CALL_OUT_RINGING, gctx, NULL); linphone_call_set_state(call,LinphoneCallOutgoingEarlyMedia,"Early media");
if (lc->ringstream!=NULL){ if (lc->ringstream!=NULL){
ring_stop(lc->ringstream); ring_stop(lc->ringstream);
lc->ringstream=NULL; lc->ringstream=NULL;
} }
ms_message("Doing early media..."); ms_message("Doing early media...");
if(call == linphone_core_get_current_call(lc)) linphone_call_start_media_streams(call);
linphone_core_start_media_streams(lc,call);
call->media_pending=TRUE; call->media_pending=TRUE;
} }
call->state=LinphoneCallRinging;
} }
/* /*
...@@ -197,25 +172,15 @@ static void call_ringing(SalOp *h){ ...@@ -197,25 +172,15 @@ static void call_ringing(SalOp *h){
static void call_accepted(SalOp *op){ static void call_accepted(SalOp *op){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
LinphoneGeneralStateContext gctx;
if (call==NULL){ if (call==NULL){
ms_warning("No call to accept."); ms_warning("No call to accept.");
return ; return ;
} }
gctx.call=call; if ((call->audiostream!=NULL) && (call->audiostream->ticker!=NULL)){
if (call->state==LinphoneCallAVRunning){ /*case where we accepted early media or already in call*/
ms_message("GET 200Ok of resume\n"); linphone_call_stop_media_streams(call);
if(lc->vtable.ack_resumed_recv) linphone_call_init_media_streams(call);
lc->vtable.ack_resumed_recv(lc,call);
return ; //already accepted
}
if ((lc->audiostream!=NULL) && (lc->audiostream->ticker!=NULL)){
/*case where we accepted early media */
if(call == linphone_core_get_current_call(lc))
{
linphone_core_stop_media_streams(lc,call);
linphone_core_init_media_streams(lc,call);
}
} }
if (call->resultdesc) if (call->resultdesc)
sal_media_description_unref(call->resultdesc); sal_media_description_unref(call->resultdesc);
...@@ -225,17 +190,12 @@ static void call_accepted(SalOp *op){ ...@@ -225,17 +190,12 @@ static void call_accepted(SalOp *op){
call->media_pending=FALSE; call->media_pending=FALSE;
} }
if (call->resultdesc && !sal_media_description_empty(call->resultdesc)){ if (call->resultdesc && !sal_media_description_empty(call->resultdesc)){
//if we initiated a pause if (call->state==LinphoneCallPausing || sal_media_description_has_dir(call->resultdesc,SalStreamSendOnly)){
if(call->state == LinphoneCallPaused) /*we initiated a pause*/
{ linphone_call_set_state(call,LinphoneCallPaused,"Call paused");
ms_message("GET 200Ok of pause\n"); linphone_call_set_media_streams_dir (call,SalStreamSendOnly);
if(lc->vtable.ack_paused_recv) linphone_call_start_media_streams (call);
lc->vtable.ack_paused_recv(lc,call); }else{
}//if there is an accepted incoming call
else
{
linphone_core_set_as_current_call (lc,call);
gstate_new_state(lc, GSTATE_CALL_OUT_CONNECTED, gctx, NULL);
linphone_connect_incoming(lc,call); linphone_connect_incoming(lc,call);
} }
}else{ }else{
...@@ -248,20 +208,15 @@ static void call_accepted(SalOp *op){ ...@@ -248,20 +208,15 @@ static void call_accepted(SalOp *op){
static void call_ack(SalOp *op){ static void call_ack(SalOp *op){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
LinphoneGeneralStateContext gctx;
if (call==NULL){ if (call==NULL){
ms_warning("No call to be ACK'd"); ms_warning("No call to be ACK'd");
return ; return ;
} }
gctx.call=call;
if (call->media_pending){ if (call->media_pending){
if (lc->audiostream->ticker!=NULL){ if (call->audiostream->ticker!=NULL){
/*case where we accepted early media */ /*case where we accepted early media */
if(call == linphone_core_get_current_call(lc)) linphone_call_stop_media_streams(call);
{ linphone_call_init_media_streams(call);
linphone_core_stop_media_streams(lc,call);
linphone_core_init_media_streams(lc,call);
}
} }
if (call->resultdesc) if (call->resultdesc)
sal_media_description_unref(call->resultdesc); sal_media_description_unref(call->resultdesc);
...@@ -269,17 +224,18 @@ static void call_ack(SalOp *op){ ...@@ -269,17 +224,18 @@ static void call_ack(SalOp *op){
if (call->resultdesc) if (call->resultdesc)
sal_media_description_ref(call->resultdesc); sal_media_description_ref(call->resultdesc);
if (call->resultdesc && !sal_media_description_empty(call->resultdesc)){ if (call->resultdesc && !sal_media_description_empty(call->resultdesc)){
gstate_new_state(lc, GSTATE_CALL_IN_CONNECTED, gctx, NULL);
linphone_connect_incoming(lc,call); linphone_connect_incoming(lc,call);
}else{ }else{
/*send a bye*/ /*send a bye*/
ms_error("Incompatible SDP response received in ACK, need to abort the call"); ms_error("Incompatible SDP response received in ACK, need to abort the call");
linphone_core_terminate_call(lc,NULL); linphone_core_abort_call(lc,call,"No codec intersection");
return;
} }
call->media_pending=FALSE; call->media_pending=FALSE;
} }
} }
/* this callback is called when an incoming re-INVITE modifies the session*/
static void call_updated(SalOp *op){ static void call_updated(SalOp *op){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
...@@ -291,37 +247,24 @@ static void call_updated(SalOp *op){ ...@@ -291,37 +247,24 @@ static void call_updated(SalOp *op){
if (call->resultdesc && !sal_media_description_empty(call->resultdesc)) if (call->resultdesc && !sal_media_description_empty(call->resultdesc))
{ {
if( (call->state == LinphoneCallPaused) && strcmp(call->resultdesc->addr,"0.0.0.0")) if (call->state==LinphoneCallPaused &&
{ sal_media_description_has_dir(call->resultdesc,SalStreamSendRecv) && strcmp(call->resultdesc->addr,"0.0.0.0")!=0){
if(lc->vtable.display_status) if(lc->vtable.display_status)
lc->vtable.display_status(lc,"we have been resumed..."); lc->vtable.display_status(lc,_("We have been resumed..."));
call->state = LinphoneCallAVRunning; linphone_call_set_state (call,LinphoneCallStreamsRunning,"Connected (streams running)");
lc->vtable.resumed_recv(lc,call); linphone_call_set_media_streams_dir (call,SalStreamSendRecv);
//we have to keep sending when holded
//linphone_core_start_media_streams(lc,call);
} }
else if( (call->state != LinphoneCallPaused) && !strcmp(call->resultdesc->addr,"0.0.0.0")) else if(call->state==LinphoneCallStreamsRunning &&
{ sal_media_description_has_dir(call->resultdesc,SalStreamRecvOnly) && !strcmp(call->resultdesc->addr,"0.0.0.0")){
if(lc->vtable.display_status) if(lc->vtable.display_status)
lc->vtable.display_status(lc,"we have been paused..."); lc->vtable.display_status(lc,_("We are being paused..."));
call->state = LinphoneCallPaused; linphone_call_set_state (call,LinphoneCallPaused,"Call paused");
lc->vtable.paused_recv(lc,call); linphone_call_set_media_streams_dir (call,SalStreamRecvOnly);
//we have to keep sending when holded
/*
if(call == linphone_core_get_current_call(lc))
{
linphone_core_stop_media_streams(lc,call);
linphone_core_init_media_streams(lc,call);
}
*/
} }
else else
{ {
if(call == linphone_core_get_current_call(lc)) linphone_call_stop_media_streams (call);
{ linphone_call_init_media_streams (call);
linphone_core_stop_media_streams(lc,call);
linphone_core_init_media_streams(lc,call);
}
linphone_connect_incoming(lc,call); linphone_connect_incoming(lc,call);
} }
} }
...@@ -330,9 +273,8 @@ static void call_updated(SalOp *op){ ...@@ -330,9 +273,8 @@ static void call_updated(SalOp *op){
static void call_terminated(SalOp *op, const char *from){ static void call_terminated(SalOp *op, const char *from){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
LinphoneGeneralStateContext gctx;
gctx.call=call; if (linphone_call_get_state(call)==LinphoneCallEnd || linphone_call_get_state(call)==LinphoneCallError){
if (linphone_call_get_state(call)==LinphoneCallTerminated){
ms_warning("call_terminated: ignoring."); ms_warning("call_terminated: ignoring.");
return; return;
} }
...@@ -342,25 +284,13 @@ static void call_terminated(SalOp *op, const char *from){ ...@@ -342,25 +284,13 @@ static void call_terminated(SalOp *op, const char *from){
ring_stop(lc->ringstream); ring_stop(lc->ringstream);
lc->ringstream=NULL; lc->ringstream=NULL;
} }
if(call == linphone_core_get_current_call(lc)) linphone_call_stop_media_streams(call);
linphone_core_stop_media_streams(lc,call);
if (lc->vtable.show!=NULL) if (lc->vtable.show!=NULL)
lc->vtable.show(lc); lc->vtable.show(lc);
if (lc->vtable.display_status!=NULL) if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Call terminated.")); lc->vtable.display_status(lc,_("Call terminated."));
call->state=LinphoneCallTerminated;
gstate_new_state(lc, GSTATE_CALL_END, gctx, NULL); linphone_call_set_state(call, LinphoneCallEnd,"Call ended");
if (lc->vtable.bye_recv!=NULL){
LinphoneAddress *addr=linphone_address_new(from);
char *tmp;
linphone_address_clean(addr);
tmp=linphone_address_as_string(addr);
if (lc->vtable.bye_recv!=NULL)
lc->vtable.bye_recv(lc,call);
ms_free(tmp);
linphone_address_destroy(addr);
}
linphone_call_set_terminated(call);
} }
static void call_failure(SalOp *op, SalError error, SalReason sr, const char *details, int code){ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *details, int code){
...@@ -372,9 +302,12 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de ...@@ -372,9 +302,12 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de
char *msg603=_("Call declined."); char *msg603=_("Call declined.");
const char *msg=details; const char *msg=details;
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
LinphoneGeneralStateContext gctx;
gctx.call=call; if (call==NULL){
ms_warning("Call faillure reported on already cleaned call ?");
return ;
}
if (lc->vtable.show) lc->vtable.show(lc); if (lc->vtable.show) lc->vtable.show(lc);
if (error==SalErrorNoResponse){ if (error==SalErrorNoResponse){
...@@ -427,19 +360,15 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de ...@@ -427,19 +360,15 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de
lc->vtable.display_status(lc,_("Call failed.")); lc->vtable.display_status(lc,_("Call failed."));
} }
} }
if (lc->vtable.failure_recv)
lc->vtable.failure_recv(lc,call,code);
if (lc->ringstream!=NULL) { if (lc->ringstream!=NULL) {
ring_stop(lc->ringstream); ring_stop(lc->ringstream);
lc->ringstream=NULL; lc->ringstream=NULL;
} }
if(call == linphone_core_get_current_call(lc)) linphone_call_stop_media_streams (call);
linphone_core_stop_media_streams(lc,call); if (sr!=SalReasonDeclined) linphone_call_set_state(call,LinphoneCallError,msg);
if (call!=NULL) { else linphone_call_set_state(call,LinphoneCallEnd,"Call declined.");
if (sr!=SalReasonDeclined) gstate_new_state(lc, GSTATE_CALL_ERROR, gctx, msg);
else gstate_new_state(lc, GSTATE_CALL_END, gctx, NULL);
linphone_call_set_terminated(call);
}
} }
static void auth_requested(SalOp *h, const char *realm, const char *username){ static void auth_requested(SalOp *h, const char *realm, const char *username){
...@@ -474,32 +403,47 @@ static void register_success(SalOp *op, bool_t registered){ ...@@ -474,32 +403,47 @@ static void register_success(SalOp *op, bool_t registered){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)sal_op_get_user_pointer(op); LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)sal_op_get_user_pointer(op);
char *msg; char *msg;
LinphoneGeneralStateContext gctx;
gctx.proxy=cfg;
cfg->registered=registered; cfg->registered=registered;
gstate_new_state(lc, GSTATE_REG_OK,gctx, NULL); linphone_proxy_config_set_state(cfg, registered ? LinphoneRegistrationOk : LinphoneRegistrationCleared ,
if (cfg->registered) msg=ms_strdup_printf(_("Registration on %s successful."),sal_op_get_proxy(op)); registered ? "Registration sucessful" : "Unregistration done");
else msg=ms_strdup_printf(_("Unregistration on %s done."),sal_op_get_proxy(op)); if (lc->vtable.display_status){
if (lc->vtable.display_status) if (cfg->registered) msg=ms_strdup_printf(_("Registration on %s successful."),sal_op_get_proxy(op));
else msg=ms_strdup_printf(_("Unregistration on %s done."),sal_op_get_proxy(op));
lc->vtable.display_status(lc,msg); lc->vtable.display_status(lc,msg);
ms_free(msg); ms_free(msg);
}
} }
static void register_failure(SalOp *op, SalError error, SalReason reason, const char *details){ static void register_failure(SalOp *op, SalError error, SalReason reason, const char *details){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneGeneralStateContext gctx; LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)sal_op_get_user_pointer(op);
char *msg=ortp_strdup_printf(_("Registration on %s failed: %s"),sal_op_get_proxy(op),(details!=NULL) ? details : _("no response timeout"));
if (lc->vtable.display_status) lc->vtable.display_status(lc,msg); if (cfg==NULL){
gctx.proxy=(LinphoneProxyConfig*)sal_op_get_user_pointer (op); ms_warning("Registration failed for unknown proxy config.");
gstate_new_state(lc, GSTATE_REG_FAILED, gctx, msg); return ;
ms_free(msg); }
if (details==NULL)
details=_("no response timeout");
if (lc->vtable.display_status) {
char *msg=ortp_strdup_printf(_("Registration on %s failed: %s"),sal_op_get_proxy(op),details );
lc->vtable.display_status(lc,msg);
ms_free(msg);
}
linphone_proxy_config_set_state(cfg,LinphoneRegistrationFailed,details);
} }
static void vfu_request(SalOp *op){ static void vfu_request(SalOp *op){
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer (op);
#ifdef VIDEO_ENABLED #ifdef VIDEO_ENABLED
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); if (call==NULL){
if (lc->videostream) ms_warning("VFU request but no call !");
video_stream_send_vfu(lc->videostream); return ;
}
if (call->videostream)
video_stream_send_vfu(call->videostream);
#endif #endif
} }
...@@ -557,7 +501,7 @@ static void ping_reply(SalOp *op){ ...@@ -557,7 +501,7 @@ static void ping_reply(SalOp *op){
LinphoneCall *call=(LinphoneCall*) sal_op_get_user_pointer(op); LinphoneCall *call=(LinphoneCall*) sal_op_get_user_pointer(op);
ms_message("ping reply !"); ms_message("ping reply !");
if (call){ if (call){
if (call->state==LinphoneCallPreEstablishing){ if (call->state==LinphoneCallOutgoingInit){
linphone_core_start_invite(call->core,call,NULL); linphone_core_start_invite(call->core,call,NULL);
} }
} }
......
...@@ -29,37 +29,37 @@ ...@@ -29,37 +29,37 @@
const char *linphone_online_status_to_string(LinphoneOnlineStatus ss){ const char *linphone_online_status_to_string(LinphoneOnlineStatus ss){
const char *str=NULL; const char *str=NULL;
switch(ss){ switch(ss){
case LINPHONE_STATUS_ONLINE: case LinphoneStatusOnline:
str=_("Online"); str=_("Online");
break;