mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
allow multiple transports in gtk application, allow to configure transport per proxy (not yet finished)
This commit is contained in:
parent
ab7e606d38
commit
6f9f860a2e
9 changed files with 331 additions and 196 deletions
|
|
@ -112,11 +112,21 @@ void linphone_address_set_domain(LinphoneAddress *uri, const char *host){
|
|||
* Sets the port number.
|
||||
**/
|
||||
void linphone_address_set_port(LinphoneAddress *uri, int port){
|
||||
#ifdef USE_BELLESIP
|
||||
sal_address_set_port(uri,port);
|
||||
#else
|
||||
sal_address_set_port_int(uri,port);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a transport.
|
||||
**/
|
||||
void linphone_address_set_transport(LinphoneAddress *uri, LinphoneTransportType tp){
|
||||
sal_address_set_transport(uri,(SalTransport)tp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the transport.
|
||||
**/
|
||||
LinphoneTransportType linphone_address_get_transport(const LinphoneAddress *uri){
|
||||
return (LinphoneTransportType)sal_address_get_transport(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -142,6 +152,13 @@ char *linphone_address_as_string_uri_only(const LinphoneAddress *u){
|
|||
return sal_address_as_string_uri_only(u);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if address refers to a secure location (sips)
|
||||
**/
|
||||
bool_t linphone_address_is_secure(const LinphoneAddress *uri){
|
||||
return sal_address_is_secure(uri);
|
||||
}
|
||||
|
||||
static bool_t strings_equals(const char *s1, const char *s2){
|
||||
if (s1==NULL && s2==NULL) return TRUE;
|
||||
if (s1!=NULL && s2!=NULL && strcmp(s1,s2)==0) return TRUE;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,14 @@ const char *sal_address_get_scheme(const SalAddress *addr){
|
|||
} else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool_t sal_address_is_secure(const SalAddress *addr){
|
||||
belle_sip_header_address_t* header_addr = BELLE_SIP_HEADER_ADDRESS(addr);
|
||||
belle_sip_uri_t* uri = belle_sip_header_address_get_uri(header_addr);
|
||||
if (uri) return belle_sip_uri_is_secure(uri);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const char *sal_address_get_display_name(const SalAddress* addr){
|
||||
belle_sip_header_address_t* header_addr = BELLE_SIP_HEADER_ADDRESS(addr);
|
||||
return belle_sip_header_address_get_displayname(header_addr);
|
||||
|
|
@ -52,17 +60,17 @@ const char *sal_address_get_display_name_unquoted(const SalAddress *addr){
|
|||
return sal_address_get_display_name(addr);
|
||||
}
|
||||
#define SAL_ADDRESS_GET(addr,param) \
|
||||
belle_sip_header_address_t* header_addr = BELLE_SIP_HEADER_ADDRESS(addr);\
|
||||
{belle_sip_header_address_t* header_addr = BELLE_SIP_HEADER_ADDRESS(addr);\
|
||||
belle_sip_uri_t* uri = belle_sip_header_address_get_uri(header_addr);\
|
||||
if (uri) {\
|
||||
return belle_sip_uri_get_##param(uri);\
|
||||
} else\
|
||||
return NULL;
|
||||
return NULL;}
|
||||
|
||||
#define SAL_ADDRESS_SET(addr,param,value) \
|
||||
#define SAL_ADDRESS_SET(addr,param,value) {\
|
||||
belle_sip_header_address_t* header_addr = BELLE_SIP_HEADER_ADDRESS(addr);\
|
||||
belle_sip_uri_t* uri = belle_sip_header_address_get_uri(header_addr);\
|
||||
belle_sip_uri_set_##param(uri,value);
|
||||
belle_sip_uri_set_##param(uri,value);}
|
||||
|
||||
const char *sal_address_get_username(const SalAddress *addr){
|
||||
SAL_ADDRESS_GET(addr,user)
|
||||
|
|
@ -137,7 +145,9 @@ void sal_address_set_param(SalAddress *addr,const char* name,const char* value){
|
|||
}
|
||||
|
||||
void sal_address_set_transport(SalAddress* addr,SalTransport transport){
|
||||
SAL_ADDRESS_SET(addr,transport_param,sal_transport_to_string(transport));
|
||||
if (!sal_address_is_secure(addr)){
|
||||
SAL_ADDRESS_SET(addr,transport_param,sal_transport_to_string(transport));
|
||||
}
|
||||
}
|
||||
|
||||
void sal_address_set_transport_name(SalAddress* addr,const char *transport){
|
||||
|
|
|
|||
|
|
@ -1892,6 +1892,13 @@ static int apply_transports(LinphoneCore *lc){
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if given transport type is supported by the library, FALSE otherwise.
|
||||
**/
|
||||
bool_t linphone_core_sip_transport_supported(const LinphoneCore *lc, LinphoneTransportType tp){
|
||||
return sal_transport_available(lc->sal,(SalTransport)tp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ports to be used for each of transport (UDP or TCP)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -89,6 +89,19 @@ typedef struct _LCSipTransports{
|
|||
} LCSipTransports;
|
||||
|
||||
|
||||
/**
|
||||
* Enum describing transport type for LinphoneAddress.
|
||||
**/
|
||||
enum _LinphoneTransportType{
|
||||
LinphoneTransportUdp,
|
||||
LinphoneTransportTcp,
|
||||
LinphoneTransportTls,
|
||||
LinphoneTransportDtls
|
||||
};
|
||||
/*this enum MUST be kept in sync with the SalTransport from sal.h*/
|
||||
|
||||
typedef enum _LinphoneTransportType LinphoneTransportType;
|
||||
|
||||
/**
|
||||
* Object that represents a SIP address.
|
||||
*
|
||||
|
|
@ -191,6 +204,9 @@ LINPHONE_PUBLIC void linphone_address_set_domain(LinphoneAddress *uri, const cha
|
|||
LINPHONE_PUBLIC void linphone_address_set_port(LinphoneAddress *uri, int port);
|
||||
/*remove tags, params etc... so that it is displayable to the user*/
|
||||
LINPHONE_PUBLIC void linphone_address_clean(LinphoneAddress *uri);
|
||||
LINPHONE_PUBLIC bool_t linphone_address_is_secure(const LinphoneAddress *uri);
|
||||
LINPHONE_PUBLIC LinphoneTransportType linphone_address_get_transport(const LinphoneAddress *uri);
|
||||
LINPHONE_PUBLIC void linphone_address_set_transport(LinphoneAddress *uri,LinphoneTransportType type);
|
||||
LINPHONE_PUBLIC char *linphone_address_as_string(const LinphoneAddress *u);
|
||||
LINPHONE_PUBLIC char *linphone_address_as_string_uri_only(const LinphoneAddress *u);
|
||||
LINPHONE_PUBLIC bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddress *a2);
|
||||
|
|
@ -1526,6 +1542,8 @@ LINPHONE_PUBLIC int linphone_core_get_sip_port(LinphoneCore *lc);
|
|||
LINPHONE_PUBLIC int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports *transports);
|
||||
|
||||
LINPHONE_PUBLIC int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *transports);
|
||||
|
||||
LINPHONE_PUBLIC bool_t linphone_core_sip_transport_supported(const LinphoneCore *lc, LinphoneTransportType tp);
|
||||
/**
|
||||
*
|
||||
* Give access to the UDP sip socket. Can be useful to configure this socket as persistent I.E kCFStreamNetworkServiceType set to kCFStreamNetworkServiceTypeVoIP)
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@
|
|||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">9.9999999995529656</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment8">
|
||||
<property name="upper">65535</property>
|
||||
<property name="value">5060</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment_max_audio_port">
|
||||
<property name="upper">65535</property>
|
||||
<property name="step_increment">2</property>
|
||||
|
|
@ -324,23 +330,10 @@
|
|||
<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>
|
||||
<property name="n_rows">7</property>
|
||||
<property name="n_rows">8</property>
|
||||
<property name="n_columns">2</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="proto_combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">model8</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="renderer1"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="proto_port">
|
||||
<object class="GtkSpinButton" id="sip_udp_port">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
|
|
@ -350,6 +343,7 @@
|
|||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<property name="adjustment">adjustment7</property>
|
||||
<signal name="value-changed" handler="linphone_gtk_udp_port_value_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -363,8 +357,8 @@
|
|||
<property name="label" translatable="yes">Media encryption type</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -376,24 +370,8 @@
|
|||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="tunnel_edit_button">
|
||||
<property name="label">gtk-edit</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_edit_tunnel" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -405,8 +383,8 @@
|
|||
<property name="justify">right</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -418,36 +396,8 @@
|
|||
<property name="justify">right</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label13">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">DSCP fields</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="dscp_edit_button">
|
||||
<property name="label">gtk-edit</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_dscp_edit" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -513,8 +463,8 @@
|
|||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -580,18 +530,8 @@
|
|||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="tunnel_label">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Tunnel</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -607,10 +547,102 @@
|
|||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="tunnel_label">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Tunnel</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="tunnel_edit_button">
|
||||
<property name="label">gtk-edit</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_edit_tunnel" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label13">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">DSCP fields</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="dscp_edit_button">
|
||||
<property name="label">gtk-edit</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_dscp_edit" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label14">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">SIP/TCP port</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="sip_tcp_port">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<property name="adjustment">adjustment8</property>
|
||||
<signal name="value-changed" handler="linphone_gtk_tcp_port_value_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label15">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">SIP/UDP port</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -102,49 +102,6 @@ void linphone_gtk_update_my_contact(GtkWidget *w){
|
|||
linphone_gtk_load_identities();
|
||||
}
|
||||
|
||||
void linphone_gtk_update_my_port(GtkWidget *w){
|
||||
GtkWidget *pb=gtk_widget_get_toplevel(GTK_WIDGET(w));
|
||||
LCSipTransports tr;
|
||||
LinphoneCore *lc=linphone_gtk_get_core();
|
||||
GtkComboBox *combo = GTK_COMBO_BOX(linphone_gtk_get_widget(pb, "proto_combo"));
|
||||
|
||||
gint port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
|
||||
if (port == 1) { // We use default port if not specified
|
||||
if (strcmp(gtk_combo_box_get_active_text(combo), "SIP (UDP)") == 0) {
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
|
||||
5060);
|
||||
}
|
||||
else if (strcmp(gtk_combo_box_get_active_text(combo), "SIP (TCP)") == 0) {
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
|
||||
5060);
|
||||
}
|
||||
else if (strcmp(gtk_combo_box_get_active_text(combo), "SIP (TLS)") == 0) {
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(w),
|
||||
5061);
|
||||
}
|
||||
}
|
||||
|
||||
linphone_core_get_sip_transports(lc,&tr);
|
||||
gchar *selected = gtk_combo_box_get_active_text(combo);
|
||||
if (strcmp(selected, "SIP (TCP)") == 0) {
|
||||
tr.tcp_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
|
||||
tr.udp_port = 0;
|
||||
tr.tls_port = 0;
|
||||
}
|
||||
else if (strcmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(linphone_gtk_get_widget(pb, "proto_combo"))), "SIP (UDP)") == 0) {
|
||||
tr.udp_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
|
||||
tr.tcp_port = 0;
|
||||
tr.tls_port = 0;
|
||||
}
|
||||
else if (strcmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(linphone_gtk_get_widget(pb, "proto_combo"))), "SIP (TLS)") == 0){
|
||||
tr.udp_port = 0;
|
||||
tr.tcp_port = 0;
|
||||
tr.tls_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w));
|
||||
}
|
||||
|
||||
linphone_core_set_sip_transports(lc,&tr);
|
||||
}
|
||||
|
||||
void linphone_gtk_set_propety_entry(GtkWidget *w, gboolean stunServer, gboolean ip){
|
||||
GtkWidget *stun_entry=linphone_gtk_get_widget(gtk_widget_get_toplevel(w),"stun_server");
|
||||
GtkWidget *ip_entry=linphone_gtk_get_widget(gtk_widget_get_toplevel(w),"nat_address");
|
||||
|
|
@ -691,6 +648,48 @@ static void linphone_gtk_proxy_closed(GtkWidget *w){
|
|||
}
|
||||
}
|
||||
|
||||
static void fill_transport_combo_box(GtkWidget *combo, LinphoneTransportType choice, gboolean is_sensitive){
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if ((model=gtk_combo_box_get_model(GTK_COMBO_BOX(combo)))==NULL){
|
||||
/*case where combo box is created with no model*/
|
||||
GtkCellRenderer *renderer=gtk_cell_renderer_text_new();
|
||||
model=GTK_TREE_MODEL(gtk_list_store_new(1,G_TYPE_STRING));
|
||||
gtk_combo_box_set_model(GTK_COMBO_BOX(combo),model);
|
||||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo),renderer,TRUE);
|
||||
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo),renderer,"markup",0,NULL);
|
||||
}
|
||||
gtk_list_store_append(GTK_LIST_STORE(model),&iter);
|
||||
gtk_list_store_set(GTK_LIST_STORE(model),&iter,0,"UDP",-1);
|
||||
gtk_list_store_append(GTK_LIST_STORE(model),&iter);
|
||||
gtk_list_store_set(GTK_LIST_STORE(model),&iter,0,"TCP",-1);
|
||||
if (linphone_core_sip_transport_supported(linphone_gtk_get_core(),LinphoneTransportTls)){
|
||||
gtk_list_store_append(GTK_LIST_STORE(model),&iter);
|
||||
gtk_list_store_set(GTK_LIST_STORE(model),&iter,0,"TLS",-1);
|
||||
}
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),(int)choice);
|
||||
gtk_widget_set_sensitive(combo,is_sensitive);
|
||||
}
|
||||
|
||||
static void update_proxy_transport(GtkWidget *w){
|
||||
const char *addr=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(w,"proxy")));
|
||||
LinphoneAddress *laddr=linphone_address_new(addr);
|
||||
if (laddr){
|
||||
GtkWidget *combo=linphone_gtk_get_widget(w,"transport");
|
||||
if (linphone_address_is_secure(laddr)){
|
||||
fill_transport_combo_box(combo,LinphoneTransportTls,FALSE);
|
||||
}else{
|
||||
fill_transport_combo_box(combo,linphone_address_get_transport(laddr),TRUE);
|
||||
}
|
||||
linphone_address_destroy(laddr);
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_gtk_proxy_address_changed(GtkEditable *editable){
|
||||
update_proxy_transport(gtk_widget_get_toplevel(GTK_WIDGET(editable)));
|
||||
}
|
||||
|
||||
void linphone_gtk_show_proxy_config(GtkWidget *pb, LinphoneProxyConfig *cfg){
|
||||
GtkWidget *w=linphone_gtk_create_window("sip_account");
|
||||
const char *tmp;
|
||||
|
|
@ -698,8 +697,7 @@ void linphone_gtk_show_proxy_config(GtkWidget *pb, LinphoneProxyConfig *cfg){
|
|||
linphone_proxy_config_edit(cfg);
|
||||
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"identity")),
|
||||
linphone_proxy_config_get_identity(cfg));
|
||||
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"proxy")),
|
||||
linphone_proxy_config_get_addr(cfg));
|
||||
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"proxy")),linphone_proxy_config_get_addr(cfg));
|
||||
tmp=linphone_proxy_config_get_route(cfg);
|
||||
if (tmp) gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"route")),tmp);
|
||||
tmp=linphone_proxy_config_get_contact_parameters(cfg);
|
||||
|
|
@ -901,14 +899,6 @@ void linphone_gtk_lang_changed(GtkComboBox *combo){
|
|||
}
|
||||
}
|
||||
|
||||
void linphone_gtk_proto_changed(GtkComboBox *combo){
|
||||
GtkWidget *pb=gtk_widget_get_toplevel(GTK_WIDGET(combo));
|
||||
|
||||
GtkWidget *proto_port = linphone_gtk_get_widget(pb, "proto_port");
|
||||
// When we change the network protocol, we call update_my_port to move the port number from the old protocol to the new one
|
||||
linphone_gtk_update_my_port(proto_port);
|
||||
}
|
||||
|
||||
static void linphone_gtk_ui_level_adapt(GtkWidget *top) {
|
||||
gboolean ui_advanced;
|
||||
const char *simple_ui = linphone_gtk_get_ui_config("simple_ui", "parameters.codec_tab parameters.transport_frame parameters.ports_frame");
|
||||
|
|
@ -1074,6 +1064,48 @@ void linphone_gtk_fill_video_renderers(GtkWidget *pb){
|
|||
if (active!=-1) gtk_combo_box_set_active(GTK_COMBO_BOX(combo),active);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
guint timeout_id;
|
||||
LCSipTransports tp;
|
||||
}PortConfigCtx;
|
||||
|
||||
static void port_config_free(PortConfigCtx *ctx){
|
||||
g_free(ctx);
|
||||
}
|
||||
|
||||
static void apply_transports(PortConfigCtx *ctx){
|
||||
GtkWidget *mw=linphone_gtk_get_main_window();
|
||||
LCSipTransports tp;
|
||||
LinphoneCore *lc=linphone_gtk_get_core();
|
||||
linphone_core_get_sip_transports(lc,&tp);
|
||||
tp.udp_port=ctx->tp.udp_port;
|
||||
tp.tcp_port=ctx->tp.tcp_port;
|
||||
linphone_core_set_sip_transports(lc,&tp);
|
||||
g_object_set_data(G_OBJECT(mw),"port_config",NULL);
|
||||
}
|
||||
|
||||
static void transport_changed(GtkWidget *parameters){
|
||||
GtkWidget *mw=linphone_gtk_get_main_window();
|
||||
PortConfigCtx *cfg=(PortConfigCtx*)g_object_get_data(G_OBJECT(mw),"port_config");
|
||||
if (cfg==NULL){
|
||||
cfg=g_new0(PortConfigCtx,1);
|
||||
g_object_set_data_full(G_OBJECT(mw),"port_config",cfg,(GDestroyNotify)port_config_free);
|
||||
}
|
||||
if (cfg->timeout_id!=0)
|
||||
g_source_remove(cfg->timeout_id);
|
||||
cfg->tp.udp_port=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(linphone_gtk_get_widget(parameters,"sip_udp_port")));
|
||||
cfg->tp.tcp_port=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(linphone_gtk_get_widget(parameters,"sip_tcp_port")));
|
||||
cfg->timeout_id=g_timeout_add_seconds(2,(GSourceFunc)apply_transports,cfg);
|
||||
}
|
||||
|
||||
void linphone_gtk_udp_port_value_changed(GtkSpinButton *button){
|
||||
transport_changed(gtk_widget_get_toplevel((GtkWidget*)button));
|
||||
}
|
||||
|
||||
void linphone_gtk_tcp_port_value_changed(GtkSpinButton *button){
|
||||
transport_changed(gtk_widget_get_toplevel((GtkWidget*)button));
|
||||
}
|
||||
|
||||
void linphone_gtk_show_parameters(void){
|
||||
GtkWidget *mw=linphone_gtk_get_main_window();
|
||||
GtkWidget *pb=(GtkWidget*)g_object_get_data(G_OBJECT(mw),"parameters");
|
||||
|
|
@ -1101,21 +1133,11 @@ void linphone_gtk_show_parameters(void){
|
|||
linphone_core_ipv6_enabled(lc));
|
||||
linphone_core_get_sip_transports(lc,&tr);
|
||||
|
||||
if (tr.tcp_port > 0) {
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 1);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")),
|
||||
tr.tcp_port);
|
||||
}
|
||||
else if (tr.tls_port > 0) {
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 2);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")),
|
||||
tr.tls_port);
|
||||
}
|
||||
else {
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 0);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")),
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"sip_udp_port")),
|
||||
tr.udp_port);
|
||||
}
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"sip_tcp_port")),
|
||||
tr.tcp_port);
|
||||
|
||||
|
||||
linphone_core_get_audio_port_range(lc, &min_port, &max_port);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb, "audio_min_rtp_port")), min_port);
|
||||
|
|
@ -1214,10 +1236,6 @@ void linphone_gtk_show_parameters(void){
|
|||
ui_advanced);
|
||||
linphone_gtk_ui_level_adapt(pb);
|
||||
|
||||
g_signal_connect(G_OBJECT(linphone_gtk_get_widget(pb,"proto_port")),"value-changed",(GCallback)linphone_gtk_update_my_port,NULL);
|
||||
g_signal_connect(G_OBJECT(linphone_gtk_get_widget(pb,"proto_combo")),"changed",(GCallback)linphone_gtk_proto_changed,NULL);
|
||||
|
||||
|
||||
if (linphone_core_tunnel_available()){
|
||||
gtk_widget_set_visible(GTK_WIDGET(linphone_gtk_get_widget(pb,"tunnel_edit_button")), TRUE);
|
||||
gtk_widget_set_visible(GTK_WIDGET(linphone_gtk_get_widget(pb,"tunnel_label")), TRUE);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 2.6 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<object class="GtkAdjustment" id="adjustment1">
|
||||
<property name="upper">100000</property>
|
||||
<property name="value">3600</property>
|
||||
|
|
@ -15,13 +16,13 @@
|
|||
<property name="window_position">center-on-parent</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox2">
|
||||
<object class="GtkVBox" id="dialog-vbox2">
|
||||
<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>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area2">
|
||||
<object class="GtkHButtonBox" id="dialog-action_area2">
|
||||
<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>
|
||||
|
|
@ -91,7 +92,7 @@
|
|||
<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>
|
||||
<property name="n_rows">5</property>
|
||||
<property name="n_rows">6</property>
|
||||
<property name="n_columns">2</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label38">
|
||||
|
|
@ -112,6 +113,8 @@
|
|||
<property name="text" translatable="yes">sip:</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -140,6 +143,9 @@
|
|||
<property name="text" translatable="yes">sip:</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<signal name="changed" handler="linphone_gtk_proxy_address_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
|
@ -148,19 +154,6 @@
|
|||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label40">
|
||||
<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>
|
||||
<property name="label" translatable="yes">Route (optional):</property>
|
||||
<property name="justify">right</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="route">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -168,12 +161,14 @@
|
|||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -185,24 +180,26 @@
|
|||
<property name="justify">right</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="regperiod">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -210,12 +207,12 @@
|
|||
<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>
|
||||
<property name="label" translatable="yes">Contact params:</property>
|
||||
<property name="label" translatable="yes">Contact params (optional):</property>
|
||||
<property name="justify">right</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -228,15 +225,53 @@
|
|||
<property name="invisible_char_set">True</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label40">
|
||||
<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>
|
||||
<property name="label" translatable="yes">Route (optional):</property>
|
||||
<property name="justify">right</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Transport</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="transport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<signal name="changed" handler="linphone_gtk_proxy_transport_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
|
|
|||
|
|
@ -85,12 +85,9 @@ const char *sal_address_get_display_name(const SalAddress* addr);
|
|||
const char *sal_address_get_display_name_unquoted(const SalAddress *addr);
|
||||
const char *sal_address_get_username(const SalAddress *addr);
|
||||
const char *sal_address_get_domain(const SalAddress *addr);
|
||||
#ifdef USE_BELLESIP
|
||||
int sal_address_get_port(const SalAddress *addr);
|
||||
#else
|
||||
const char * sal_address_get_port(const SalAddress *addr);
|
||||
int sal_address_get_port_int(const SalAddress *addr);
|
||||
#endif
|
||||
bool_t sal_address_is_secure(const SalAddress *addr);
|
||||
|
||||
SalTransport sal_address_get_transport(const SalAddress* addr);
|
||||
const char* sal_address_get_transport_name(const SalAddress* addr);
|
||||
|
||||
|
|
@ -479,6 +476,7 @@ void sal_signing_key_delete(SalSigningKey *key);
|
|||
void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs);
|
||||
int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure);
|
||||
int sal_unlisten_ports(Sal *ctx);
|
||||
int sal_transport_available(Sal *ctx, SalTransport t);
|
||||
void sal_set_dscp(Sal *ctx, int dscp);
|
||||
int sal_reset_transports(Sal *ctx);
|
||||
ortp_socket_t sal_get_socket(Sal *ctx);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
127.0.0.1 sip2.linphone.org sip.example.org sipopen.example.org auth.example.org auth1.example.org auth2.example.org altname.linphone.org sip.wildcard1.linphone.org altname.wildcard2.linphone.org
|
||||
94.23.19.176 sip2.linphone.org sip.example.org sipopen.example.org auth.example.org auth1.example.org auth2.example.org altname.linphone.org sip.wildcard1.linphone.org altname.wildcard2.linphone.org
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue