return "Paused";
}
break;
+ case LinphoneCallPausedByRemote:
+ return "Paused by remote";
+ break;
case LinphoneCallIncomingReceived:
return "Pending";
break;
case LinphoneCallPaused:
linphonec_out("Call %i with %s is now paused.\n", id, from);
break;
+ case LinphoneCallPausedByRemote:
+ linphonec_out("Call %i has been paused by %s.\n",id,from);
+ break;
case LinphoneCallIncomingReceived:
linphonec_call_identify(call);
id=(long)linphone_call_get_user_pointer (call);
if (call->resultdesc && !sal_media_description_empty(call->resultdesc))
{
- if (call->state==LinphoneCallPaused &&
+ if (call->state==LinphoneCallPausedByRemote &&
sal_media_description_has_dir(call->resultdesc,SalStreamSendRecv) && strcmp(call->resultdesc->addr,"0.0.0.0")!=0){
/*make sure we can be resumed */
if (lc->current_call!=NULL && lc->current_call!=call){
sal_media_description_has_dir(call->resultdesc,SalStreamRecvOnly) && !strcmp(call->resultdesc->addr,"0.0.0.0")){
if(lc->vtable.display_status)
lc->vtable.display_status(lc,_("We are being paused..."));
- linphone_call_set_state (call,LinphoneCallPaused,"Call paused");
+ linphone_call_set_state (call,LinphoneCallPausedByRemote,"Call paused by remote");
if (lc->current_call!=call){
ms_error("Inconsitency detected: current call is %p but call %p is being paused !",lc->current_call,call);
}
**/
void linphone_call_unref(LinphoneCall *obj){
obj->refcnt--;
- if (obj->refcnt==0)
+ if (obj->refcnt==0){
linphone_call_destroy(obj);
+ }
}
/**
number=payload_type_get_number(pt);
if (rtp_profile_get_payload(prof,number)!=NULL){
ms_warning("A payload type with number %i already exists in profile !",number);
- payload_type_destroy(pt);
}else
rtp_profile_set_payload(prof,number,pt);
}
{
const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
SalProtoRtpAvp,SalAudio);
- if (stream){
+ if (stream && stream->dir!=SalStreamInactive){
MSSndCard *playcard=lc->sound_conf.lsd_card ?
lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
MSSndCard *captcard=lc->sound_conf.capt_sndcard;
video_preview_stop(lc->previewstream);
lc->previewstream=NULL;
}
- if (stream) {
+ if (stream && stream->dir!=SalStreamInactive) {
const char *addr=stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr;
call->video_profile=make_profile(lc,call->resultdesc,stream,&used_pt);
if (used_pt!=-1){
{
LinphoneCall *call = the_call;
- if(linphone_core_get_current_call(lc) != call)
- {
- ms_error("The call asked to be paused was not the current on");
- return -1;
- }
if (sal_call_hold(call->op,TRUE) != 0)
{
if (lc->vtable.display_warning)
return 0;
}
+/**
+ * Pause all currently running calls.
+**/
+int linphone_core_pause_all_calls(LinphoneCore *lc){
+ const MSList *elem;
+ for(elem=lc->calls;elem!=NULL;elem=elem->next){
+ LinphoneCall *call=(LinphoneCall *)elem->data;
+ LinphoneCallState cs=linphone_call_get_state(call);
+ if (cs==LinphoneCallStreamsRunning && cs==LinphoneCallPausedByRemote){
+ linphone_core_pause_call(lc,call);
+ }
+ }
+ return 0;
+}
+
/**
* Resumes the call.
*
LinphoneCall *call = the_call;
if(call->state!=LinphoneCallPaused ){
- ms_warning("we cannot resume a call when the communication is not established");
+ ms_warning("we cannot resume a call that has not been established and paused before");
return -1;
}
if(linphone_core_get_current_call(lc) != NULL){
LinphoneCallRefered,
LinphoneCallError,
LinphoneCallEnd,
+ LinphoneCallPausedByRemote
} LinphoneCallState;
int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);
+int linphone_core_pause_all_calls(LinphoneCore *lc);
+
int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call);
LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address);
return TRUE;
}
+static SalStreamDir compute_dir(SalStreamDir local, SalStreamDir answered){
+ SalStreamDir res=local;
+ if (local==SalStreamSendRecv){
+ if (answered==SalStreamRecvOnly){
+ res=SalStreamSendOnly;
+ }else if (answered==SalStreamSendOnly){
+ res=SalStreamRecvOnly;
+ }
+ }
+ if (answered==SalStreamInactive){
+ res=SalStreamInactive;
+ }
+ return res;
+}
+
static void initiate_outgoing(const SalStreamDescription *local_offer,
const SalStreamDescription *remote_answer,
SalStreamDescription *result){
result->payloads=match_payloads(local_offer->payloads,remote_answer->payloads,TRUE);
result->proto=local_offer->proto;
result->type=local_offer->type;
- result->dir=local_offer->dir;
+ result->dir=compute_dir(local_offer->dir,remote_answer->dir);
if (result->payloads && !only_telephone_event(result->payloads)){
strcpy(result->addr,remote_answer->addr);
GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch");
static int call_index=1;
int idx;
-
+
+ if (ms_list_size(linphone_core_get_calls(linphone_gtk_get_core()))==1){
+ /*this is the only call at this time */
+ call_index=1;
+ }
g_object_set_data(G_OBJECT(call_view),"call",call);
linphone_call_set_user_pointer (call,call_view);
linphone_call_ref(call);
}else gtk_image_set_from_stock(GTK_IMAGE(animation),GTK_STOCK_FIND,GTK_ICON_SIZE_DIALOG);
}
-void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call){
+void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call, bool_t with_pause){
GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call);
GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status");
GtkWidget *callee=linphone_gtk_get_widget(callview,"in_call_uri");
GtkWidget *duration=linphone_gtk_get_widget(callview,"in_call_duration");
GtkWidget *animation=linphone_gtk_get_widget(callview,"in_call_animation");
GdkPixbufAnimation *pbuf=create_pixbuf_animation("calling_anim.gif");
+ GtkWidget *answer_button;
gtk_label_set_markup(GTK_LABEL(status),_("<b>Incoming call</b>"));
gtk_widget_show_all(linphone_gtk_get_widget(callview,"answer_decline_panel"));
display_peer_name_in_label(callee,linphone_call_get_remote_address (call));
- gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(callview,"accept_call")),
+ answer_button=linphone_gtk_get_widget(callview,"accept_call");
+ gtk_button_set_image(GTK_BUTTON(answer_button),
create_pixmap (linphone_gtk_get_ui_config("start_call_icon","startcall-green.png")));
+ if (with_pause){
+ gtk_button_set_label(GTK_BUTTON(answer_button),
+ _("Pause all calls\nand answer"));
+ }else gtk_button_set_label(GTK_BUTTON(answer_button),_("Answer"));
gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(callview,"decline_call")),
create_pixmap (linphone_gtk_get_ui_config("stop_call_icon","stopcall-red.png")));
g_object_set_data(G_OBJECT(holdbutton),"call",call);
}
+void linphone_gtk_in_call_view_set_paused(LinphoneCall *call){
+ GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call);
+ GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status");
+ gtk_widget_hide(linphone_gtk_get_widget(callview,"answer_decline_panel"));
+ gtk_label_set_markup(GTK_LABEL(status),_("<b>Paused call with</b>"));
+}
+
void linphone_gtk_in_call_view_update_duration(LinphoneCall *call){
GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call);
GtkWidget *duration_label=linphone_gtk_get_widget(callview,"in_call_duration");
void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call);
void linphone_gtk_in_call_view_update_duration(LinphoneCall *call);
void linphone_gtk_in_call_view_terminate(LinphoneCall *call, const char *error_msg);
-void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call);
+void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call, bool_t with_pause);
+void linphone_gtk_in_call_view_set_paused(LinphoneCall *call);
void linphone_gtk_enable_mute_button(GtkToggleButton *button, gboolean sensitive);
void linphone_gtk_enable_hold_button(GtkToggleButton *button, gboolean sensitive);
static bool_t all_calls_paused(const MSList *calls){
for(;calls!=NULL;calls=calls->next){
LinphoneCall *call=(LinphoneCall*)calls->data;
- if (linphone_call_get_state(call)!=LinphoneCallPaused)
+ LinphoneCallState cs=linphone_call_get_state(call);
+ if (cs!=LinphoneCallPaused && cs!=LinphoneCallIncomingReceived)
return FALSE;
}
return TRUE;
void linphone_gtk_answer_clicked(GtkWidget *button){
LinphoneCall *call=linphone_gtk_get_currently_displayed_call ();
- if (call)
+ if (call){
+ linphone_core_pause_all_calls(linphone_gtk_get_core());
linphone_core_accept_call(linphone_gtk_get_core(),call);
+ }
}
void linphone_gtk_set_audio_video(){
case LinphoneCallOutgoingProgress:
linphone_gtk_in_call_view_set_calling (call);
break;
- case LinphoneCallConnected:
+ case LinphoneCallStreamsRunning:
linphone_gtk_in_call_view_set_in_call(call);
linphone_gtk_enable_mute_button(
GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"main_mute")),
break;
case LinphoneCallIncomingReceived:
linphone_gtk_create_in_call_view (call);
- linphone_gtk_in_call_view_set_incoming(call);
+ linphone_gtk_in_call_view_set_incoming(call,!all_calls_paused (linphone_core_get_calls(lc)));
if (auto_answer) {
linphone_call_ref(call);
g_timeout_add(2000,(GSourceFunc)linphone_gtk_auto_answer ,call);
- }
-
+ }
+ break;
+ case LinphoneCallPaused:
+ case LinphoneCallPausedByRemote:
+ linphone_gtk_in_call_view_set_paused(call);
break;
default:
break;