[ --with-sdl Sets the installation prefix of libSDL, needed for video support. [default=/usr] ],
[ libsdldir=${withval}],[ libsdldir=/usr ])
+AC_ARG_ENABLE(x11,
+ [ --disable-x11 Disable X11 support],
+ [case "${enableval}" in
+ yes) enable_x11=true ;;
+ no) enable_x11=false ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --disable-x11) ;;
+ esac],[enable_x11=true])
+
if test "$video" = "true"; then
+
+ if test "$enable_x11" = "true"; then
+ AC_CHECK_HEADERS(X11/Xlib.h)
+ fi
AC_DEFINE(VIDEO_ENABLED,1,[defined if video support is available])
fi
static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args);
static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args);
static int lpc_cmd_video_window(LinphoneCore *lc, char *args);
+static int lpc_cmd_states(LinphoneCore *lc, char *args);
/* Command handler helpers */
static void linphonec_proxy_add(LinphoneCore *lc);
void linphonec_out(const char *fmt,...);
+VideoParams lpc_video_params={-1,-1,-1,-1,TRUE};
/***************************************************************************
* Commands table.
*/
static LPC_COMMAND commands[] = {
- { "help", lpc_cmd_help, "Print commands help, 'help advanced' for advanced features.",
+ { "help", lpc_cmd_help, "Print commands help.",
"'help <command>'\t: displays specific help for command.\n"
"'help advanced'\t: shows advanced commands.\n"
},
"Set the rtp_no_xmit_on_audio_mute configuration parameter",
" If set to 1 then rtp transmission will be muted when\n"
" audio is muted , otherwise rtp is always sent."},
- { "video-window", lpc_cmd_video_window, "Control video display window", NULL },
+ { "vwindow", lpc_cmd_video_window, "Control video display window",
+ "'vwindow show': shows video window\n"
+ "'vwindow hide': hides video window\n"
+ "'vwindow pos <x> <y>': Moves video window to x,y pixel coordinates\n"
+ "'vwindow size <width> <height>': Resizes video window"
+ },
+ { "states", lpc_cmd_states, "Show internal states of liblinphone, registrations and calls, according to linphonecore.h definitions",
+ "'states global': shows global state of liblinphone \n"
+ "'states calls': shows state of calls\n"
+ "'states proxies': shows state of proxy configurations"
+ },
{ "register", lpc_cmd_register, "Register in one line to a proxy" , "register <sip identity> <sip proxy> <password>"},
{ "unregister", lpc_cmd_unregister, "Unregister from default proxy", NULL },
{ "status", lpc_cmd_status, "Print various status information",
}
linphonec_out("---------------------------\n");
- linphonec_out("Type 'help <command>' for more details.\n");
+ linphonec_out("Type 'help <command>' for more details or 'help advanced' to list additional commands.\n");
return 1;
}
}
static int lpc_cmd_video_window(LinphoneCore *lc, char *args){
+ char subcommand[64];
+ int a,b;
+ int err;
+#ifdef VIDEO_ENABLED
+ err=sscanf(args,"%s %i %i",subcommand,&a,&b);
+ if (err>=1){
+ if (strcmp(subcommand,"pos")==0){
+ if (err<3) return 0;
+ lpc_video_params.x=a;
+ lpc_video_params.y=b;
+ lpc_video_params.refresh=TRUE;
+ }else if (strcmp(subcommand,"size")==0){
+ if (err<3) return 0;
+ lpc_video_params.w=a;
+ lpc_video_params.h=b;
+ lpc_video_params.refresh=TRUE;
+ }else if (strcmp(subcommand,"show")==0){
+ lpc_video_params.show=TRUE;
+ lpc_video_params.refresh=TRUE;
+ }else if (strcmp(subcommand,"hide")==0){
+ lpc_video_params.show=FALSE;
+ lpc_video_params.refresh=TRUE;
+ }else return 0;
+ }
+#else
+ linphonec_out("Sorry, this version of linphonec wasn't compiled with video support.");
+#endif
return 1;
}
+static void lpc_display_global_state(LinphoneCore *lc){
+ linphonec_out("****************Global liblinphone state********************\n\t%s",
+ linphone_global_state_to_string(linphone_core_get_global_state(lc)));
+}
+
+static void lpc_display_call_states(LinphoneCore *lc){
+ LinphoneCall *call;
+ const MSList *elem;
+ char *tmp;
+ linphonec_out("****************Calls states*******************************\nId | Destination | State\n");
+
+ for(elem=linphone_core_get_calls(lc);elem!=NULL;elem=elem->next){
+ call=(LinphoneCall*)elem->data;
+ tmp=linphone_call_get_remote_address_as_string (call);
+ linphonec_out("%2.2i|%10.10s|%s",(int)(long)linphone_call_get_user_pointer(call),
+ tmp,linphone_call_state_to_string(linphone_call_get_state(call)));
+ ms_free(tmp);
+ }
+}
+
+static void lpc_display_proxy_states(LinphoneCore *lc){
+ const MSList *elem;
+ linphonec_out("****************Proxy registration states*****************\nIdentity | State\n");
+ for(elem=linphone_core_get_proxy_config_list (lc);elem!=NULL;elem=elem->next){
+ LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
+ linphonec_out("%20.10s | %s",linphone_proxy_config_get_identity (cfg),
+ linphone_registration_state_to_string(linphone_proxy_config_get_state(cfg)));
+ }
+}
+
+static int lpc_cmd_states(LinphoneCore *lc, char *args){
+ if (args==NULL) {
+ lpc_display_global_state(lc);
+ lpc_display_call_states(lc);
+ lpc_display_proxy_states(lc);
+ return 1;
+ }
+ if (strcmp(args,"global")==0){
+ lpc_display_global_state(lc);
+ return 1;
+ }
+ if (strcmp(args,"proxies")==0){
+ lpc_display_proxy_states(lc);
+ return 1;
+ }
+ if (strcmp(args,"calls")==0){
+ lpc_display_call_states(lc);
+ return 1;
+ }
+ return 0;
+}
+
/***************************************************************************
*
* Command table management funx
#define PACKAGE_DIR ""
#endif
+#ifdef HAVE_X11_XLIB_H
+#include <X11/Xlib.h>
+#include <SDL/SDL_syswm.h>
+#endif
+
/***************************************************************************
*
* Types
#endif /*_WIN32_WCE*/
+extern VideoParams lpc_video_params;
+
void linphonec_call_identify(LinphoneCall* call){
static long callid=1;
linphone_call_set_user_pointer (call,(void*)callid);
exit(exit_status);
}
+#ifdef VIDEO_ENABLED
+
+#ifdef HAVE_X11_XLIB_H
+static void sdl_x11_apply_video_params(){
+ static SDL_SysWMinfo info;
+ static bool_t wminfo_ready=FALSE;
+
+ if ( !wminfo_ready){
+ SDL_VERSION(&info.version);
+ if ( SDL_GetWMInfo(&info) ) {
+ if ( info.subsystem == SDL_SYSWM_X11 ) {
+ wminfo_ready=TRUE;
+ }
+ }
+ }
+ if ( !wminfo_ready) return;
+
+ {
+ XWindowChanges wc;
+ unsigned int flags=0;
+ Display *display = info.info.x11.display;
+ Window window = info.info.x11.wmwindow;
+
+ memset(&wc,0,sizeof(wc));
+ wc.x=lpc_video_params.x;
+ wc.y=lpc_video_params.y;
+ wc.width=lpc_video_params.w;
+ wc.height=lpc_video_params.h;
+ if (lpc_video_params.x!=-1 ){
+ flags|=CWX|CWY;
+ }
+ if (lpc_video_params.w!=-1){
+ flags|=CWWidth|CWHeight;
+ }
+ info.info.x11.lock_func();
+ XConfigureWindow(display,window,flags,&wc);
+ if (lpc_video_params.show)
+ XMapWindow(display,window);
+ else
+ XUnmapWindow(display,window);
+ info.info.x11.unlock_func();
+ }
+}
+#endif
+
+
+static void lpc_apply_video_params(){
+ if (lpc_video_params.refresh){
+ unsigned long wid=linphone_core_get_native_video_window_id (linphonec);
+ if (wid!=0){
+ lpc_video_params.refresh=FALSE;
+#ifdef HAVE_X11_XLIB_H
+ sdl_x11_apply_video_params();
+#endif
+ }
+ }
+}
+
+#endif
+
/*
*
#endif
}
+#ifdef VIDEO_ENABLED
+ lpc_apply_video_params();
+#endif
+
return 0;
}
char *doc; /* Long description. */
} LPC_COMMAND;
+typedef struct {
+ int x,y,w,h;
+ bool_t show;
+ bool_t refresh;
+} VideoParams;
+
/***************************************************************************
*
* Forward declarations
/*not found*/
return NULL;
}
+
+const char *linphone_global_state_to_string(LinphoneGlobalState gs){
+ switch(gs){
+ case LinphoneGlobalOff:
+ return "LinphoneGlobalOff";
+ break;
+ case LinphoneGlobalOn:
+ return "LinphoneGlobalOn";
+ break;
+ case LinphoneGlobalStartup:
+ return "LinphoneGlobalStartup";
+ break;
+ case LinphoneGlobalShutdown:
+ return "LinphoneGlobalShutdown";
+ break;
+ }
+ return NULL;
+}
+
+LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc){
+ return LinphoneGlobalOn;
+}
LinphoneCallPausedByRemote
} LinphoneCallState;
+const char *linphone_call_state_to_string(LinphoneCallState cs);
-enum _LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
+
+LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
const LinphoneAddress * linphone_core_get_current_call_remote_address(struct _LinphoneCore *lc);
const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
**/
typedef struct _LinphoneProxyConfig LinphoneProxyConfig;
+/**
+ * LinphoneRegistrationState describes proxy registration states.
+**/
+typedef enum _LinphoneRegistrationState{
+ LinphoneRegistrationNone,
+ LinphoneRegistrationProgress,
+ LinphoneRegistrationOk,
+ LinphoneRegistrationCleared,
+ LinphoneRegistrationFailed
+}LinphoneRegistrationState;
+
+const char *linphone_registration_state_to_string(LinphoneRegistrationState cs);
+
LinphoneProxyConfig *linphone_proxy_config_new(void);
int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr);
int linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity);
void linphone_proxy_config_set_dial_escape_plus(LinphoneProxyConfig *cfg, bool_t val);
void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char *prefix);
+LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *obj);
bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
LinphoneGlobalShutdown
}LinphoneGlobalState;
-typedef enum _LinphoneRegistrationState{
- LinphoneRegistrationNone,
- LinphoneRegistrationProgress,
- LinphoneRegistrationOk,
- LinphoneRegistrationCleared,
- LinphoneRegistrationFailed
-}LinphoneRegistrationState;
+const char *linphone_global_state_to_string(LinphoneGlobalState gs);
/**
* @addtogroup initializing
const MSList *linphone_core_get_calls(LinphoneCore *lc);
+LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc);
+
#ifdef __cplusplus
}
#endif
struct _SipSetupContext *ssctx;
int auth_failures;
char *dial_prefix;
+ LinphoneRegistrationState state;
bool_t commit;
bool_t reg_sendregister;
bool_t registered;
void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *message){
LinphoneCore *lc=cfg->lc;
+ cfg->state=state;
if (lc && lc->vtable.registration_state_changed){
lc->vtable.registration_state_changed(lc,cfg,state,message);
}
}
+LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyConfig *cfg){
+ return cfg->state;
+}
+
+ const char *linphone_registration_state_to_string(LinphoneRegistrationState cs){
+ switch(cs){
+ case LinphoneRegistrationCleared:
+ return "LinphoneRegistrationCleared";
+ break;
+ case LinphoneRegistrationNone:
+ return "LinphoneRegistrationNone";
+ break;
+ case LinphoneRegistrationProgress:
+ return "LinphoneRegistrationProgress";
+ break;
+ case LinphoneRegistrationOk:
+ return "LinphoneRegistrationOk";
+ break;
+ case LinphoneRegistrationFailed:
+ return "LinphoneRegistrationFailed";
+ break;
+ }
+ return NULL;
+ }