Commit e7918bab authored by Simon Morlat's avatar Simon Morlat

merge multicall patch from Aurelien

parent ace54d21
......@@ -78,6 +78,8 @@ static int lpc_cmd_ports(LinphoneCore *lc, char *args);
static int lpc_cmd_speak(LinphoneCore *lc, char *args);
static int lpc_cmd_codec(LinphoneCore *lc, char *args);
static int lpc_cmd_echocancellation(LinphoneCore *lc, char *args);
static int lpc_cmd_pause(LinphoneCore *lc, char *args);
static int lpc_cmd_resume(LinphoneCore *lc, char *args);
/* Command handler helpers */
static void linphonec_proxy_add(LinphoneCore *lc);
......@@ -120,17 +122,21 @@ void linphonec_out(const char *fmt,...);
LPC_COMMAND commands[] = {
{ "help", lpc_cmd_help, "Print commands help", NULL },
{ "call", lpc_cmd_call, "Call a SIP uri",
"'call <sip-url>' "
": initiate a call to the specified destination."
"'call <sip-url>' \t: initiate a call to the specified destination.\n"
"'call show' \t: show all the current calls status.\n"
},
{ "chat", lpc_cmd_chat, "Chat with a SIP uri",
"'chat <sip-url> \"message\"' "
": send a chat message \"message\" to the specified destination."
},
{ "terminate", lpc_cmd_terminate, "Terminate the current call",
NULL },
{ "terminate", lpc_cmd_terminate, "Terminate a call",
"'terminate' : Terminate the current call\n"
"'terminate <sip:XXX@XXX.XXX.XXX.XXX>' : Terminate the call with remote address\n"
"'terminate <all>' : Terminate all the current calls\n"
},
{ "answer", lpc_cmd_answer, "Answer a call",
"Accept an incoming call."
"'answer' : Answer the current incoming call\n"
"'answer <sip:XXX@XXX.XXX.XXX.XXX>' : Answer the call with remote address\n"
},
{ "autoanswer", lpc_cmd_autoanswer, "Show/set auto-answer mode",
"'autoanswer' \t: show current autoanswer mode\n"
......@@ -223,7 +229,12 @@ LPC_COMMAND commands[] = {
"'ec on [<delay>] [<tail>] [<framesize>]' : turn EC on with given delay, tail length and framesize\n"
"'ec off' : turn echo cancellation (EC) off\n"
"'ec show' : show EC status" },
{ (char *)NULL, (lpc_cmd_handler)NULL, (char *)NULL, (char *)NULL }
{ "pause", lpc_cmd_pause, "pause a call",
"'pause' : pause the current call\n"},
{ "resume", lpc_cmd_resume, "resume a call",
"'resume' : resume the unique call\n"
"'resume <sip:XXX@XXX.XXX.XXX.XXX>' : hold off the call with cid <cid>\n"},
{ (char *)NULL, (lpc_cmd_handler)NULL, (char *)NULL, (char *)NULL }
};
/***************************************************************************
......@@ -374,13 +385,34 @@ lpc_cmd_call(LinphoneCore *lc, char *args)
{
return 0;
}
if ( lc->call != NULL )
if(!strcmp(args,"show"))
{
linphonec_out("Terminate current call first.\n");
MSList *calls = linphone_core_get_calls(lc);
if(calls)
{
MSList *p_calls = calls;
linphonec_out("<remote>\t\t\t\t<status>\r\n");
while(p_calls != NULL)
{
linphonec_out("%s\t\t\t%s\r\n",
linphone_call_get_remote_address_as_string(p_calls->data),
(((LinphoneCall *)p_calls->data)==linphone_core_get_current_call(lc))?"yes":"no");
p_calls = p_calls->next;
}
ms_list_free(calls);
}
else
{
linphonec_out("No active call.\n");
}
}
else
{
if ( linphone_core_in_call(lc) )
{
linphonec_out("Terminate or hold on the current call first.\n");
return 1;
}
if ( NULL == linphone_core_invite(lc, args) )
{
linphonec_out("Error from linphone_core_invite.\n");
......@@ -448,21 +480,98 @@ lpc_cmd_refer(LinphoneCore *lc, char *args)
static int
lpc_cmd_terminate(LinphoneCore *lc, char *args)
{
if ( -1 == linphone_core_terminate_call(lc, NULL) )
char *arg1 = args;
char *arg2 = NULL;
char *ptr = args;
if (!args)
{
linphonec_out("No active call.\n");
if(linphone_core_in_call(lc))
{
if ( -1 == linphone_core_terminate_call(lc, linphone_core_get_current_call(lc)) )
{
linphonec_out("Could not stop the active call.\n");
}
}
else
{
linphonec_out("No active call.\n");
}
return 1;
}
return 1;
/* Isolate first and second arg */
while(*ptr && !isspace(*ptr)) ++ptr;
if ( *ptr )
{
*ptr='\0';
arg2=ptr+1;
while(*arg2 && isspace(*arg2)) ++arg2;
}
if (arg1 != 0)
{
if(strcmp(arg1,"all")==0)
{
linphonec_out("We are going to stop all the calls.\n");
return (linphone_core_terminate_all_calls(lc)==0)?1:0;
}
else
{
char the_remote_address[255];
int n = sscanf(arg1, "%s", the_remote_address);
if (n == 1)
{
if ( -1 == linphone_core_terminate_call(lc,linphone_core_get_call_by_remote_address(lc,the_remote_address)))
{
linphonec_out("Cannot stop the call with %s.\n",the_remote_address);
}
return 1;
}
}
}
return 0;
}
static int
lpc_cmd_answer(LinphoneCore *lc, char *args)
{
if ( -1 == linphone_core_accept_call(lc, NULL) )
char *arg1 = args;
char *arg2 = NULL;
char *ptr = args;
if (!args)
{
linphonec_out("No incoming call.\n");
//TODO if just one call is present answer the only one ...
if ( -1 == linphone_core_accept_call(lc, linphone_core_get_current_call(lc)) )//TODO is there any current call here=> nope
{
linphonec_out("No incoming call.\n");
}
return 1;
}
return 1;
// Isolate first and second arg
while(*ptr && !isspace(*ptr)) ++ptr;
if ( *ptr )
{
*ptr='\0';
arg2=ptr+1;
while(*arg2 && isspace(*arg2)) ++arg2;
}
if (arg1 != 0)
{
char the_remote_address[256];
int n = sscanf(arg1, "%s", the_remote_address);
if (n == 1)
{
if ( -1 == linphone_core_accept_call(lc, linphone_core_get_call_by_remote_address(lc,the_remote_address)) )
{
linphonec_out("Cannot answer the call from %s.\n",the_remote_address);
}
return 1;
}
}
return 0;
}
static int
......@@ -1063,7 +1172,62 @@ lpc_cmd_staticpic(LinphoneCore *lc, char *args)
return 0; /* Syntax error */
}
static int lpc_cmd_pause(LinphoneCore *lc, char *args){
if(linphone_core_in_call(lc))
{
linphone_core_pause_call(lc,linphone_core_get_current_call(lc));
return 1;
}
linphonec_out("you can only pause when a call is in process\n");
return 0;
}
static int lpc_cmd_resume(LinphoneCore *lc, char *args){
if(linphone_core_in_call(lc))
{
linphonec_out("There is already a call in process pause or stop it first");
}
if (args)
{
char the_remote_address[255];
int n = sscanf(args, "%s", the_remote_address);
if (n == 1)
{
if(linphone_core_resume_call(lc,linphone_core_get_call_by_remote_address(lc,the_remote_address)) < 0)
{
linphonec_out("There was a problem to resume the call check the remote address you gave %s\n",args);
return 0;
}
else
{
return 1;
}
}
}
else
{
int returned = 0;
MSList *calls = linphone_core_get_calls(lc);
if(ms_list_size(calls) == 1)
{
if(linphone_core_resume_call(lc,calls->data) < 0)
{
linphonec_out("There was a problem to resume the unique call \n");
returned = 0;
}
else
{
returned = 1;
}
ms_list_free(calls);
return returned;
}
}
return 0;
}
/***************************************************************************
*
......
......@@ -344,7 +344,9 @@ linphonec_bye_received(LinphoneCore *lc, LinphoneCall *call)
// printing this is unneeded as we'd get a "Communication ended"
// message trough display_status callback anyway
//printf("Bye received from %s\n", from);
char *from=linphone_call_get_remote_address_as_string(call);
printf("Bye received from %s\n", from);
ms_free(from);
}
/*
......
......@@ -35,7 +35,8 @@ static void linphone_connect_incoming(LinphoneCore *lc, LinphoneCall *call){
ring_stop(lc->ringstream);
lc->ringstream=NULL;
}
linphone_core_start_media_streams(lc,call);
if(call == linphone_core_get_current_call(lc))
linphone_core_start_media_streams(lc,call);
}
static void call_received(SalOp *h){
......@@ -66,7 +67,7 @@ static void call_received(SalOp *h){
sal_op_release(h);
return;
}
if (lc->call!=NULL){/*busy*/
if (!linphone_core_can_we_add_call(lc)){/*busy*/
sal_call_decline(h,SalReasonBusy,NULL);
sal_op_release(h);
return;
......@@ -75,7 +76,19 @@ static void call_received(SalOp *h){
to=sal_op_get_to(h);
call=linphone_call_new_incoming(lc,linphone_address_new(from),linphone_address_new(to),h);
lc->call=call;
if(linphone_core_add_call(lc,call)!= 0)
{
ms_warning("we cannot have more calls\n");
sal_call_decline(h,SalReasonMedia,NULL);
linphone_call_unref(call);
return;
}
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),"A new incoming call from %s during call",from);
lc->vtable.display_status(lc,temp);
}
sal_call_set_local_media_description(h,call->localdesc);
call->resultdesc=sal_call_get_final_media_description(h);
if (call->resultdesc)
......@@ -83,7 +96,6 @@ static void call_received(SalOp *h){
if (call->resultdesc && sal_media_description_empty(call->resultdesc)){
sal_call_decline(h,SalReasonMedia,NULL);
linphone_call_unref(call);
lc->call=NULL;
return;
}
......@@ -99,13 +111,13 @@ static void call_received(SalOp *h){
lc->vtable.display_status(lc,barmesg);
/* play the ring */
if (lc->sound_conf.ring_sndcard!=NULL){
if (lc->sound_conf.ring_sndcard!=NULL && !linphone_core_in_call(lc)){
ms_message("Starting local ring...");
lc->ringstream=ring_start(lc->sound_conf.local_ring,2000,lc->sound_conf.ring_sndcard);
}
call->state=LinphoneCallRinging;
sal_call_notify_ringing(h);
linphone_core_init_media_streams(lc,lc->call);
linphone_core_init_media_streams(lc,call);
if (lc->vtable.inv_recv) lc->vtable.inv_recv(lc,call);
ms_free(barmesg);
ms_free(tmp);
......@@ -113,7 +125,7 @@ static void call_received(SalOp *h){
static void call_ringing(SalOp *h){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h));
LinphoneCall *call=lc->call;
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(h);
SalMediaDescription *md;
if (call==NULL) return;
if (lc->vtable.display_status)
......@@ -143,7 +155,8 @@ static void call_ringing(SalOp *h){
lc->ringstream=NULL;
}
ms_message("Doing early media...");
linphone_core_start_media_streams(lc,call);
if(call == linphone_core_get_current_call(lc))
linphone_core_start_media_streams(lc,call);
call->media_pending=TRUE;
}
call->state=LinphoneCallRinging;
......@@ -151,22 +164,21 @@ static void call_ringing(SalOp *h){
static void call_accepted(SalOp *op){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneCall *call=lc->call;
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
if (call==NULL){
ms_warning("No call to accept.");
return ;
}
if (sal_op_get_user_pointer(op)!=lc->call){
ms_warning("call_accepted: ignoring.");
return;
}
if (call->state==LinphoneCallAVRunning){
return ; /*already accepted*/
}
if (lc->audiostream->ticker!=NULL){
if ((lc->audiostream!=NULL) && (lc->audiostream->ticker!=NULL)){
/*case where we accepted early media */
linphone_core_stop_media_streams(lc,call);
linphone_core_init_media_streams(lc,call);
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)
sal_media_description_unref(call->resultdesc);
......@@ -187,20 +199,19 @@ static void call_accepted(SalOp *op){
static void call_ack(SalOp *op){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneCall *call=lc->call;
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
if (call==NULL){
ms_warning("No call to be ACK'd");
return ;
}
if (sal_op_get_user_pointer(op)!=lc->call){
ms_warning("call_ack: ignoring.");
return;
}
if (call->media_pending){
if (lc->audiostream->ticker!=NULL){
/*case where we accepted early media */
linphone_core_stop_media_streams(lc,call);
linphone_core_init_media_streams(lc,call);
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)
sal_media_description_unref(call->resultdesc);
......@@ -222,8 +233,11 @@ static void call_ack(SalOp *op){
static void call_updated(SalOp *op){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
linphone_core_stop_media_streams(lc,call);
linphone_core_init_media_streams(lc,call);
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)
sal_media_description_unref(call->resultdesc);
call->resultdesc=sal_call_get_final_media_description(op);
......@@ -244,7 +258,8 @@ static void call_terminated(SalOp *op, const char *from){
ring_stop(lc->ringstream);
lc->ringstream=NULL;
}
linphone_core_stop_media_streams(lc,lc->call);
if(call == linphone_core_get_current_call(lc))
linphone_core_stop_media_streams(lc,call);
lc->vtable.show(lc);
lc->vtable.display_status(lc,_("Call terminated."));
linphone_call_set_terminated(call);
......@@ -259,7 +274,6 @@ static void call_terminated(SalOp *op, const char *from){
linphone_address_destroy(addr);
}
linphone_call_unref(call);
lc->call=NULL;
}
static void call_failure(SalOp *op, SalError error, SalReason sr, const char *details){
......@@ -270,12 +284,8 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de
char *msg600=_("User does not want to be disturbed.");
char *msg603=_("Call declined.");
char *msg=NULL;
LinphoneCall *call=lc->call;
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
if (sal_op_get_user_pointer(op)!=lc->call){
ms_warning("call_failure: ignoring.");
return;
}
if (lc->vtable.show) lc->vtable.show(lc);
if (error==SalErrorNoResponse){
......@@ -330,12 +340,13 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de
ring_stop(lc->ringstream);
lc->ringstream=NULL;
}
linphone_core_stop_media_streams(lc,call);
if(call == linphone_core_get_current_call(lc))
linphone_core_stop_media_streams(lc,call);
if (call!=NULL) {
linphone_call_set_terminated(call);
linphone_call_unref(call);//TODO not an unref here ???//AUREL
if (sr!=SalReasonDeclined) gstate_new_state(lc, GSTATE_CALL_ERROR, msg);
else gstate_new_state(lc, GSTATE_CALL_END, NULL);
lc->call=NULL;
}
}
......
......@@ -55,7 +55,7 @@ void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg){
if(linphone_core_is_in_communication_with(cr->lc,cr->peer))
{
ms_message("send SIP message into the call\n");
op = cr->lc->call->op;
op = (linphone_core_get_current_call(cr->lc))->op;
}
else
{
......
......@@ -177,6 +177,15 @@ static void linphone_call_destroy(LinphoneCall *obj)
if (obj->ping_op) {
sal_op_release(obj->ping_op);
}
if(linphone_core_del_call(obj->core,obj) != 0)
{
ms_error("could not remove the call from the list !!!");
}
if(obj == linphone_core_get_current_call(obj->core))
{
ms_message("destroying the current call\n");
linphone_core_unset_the_current_call(obj->core);
}
ms_free(obj);
}
......
This diff is collapsed.
......@@ -97,6 +97,7 @@ typedef enum _LinphoneCallState{
LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
bool_t linphone_call_paused(LinphoneCall *call);
const LinphoneAddress * linphone_core_get_current_call_remote_address(struct _LinphoneCore *lc);
const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
char *linphone_call_get_remote_address_as_string(const LinphoneCall *call);
void linphone_call_ref(LinphoneCall *call);
......@@ -519,7 +520,7 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call);
LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc);
LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address);
void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf);
......@@ -812,5 +813,5 @@ void linphone_core_set_audio_transports(LinphoneCore *lc, RtpTransport *rtp, Rtp
#ifdef __cplusplus
}
#endif
MSList *linphone_core_get_calls(LinphoneCore *lc);
#endif
......@@ -355,7 +355,8 @@ struct _LinphoneCore
MSList *auth_info;
struct _RingStream *ringstream;
LCCallbackObj preview_finished_cb;
struct _LinphoneCall *call; /* the current call, in the future it will be a list of calls (conferencing)*/
LinphoneCall *current_call; /* the current call */
MSList *calls; /* all the processed calls */
MSList *queued_calls; /* used by the autoreplier */
MSList *call_logs;
MSList *chatrooms;
......@@ -394,4 +395,18 @@ struct _LinphoneCore
bool_t network_reachable;
};
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);
#define HOLD_OFF (0)
#define HOLD_ON (1)
#ifndef NB_MAX_CALLS
#define NB_MAX_CALLS (10)
#endif
#endif /* _PRIVATE_H */
......@@ -98,6 +98,7 @@ typedef struct SalStreamDescription{
int bandwidth;
int ptime;
SalEndpointCandidate candidates[SAL_ENDPOINT_CANDIDATE_MAX];
bool_t notsending;
} SalStreamDescription;
#define SAL_MEDIA_DESCRIPTION_MAX_STREAMS 4
......@@ -109,6 +110,7 @@ typedef struct SalMediaDescription{
int nstreams;
int bandwidth;
SalStreamDescription streams[SAL_MEDIA_DESCRIPTION_MAX_STREAMS];
bool_t notsending;
} SalMediaDescription;
SalMediaDescription *sal_media_description_new();
......@@ -258,6 +260,7 @@ int sal_call(SalOp *h, const char *from, const char *to);
int sal_call_notify_ringing(SalOp *h);
int sal_call_accept(SalOp*h);
int sal_call_decline(SalOp *h, SalReason reason, const char *redirection /*optional*/);
int sal_call_hold(SalOp *h, bool_t holdon);
SalMediaDescription * sal_call_get_final_media_description(SalOp *h);
int sal_refer(SalOp *h, const char *refer_to);
int sal_refer_accept(SalOp *h);
......@@ -299,5 +302,4 @@ void __sal_op_init(SalOp *b, Sal *sal);
void __sal_op_set_network_origin(SalOp *op, const char *origin /*a sip uri*/);
void __sal_op_free(SalOp *b);
#endif
......@@ -398,6 +398,19 @@ static void set_sdp(osip_message_t *sip,sdp_message_t *msg){
osip_free(sdp);
}
static void set_hold_status_to_desc(SalMediaDescription *desc, bool_t holdon)
{
int i;
if(desc == NULL)
return;
desc->notsending = holdon;
for(i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++)
{
if(desc->streams != NULL)
desc->streams[i].notsending = holdon;//Audio
}
}
static void set_sdp_from_desc(osip_message_t *sip, const SalMediaDescription *desc){
sdp_message_t *msg=media_description_to_sdp(desc);
if (msg==NULL) {
......@@ -1691,3 +1704,35 @@ void sal_address_destroy(SalAddress *u){
osip_from_free((osip_from_t*)u);
}
/**
* 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;
osip_message_t *reinvite;
eXosip_call_build_request(h->did,"INVITE",&reinvite);
osip_message_set_subject(reinvite,osip_strdup("Phone Call Hold"));
osip_message_set_allow(reinvite, "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO");
if (h->base.root->session_expires!=0){
osip_message_set_header(reinvite, "Session-expires", "200");
osip_message_set_supported(reinvite, "timer");
}
//add something to say that the distant sip phone will be in sendonly/sendrecv mode
if (h->base.local_media){
h->sdp_offering=TRUE;
set_hold_status_to_desc(h->base.local_media,holdon);
set_sdp_from_desc(reinvite,h->base.local_media);
}else h->sdp_offering=FALSE;
eXosip_lock();
err = eXosip_call_send_request(h->did, reinvite);
eXosip_unlock();
return err;
}
......@@ -121,12 +121,21 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc)
osip_strdup ("IN"), inet6 ? osip_strdup("IP6") : osip_strdup ("IP4"),
osip_strdup (desc->addr));
sdp_message_s_name_set (local, osip_strdup ("A conversation"));
sdp_message_c_connection_add (local, -1,
osip_strdup ("IN"), inet6 ? osip_strdup ("IP6") : osip_strdup ("IP4"),
osip_strdup (desc->addr), NULL, NULL);
if(!desc->notsending)
{
sdp_message_c_connection_add (local, -1,
osip_strdup ("IN"), inet6 ? osip_strdup ("IP6") : osip_strdup ("IP4"),
osip_strdup (desc->addr), NULL, NULL);
}
else
{
sdp_message_c_connection_add (local, -1,
osip_strdup ("IN"), inet6 ? osip_strdup ("IP6") : osip_strdup ("IP4"),
inet6 ? osip_strdup ("0.0.0.0.0.0") : osip_strdup ("0.0.0.0"), NULL, NULL);
}
sdp_message_t_time_descr_add (local, osip_strdup ("0"), osip_strdup ("0"));
if (desc->bandwidth>0) sdp_message_b_bandwidth_add (local, -1, osip_strdup ("AS"),
int_2char(desc->bandwidth));
int_2char(desc->bandwidth));
return local;
}
......@@ -186,6 +195,10 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription
for(elem=desc->payloads;elem!=NULL;elem=elem->next){
add_payload(msg, lineno, (PayloadType*)elem->data);
}
if(desc->notsending)//to hold the distant SIP endpoint
sdp_message_a_attribute_add (msg, lineno, osip_strdup ("sendonly"),NULL);
else
sdp_message_a_attribute_add (msg, lineno, osip_strdup ("sendrecv"),NULL);
}
sdp_message_t *media_description_to_sdp(const SalMediaDescription *desc){
......
......@@ -128,7 +128,7 @@ void linphone_gtk_in_call_view_set_in_call(){
GtkWidget *duration=linphone_gtk_get_widget(main_window,"in_call_duration");
GtkWidget *animation=linphone_gtk_get_widget(main_window,"in_call_animation");
GdkPixbufAnimation *pbuf=create_pixbuf_animation("incall_anim.gif");
const LinphoneAddress *uri=linphone_core_get_remote_address(lc);
const LinphoneAddress *uri=linphone_core_get_current_call_remote_address(lc);
char *tmp=linphone_address_as_string(uri);
display_peer_name_in_label(callee,tmp);
ms_free(tmp);
......@@ -141,7 +141,9 @@ void linphone_gtk_in_call_view_set_in_call(){
g_object_unref(G_OBJECT(pbuf));
}else gtk_image_set_from_stock(GTK_IMAGE(animation),GTK_STOCK_INFO,GTK_ICON_SIZE_DIALOG);
linphone_gtk_enable_mute_button(
GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(main_window,"incall_mute")),TRUE);
GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(main_window,"incall_mute")),TRUE);
linphone_gtk_enable_hold_button(
GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(main_window,"hold_call")),TRUE);
}
void linphone_gtk_in_call_view_update_duration(int duration){
......@@ -179,6 +181,8 @@ void linphone_gtk_in_call_view_terminate(const char *error_msg){
}
linphone_gtk_enable_mute_button(
GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(main_window,"incall_mute")),FALSE);
linphone_gtk_enable_hold_button(
GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(main_window,"hold_call")),FALSE);
g_timeout_add_seconds(2,(GSourceFunc)in_call_view_terminated,NULL);
}
......@@ -206,7 +210,50 @@ void linphone_gtk_mute_toggled(GtkToggleButton *button){
linphone_gtk_draw_mute_button(button,active);
}
void linphone_gtk_enable_mute_button(GtkToggleButton *button, gboolean sensitive){
void linphone_gtk_enable_mute_button(GtkToggleButton *button, gboolean sensitive)
{
gtk_widget_set_sensitive(GTK_WIDGET(button),sensitive);
linphone_gtk_draw_mute_button(button,FALSE);
}
void linphone_gtk_draw_hold_button(GtkToggleButton *button, gboolean active){
GtkWidget *status=linphone_gtk_get_widget(linphone_gtk_get_main_window(),"in_call_status");
if (active){
GtkWidget *image=create_pixmap("hold_off.png");
gtk_button_set_label(GTK_BUTTON(button),_("HoldOff"));
gtk_label_set_markup(GTK_LABEL(status),_("<b>In call holded with</b>"));
if (image!=NULL) {
gtk_button_set_image(GTK_BUTTON(button),image);
gtk_widget_show(image);
}
}else{
GtkWidget *image=create_pixmap("hold_on.png");
gtk_button_set_label(GTK_BUTTON(button),_("HoldOn"));
gtk_label_set_markup(GTK_LABEL(status),_("<b>In call with</b>"));
if (image!=NULL) {
gtk_button_set_image(GTK_BUTTON(button),image);
gtk_widget_show(image);
}
}
}
void linphone_gtk_hold_toggled(GtkToggleButton *button){
GtkWidget *mw=linphone_gtk_get_main_window();
gboolean active=gtk_toggle_button_get_active(button);
if(active)
{
linphone_core_pause_call(linphone_gtk_get_core(),NULL);
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"terminate_call"),FALSE);
}