mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-26 07:38:09 +00:00
Based on a patch from Jim Diammond (mostly rewritten)
- add --call --autoanswer options to gtk ui - allow remote calling (ie if an instance of linphone is already running, tell this instance to call instead of spawning another instance). git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@593 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
parent
4496bcfcb9
commit
4fdf505481
8 changed files with 129 additions and 271 deletions
|
|
@ -160,16 +160,11 @@ LinphoneCoreVTable linphonec_vtable = {
|
|||
.display_url=linphonec_display_url,
|
||||
.display_question=(DisplayQuestionCb)stub,
|
||||
.text_received=linphonec_text_received,
|
||||
.general_state=linphonec_general_state,
|
||||
.general_state=linphonec_general_state,
|
||||
.dtmf_received=linphonec_dtmf_received
|
||||
};
|
||||
|
||||
|
||||
/* zsd: called from exevents, only interesting to gui */
|
||||
void linphone_call_started_remotely(const char * url)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
|
|
|
|||
|
|
@ -21,12 +21,6 @@ call.
|
|||
#include "sipomatic.h"
|
||||
#include <eXosip2/eXosip.h>
|
||||
|
||||
|
||||
/* zsd: called from exevents, only interesting to gui */
|
||||
void linphone_call_started_remotely(const char * url)
|
||||
{
|
||||
}
|
||||
|
||||
int run_cond=1;
|
||||
|
||||
Sipomatic sipomatic;
|
||||
|
|
|
|||
|
|
@ -25,10 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <osipparser2/osip_message.h>
|
||||
#include <osipparser2/osip_parser.h>
|
||||
|
||||
|
||||
/* zsd: only want to do something here if the GUI is active */
|
||||
void linphone_call_started_remotely(const char * URL);
|
||||
|
||||
static int linphone_answer_sdp(LinphoneCore *lc, eXosip_event_t *ev, sdp_message_t *sdp);
|
||||
|
||||
static bool_t linphone_call_matches_event(LinphoneCall *call, eXosip_event_t *ev){
|
||||
|
|
@ -339,14 +335,6 @@ int linphone_inc_new_call(LinphoneCore *lc, eXosip_event_t *ev)
|
|||
lc->vtable.display_status(lc,barmesg);
|
||||
|
||||
/* play the ring */
|
||||
/*
|
||||
* zsd moved this statement and the next four from the bottom of
|
||||
* this block so that the gui inv_recv function could automatically
|
||||
* answer.
|
||||
* With this below, the ringing didn't start until after the
|
||||
* auto-answer, which caused the ring to time out and terminate the
|
||||
* call.
|
||||
*/
|
||||
if (lc->sound_conf.ring_sndcard!=NULL){
|
||||
ms_message("Starting local ring...");
|
||||
lc->ringstream=ring_start(lc->sound_conf.local_ring,2000,lc->sound_conf.ring_sndcard);
|
||||
|
|
@ -1014,77 +1002,29 @@ static void linphone_other_request(LinphoneCore *lc, eXosip_event_t *ev){
|
|||
linphone_core_text_received(lc,ev);
|
||||
eXosip_message_send_answer(ev->tid,200,NULL);
|
||||
}else if (strcmp(ev->request->sip_method,"OPTIONS")==0){
|
||||
#if 1
|
||||
osip_message_t *options=NULL;
|
||||
eXosip_options_build_answer(ev->tid,200,&options);
|
||||
osip_message_set_allow(options,"INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, SUBSCRIBE, NOTIFY, INFO");
|
||||
osip_message_set_accept(options,"application/sdp");
|
||||
eXosip_options_send_answer(ev->tid,200,options);
|
||||
#else
|
||||
ms_warning("Not answering to this options request.");
|
||||
#endif
|
||||
}else if (strcmp(ev->request->sip_method,"WAKEUP")==0
|
||||
&& comes_from_local_if(ev->request)) {
|
||||
eXosip_message_send_answer(ev->tid,200,NULL);
|
||||
ms_message("Receiving WAKEUP request !");
|
||||
if (lc->vtable.show)
|
||||
lc->vtable.show(lc);
|
||||
}
|
||||
/* zsd addition: allow a "remote" call request */
|
||||
/*
|
||||
* The current implementation of the feature is a horrible kludge:
|
||||
* rather than extracting the URL from the body, get it from the SIP
|
||||
* method... it is all the chars after "CALL".
|
||||
*/
|
||||
else if (strncmp(ev->request->sip_method, "CALL", 4) == 0
|
||||
&& comes_from_local_if(ev->request))
|
||||
{
|
||||
char * sip_method = ev->request->sip_method;
|
||||
|
||||
eXosip_message_send_answer(ev->tid, 200, NULL);
|
||||
ms_message("Received CALL request.");
|
||||
|
||||
/*
|
||||
fprintf(stderr, "Received CALL request!\n");
|
||||
fprintf(stderr, "addr to call is |%s|\n", &ev->request->sip_method[4]);
|
||||
fprintf(stderr, "addr to call is |%s|\n", &sip_method[4]);
|
||||
*/
|
||||
/*
|
||||
* The following two lines of code should probably be wrapped into
|
||||
* something and then put in a new slot in the vtable.
|
||||
*/
|
||||
linphone_core_invite(lc, &sip_method[4]);
|
||||
linphone_call_started_remotely(&sip_method[4]);
|
||||
|
||||
#if 0
|
||||
fprintf(stderr, "textinfo is |%s|\n", ev->textinfo);
|
||||
fprintf(stderr, "request content_length is |%s|\n",
|
||||
ev->request->content_length->value);
|
||||
/*
|
||||
* The following code (in the braces) was snarfled off the web, as
|
||||
* an example of how to get at the body content.
|
||||
* It didn't work for me.
|
||||
*/
|
||||
{
|
||||
int pos = 0;
|
||||
while (!osip_list_eol (&ev->request->bodies, pos))
|
||||
{
|
||||
osip_body_t * oldbody;
|
||||
|
||||
oldbody = (osip_body_t *)osip_list_get(&ev->request->bodies,
|
||||
pos);
|
||||
pos++;
|
||||
|
||||
/* !!!! -> body is here: "oldbody->body" */
|
||||
fprintf(stderr, "oldbody->length = %d\n", oldbody->length);
|
||||
fprintf(stderr, "oldbody->body = %s\n", oldbody->body);
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "request is |%s|\n", ev->request->message);
|
||||
#endif
|
||||
|
||||
if (lc->vtable.show)
|
||||
lc->vtable.show(lc);
|
||||
}else if (strncmp(ev->request->sip_method, "REFER", 5) == 0){
|
||||
ms_message("Receiving REFER request !");
|
||||
if (comes_from_local_if(ev->request)) {
|
||||
osip_header_t *h=NULL;
|
||||
osip_message_header_get_byname(ev->request,"Refer-To",0,&h);
|
||||
eXosip_message_send_answer(ev->tid,200,NULL);
|
||||
if (h){
|
||||
if (lc->vtable.refer_received)
|
||||
lc->vtable.refer_received(lc,h->hvalue);
|
||||
}
|
||||
|
||||
}else ms_warning("Ignored REFER not coming from this local loopback interface.");
|
||||
}
|
||||
else {
|
||||
char *tmp=NULL;
|
||||
|
|
|
|||
|
|
@ -440,6 +440,7 @@ typedef void (*CallLogUpdated)(struct _LinphoneCore *lc, struct _LinphoneCallLog
|
|||
typedef void (*TextMessageReceived)(struct _LinphoneCore *lc, LinphoneChatRoom *room, const char *from, const char *message);
|
||||
typedef void (*GeneralStateChange)(struct _LinphoneCore *lc, LinphoneGeneralState *gstate);
|
||||
typedef void (*DtmfReceived)(struct _LinphoneCore* lc, int dtmf);
|
||||
typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to);
|
||||
|
||||
typedef struct _LinphoneVTable
|
||||
{
|
||||
|
|
@ -462,6 +463,7 @@ typedef struct _LinphoneVTable
|
|||
TextMessageReceived text_received;
|
||||
GeneralStateChange general_state;
|
||||
DtmfReceived dtmf_received;
|
||||
ReferReceived refer_received;
|
||||
} LinphoneCoreVTable;
|
||||
|
||||
typedef struct _LCCallbackObj
|
||||
|
|
@ -787,12 +789,9 @@ struct _LpConfig *linphone_core_get_config(LinphoneCore *lc);
|
|||
|
||||
/* attempts to wake up another linphone engine already running.
|
||||
The "show" callback is called for the other linphone, causing gui to show up.
|
||||
call_addr is an optional sip-uri to call immediately after waking up.
|
||||
The method returns 0 if an already running linphone was found*/
|
||||
/* zsd: old code was
|
||||
int linphone_core_wake_up_possible_already_running_instance(const char *config_file);
|
||||
* new code: If the second arg is non-null, pass the call addr to the
|
||||
* already-running instance.
|
||||
*/
|
||||
|
||||
int linphone_core_wake_up_possible_already_running_instance(
|
||||
const char * config_file, const char * call_addr);
|
||||
|
||||
|
|
|
|||
|
|
@ -679,7 +679,6 @@ static int extract_sip_port(const char *config){
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* zsd added "addr_to_call" to this function. */
|
||||
int linphone_core_wake_up_possible_already_running_instance(
|
||||
const char * config_file, const char * addr_to_call)
|
||||
{
|
||||
|
|
@ -691,18 +690,14 @@ int linphone_core_wake_up_possible_already_running_instance(
|
|||
"CSeq: 1 WAKEUP\r\n"
|
||||
"Call-ID: %u@onsantape\r\n"
|
||||
"Content-length: 0\r\n\r\n";
|
||||
/*
|
||||
* zsd: is this the worst kludge ever?
|
||||
* Q: How do you extract the body of the message at the other end??
|
||||
* (Use "...Content-length: %d\r\n\r\n%s\r\n", strlen(a_to_c)+2, a_to_c
|
||||
* to put stuff in the body, assuming content length includes the \r\n.)
|
||||
*/
|
||||
const char * call = "CALL%s sip:127.0.0.1 SIP/2.0\r\n"
|
||||
"Via: SIP/2.0/UDP 127.0.0.1:%i;rport;branch=z9hG4bK%u\r\n"
|
||||
"From: <sip:another_linphone@127.0.0.1>;tag=%u\r\n"
|
||||
"To: <sip:you@127.0.0.1>\r\n"
|
||||
"CSeq: 1 CALL\r\n"
|
||||
"Call-ID: %u@onsantape\r\n" "Content-length: 0\r\n\r\n";
|
||||
const char * call = "REFER sip:127.0.0.1 SIP/2.0\r\n"
|
||||
"Via: SIP/2.0/UDP 127.0.0.1:%i;rport;branch=z9hG4bK%u\r\n"
|
||||
"From: <sip:another_linphone@127.0.0.1>;tag=%u\r\n"
|
||||
"To: <sip:you@127.0.0.1>\r\n"
|
||||
"Refer-To: %s\r\n"
|
||||
"CSeq: 1 WAKEUP\r\n"
|
||||
"Call-ID: %u@onsantape\r\n"
|
||||
"Content-length: 0\r\n\r\n";
|
||||
|
||||
/*make sure ortp is initialized (it initializes win32 socket api)*/
|
||||
ortp_init();
|
||||
|
|
@ -717,15 +712,12 @@ int linphone_core_wake_up_possible_already_running_instance(
|
|||
if (sock<0) sock=create_socket(++locport);
|
||||
if (sock>=0){
|
||||
char req[512];
|
||||
/* zsd */
|
||||
if (addr_to_call != NULL)
|
||||
snprintf(req, sizeof(req), call, addr_to_call, locport,
|
||||
random(), random(), random());
|
||||
else
|
||||
snprintf(req, sizeof(req), wakeup, locport,
|
||||
random(), random(), random());
|
||||
//fprintf(stderr, "linphone_core_wake_up_... MAY send\n|%s|\n", req); /* zsd */
|
||||
//original line of code: snprintf(req,sizeof(req),wakeup,locport,random(),random(),random());
|
||||
if (addr_to_call != NULL)
|
||||
snprintf(req, sizeof(req), call, locport,
|
||||
random(), random(), addr_to_call, random());
|
||||
else
|
||||
snprintf(req, sizeof(req), wakeup, locport,
|
||||
random(), random(), random());
|
||||
if (connect(sock,(struct sockaddr*)&ss,sslen)<0){
|
||||
fprintf(stderr,"connect failed: %s\n",getSocketError());
|
||||
}else if (send(sock,req,strlen(req),0)>0){
|
||||
|
|
@ -734,11 +726,8 @@ int linphone_core_wake_up_possible_already_running_instance(
|
|||
for(i=0;i<10;++i){
|
||||
if (recv(sock,req,sizeof(req),0)>0){
|
||||
close_socket(sock);
|
||||
//fprintf(stderr, "GOT A RESPONSE to the wake-up message\n"); /* zsd */
|
||||
return 0;
|
||||
}else if (getSocketErrorCode()!=EWOULDBLOCK){
|
||||
/* zsd */
|
||||
// fprintf(stderr, "l_c_w_u_p_a_r_i: WOULDN'T BLOCK!\n");
|
||||
break;
|
||||
}
|
||||
#ifdef WIN32
|
||||
|
|
@ -747,21 +736,12 @@ int linphone_core_wake_up_possible_already_running_instance(
|
|||
usleep(100000);
|
||||
#endif
|
||||
}
|
||||
}else
|
||||
{
|
||||
/* zsd fprintf() */
|
||||
// fprintf(stderr, "sendto() of WAKEUP request failed\n");
|
||||
ms_message("sendto() of WAKEUP request failed, nobody to wakeup.");
|
||||
}else{
|
||||
ms_message("sendto() of WAKEUP request failed, nobody to wakeup.");
|
||||
}
|
||||
|
||||
}
|
||||
// else /* zsd */
|
||||
// fprintf(stderr, "l_c_w_u_p_a_r_i: unable to create socket\n");
|
||||
close_socket(sock);
|
||||
}
|
||||
}
|
||||
/* zsd */
|
||||
// else
|
||||
// fprintf(stderr, "l_c_w_u_p_a_r_i: port <= 0 !!!!!!!\n");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<!--Generated with glade3 3.4.5 on Mon Jul 28 13:06:22 2008 -->
|
||||
<?xml version="1.0"?>
|
||||
<glade-interface>
|
||||
<!-- interface-requires gtk+ 2.16 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<widget class="GtkDialog" id="incoming_call">
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="type">GTK_WINDOW_POPUP</property>
|
||||
<property name="type">popup</property>
|
||||
<property name="title" translatable="yes">Linphone - Incoming call</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="icon">linphone2.png</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NOTIFICATION</property>
|
||||
<property name="type_hint">notification</property>
|
||||
<property name="urgency_hint">True</property>
|
||||
<property name="deletable">False</property>
|
||||
<property name="has_separator">False</property>
|
||||
|
|
@ -58,14 +58,13 @@
|
|||
<widget class="GtkHButtonBox" id="dialog-action_area7">
|
||||
<property name="visible">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="layout_style">GTK_BUTTONBOX_SPREAD</property>
|
||||
<property name="layout_style">spread</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="accept_call">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">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="response_id">0</property>
|
||||
<signal name="clicked" handler="linphone_gtk_accept_call"/>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox17">
|
||||
|
|
@ -77,6 +76,9 @@
|
|||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="stock">gtk-yes</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label44">
|
||||
|
|
@ -91,14 +93,18 @@
|
|||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="accept_call2">
|
||||
<widget class="GtkButton" id="decline_cal">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">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="response_id">0</property>
|
||||
<signal name="clicked" handler="linphone_gtk_decline_call"/>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox20">
|
||||
|
|
@ -110,6 +116,9 @@
|
|||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="stock">gtk-no</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="decline_call">
|
||||
|
|
@ -125,13 +134,16 @@
|
|||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ static void linphone_gtk_display_url(LinphoneCore *lc, const char *msg, const ch
|
|||
static void linphone_gtk_display_question(LinphoneCore *lc, const char *question);
|
||||
static void linphone_gtk_call_log_updated(LinphoneCore *lc, LinphoneCallLog *cl);
|
||||
static void linphone_gtk_general_state(LinphoneCore *lc, LinphoneGeneralState *gstate);
|
||||
static void linphone_gtk_refer_received(LinphoneCore *lc, const char *refer_to);
|
||||
static gboolean linphone_gtk_auto_answer(GtkWidget *incall_window);
|
||||
|
||||
static LinphoneCoreVTable vtable={
|
||||
.show=linphone_gtk_show,
|
||||
|
|
@ -66,33 +68,34 @@ static LinphoneCoreVTable vtable={
|
|||
.display_question=linphone_gtk_display_question,
|
||||
.call_log_updated=linphone_gtk_call_log_updated,
|
||||
.text_received=linphone_gtk_text_received,
|
||||
.general_state=linphone_gtk_general_state
|
||||
.general_state=linphone_gtk_general_state,
|
||||
.refer_received=linphone_gtk_refer_received
|
||||
};
|
||||
|
||||
static gboolean verbose=0;
|
||||
static gboolean auto_answer = 0; /* zsd */
|
||||
static gchar * addr_to_call = NULL; /* zsd: FIXME: is this correct??? */
|
||||
static GOptionEntry linphone_options[]={ /* zsd deleted array size 2 */
|
||||
static gboolean auto_answer = 0;
|
||||
static gchar * addr_to_call = NULL;
|
||||
static GOptionEntry linphone_options[]={
|
||||
{
|
||||
.long_name="verbose",
|
||||
.short_name= '\0',
|
||||
.arg=G_OPTION_ARG_NONE,
|
||||
.arg_data= (gpointer)&verbose,
|
||||
.description="log to stdout some debug information while running."
|
||||
.description=N_("log to stdout some debug information while running.")
|
||||
},
|
||||
{ /* zsd addition */
|
||||
.long_name = "call",
|
||||
.short_name = 'c',
|
||||
.arg = G_OPTION_ARG_STRING,
|
||||
.arg_data = &addr_to_call, /* zsd: FIXME: is this correct??? */
|
||||
.description = "address to call right now"
|
||||
.arg_data = &addr_to_call,
|
||||
.description = N_("address to call right now")
|
||||
},
|
||||
{ /* zsd addition */
|
||||
.long_name = "auto-answer",
|
||||
.short_name = 'a',
|
||||
.arg = G_OPTION_ARG_NONE,
|
||||
.arg_data = (gpointer) & auto_answer,
|
||||
.description = "if set, automatically answer incoming calls"
|
||||
.description = N_("if set,b automatically answer incoming calls")
|
||||
},
|
||||
{0}
|
||||
};
|
||||
|
|
@ -319,7 +322,8 @@ void linphone_gtk_show_about(){
|
|||
g_free(license);
|
||||
}
|
||||
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(about),LINPHONE_VERSION);
|
||||
|
||||
gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(about),linphone_gtk_get_ui_config("title","Linphone"));
|
||||
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(about),linphone_gtk_get_ui_config("home","http://www.linphone.org"));
|
||||
gtk_widget_show(about);
|
||||
}
|
||||
|
||||
|
|
@ -382,6 +386,12 @@ static gboolean linphone_gtk_iterate(LinphoneCore *lc){
|
|||
if (video_needs_update) video_needs_update=FALSE;
|
||||
}
|
||||
}
|
||||
if (addr_to_call!=NULL){
|
||||
GtkWidget *uri_bar=linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar");
|
||||
gtk_entry_set_text(GTK_ENTRY(uri_bar),addr_to_call);
|
||||
addr_to_call=NULL;
|
||||
linphone_gtk_start_call(uri_bar);
|
||||
}
|
||||
in_iterate=FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -462,7 +472,7 @@ void linphone_gtk_call_terminated(const char *error){
|
|||
GtkWidget *mw=linphone_gtk_get_main_window();
|
||||
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"terminate_call"),FALSE);
|
||||
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"start_call"),TRUE);
|
||||
gtk_widget_hide(linphone_gtk_get_widget(mw,"go_to_call_view"));
|
||||
gtk_widget_hide(linphone_gtk_get_widget(mw,"go_to_call_view_box"));
|
||||
linphone_gtk_in_call_view_terminate(error);
|
||||
update_video_title();
|
||||
g_object_set_data(G_OBJECT(mw),"incoming_call",NULL);
|
||||
|
|
@ -481,7 +491,7 @@ static gboolean in_call_timer(){
|
|||
static void linphone_gtk_call_started(GtkWidget *mw){
|
||||
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"start_call"),FALSE);
|
||||
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"terminate_call"),TRUE);
|
||||
gtk_widget_show(linphone_gtk_get_widget(mw,"go_to_call_view"));
|
||||
gtk_widget_show(linphone_gtk_get_widget(mw,"go_to_call_view_box"));
|
||||
update_video_title();
|
||||
g_timeout_add(250,(GSourceFunc)in_call_timer,NULL);
|
||||
}
|
||||
|
|
@ -538,6 +548,11 @@ void linphone_gtk_accept_call(GtkWidget *button){
|
|||
linphone_gtk_show_in_call_view();
|
||||
}
|
||||
|
||||
static gboolean linphone_gtk_auto_answer(GtkWidget *incall_window){
|
||||
linphone_gtk_accept_call(linphone_gtk_get_widget(incall_window,"accept_call"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void linphone_gtk_set_audio_video(){
|
||||
linphone_core_enable_video(linphone_gtk_get_core(),TRUE,TRUE);
|
||||
linphone_core_enable_video_preview(linphone_gtk_get_core(),TRUE);
|
||||
|
|
@ -577,20 +592,8 @@ static void linphone_gtk_inv_recv(LinphoneCore *lc, const char *from){
|
|||
GtkWidget *label;
|
||||
gchar *msg;
|
||||
|
||||
if (auto_answer) // zsd addition
|
||||
{
|
||||
/*
|
||||
* Let the phone ring a bit before the auto-answer so that the
|
||||
* local user knows something is happening.
|
||||
*/
|
||||
//fflush(stdout);fprintf(stderr, "******************** sleep(2)\n");
|
||||
sleep(2);
|
||||
//fflush(stdout);fprintf(stderr, "******************** calling linphone_core_accept_call()\n");
|
||||
linphone_core_accept_call(linphone_gtk_get_core(), NULL);
|
||||
//fflush(stdout);fprintf(stderr, "******************** calling linphone_gtk_call_started()\n");
|
||||
linphone_gtk_call_started(linphone_gtk_get_main_window());
|
||||
|
||||
return;
|
||||
if (auto_answer){
|
||||
g_timeout_add(2000,(GSourceFunc)linphone_gtk_auto_answer,w);
|
||||
}
|
||||
|
||||
gtk_window_set_transient_for(GTK_WINDOW(w),GTK_WINDOW(linphone_gtk_get_main_window()));
|
||||
|
|
@ -1006,17 +1009,12 @@ void linphone_gtk_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* zsd added this */
|
||||
void linphone_call_started_remotely(const char * url)
|
||||
{
|
||||
GtkEntry * uri_bar =
|
||||
GTK_ENTRY(linphone_gtk_get_widget
|
||||
(linphone_gtk_get_main_window(), "uribar"));
|
||||
|
||||
gtk_entry_set_text(uri_bar, url);
|
||||
linphone_gtk_call_started(linphone_gtk_get_main_window());
|
||||
static void linphone_gtk_refer_received(LinphoneCore *lc, const char *refer_to){
|
||||
GtkEntry * uri_bar =GTK_ENTRY(linphone_gtk_get_widget(
|
||||
linphone_gtk_get_main_window(), "uribar"));
|
||||
linphone_gtk_show_main_window();
|
||||
gtk_entry_set_text(uri_bar, refer_to);
|
||||
linphone_gtk_start_call(linphone_gtk_get_main_window());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1026,43 +1024,12 @@ int main(int argc, char *argv[]){
|
|||
#endif
|
||||
const char *config_file;
|
||||
const char *lang;
|
||||
int i; // zsd
|
||||
|
||||
g_thread_init(NULL);
|
||||
gdk_threads_init();
|
||||
|
||||
config_file=linphone_gtk_get_config_file();
|
||||
|
||||
/*
|
||||
* zsd addition:
|
||||
* Did the user ask for an-already running instance to make a call?
|
||||
* Look thru the args the old-fashioned way.
|
||||
*/
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "-call") == 0)
|
||||
{
|
||||
if (i + 1 < argc)
|
||||
addr_to_call = argv[i + 1];
|
||||
i = argc + 1;
|
||||
}
|
||||
}
|
||||
// fprintf(stderr, "addr_to_call is |%s|\n", addr_to_call);
|
||||
|
||||
// zsd replaced this line
|
||||
// if (linphone_core_wake_up_possible_already_running_instance(config_file)==0){
|
||||
if (linphone_core_wake_up_possible_already_running_instance(
|
||||
config_file, addr_to_call) == 0)
|
||||
{
|
||||
// and zsd added this if stmt and the braces
|
||||
if (addr_to_call == NULL)
|
||||
{
|
||||
g_warning("Another running instance of linphone has been detected. It has been woken-up.");
|
||||
g_warning("This instance is going to exit now.");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/*workaround for windows: sometimes LANG is defined to an integer value, not understood by gtk */
|
||||
if ((lang=getenv("LANG"))!=NULL){
|
||||
|
|
@ -1095,21 +1062,21 @@ int main(int argc, char *argv[]){
|
|||
#ifdef WIN32
|
||||
gtk_rc_add_default_file("./gtkrc");
|
||||
#endif
|
||||
// fprintf(stderr, "about to call gdk_threads_enter()\n"); //zsd
|
||||
gdk_threads_enter();
|
||||
// fprintf(stderr, "AFTER call gdk_threads_enter()\n");
|
||||
// fprintf(stderr, "b4 !gtk_init_with_args() addr_to_call is |%s|\n",
|
||||
// addr_to_call); /* zsd */
|
||||
|
||||
if (!gtk_init_with_args(&argc,&argv,_("A free SIP video-phone"),
|
||||
linphone_options,NULL,NULL)){
|
||||
fprintf(stderr, "IN !gtk_init_with_args() if clause\n"); /* zsd */
|
||||
gdk_threads_leave();
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* zsd: we don't get here if the args were not OK */
|
||||
// fprintf(stderr, "AFTER !gtk_init_with_args() addr_to_call is |%s|\n",
|
||||
// addr_to_call); /* zsd */
|
||||
if (linphone_core_wake_up_possible_already_running_instance(
|
||||
config_file, addr_to_call) == 0){
|
||||
g_message("addr_to_call=%s",addr_to_call);
|
||||
g_warning("Another running instance of linphone has been detected. It has been woken-up.");
|
||||
g_warning("This instance is going to exit now.");
|
||||
gdk_threads_leave();
|
||||
return 0;
|
||||
}
|
||||
|
||||
add_pixmap_directory("pixmaps");
|
||||
add_pixmap_directory(PACKAGE_DATA_DIR "/pixmaps/linphone");
|
||||
|
|
@ -1128,29 +1095,6 @@ int main(int argc, char *argv[]){
|
|||
linphone_gtk_show_main_window();
|
||||
linphone_gtk_check_for_new_version();
|
||||
|
||||
/* zsd additions for calling a URL given as an argument */
|
||||
/*
|
||||
* Comment from linphone 3.0.0:
|
||||
* With this here, the video window never shows up, altho the
|
||||
* main window does. Why is that?
|
||||
if (addr_to_call != NULL)
|
||||
{
|
||||
linphone_core_invite(linphone_gtk_get_core(), addr_to_call);
|
||||
linphone_call_started_remotely(addr_to_call);
|
||||
}
|
||||
*/
|
||||
/* Horrible, horrible kludge since the above doesn't work: */
|
||||
if (addr_to_call != NULL)
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
snprintf(buf, sizeof(buf),
|
||||
"(sleep 2; %s -c %s)&", argv[0], addr_to_call);
|
||||
if (system(buf))
|
||||
linphone_gtk_display_warning(linphone_gtk_get_core(),
|
||||
"Unable to perform remote call!");
|
||||
}
|
||||
|
||||
gtk_main();
|
||||
gdk_threads_leave();
|
||||
linphone_gtk_destroy_log_window();
|
||||
|
|
|
|||
|
|
@ -833,47 +833,41 @@ Online users</property>
|
|||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="go_to_call_view_box">
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<widget class="GtkButton" id="go_to_call_view">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="linphone_gtk_show_in_call_view"/>
|
||||
<child>
|
||||
<widget class="GtkButton" id="go_to_call_view">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="linphone_gtk_show_in_call_view"/>
|
||||
<widget class="GtkHBox" id="hbox10">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox10">
|
||||
<widget class="GtkImage" id="image7">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image7">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-jump-to</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show current call</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<property name="stock">gtk-go-forward</property>
|
||||
<property name="icon-size">4</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show current call</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">8</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
|
|
@ -881,12 +875,12 @@ Online users</property>
|
|||
<property name="fill">False</property>
|
||||
<property name="padding">8</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue