Merge branch 'master' into belle-sip

Conflicts:
	coreapi/linphonecore.h
This commit is contained in:
Yann Diorcet 2013-04-05 12:47:09 +02:00
commit 4da21ea4b0
21 changed files with 645 additions and 217 deletions

View file

@ -21,7 +21,6 @@
LOCAL_PATH:= $(call my-dir)/../../coreapi
include $(CLEAR_VARS)
include $(linphone-root-dir)/submodules/linphone/build/android/common.mk
@ -43,4 +42,3 @@ include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/cpufeatures)

View file

@ -39,10 +39,3 @@ include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/cpufeatures)
ifeq ($(BUILD_REMOTE_PROVISIONING),1)
include $(linphone-root-dir)/submodules/linphone/build/android/xml2lpc.mk
include $(linphone-root-dir)/submodules/linphone/build/android/lpc2xml.mk
endif

View file

@ -40,6 +40,7 @@ LOCAL_C_INCLUDES = \
LOCAL_SHARED_LIBRARIES = \
libxml2 \
liblinphonenoneon \
liblinphone \
LOCAL_MODULE := liblpc2xml

View file

@ -40,6 +40,7 @@ LOCAL_C_INCLUDES = \
LOCAL_SHARED_LIBRARIES = \
libxml2 \
liblinphonenoneon \
liblinphone \
LOCAL_MODULE := libxml2lpc

View file

@ -51,15 +51,31 @@ typedef struct _LinphoneCore LinphoneCore;
struct _LpConfig;
/**
* Linphone core SIP transport ports.
* Use with #linphone_core_set_sip_transports
* @ingroup initializing
*/
typedef struct _LCSipTransports{
/**
* udp port to listening on, negative value if not set
* */
int udp_port;
/**
* tcp port to listening on, negative value if not set
* */
int tcp_port;
/**
* dtls port to listening on, negative value if not set
* */
int dtls_port;
/**
* tls port to listening on, negative value if not set
* */
int tls_port;
} LCSipTransports;
/**
* Object that represents a SIP address.
*
@ -945,7 +961,12 @@ LINPHONE_PUBLIC int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *ca
int linphone_core_defer_call_update(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params);
/**
* @ingroup media_parameters
* Get default call parameters reflecting current linphone core configuration
* @param LinphoneCore object
* @return LinphoneCallParams
*/
LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc);
LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address);
@ -993,16 +1014,23 @@ const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc);
int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs);
LINPHONE_PUBLIC bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const PayloadType *pt);
/**
* Enable payload type
* @param linphone core
* @param pt payload type to enable, can be retrieve from #linphone_core_find_payload_type
* @param TRUE if enabled
* @return 0 if succed
*
*/
LINPHONE_PUBLIC int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t enable);
/**
* Wildcard value used by #linphone_core_find_payload_type to ignore rate in search algirithm
* Wildcard value used by #linphone_core_find_payload_type to ignore rate in search algorithm
* @ingroup media_parameters
*/
#define LINPHONE_FIND_PAYLOAD_IGNORE_RATE -1
/**
* Wildcard value used by #linphone_core_find_payload_type to ignore channel in search algirithm
* Wildcard value used by #linphone_core_find_payload_type to ignore channel in search algorithm
* @ingroup media_parameters
*/
#define LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS -1
@ -1381,7 +1409,13 @@ LINPHONE_PUBLIC void linphone_core_refresh_registers(LinphoneCore* lc);
/* Path to the file storing secrets cache */
void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file);
const char *linphone_core_get_zrtp_secrets_file(LinphoneCore *lc);
/**
* Search from the list of current calls if a remote address match uri
* @ingroup call_control
* @param lc
* @param uri which should match call remote uri
* @return LinphoneCall or NULL is no match is found
*/
const LinphoneCall* linphone_core_find_call_from_uri(LinphoneCore *lc, const char *uri);
LINPHONE_PUBLIC int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call);
@ -1396,8 +1430,19 @@ LINPHONE_PUBLIC int linphone_core_terminate_conference(LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_get_conference_size(LinphoneCore *lc);
int linphone_core_start_conference_recording(LinphoneCore *lc, const char *path);
int linphone_core_stop_conference_recording(LinphoneCore *lc);
/**
* Get the maximum number of simultaneous calls Linphone core can manage at a time. All new call above this limit are declined with a busy answer
* @ingroup initializing
* @param lc core
* @return max number of simultaneous calls
*/
int linphone_core_get_max_calls(LinphoneCore *lc);
/**
* Set the maximum number of simultaneous calls Linphone core can manage at a time. All new call above this limit are declined with a busy answer
* @ingroup initializing
* @param lc core
* @param max number of simultaneous calls
*/
void linphone_core_set_max_calls(LinphoneCore *lc, int max);
bool_t linphone_core_sound_resources_locked(LinphoneCore *lc);

View file

@ -846,6 +846,7 @@ int linphone_proxy_config_send_publish(LinphoneProxyConfig *proxy,
LinphoneOnlineStatus presence_mode){
int err;
SalOp *op=sal_op_new(proxy->lc->sal);
sal_op_set_route(op,proxy->reg_proxy);
err=sal_publish(op,linphone_proxy_config_get_identity(proxy),
linphone_proxy_config_get_identity(proxy),linphone_online_status_to_sal(presence_mode));
if (proxy->publish_op!=NULL)

View file

@ -635,7 +635,7 @@ int sal_publish(SalOp *op, const char *from, const char *to, SalPresenceStatus p
mk_presence_body (presence_mode, from, buf, sizeof (buf), presence_style);
i = eXosip_build_publish(&pub,from, to, NULL, "presence", "300",
i = eXosip_build_publish(&pub,from, to, sal_op_get_route(op), "presence", "300",
presence_style ? "application/xpidf+xml" : "application/pidf+xml", buf);
if (i<0){
ms_warning("Failed to build publish request.");

View file

@ -19,7 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphone.h"
static void fill_renderers(GtkTreeView *v){
GtkTreeViewColumn *c;
GtkCellRenderer *r;
@ -36,14 +35,16 @@ static void fill_renderers(GtkTreeView *v){
void call_log_selection_changed(GtkTreeView *v){
GtkTreeSelection *select;
GtkTreeIter iter;
GtkTreeModel *model;
GtkTreeModel *model=NULL;
select = gtk_tree_view_get_selection(v);
if (gtk_tree_selection_get_selected (select, &model, &iter)){
GtkTreePath *path=gtk_tree_model_get_path(model,&iter);
gtk_tree_view_collapse_all(v);
gtk_tree_view_expand_row(v,path,TRUE);
gtk_tree_path_free(path);
if (select!=NULL){
if (gtk_tree_selection_get_selected (select, &model, &iter)){
GtkTreePath *path=gtk_tree_model_get_path(model,&iter);
gtk_tree_view_collapse_all(v);
gtk_tree_view_expand_row(v,path,TRUE);
gtk_tree_path_free(path);
}
}
}
@ -91,19 +92,18 @@ void linphone_gtk_call_log_add_contact(GtkWidget *w){
static bool_t put_selection_to_uribar(GtkWidget *treeview){
GtkTreeSelection *sel;
sel=gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
if (sel!=NULL){
GtkTreeModel *model=NULL;
GtkTreeIter iter;
if (gtk_tree_selection_get_selected (sel,&model,&iter)){
gpointer pla;
LinphoneAddress *la;
char *tmp;
gtk_tree_model_get(model,&iter,2,&pla,-1);
la=(LinphoneAddress*)pla;
tmp=linphone_address_as_string (la);
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar")),tmp);
LinphoneAddress *la;
gtk_tree_model_get(model,&iter,2,&la,-1);
tmp=linphone_address_as_string(la);
if(tmp!=NULL)
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar")),tmp);
ms_free(tmp);
return TRUE;
}
@ -159,7 +159,6 @@ static GtkWidget *linphone_gtk_create_call_log_menu(GtkWidget *call_log){
gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item);
g_signal_connect_swapped(G_OBJECT(menu_item),"activate",(GCallback)linphone_gtk_call_log_chat_selected,call_log);
}
menu_item=gtk_image_menu_item_new_from_stock(GTK_STOCK_ADD,NULL);
gtk_widget_show(menu_item);
gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item);
@ -186,25 +185,77 @@ gboolean linphone_gtk_call_log_button_pressed(GtkWidget *widget, GdkEventButton
return FALSE;
}
void linphone_gtk_call_log_clear_missed_call(){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(mw,"viewswitch"));
GtkWidget *page=gtk_notebook_get_nth_page(notebook,0);
GtkWidget *box=gtk_hbox_new(FALSE,0);
GtkWidget *image=gtk_image_new_from_stock(GTK_STOCK_REFRESH,GTK_ICON_SIZE_MENU);
GtkWidget *l;
l=gtk_label_new("Recent calls");
gtk_box_pack_start(GTK_BOX(box),image,FALSE,FALSE,0);
gtk_box_pack_start(GTK_BOX(box),l,FALSE,FALSE,0);
gtk_notebook_set_tab_label(notebook,page,box);
gtk_widget_show_all(box);
}
gboolean linphone_gtk_call_log_reset_missed_call(GtkWidget *w, GdkEvent *event,gpointer user_data){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(mw,"viewswitch"));
gtk_notebook_set_current_page(notebook,0);
linphone_core_reset_missed_calls_count(linphone_gtk_get_core());
linphone_gtk_call_log_clear_missed_call();
return TRUE;
}
void linphone_gtk_call_log_display_missed_call(int nb){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(mw,"viewswitch"));
GtkWidget *page=gtk_notebook_get_nth_page(notebook,0);
GtkWidget *ebox=gtk_event_box_new();
GtkWidget *box=gtk_hbox_new(FALSE,0);
GtkWidget *image=gtk_image_new_from_stock(GTK_STOCK_REFRESH,GTK_ICON_SIZE_MENU);
GtkWidget *l;
gchar *buf;
buf=g_markup_printf_escaped(_("<b>Recent calls (%i)</b>"),nb);
l=gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(l),buf);
gtk_box_pack_start(GTK_BOX(box),image,FALSE,FALSE,0);
gtk_box_pack_start(GTK_BOX(box),l,FALSE,FALSE,0);
gtk_container_add(GTK_CONTAINER(ebox),box);
gtk_notebook_set_tab_label(notebook,page,ebox);
gtk_widget_add_events(ebox,GDK_BUTTON_PRESS_MASK);
g_signal_connect(G_OBJECT(ebox),"button_press_event",(GCallback)linphone_gtk_call_log_reset_missed_call,NULL);
gtk_widget_show_all(ebox);
}
void linphone_gtk_call_log_update(GtkWidget *w){
GtkTreeView *v=GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view"));
GtkTreeStore *store;
const MSList *logs;
GtkTreeSelection *select;
GtkWidget *notebook=linphone_gtk_get_widget(w,"viewswitch");
gint nb;
store=(GtkTreeStore*)gtk_tree_view_get_model(v);
if (store==NULL){
store=gtk_tree_store_new(3,GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_POINTER);
store=gtk_tree_store_new(3,GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_POINTER,G_TYPE_STRING);
gtk_tree_view_set_model(v,GTK_TREE_MODEL(store));
g_object_unref(G_OBJECT(store));
fill_renderers(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view")));
select=gtk_tree_view_get_selection(v);
gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
g_signal_connect_swapped(G_OBJECT(select),"changed",(GCallback)call_log_selection_changed,v);
g_signal_connect(G_OBJECT(notebook),"focus-tab",(GCallback)linphone_gtk_call_log_reset_missed_call,NULL);
g_signal_connect(G_OBJECT(v),"button-press-event",(GCallback)linphone_gtk_call_log_button_pressed,NULL);
// gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(w,"call_back_button")),
// create_pixmap (linphone_gtk_get_ui_config("callback_button","status-green.png")));
}
nb=linphone_core_get_missed_calls_count(linphone_gtk_get_core());
if(nb > 0)
linphone_gtk_call_log_display_missed_call(nb);
gtk_tree_store_clear (store);
for (logs=linphone_core_get_call_logs(linphone_gtk_get_core());logs!=NULL;logs=logs->next){
@ -237,7 +288,6 @@ void linphone_gtk_call_log_update(GtkWidget *w){
} else {
display=linphone_address_get_display_name(la);
}
if (display==NULL){
display=linphone_address_get_username (la);
if (display==NULL){
@ -294,7 +344,6 @@ void linphone_gtk_call_log_update(GtkWidget *w){
g_free(logtxt);
g_free(headtxt);
}
}
void linphone_gtk_history_row_activated(GtkWidget *treeview){

View file

@ -61,10 +61,9 @@ void linphone_gtk_quit_chatroom(LinphoneChatRoom *cr) {
GtkWidget *nb=linphone_gtk_get_widget(main_window,"viewswitch");
GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list");
GtkWidget *w=g_object_get_data(G_OBJECT(friendlist),"chatview");
int idx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"idx"));
g_return_if_fail(w!=NULL);
gtk_notebook_remove_page(GTK_NOTEBOOK(nb),idx);
gtk_notebook_remove_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb),w));
linphone_gtk_create_chat_picture(FALSE);
g_object_set_data(G_OBJECT(friendlist),"chatview",NULL);
g_object_set_data(G_OBJECT(w),"from_message",NULL);
@ -74,7 +73,8 @@ void linphone_gtk_quit_chatroom(LinphoneChatRoom *cr) {
}
const char* get_display_name(const LinphoneAddress *from){
const char *display=linphone_address_get_display_name(from);
const char *display;
display=linphone_address_get_display_name(from);
if (display==NULL || display[0]=='\0') {
display=linphone_address_get_username(from);
}
@ -92,7 +92,7 @@ GtkWidget *create_tab_chat_header(LinphoneChatRoom *cr,const LinphoneAddress *ur
gtk_button_set_relief(GTK_BUTTON(b),GTK_RELIEF_NONE);
gtk_widget_set_size_request(b,25,20);
g_signal_connect_swapped(G_OBJECT(b),"clicked",G_CALLBACK(linphone_gtk_quit_chatroom),cr);
l=gtk_label_new (get_display_name(uri));
l=gtk_label_new(get_display_name(uri));
gtk_box_pack_start (GTK_BOX(w),i,FALSE,FALSE,0);
gtk_box_pack_start (GTK_BOX(w),l,FALSE,FALSE,0);
gtk_box_pack_end(GTK_BOX(w),b,TRUE,TRUE,0);
@ -131,7 +131,12 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
char *from_message=(char *)g_object_get_data(G_OBJECT(w),"from_message");
GList *list=g_object_get_data(G_OBJECT(w),"list");
time_t t;
char buf[80];
time_t tnow;
struct tm *tm;
int tnow_day;
int tnow_year;
gtk_text_buffer_get_start_iter(buffer,&begin);
gtk_text_buffer_get_end_iter(buffer,&iter);
off=gtk_text_iter_get_offset(&iter);
@ -162,15 +167,22 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
}
case LinphoneChatMessageStateDelivered:
{
struct tm *tm=localtime(&t);
char buf[80];
tnow=time(NULL);
tm=gmtime(&tnow);
tnow_day=tm->tm_yday;
tnow_year=tm->tm_year;
tm=gmtime(&t);
if(tnow_day != tm->tm_yday || (tnow_day == tm->tm_yday && tnow_year != tm->tm_year)) {
strftime(buf,80,"%a %x, %H:%M",tm);
} else {
strftime(buf,80,"%H:%M",tm);
gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,buf,-1,
"right","small","italic","font_grey",me ? "bg":NULL,NULL);
break;
}
gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,buf,-1,
"right","small","italic","font_grey",me ? "bg":NULL,NULL);
break;
}
case LinphoneChatMessageStateNotDelivered:
gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Error",-1,
gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Message not sent",-1,
"right","small","italic","font_grey",me ? "bg":NULL,NULL);
break;
default : gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Sending ..",-1,
@ -202,6 +214,7 @@ void update_chat_state_message(LinphoneChatMessageState state,LinphoneChatMessag
GtkTextIter iter;
GtkTextIter end;
GtkTextIter start;
gchar *result;
gtk_text_buffer_get_iter_at_line(b,&iter,
GPOINTER_TO_INT(g_list_nth_data(list,0)));
@ -217,7 +230,6 @@ void update_chat_state_message(LinphoneChatMessageState state,LinphoneChatMessag
GPOINTER_TO_INT(g_list_nth_data(list,0)),0);
gtk_text_buffer_delete(b,&start,&end);
gtk_text_buffer_get_iter_at_line(b,&iter,GPOINTER_TO_INT(g_list_nth_data(list,0)));
gchar *result;
switch (state) {
case LinphoneChatMessageStateInProgress:
result="Sending ";
@ -225,7 +237,7 @@ void update_chat_state_message(LinphoneChatMessageState state,LinphoneChatMessag
case LinphoneChatMessageStateDelivered:
{
time_t t=time(NULL);
struct tm *tm=localtime(&t);
struct tm *tm=gmtime(&t);
char buf[80];
strftime(buf,80,"%H:%M",tm);
result=buf;
@ -295,6 +307,29 @@ void display_history_message(GtkWidget *chat_view,MSList *messages,const Linphon
}
}
void linphone_gtk_chat_add_contact(const LinphoneAddress *addr){
//LinphoneAddress *addr=(LinphoneAddress *)data;
LinphoneFriend *lf=NULL;
char *uri=linphone_address_as_string(addr);
lf=linphone_friend_new_with_addr(uri);
ms_free(uri);
char *fixed_uri=NULL;
gboolean show_presence=FALSE;
linphone_friend_set_inc_subscribe_policy(lf,LinphoneSPDeny);
linphone_friend_send_subscribe(lf,show_presence);
linphone_core_interpret_friend_uri(linphone_gtk_get_core(),uri,&fixed_uri);
if (fixed_uri==NULL){
linphone_gtk_display_something(GTK_MESSAGE_WARNING,_("Invalid sip contact !"));
return ;
}
linphone_friend_set_addr(lf,addr);
linphone_core_add_friend(linphone_gtk_get_core(),lf);
ms_free(fixed_uri);
linphone_gtk_show_friends();
}
GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddress *with){
GtkWidget *chat_view=linphone_gtk_create_widget("main","chatroom_frame");
GtkWidget *main_window=linphone_gtk_get_main_window ();
@ -312,7 +347,6 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres
color.red = 32512;
color.green = 32512;
color.blue = 32512;
colorb.red = 56832;
colorb.green = 60928;
colorb.blue = 61952;
@ -321,12 +355,12 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres
linphone_chat_room_mark_as_read(cr);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text),GTK_WRAP_WORD_CHAR);
gtk_text_view_set_editable(GTK_TEXT_VIEW(text),FALSE);
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(text),FALSE);
gtk_notebook_append_page(notebook,chat_view,create_tab_chat_header(cr,with));
idx = gtk_notebook_page_num(notebook, chat_view);
gtk_notebook_set_current_page(notebook, idx);
gtk_widget_show(chat_view);
g_object_set_data(G_OBJECT(chat_view),"cr",cr);
g_object_set_data(G_OBJECT(chat_view),"idx",GINT_TO_POINTER(idx));
g_object_set_data(G_OBJECT(chat_view),"from_message",NULL);
g_object_set_data(G_OBJECT(chat_view),"list",list);
gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
@ -369,7 +403,7 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,
char *uri_str=linphone_address_as_string(uri);
char *uri_only=linphone_address_as_string_uri_only(uri);
MSList *messages=NULL;
linphone_chat_room_mark_as_read(cr);
if(g_strcmp0(from_str,uri_only)!=0){
GtkTextView *text_view=GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview"));
@ -389,6 +423,7 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,
}
ms_free(from_str);
ms_free(uri_str);
ms_free(uri_only);
}
void linphone_gtk_chat_destroyed(GtkWidget *w){
@ -408,18 +443,27 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room,
GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list");
GtkWidget *w;
gboolean send=TRUE;
GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch");
char *from=linphone_address_as_string(linphone_chat_message_get_from(msg));
w=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
if(w!=NULL){
char *from_chatview=(char *)g_object_get_data(G_OBJECT(friendlist),"from");
if(g_strcmp0(from,from_chatview)==0){
send=TRUE;
} else {
if(!linphone_gtk_friend_list_is_contact(linphone_chat_message_get_from(msg))){
//linphone_gtk_load_chatroom(room,linphone_chat_message_get_from(msg),w);
linphone_gtk_chat_add_contact(linphone_chat_message_get_from(msg));
}
send=FALSE;
}
} else {
send=FALSE;
if(!linphone_gtk_friend_list_is_contact(linphone_chat_message_get_from(msg))){
//linphone_gtk_load_chatroom(room,linphone_chat_message_get_from(msg),w);
linphone_gtk_chat_add_contact(linphone_chat_message_get_from(msg));
}
w=linphone_gtk_init_chatroom(room,linphone_chat_message_get_from(msg));
g_object_set_data(G_OBJECT(friendlist),"chatview",(gpointer)w);
g_object_set_data(G_OBJECT(friendlist),"from",from);
@ -439,14 +483,13 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room,
}
#endif
if(send){
linphone_chat_room_mark_as_read(room);
if(gtk_notebook_get_current_page(notebook)!=gtk_notebook_page_num(notebook,w)){
linphone_gtk_show_friends();
}
linphone_gtk_push_text(w,linphone_chat_message_get_from(msg),
FALSE,room,msg,FALSE);
} else {
linphone_gtk_show_friends();
//linphone_gtk_friend_list_update_message(msg);
}
//linphone_gtk_update_chat_picture();
//gtk_window_present(GTK_WINDOW(w));
/*gtk_window_set_urgency_hint(GTK_WINDOW(w),TRUE);*/
//linphone_gtk_update_chat_picture();
}

View file

@ -32,7 +32,6 @@ enum{
FRIEND_ICON,
FRIEND_CALL,
FRIEND_CHAT,
FRIEND_NB_UNREAD_MSG,
FRIEND_LIST_NCOL
};
@ -76,17 +75,23 @@ static GdkPixbuf *create_call_picture(){
return pixbuf;
}
static GdkPixbuf *create_unread_msg(){
GdkPixbuf *pixbuf;
pixbuf = create_pixbuf("active_chat.png");
return pixbuf;
}
static GdkPixbuf *create_chat_picture(){
GdkPixbuf *pixbuf;
pixbuf = create_pixbuf("chat.png");
return pixbuf;
}
static GdkPixbuf *create_active_chat_picture(){
/*static GdkPixbuf *create_active_chat_picture(){
GdkPixbuf *pixbuf;
pixbuf = create_pixbuf("active_chat.png");
return pixbuf;
}
}*/
/*
void linphone_gtk_set_friend_status(GtkWidget *friendlist , LinphoneFriend * fid, const gchar *url, const gchar *status, const gchar *img){
GtkTreeIter iter;
@ -110,6 +115,16 @@ void linphone_gtk_set_friend_status(GtkWidget *friendlist , LinphoneFriend * fid
}
}
*/
gboolean linphone_gtk_friend_list_is_contact(const LinphoneAddress *addr){
LinphoneFriend *lf;
char *addr_str=linphone_address_as_string(addr);
lf=linphone_core_get_friend_by_address(linphone_gtk_get_core(),addr_str);
if(lf == NULL){
return FALSE;
} return TRUE;
}
static void linphone_gtk_set_selection_to_uri_bar(GtkTreeView *treeview){
GtkTreeSelection *select;
GtkTreeIter iter;
@ -156,28 +171,51 @@ void linphone_gtk_remove_contact(GtkWidget *button){
GtkTreeIter iter;
GtkTreeModel *model;
LinphoneFriend *lf=NULL;
LinphoneChatRoom *cr=NULL;
select = gtk_tree_view_get_selection(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"contact_list")));
if (gtk_tree_selection_get_selected (select, &model, &iter))
{
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
linphone_core_remove_friend(linphone_gtk_get_core(),lf);
gtk_tree_model_get (model, &iter,FRIEND_CHATROOM , &cr, -1);
linphone_chat_room_delete_history(cr);
linphone_gtk_show_friends();
}
}
void linphone_gtk_delete_history(GtkWidget *button){
GtkWidget *w=gtk_widget_get_toplevel(button);
GtkWidget *w=linphone_gtk_get_main_window();
GtkTreeSelection *select;
GtkTreeIter iter;
GtkTreeModel *model;
GtkWidget *chat_view;
LinphoneFriend *lf=NULL;
select = gtk_tree_view_get_selection(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"contact_list")));
GtkWidget *friendlist;
friendlist=linphone_gtk_get_widget(w,"contact_list");
chat_view=(GtkWidget *)g_object_get_data(G_OBJECT(friendlist),"chatview");
select = gtk_tree_view_get_selection(GTK_TREE_VIEW(friendlist));
if (gtk_tree_selection_get_selected (select, &model, &iter))
{
LinphoneChatRoom *cr;
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
cr=linphone_core_get_chat_room(linphone_gtk_get_core(),linphone_friend_get_address(lf));
gtk_tree_model_get (model, &iter,FRIEND_CHATROOM , &cr, -1);
linphone_chat_room_delete_history(cr);
if(chat_view!=NULL){
char *from=g_object_get_data(G_OBJECT(friendlist),"from");
char *addr=linphone_address_as_string(linphone_friend_get_address(lf));
if(g_strcmp0(from,addr)==0){
GtkTextView *text_view=GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview"));
GtkTextIter start;
GtkTextIter end;
GtkTextBuffer *text_buffer;
text_buffer=gtk_text_view_get_buffer(text_view);
gtk_text_buffer_get_bounds(text_buffer, &start, &end);
gtk_text_buffer_delete (text_buffer, &start, &end);
g_object_set_data(G_OBJECT(chat_view),"from_message",NULL);
}
}
linphone_gtk_show_friends();
}
}
@ -209,7 +247,7 @@ static gboolean grab_focus(GtkWidget *w){
return FALSE;
}
void linphone_gtk_tree_view_set_chat_conversation(LinphoneAddress *la){
void linphone_gtk_tree_view_set_chat_conversation(const LinphoneAddress *la){
GtkTreeIter iter;
GtkListStore *store=NULL;
GtkWidget *w = linphone_gtk_get_main_window();
@ -240,7 +278,7 @@ void linphone_gtk_tree_view_set_chat_conversation(LinphoneAddress *la){
do{
const LinphoneAddress *uri;
char *lf_str;
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
gtk_tree_model_get(model, &iter,FRIEND_ID , &lf, -1);
uri=linphone_friend_get_address(lf);
lf_str=linphone_address_as_string(uri);
if( g_strcmp0(lf_str,la_str)==0){
@ -259,14 +297,30 @@ void linphone_gtk_tree_view_set_chat_conversation(LinphoneAddress *la){
gtk_notebook_set_current_page(notebook,gtk_notebook_page_num(notebook,chat_view));
linphone_gtk_create_chat_picture(FALSE);
g_idle_add((GSourceFunc)grab_focus,linphone_gtk_get_widget(chat_view,"text_entry"));
gtk_list_store_set(store,&iter,FRIEND_CHAT,create_active_chat_picture(),-1);
gtk_list_store_set(store,&iter,FRIEND_NB_UNREAD_MSG,"",-1);
break;
}
}while(gtk_tree_model_iter_next(model,&iter));
}
}
}
void linphone_gtk_notebook_tab_select(GtkNotebook *notebook,GtkWidget *page,guint page_num, gpointer data){
GtkWidget *w=linphone_gtk_get_main_window();
GtkWidget *friendlist=linphone_gtk_get_widget(w,"contact_list");
GtkWidget *chat_view;
LinphoneChatRoom *cr=NULL;
const LinphoneAddress *addr=(const LinphoneAddress *)data;
chat_view=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
if(page != NULL){
notebook=(GtkNotebook *)linphone_gtk_get_widget(w,"viewswitch");
if(gtk_notebook_page_num(notebook,page)==gtk_notebook_page_num(notebook,chat_view)){
cr=linphone_core_get_chat_room(linphone_gtk_get_core(),addr);
if(cr!=NULL){
linphone_chat_room_mark_as_read(cr);
linphone_gtk_show_friends();
}
}
}
}
void linphone_gtk_chat_selected(GtkWidget *item){
@ -303,8 +357,7 @@ void linphone_gtk_chat_selected(GtkWidget *item){
gtk_notebook_set_current_page(notebook,gtk_notebook_page_num(notebook,page));
linphone_gtk_create_chat_picture(FALSE);
g_idle_add((GSourceFunc)grab_focus,linphone_gtk_get_widget(page,"text_entry"));
gtk_list_store_set(store,&iter,FRIEND_CHAT,create_active_chat_picture(),-1);
gtk_list_store_set(store,&iter,FRIEND_NB_UNREAD_MSG,"",-1);
g_signal_connect(G_OBJECT(notebook),"switch_page",(GCallback)linphone_gtk_notebook_tab_select,(gpointer)uri);
}
}
@ -577,8 +630,7 @@ static void linphone_gtk_friend_list_init(GtkWidget *friendlist){
linphone_gtk_init_bookmark_icon();
store = gtk_list_store_new(FRIEND_LIST_NCOL,GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER,
G_TYPE_POINTER, G_TYPE_STRING, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF,
G_TYPE_STRING, G_TYPE_STRING);
G_TYPE_POINTER, G_TYPE_STRING, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF);
gtk_tree_view_set_model(GTK_TREE_VIEW(friendlist),GTK_TREE_MODEL(store));
g_object_unref(G_OBJECT(store));
@ -588,7 +640,7 @@ static void linphone_gtk_friend_list_init(GtkWidget *friendlist){
gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(friendlist),friend_search_func,NULL,NULL);
gtk_tree_view_set_search_column(GTK_TREE_VIEW(friendlist),FRIEND_NAME);
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store),FRIEND_NAME,friend_sort,NULL,NULL);
/*Name and presence column*/
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Presence status"),
@ -599,6 +651,7 @@ static void linphone_gtk_friend_list_init(GtkWidget *friendlist){
g_signal_connect_swapped(G_OBJECT(column),"clicked",(GCallback)on_presence_column_clicked,GTK_TREE_MODEL(store));
gtk_tree_view_column_set_clickable(column,TRUE);
gtk_tree_view_column_set_visible(column,linphone_gtk_get_ui_config_int("friendlist_status",1));
gtk_tree_view_column_set_min_width(column,50);
renderer = gtk_cell_renderer_pixbuf_new();
gtk_tree_view_column_pack_start(column,renderer,TRUE);
@ -616,11 +669,6 @@ static void linphone_gtk_friend_list_init(GtkWidget *friendlist){
gtk_tree_view_column_set_clickable(column,TRUE);
gtk_tree_view_column_set_expand(column,TRUE);
gtk_tree_view_column_set_max_width(column,60);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start(column,renderer,TRUE);
gtk_tree_view_column_add_attribute (column,renderer,"text",FRIEND_NB_UNREAD_MSG);
gtk_tree_view_append_column (GTK_TREE_VIEW (friendlist), column);
/* Call column*/
@ -641,7 +689,7 @@ static void linphone_gtk_friend_list_init(GtkWidget *friendlist){
gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(friendlist),FRIEND_SIP_ADDRESS);
#endif
gtk_widget_set_size_request(friendlist,200,100);
gtk_widget_set_size_request(friendlist,200,120);
/*gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(
gtk_widget_get_toplevel(friendlist),"show_category")),0);*/
}
@ -713,7 +761,6 @@ void linphone_gtk_show_friends(void){
LinphoneChatRoom *cr=NULL;
linphone_gtk_show_directory_search();
if (gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist))==NULL){
linphone_gtk_friend_list_init(friendlist);
}
@ -735,7 +782,7 @@ void linphone_gtk_show_friends(void){
const char *name=linphone_address_get_display_name(f_uri);
const char *display=name;
char *escaped=NULL;
char buf[26]={0};
//char buf[26]={0};
int nbmsg=0;
/*if (lookup){
@ -752,26 +799,13 @@ void linphone_gtk_show_friends(void){
gtk_list_store_append(store,&iter);
gtk_list_store_set(store,&iter,FRIEND_NAME, display,FRIEND_ID,lf,
FRIEND_PRESENCE_IMG, send_subscribe ? create_status_picture(linphone_friend_get_status(lf)) : NULL,
-1);
gtk_tree_model_get(gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist)),&iter,FRIEND_CHATROOM,&cr,-1);
if(cr!=NULL){
nbmsg=linphone_chat_room_get_unread_messages_count(cr);
if(nbmsg != 0){
sprintf(buf,"%i",nbmsg);
}
} else {
cr=linphone_gtk_create_chatroom(f_uri);
gtk_list_store_set(store,&iter,FRIEND_CHATROOM,cr,-1);
nbmsg=linphone_chat_room_get_unread_messages_count(cr);
if(nbmsg != 0){
sprintf(buf,"%i",nbmsg);
}
FRIEND_CHAT,create_chat_picture(),FRIEND_CALL,create_call_picture(),-1);
cr=linphone_gtk_create_chatroom(f_uri);
gtk_list_store_set(store,&iter,FRIEND_CHATROOM,cr,-1);
nbmsg=linphone_chat_room_get_unread_messages_count(cr);
if(nbmsg != 0){
gtk_list_store_set(store,&iter,FRIEND_CHAT,create_unread_msg(),-1);
}
gtk_list_store_set(store,&iter,FRIEND_CALL,create_call_picture(),-1);
gtk_list_store_set(store,&iter,FRIEND_CHAT,create_chat_picture(),-1);
gtk_list_store_set(store,&iter,FRIEND_NB_UNREAD_MSG,buf,-1);
escaped=g_markup_escape_text(uri,-1);
gtk_list_store_set(store,&iter,FRIEND_SIP_ADDRESS,escaped,-1);
g_free(escaped);
@ -823,6 +857,7 @@ void linphone_gtk_contact_ok(GtkWidget *button){
char *fixed_uri=NULL;
gboolean show_presence=FALSE,allow_presence=FALSE;
const gchar *name,*uri;
LinphoneAddress* friend_address;
if (lf==NULL){
lf=linphone_friend_new();
if (linphone_gtk_get_ui_config_int("use_subscribe_notify",1)==1){
@ -841,7 +876,7 @@ void linphone_gtk_contact_ok(GtkWidget *button){
linphone_gtk_display_something(GTK_MESSAGE_WARNING,_("Invalid sip contact !"));
return ;
}
LinphoneAddress* friend_address = linphone_address_new(fixed_uri);
friend_address = linphone_address_new(fixed_uri);
linphone_address_set_display_name(friend_address,name);
linphone_friend_set_addr(lf,friend_address);
linphone_address_destroy(friend_address);

View file

@ -431,8 +431,6 @@ void linphone_gtk_remove_in_call_view(LinphoneCall *call){
int idx;
g_return_if_fail(w!=NULL);
idx=gtk_notebook_page_num(GTK_NOTEBOOK(nb),w);
gtk_notebook_remove_page (GTK_NOTEBOOK(nb),idx);
gtk_widget_destroy(w);
if (in_conf){
linphone_gtk_unset_from_conference(call);
}
@ -444,12 +442,13 @@ void linphone_gtk_remove_in_call_view(LinphoneCall *call){
/*show the conference*/
gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb),
g_object_get_data(G_OBJECT(main_window),"conf_frame")));
}else gtk_notebook_set_current_page(GTK_NOTEBOOK(nb), 0);
}else gtk_notebook_prev_page(GTK_NOTEBOOK(nb));
}else{
/*show the active call*/
gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb),
linphone_call_get_user_pointer(call)));
gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb), linphone_call_get_user_pointer(call)));
}
gtk_notebook_remove_page (GTK_NOTEBOOK(nb),idx);
gtk_widget_destroy(w);
}
static void display_peer_name_in_label(GtkWidget *label, const LinphoneAddress *from){

View file

@ -152,5 +152,5 @@ void linphone_gtk_monitor_usb(void);
void linphone_gtk_unmonitor_usb(void);
gchar *linphone_gtk_get_record_path(const LinphoneAddress *address, gboolean is_conference);
void linphone_gtk_friend_list_update_message(LinphoneChatMessage *msg);
void linphone_gtk_tree_view_set_chat_conversation(LinphoneAddress *la);
void linphone_gtk_tree_view_set_chat_conversation(const LinphoneAddress *la);
gboolean linphone_gtk_friend_list_is_contact(const LinphoneAddress *addr);

View file

@ -1726,6 +1726,7 @@ static void linphone_gtk_init_main_window(){
linphone_gtk_load_identities();
linphone_gtk_set_my_presence(linphone_core_get_presence_info(linphone_gtk_get_core()));
linphone_gtk_show_friends();
linphone_core_reset_missed_calls_count(linphone_gtk_get_core());
main_window=linphone_gtk_get_main_window();
linphone_gtk_call_log_update(main_window);
@ -1748,7 +1749,6 @@ static void linphone_gtk_init_main_window(){
linphone_gtk_check_menu_items();
}
void linphone_gtk_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){
if (verbose){
const char *lname="undef";

View file

@ -794,6 +794,8 @@
<object class="GtkWindow" id="main">
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="default_width">660</property>
<property name="default_height">450</property>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
@ -1042,6 +1044,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">6</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
@ -1247,49 +1250,11 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="erase_call_logs_button">
<property name="label">gtk-clear</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="linphone_gtk_clear_call_logs" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkFrame" id="directory_search_box">
<property name="can_focus">False</property>
@ -1375,7 +1340,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">2</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -1401,14 +1366,47 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="erase_call_logs_button">
<property name="label">gtk-clear</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="linphone_gtk_clear_call_logs" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
@ -1428,6 +1426,7 @@
<object class="GtkHBox" id="hbox6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="button-press-event" handler="linphone_gtk_call_log_reset_missed_call" swapped="no"/>
<child>
<object class="GtkImage" id="history_tab_icon">
<property name="visible">True</property>

View file

@ -18,9 +18,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core;
/**
* Enum representing the direction of a call.
**/
public class CallDirection {
/**
* outgoing calls*
* */
public static CallDirection Outgoing = new CallDirection("CallOutgoing");
/**
* incoming calls
*/
public static CallDirection Incoming = new CallDirection("Callincoming");
private String mStringValue;
private CallDirection(String aStringValue) {

View file

@ -39,21 +39,48 @@ public interface LinphoneAddress {
*/
public String getUserName();
/**
*
* Domain name
* @return null if not set
*/
public String getDomain();
/**
* Port as String
* @return null if not set
*/
public String getPort();
/**
* Port as integer value.
* @return negative value if not set if not set
*/
public int getPortInt();
/**
* set display name
* @param name
*/
public void setDisplayName(String name);
/**
* set user name
* @param username
*/
public void setUserName(String username);
/**
* set domain name
* @param domain
*/
public void setDomain(String domain);
/**
* set port as String
* @param port, null if not set
*/
public void setPort(String port);
/**
* set port as int
* @param port, negative value if not set
*/
public void setPortInt(int port);
/**
* Removes address's tags and uri headers so that it is displayable to the user.
**/
public void clean();
/**

View file

@ -20,7 +20,7 @@ package org.linphone.core;
/**
* Object holding authentication information.
* In most case, authentication information consists of a username and password. Sometimes, a userid is required by proxy, and realm can be useful to discriminate different SIP domains.
*<br>This object is instanciated using {@link LinphoneCoreFactory#createAuthInfo(String, String, String)}.
*<br>This object is instantiated using either {@link LinphoneCoreFactory#createAuthInfo(String, String, String)} or {@link LinphoneCoreFactory#createAuthInfo(String, String, String, String, String)}.
*<br>
*Once created and filled, a LinphoneAuthInfo must be added to the LinphoneCore in order to become known and used automatically when needed.
*Use {@link LinphoneCore#addAuthInfo(LinphoneAuthInfo)} for that purpose.

View file

@ -24,7 +24,11 @@ package org.linphone.core;
import java.util.Vector;
/**
* Object representing a call log.
*
*
**/
public interface LinphoneCallLog {
/**
* Represents call status
@ -91,26 +95,30 @@ public interface LinphoneCallLog {
public CallDirection getDirection();
/**
* get status of this call
* @return
* @return CallStatus
*/
public CallStatus getStatus();
/**
* @return a human readble String with the start date/time of the call
* A human readable String with the start date/time of the call
* @return String
*/
public String getStartDate();
/**
* @return a timestamp of the start date/time of the call in milliseconds since January 1st 1970
* A timestamp of the start date/time of the call in milliseconds since January 1st 1970
* @return long
*/
public long getTimestamp();
/**
* @return the call duration, in seconds
* The call duration, in seconds
* @return int
*/
public int getCallDuration();
/**
* @return the call id from signaling
* Call id from signaling
* @return int
*/
public int getCallId();
}

View file

@ -20,6 +20,9 @@ package org.linphone.core;
import java.util.Vector;
import org.linphone.core.LinphoneCall.State;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
/**
* Linphone core main object created by method {@link LinphoneCoreFactory#createLinphoneCore(LinphoneCoreListener, String, String, Object)}.
*
@ -172,11 +175,22 @@ public interface LinphoneCore {
}
/**
* Signaling transports ports.
* Linphone core SIP transport ports.
* Use with {@link LinphoneCore#setSignalingTransportPorts(Transports)}
* @ingroup initializing
*/
static public class Transports {
/**
* udp port to listening on, negative value if not set
* */
public int udp;
/**
* tcp port to listening on, negative value if not set
* */
public int tcp;
/**
* tls port to listening on, negative value if not set
* */
public int tls;
public Transports() {};
@ -389,10 +403,10 @@ public interface LinphoneCore {
public LinphoneCall invite(String destination)throws LinphoneCoreException;
/**
* Initiates an outgoing call given a destination LinphoneAddress
*<br>The LinphoneAddress can be constructed directly using linphone_address_new(), or created by linphone_core_interpret_url(). The application doesn't own a reference to the returned LinphoneCall object. Use linphone_call_ref() to safely keep the LinphoneCall pointer valid within your application.
*<br>The LinphoneAddress can be constructed directly using {@link LinphoneCoreFactory#createLinphoneAddress} , or created {@link LinphoneCore#interpretUrl(String)}. .
* @param to the destination of the call (sip address).
* @return LinphoneCall
* @throws LinphoneCoreException
* @return linphone call
* @throws LinphoneCoreException if linphone call cannot be created
*/
public LinphoneCall invite(LinphoneAddress to)throws LinphoneCoreException;
/**
@ -402,6 +416,8 @@ public interface LinphoneCore {
public void terminateCall(LinphoneCall aCall);
/**
* Declines an incoming call, providing a reason for declining it.
* @param call the LinphoneCall, must be in the {@link LinphoneCall.State#IncomingReceived} state.
* @param reason the reason for rejecting the call: {@link Reason#Declined} or {@link Reason#Busy}
*/
public void declineCall(LinphoneCall aCall, Reason reason);
/**
@ -417,7 +433,7 @@ public interface LinphoneCore {
public LinphoneAddress getRemoteAddress();
/**
*
* @return TRUE if there is a call running or pending.
* @return true if there is a call running or pending.
*/
public boolean isIncall();
/**
@ -482,8 +498,6 @@ public interface LinphoneCore {
*/
public void deferCallUpdate(LinphoneCall aCall) throws LinphoneCoreException;
public void startRinging();
/**
* @return a list of LinphoneCallLog
*/
@ -499,7 +513,7 @@ public interface LinphoneCore {
*/
public void setNetworkReachable(boolean isReachable);
/**
*
* Get network state has known by {@link LinphoneCore}
* @return if false, there is no network connection.
*/
public boolean isNetworkReachable();
@ -541,16 +555,16 @@ public interface LinphoneCore {
/**
* Initiate a dtmf signal if in call
* @param number
* @param send dtmf ['0'..'9'] | '#', '*'
*/
void sendDtmf(char number);
/**
* Initiate a dtmf signal to the speaker if not in call.
* Sending of the DTMF is done in another function.
* @param number
* @param dtmf ['0'..'9'] | '#', '*'
* @param duration in ms , -1 for unlimited
*/
void playDtmf(char number,int duration);
void playDtmf(char dtmf,int duration);
/**
* stop current dtmf
*/
@ -560,23 +574,43 @@ public interface LinphoneCore {
* remove all call logs
*/
void clearCallLogs();
/***
* get payload type from mime type, clock rate, and number of channels.-
*
* return null if not found
*/
/**
* Get payload type from mime type and clock rate
*
* This function searches in audio and video codecs for the given payload type name and clockrate.
* @param mime payload mime type (I.E SPEEX, PCMU, VP8)
* @param clockRate (I.E 8000, 16000, 90000, ...)
* @param channels number of channels
* @return Returns null if not found.
*/
PayloadType findPayloadType(String mime, int clockRate, int channels);
/***
* get payload type from mime type and clock rate..
*
* return null if not found
* Same as @{link {@link #findPayloadType(String, int, int)} but ignoring channels params
* @param mime payload mime type (I.E SPEEX, PCMU, VP8)
* @param clockRate (I.E 8000, 16000, 90000, ...)
* @return null if not found
*/
PayloadType findPayloadType(String mime, int clockRate);
/***
* get payload type from mime type
* Same as @{link {@link #findPayloadType(String, int, int)} but ignoring channels and clock rate params
* @param mime payload mime type (I.E SPEEX, PCMU, VP8)
* @return null if not found
*/
PayloadType findPayloadType(String mime);
/**
* not implemented yet
* @param pt
* @param enable
* @throws LinphoneCoreException
* Enable payload type
* @param pt payload type to enable, can be retrieve from {@link #findPayloadType}
* @param true if enabled
* @exception LinphoneCoreException
*
*/
void enablePayloadType(PayloadType pt, boolean enable) throws LinphoneCoreException;
/**
@ -595,10 +629,11 @@ public interface LinphoneCore {
*/
boolean isEchoLimiterEnabled();
/**
* @param transports used for signaling (TCP, UDP and TLS)
* Set transport ports linphone core will listen on
* @param local transports ports used for signaling (TCP, UDP and TLS)
*/
void setSignalingTransportPorts(Transports transports);
/**
/**Get
* @return transports used for signaling (TCP, UDP, TLS)
*/
Transports getSignalingTransportPorts();
@ -632,12 +667,36 @@ public interface LinphoneCore {
* @return {@link LinphoneChatRoom} where messaging can take place.
*/
LinphoneChatRoom createChatRoom(String to);
/**
* Set the native video window id where the video is to be displayed.
* On Android, it must be of type {@link AndroidVideoWindowImpl}
* @param video window of type {@link AndroidVideoWindowImpl}
**/
void setVideoWindow(Object w);
/**
* Set the native video window id where the video preview is to be displayed.
* On Android, it must of type {@link SurfaceView}
* @param video window of type {@link SurfaceView}
**/
void setPreviewWindow(Object w);
/**
* Tells the core the device current orientation. This can be used by capture filters
* on mobile devices to select between portrait/landscape mode and to produce properly
* oriented images. The exact meaning of the value in rotation if left to each device
* specific implementations.
*@param rotation . Android supported values are 0, 90, 180 and 270.
*
**/
void setDeviceRotation(int rotation);
/**
* Sets the active video device.
*
* @param id of the video device as returned by {@link AndroidCameraConfiguration#retrieveCameras}
**/
void setVideoDevice(int id);
/**
* Returns the id of the currently active video device as found in {@link AndroidCameraConfiguration#retrieveCameras}.
**/
int getVideoDevice();
/**
@ -665,6 +724,7 @@ public interface LinphoneCore {
*/
void setStunServer(String stun_server);
/**
* Get STUN server
* @return stun server address if previously set.
*/
String getStunServer();
@ -678,11 +738,35 @@ public interface LinphoneCore {
* @return previously set firewall policy.
*/
FirewallPolicy getFirewallPolicy();
/**
* Initiates an outgoing call given a destination LinphoneAddress
*
* @param addr the destination of the call {@link #LinphoneAddress }.
* @param params call parameters {@link #LinphoneCallParams }
*
*<br>The LinphoneAddress can be constructed directly using {@link LinphoneCoreFactory#createLinphoneAddress} , or created {@link LinphoneCore#interpretUrl(String)}. .
*
* @return a {@link #LinphoneCall LinphoneCall} object
* @throws LinphoneCoreException in case of failure
**/
LinphoneCall inviteAddressWithParams(LinphoneAddress destination, LinphoneCallParams params) throws LinphoneCoreException ;
/**
* Updates a running call according to supplied call parameters or parameters changed in the LinphoneCore.
*
* In this version this is limited to the following use cases:
* - setting up/down the video stream according to the video parameter of the {@link LinphoneCallParams} (see {@link LinphoneCallParams#enableVideo} ).
* - changing the size of the transmitted video after calling {@link LinphoneCore#setPreferredVideoSize(VideoSize)}
*
* In case no changes are requested through the {@link LinphoneCallParams} argument, then this argument can be omitted and set to null.
* @param call the {@link LinphoneCall} to be updated
* @param params the new {@link LinphoneCallParams call parameters} to use. (may be NULL)
* @return 0 if successful, -1 otherwise.
**/
int updateCall(LinphoneCall call, LinphoneCallParams params);
/**
* Get default call parameters reflecting current linphone core configuration
* @return LinphoneCallParams
*/
LinphoneCallParams createDefaultCallParameters();
/**
@ -694,7 +778,7 @@ public interface LinphoneCore {
/**
* gets the path to a wav file used for ringing.
*
* @param null if not set
* @return null if not set
*/
String getRing();
@ -706,7 +790,18 @@ public interface LinphoneCore {
void setRootCA(String path);
void setUploadBandwidth(int bw);
/**
* Sets maximum available download bandwidth
*
*
* This is IP bandwidth, in kbit/s.
* This information is used signaled to other parties during
* calls (within SDP messages) so that the remote end can have
* sufficient knowledge to properly configure its audio & video
* codec output bitrate to not overflow available bandwidth.
*
* @param bw the bandwidth in kbits/s, 0 for infinite
*/
void setDownloadBandwidth(int bw);
/**
@ -720,9 +815,20 @@ public interface LinphoneCore {
* @param ptime packetization interval in milliseconds
*/
void setUploadPtime(int ptime);
/**
* Sets the preferred video size.
*
* This applies only to the stream that is captured and sent to the remote party,
* since we accept all standard video size on the receive path.
* @param vSize
*
**/
void setPreferredVideoSize(VideoSize vSize);
/**
* get current preferred video size for sending.
* @return video size
*
**/
VideoSize getPreferredVideoSize();
/**
@ -766,13 +872,18 @@ public interface LinphoneCore {
void adjustSoftwareVolume(int i);
/**
* Pause a call.
* Pauses a call. If a music file has been setup using {@link LinphoneCore#setPlayFile(String)},
* this file will be played to the remote user.
*
**/
boolean pauseCall(LinphoneCall call);
/**
* Resume a call.
**/
boolean resumeCall(LinphoneCall call);
/**
* Pause all currently running calls.
**/
boolean pauseAllCalls();
void setZrtpSecretsCache(String file);
@ -783,33 +894,75 @@ public interface LinphoneCore {
**/
boolean isInConference();
/**
* Connect the local user to the conference.
* Moves the local participant inside the conference.
*
* Makes the local participant to join the conference.
* Typically, the local participant is by default always part of the conference when joining an active call into a conference.
* However, by calling {@link #leaveConference()} and {@link #enterConference()} the application can decide to temporarily
* move out and in the local participant from the conference.
*
* @returns true if successful
**/
boolean enterConference();
/**
* Disconnect the local user from the conference.
* Moves the local participant out of the conference.
* When the local participant is out of the conference, the remote participants can continue to talk normally.
**/
void leaveConference();
/**
* Add an established call to the conference. The LinphoneCore is able to manage one client based conference.
* Merge a call into a conference.
*
* If this is the first call that enters the conference, the virtual conference will be created automatically.
* If the local user was actively part of the call (ie not in paused state), then the local user is automatically entered into the conference.
* If the call was in paused state, then it is automatically resumed when entering into the conference.
* @param call an established call, either in {@link LinphoneCall.State#StreamsRunning} or {@link LinphoneCall.State#Paused} state.
*
**/
void addToConference(LinphoneCall call);
/**
* Remove an established call from the conference.
**/
* Remove a call from the conference.
* @param call a call that has been previously merged into the conference.
*
* After removing the remote participant belonging to the supplied call, the call becomes a normal call in paused state.
* If one single remote participant is left alone together with the local user in the conference after the removal, then the conference is
* automatically transformed into a simple call in StreamsRunning state.
* The conference's resources are then automatically destroyed.
*
* In other words, unless {@link #leaveConference()} is explicitely called, the last remote participant of a conference is automatically
* put in a simple call in running state.
*
**/
void removeFromConference(LinphoneCall call);
/**
* Add all calls into a conference.
*
* Merge all established calls (either in {@link LinphoneCall.State#StreamsRunning} or {@link LinphoneCall.State#Paused}) into a conference.
*
**/
void addAllToConference();
/**
* Terminate the conference, all users are disconnected.
* Terminates the conference and the calls associated with it.
*
* All the calls that were merged to the conference are terminated, and the conference resources are destroyed.
*
**/
void terminateConference();
/**
* Returns the number of participants to the conference, including the local participant.
*
* Typically, after merging two calls into the conference, there is total of 3 participants:
* the local participant (or local user), and two remote participants that were the destinations of the two previously establised calls.
*
* @returns the number of participants to the conference
**/
int getConferenceSize();
/**
* Request recording of the conference into a supplied file path.
* The format is wav.
* @param path where to write recording file
**/
void startConferenceRecording(String path);
@ -817,22 +970,60 @@ public interface LinphoneCore {
* Stop recording of the conference.
**/
void stopConferenceRecording();
/**
* Terminates all the calls.
*/
void terminateAllCalls();
/**
* Returns all calls.
* @return an array with all call currently handle by Linphone core
**/
LinphoneCall[] getCalls();
/**
* Get number of calls currently handled by Linphone core
* @returns number of calls
* */
int getCallsNb();
/**
* Performs a simple call transfer to the specified destination.
*
* @param call The current local call remains active and thus can be later paused or terminated.
* @param referTo The remote call party endpoint is expected to issue a new call to this specified destination.
**/
void transferCall(LinphoneCall call, String referTo);
/**
* Transfer a call to destination of another running call. This is used for "attended transfer" scenarios.
* The transfered call is supposed to be in paused state, so that it is able to accept the transfer immediately.
* The destination call is a call previously established to introduce the transfered person.
* This method will send a transfer request to the transfered person. The phone of the transfered is then
* expected to automatically call to the destination of the transfer. The receiver of the transfer will then automatically
* close the call with us (the 'dest' call).
* @param call a running call you want to transfer
* @param dest a running call whose remote person will receive the transfer
**/
void transferCallToAnother(LinphoneCall callToTransfer, LinphoneCall destination);
/**
* Search from the list of current calls if a remote address match uri
* @param uri which should match call remote uri
* @return LinphoneCall or NULL is no match is found
*/
LinphoneCall findCallFromUri(String uri);
/**
* Get the maximum number of simultaneous calls Linphone core can manage at a time. All new call above this limit are declined with a busy answer
* @return max number of simultaneous calls
*/
int getMaxCalls();
/**
* Set the maximum number of simultaneous calls Linphone core can manage at a time. All new call above this limit are declined with a busy answer
* @param max number of simultaneous calls
*/
void setMaxCalls(int max);
/**
* @deprecated
* @param uri
* @return
*/
boolean isMyself(String uri);
/**
@ -884,15 +1075,31 @@ public interface LinphoneCore {
void tunnelAddServerAndMirror(String host, int port, int udpMirrorPort, int roundTripDelay);
boolean isTunnelAvailable();
/**
* Returns an unmodifiable list of entered proxy configurations.
* @return list of proxy config
**/
LinphoneProxyConfig[] getProxyConfigList();
/**
* Sets the default policy for video.
* This policy defines whether:
* @param autoInitiate video shall be initiated by default for outgoing calls
* @param autoAccept video shall be accepter by default for incoming calls
**/
void setVideoPolicy(boolean autoInitiate, boolean autoAccept);
/** Set static picture to be used when "Static picture" is the video device
* @param path to the static picture file
* */
void setStaticPicture(String path);
/**
* Sets the user agent string used in SIP messages.
* @param user agent name
* @param user agent version
**/
void setUserAgent(String name, String version);
/**
* Set the number of cores used for media processing
* */
void setCpuCount(int count);
/**
@ -961,7 +1168,10 @@ public interface LinphoneCore {
* Once this time is elapsed (ringing included), the call is automatically hung up.
**/
void setInCallTimeout(int timeout);
/**
* Allow to control microphone level:
* @param gain in db
**/
void setMicrophoneGain(float gain);
/**

View file

@ -48,6 +48,12 @@ abstract public class LinphoneCoreFactory {
}
return theLinphoneCoreFactory;
}
/**
* create {@link LinphoneAuthInfo}
* @param username
* @param userid user id as set in auth header
* @param passwd
* */
abstract public LinphoneAuthInfo createAuthInfo(String username,String password, String realm);
/**
* create {@link LinphoneAuthInfo}

View file

@ -745,12 +745,6 @@ class LinphoneCoreImpl implements LinphoneCore {
deferCallUpdate(nativePtr, getCallPtr(aCall));
}
public synchronized void startRinging() {
if (!contextInitialized()) return;
if (Hacks.needGalaxySAudioHack()) {
mAudioManager.setMode(MODE_RINGTONE);
}
}
private native void setVideoPolicy(long nativePtr, boolean autoInitiate, boolean autoAccept);
public synchronized void setVideoPolicy(boolean autoInitiate, boolean autoAccept) {
@ -801,10 +795,17 @@ class LinphoneCoreImpl implements LinphoneCore {
public String getVersion() {
return getVersion(nativePtr);
}
/**
* Wildcard value used by #linphone_core_find_payload_type to ignore rate in search algorithm
*/
static int FIND_PAYLOAD_IGNORE_RATE = -1;
/**
* Wildcard value used by #linphone_core_find_payload_type to ignore channel in search algorithm
*/
static int FIND_PAYLOAD_IGNORE_CHANNELS = -1;
@Override
public synchronized PayloadType findPayloadType(String mime, int clockRate) {
return findPayloadType(mime, clockRate, 1);
return findPayloadType(mime, clockRate, FIND_PAYLOAD_IGNORE_CHANNELS);
}
private native void removeFriend(long ptr, long lf);
@ -908,4 +909,8 @@ class LinphoneCoreImpl implements LinphoneCore {
public void stopConferenceRecording() {
stopConferenceRecording(nativePtr);
}
@Override
public PayloadType findPayloadType(String mime) {
return findPayloadType(mime, FIND_PAYLOAD_IGNORE_RATE);
}
}