multicall again

This commit is contained in:
Simon Morlat 2010-08-17 15:20:00 +02:00
parent 675f7bcd9e
commit 5de380f508
13 changed files with 310 additions and 486 deletions

View file

@ -407,19 +407,20 @@ lpc_cmd_call(LinphoneCore *lc, char *args)
}
if(!strcmp(args,"show"))
{
MSList *calls = linphone_core_get_calls(lc);
const MSList *calls = linphone_core_get_calls(lc);
if(calls)
{
MSList *p_calls = calls;
const MSList *p_calls = calls;
linphonec_out("<remote>\t\t\t\t<status>\r\n");
while(p_calls != NULL)
{
char *tmp=linphone_call_get_remote_address_as_string(p_calls->data);
linphonec_out("%s\t\t\t%s\r\n",
linphone_call_get_remote_address_as_string(p_calls->data),
tmp,
(((LinphoneCall *)p_calls->data)==linphone_core_get_current_call(lc))?"yes":"no");
p_calls = p_calls->next;
ms_free(tmp);
}
ms_list_free(calls);
}
else
{
@ -639,7 +640,7 @@ lpc_cmd_nat(LinphoneCore *lc, char *args)
}
nat = linphone_core_get_nat_address(lc);
use = linphone_core_get_firewall_policy(lc)==LINPHONE_POLICY_USE_NAT_ADDRESS;
use = linphone_core_get_firewall_policy(lc)==LinphonePolicyUseNatAddress;
linphonec_out("Nat address: %s%s\n", nat ? nat : "unspecified" , use ? "" : " (disabled - use 'firewall nat' to enable)");
return 1;
@ -660,7 +661,7 @@ lpc_cmd_stun(LinphoneCore *lc, char *args)
}
stun = linphone_core_get_stun_server(lc);
use = linphone_core_get_firewall_policy(lc)==LINPHONE_POLICY_USE_STUN;
use = linphone_core_get_firewall_policy(lc)==LinphonePolicyUseStun;
linphonec_out("Stun server: %s%s\n", stun ? stun : "unspecified" , use? "" : " (disabled - use 'firewall stun' to enable)");
return 1;
@ -677,7 +678,7 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
{
if (strcmp(args,"none")==0)
{
linphone_core_set_firewall_policy(lc,LINPHONE_POLICY_NO_FIREWALL);
linphone_core_set_firewall_policy(lc,LinphonePolicyNoFirewall);
}
else if (strcmp(args,"stun")==0)
{
@ -687,7 +688,7 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
linphonec_out("No stun server address is defined, use 'stun <address>' first\n");
return 1;
}
linphone_core_set_firewall_policy(lc,LINPHONE_POLICY_USE_STUN);
linphone_core_set_firewall_policy(lc,LinphonePolicyUseStun);
}
else if (strcmp(args,"nat")==0)
{
@ -697,19 +698,19 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
linphonec_out("No nat address is defined, use 'nat <address>' first");
return 1;
}
linphone_core_set_firewall_policy(lc,LINPHONE_POLICY_USE_NAT_ADDRESS);
linphone_core_set_firewall_policy(lc,LinphonePolicyUseNatAddress);
}
}
switch(linphone_core_get_firewall_policy(lc))
{
case LINPHONE_POLICY_NO_FIREWALL:
case LinphonePolicyNoFirewall:
linphonec_out("No firewall\n");
break;
case LINPHONE_POLICY_USE_STUN:
case LinphonePolicyUseStun:
linphonec_out("Using stun server %s to discover firewall address\n", setting ? setting : linphone_core_get_stun_server(lc));
break;
case LINPHONE_POLICY_USE_NAT_ADDRESS:
case LinphonePolicyUseNatAddress:
linphonec_out("Using supplied nat address %s.\n", setting ? setting : linphone_core_get_nat_address(lc));
break;
}
@ -1229,7 +1230,7 @@ static int lpc_cmd_resume(LinphoneCore *lc, char *args){
else
{
int returned = 0;
MSList *calls = linphone_core_get_calls(lc);
const MSList *calls = linphone_core_get_calls(lc);
if(ms_list_size(calls) == 1)
{
if(linphone_core_resume_call(lc,calls->data) < 0)
@ -1241,7 +1242,6 @@ static int lpc_cmd_resume(LinphoneCore *lc, char *args){
{
returned = 1;
}
ms_list_free(calls);
return returned;
}
}
@ -1775,31 +1775,31 @@ static int lpc_cmd_status(LinphoneCore *lc, char *args)
}
else if (strstr(args,"hook"))
{
gstate_t call_state=linphone_core_get_state(lc,GSTATE_GROUP_CALL);
/*
if (!cfg || !linphone_proxy_config_is_registered(cfg)){
linphonec_out("unregistered\n");
return 1;
}
*/
LinphoneCall *call=linphone_core_get_current_call (lc);
LinphoneCallState call_state=LinphoneCallIdle;
if (call) call_state=linphone_call_get_state(call);
switch(call_state){
case GSTATE_CALL_OUT_INVITE:
case LinphoneCallOutgoingInit:
case LinphoneCallOutgoingProgress:
linphonec_out("hook=dialing\n");
break;
case GSTATE_CALL_IDLE:
case LinphoneCallIdle:
linphonec_out("hook=offhook\n");
break;
case GSTATE_CALL_OUT_CONNECTED:
linphonec_out("Call out, hook=%s duration=%i, muted=%s rtp-xmit-muted=%s\n", linphonec_get_callee(),
case LinphoneCallStreamsRunning:
case LinphoneCallConnected:
if (linphone_call_get_dir(call)==LinphoneCallOutgoing){
linphonec_out("Call out, hook=%s duration=%i, muted=%s rtp-xmit-muted=%s\n", linphonec_get_callee(),
linphone_core_get_current_call_duration(lc),
lc->audio_muted ? "yes" : "no",
linphone_core_is_mic_muted (lc) ? "yes" : "no",
linphone_core_is_rtp_muted(lc) ? "yes" : "no");
break;
case GSTATE_CALL_IN_CONNECTED:
linphonec_out("hook=answered duration=%i\n" ,
linphone_core_get_current_call_duration(lc));
}else{
linphonec_out("hook=answered duration=%i\n" ,
linphone_core_get_current_call_duration(lc));
}
break;
case GSTATE_CALL_IN_INVITE:
case LinphoneCallIncomingReceived:
linphonec_out("Incoming call from %s\n",linphonec_get_caller());
break;
default:
@ -2048,22 +2048,21 @@ static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args){
static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args)
{
bool_t rtp_xmit_off=FALSE;
char *status;
gstate_t call_state=linphone_core_get_state(lc,GSTATE_GROUP_CALL);
bool_t rtp_xmit_off=FALSE;
char *status;
if(args){
if(strstr(args,"1"))rtp_xmit_off=TRUE;
if(call_state == GSTATE_CALL_IDLE)
linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_xmit_off);
else
linphonec_out("nortp-on-audio-mute: call in progress - cannot change state\n");
}
rtp_xmit_off=linphone_core_get_rtp_no_xmit_on_audio_mute(lc);
if(rtp_xmit_off)status="off";
else status="on";
linphonec_out("rtp transmit %s when audio muted\n",status);
return 1;
if(args){
if(strstr(args,"1"))rtp_xmit_off=TRUE;
if(linphone_core_get_current_call (lc)==NULL)
linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_xmit_off);
else
linphonec_out("nortp-on-audio-mute: call in progress - cannot change state\n");
}
rtp_xmit_off=linphone_core_get_rtp_no_xmit_on_audio_mute(lc);
if (rtp_xmit_off) status="off";
else status="on";
linphonec_out("rtp transmit %s when audio muted\n",status);
return 1;
}

View file

@ -112,27 +112,21 @@ static char **linephonec_readline_completion(const char *text,
#endif
/* These are callback for linphone core */
static void linphonec_call_received(LinphoneCore *lc, LinphoneCall *call);
static void linphonec_paused_received(LinphoneCore *lc, LinphoneCall *call);
static void linphonec_resumed_received(LinphoneCore *lc, LinphoneCall *call);
static void linphonec_prompt_for_auth(LinphoneCore *lc, const char *realm,
const char *username);
static void linphonec_display_refer (LinphoneCore * lc,LinphoneCall *call, const char *refer_to);
static void linphonec_display_refer (LinphoneCore * lc, const char *refer_to);
static void linphonec_display_something (LinphoneCore * lc, const char *something);
static void linphonec_display_url (LinphoneCore * lc, const char *something, const char *url);
static void linphonec_display_warning (LinphoneCore * lc, const char *something);
static void stub () {}
static void linphonec_notify_received(LinphoneCore *lc,const char *from,const char *msg);
static void linphonec_ack_paused_received(LinphoneCore *lc, LinphoneCall *call);
static void linphonec_ack_resumed_received(LinphoneCore *lc, LinphoneCall *call);
static void linphonec_notify_presence_received(LinphoneCore *lc,LinphoneFriend *fid);
static void linphonec_new_unknown_subscriber(LinphoneCore *lc,
LinphoneFriend *lf, const char *url);
static void linphonec_bye_received(LinphoneCore *lc, LinphoneCall *call);
static void linphonec_text_received(LinphoneCore *lc, LinphoneChatRoom *cr,
const char *from, const char *msg);
static void linphonec_display_status (LinphoneCore * lc, const char *something);
static void linphonec_general_state (LinphoneCore * lc, LinphoneGeneralState *gstate, LinphoneGeneralStateContext gctx);
static void linphonec_dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf);
static void print_prompt(LinphoneCore *opm);
void linphonec_out(const char *fmt,...);
@ -175,37 +169,6 @@ static ortp_pipe_t server_sock;
#endif /*_WIN32_WCE*/
LinphoneCoreVTable linphonec_vtable
#if !defined (_MSC_VER)
= {
.show =(ShowInterfaceCb) stub,
.inv_recv = linphonec_call_received,
.bye_recv = linphonec_bye_received,
.ringing_recv = (RingingReceivedCb) stub,
.connected_recv = (ConnectedReceivedCb) stub,
.failure_recv = (FailureReceivedCb) stub,
.paused_recv = linphonec_paused_received,
.resumed_recv = linphonec_resumed_received,
.notify_recv = linphonec_notify_received,
.ack_paused_recv = linphonec_ack_paused_received,
.ack_resumed_recv = linphonec_ack_resumed_received,
.notify_presence_recv = linphonec_notify_presence_received,
.new_unknown_subscriber = linphonec_new_unknown_subscriber,
.auth_info_requested = linphonec_prompt_for_auth,
.display_status = linphonec_display_status,
.display_message=linphonec_display_something,
.display_warning=linphonec_display_warning,
.display_url=linphonec_display_url,
.text_received=linphonec_text_received,
.general_state=linphonec_general_state,
.dtmf_received=linphonec_dtmf_received,
.refer_received=linphonec_display_refer
}
#endif /*_WIN32_WCE*/
;
/***************************************************************************
*
* Linphone core callbacks
@ -216,10 +179,9 @@ LinphoneCoreVTable linphonec_vtable
* Linphone core callback
*/
static void
linphonec_display_refer (LinphoneCore * lc,LinphoneCall *call, const char *refer_to)
linphonec_display_refer (LinphoneCore * lc, const char *refer_to)
{
fprintf (stdout, "The distant end point asked to transfer the call to %s,don't forget to terminate the call if not\n%s", refer_to,prompt);
fflush(stdout);
linphonec_out("Receiving out of call refer to %s", refer_to);
}
/*
@ -261,49 +223,6 @@ linphonec_display_url (LinphoneCore * lc, const char *something, const char *url
fprintf (stdout, "%s : %s\n", something, url);
}
/*
* Linphone core callback
*/
static void
linphonec_call_received(LinphoneCore *lc, LinphoneCall *call)
{
char *from=linphone_call_get_remote_address_as_string(call);
linphonec_set_caller(from);
ms_free(from);
if ( auto_answer) {
answer_call=TRUE;
}
}
/*
* Linphone core callback
*/
static void
linphonec_paused_received(LinphoneCore *lc, LinphoneCall *call)
{
char *from=linphone_call_get_remote_address_as_string(call);
if(from)
{
linphonec_out("the call from %s have been paused\n",from);
ms_free(from);
}
}
/*
* Linphone core callback
*/
static void
linphonec_resumed_received(LinphoneCore *lc, LinphoneCall *call)
{
char *from=linphone_call_get_remote_address_as_string(call);
if(from)
{
linphonec_out("the call from %s have been resumed\n",from);
ms_free(from);
}
}
/*
* Linphone core callback
*/
@ -343,33 +262,6 @@ linphonec_notify_received(LinphoneCore *lc,const char *from,const char *msg)
}
}
/*
* Linphone core callback
*/
static void
linphonec_ack_paused_received(LinphoneCore *lc, LinphoneCall *call)
{
char *from=linphone_call_get_remote_address_as_string(call);
if(from)
{
linphonec_out("the previous pause sent to %s has been acknowledged\n",from);
ms_free(from);
}
}
/*
* Linphone core callback
*/
static void
linphonec_ack_resumed_received(LinphoneCore *lc, LinphoneCall *call)
{
char *from=linphone_call_get_remote_address_as_string(call);
if(from)
{
linphonec_out("the previous resume sent to %s has been acknowledged\n",from);
ms_free(from);
}
}
/*
* Linphone core callback
@ -397,18 +289,33 @@ linphonec_new_unknown_subscriber(LinphoneCore *lc, LinphoneFriend *lf,
}
/*
* Linphone core callback
*/
static void
linphonec_bye_received(LinphoneCore *lc, LinphoneCall *call)
{
// Should change prompt back to original maybe
// printing this is unneeded as we'd get a "Communication ended"
// message trough display_status callback anyway
static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState st, const char *msg){
char *from=linphone_call_get_remote_address_as_string(call);
printf("Bye received from %s\n", from);
switch(st){
case LinphoneCallEnd:
printf("Call with %s ended.\n", from);
break;
case LinphoneCallResuming:
printf("Resuming call with %s.\n", from);
break;
case LinphoneCallStreamsRunning:
printf("Media streams established with %s.\n", from);
break;
case LinphoneCallPausing:
printf("Pausing call with %s.\n", from);
break;
case LinphoneCallPaused:
printf("Call with %s is now paused.\n", from);
break;
case LinphoneCallIncomingReceived:
linphonec_set_caller(from);
if ( auto_answer) {
answer_call=TRUE;
}
break;
default:
break;
}
ms_free(from);
}
@ -431,64 +338,6 @@ static void linphonec_dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dt
ms_free(from);
}
static void
linphonec_general_state (LinphoneCore * lc, LinphoneGeneralState *gstate, LinphoneGeneralStateContext gctx)
{
if (show_general_state) {
switch(gstate->new_state) {
case GSTATE_POWER_OFF:
printf("GSTATE_POWER_OFF");
break;
case GSTATE_POWER_STARTUP:
printf("GSTATE_POWER_STARTUP");
break;
case GSTATE_POWER_ON:
printf("GSTATE_POWER_ON");
break;
case GSTATE_POWER_SHUTDOWN:
printf("GSTATE_POWER_SHUTDOWN");
break;
case GSTATE_REG_NONE:
printf("GSTATE_REG_NONE");
break;
case GSTATE_REG_OK:
printf("GSTATE_REG_OK");
break;
case GSTATE_REG_FAILED:
printf("GSTATE_REG_FAILED");
break;
case GSTATE_CALL_IDLE:
printf("GSTATE_CALL_IDLE");
break;
case GSTATE_CALL_OUT_RINGING:
printf("GSTATE_CALL_OUT_RINGING");
break;
case GSTATE_CALL_OUT_INVITE:
printf("GSTATE_CALL_OUT_INVITE");
break;
case GSTATE_CALL_OUT_CONNECTED:
printf("GSTATE_CALL_OUT_CONNECTED");
break;
case GSTATE_CALL_IN_INVITE:
printf("GSTATE_CALL_IN_INVITE");
break;
case GSTATE_CALL_IN_CONNECTED:
printf("GSTATE_CALL_IN_CONNECTED");
break;
case GSTATE_CALL_END:
printf("GSTATE_CALL_END");
break;
case GSTATE_CALL_ERROR:
printf("GSTATE_CALL_ERROR");
break;
default:
printf("GSTATE_UNKNOWN_%d",gstate->new_state);
}
if (gstate->message) printf(" %s", gstate->message);
printf("\n");
}
}
static char received_prompt[PROMPT_MAX_LEN];
static ms_mutex_t prompt_mutex;
static bool_t have_prompt=FALSE;
@ -668,6 +517,8 @@ bool_t linphonec_get_autoanswer(){
return auto_answer;
}
LinphoneCoreVTable linphonec_vtable={0};
/***************************************************************************/
/*
* Main
@ -693,31 +544,24 @@ char **convert_args_to_ascii(int argc, _TCHAR **wargv){
int _tmain(int argc, _TCHAR* wargv[]) {
char **argv=convert_args_to_ascii(argc,wargv);
trace_level=6;
linphonec_vtable.show =(ShowInterfaceCb) stub;
linphonec_vtable.inv_recv = linphonec_call_received;
linphonec_vtable.bye_recv = linphonec_bye_received;
linphonec_vtable.notify_presence_recv = linphonec_notify_received;
linphonec_vtable.new_unknown_subscriber = linphonec_new_unknown_subscriber;
linphonec_vtable.auth_info_requested = linphonec_prompt_for_auth;
linphonec_vtable.display_status = linphonec_display_status;
linphonec_vtable.display_message=linphonec_display_something;
#ifdef VINCENT_MAURY_RSVP
/* the yes/no dialog box */
linphonec_vtable.display_yes_no= (DisplayMessageCb) stub;
#endif
linphonec_vtable.display_warning=linphonec_display_warning;
linphonec_vtable.display_url=linphonec_display_url;
linphonec_vtable.display_question=(DisplayQuestionCb)stub;
linphonec_vtable.text_received=linphonec_text_received;
linphonec_vtable.general_state=linphonec_general_state;
linphonec_vtable.dtmf_received=linphonec_dtmf_received;
#else
int
main (int argc, char *argv[]) {
#endif
linphonec_vtable.call_state_changed=linphonec_call_state_changed;
linphonec_vtable.notify_presence_recv = linphonec_notify_presence_received;
linphonec_vtable.new_unknown_subscriber = linphonec_new_unknown_subscriber;
linphonec_vtable.auth_info_requested = linphonec_prompt_for_auth;
linphonec_vtable.display_status = linphonec_display_status;
linphonec_vtable.display_message=linphonec_display_something;
linphonec_vtable.display_warning=linphonec_display_warning;
linphonec_vtable.display_url=linphonec_display_url;
linphonec_vtable.text_received=linphonec_text_received;
linphonec_vtable.dtmf_received=linphonec_dtmf_received;
linphonec_vtable.refer_received=linphonec_display_refer;
linphonec_vtable.notify_recv=linphonec_notify_received;
if (! linphonec_init(argc, argv) ) exit(EXIT_FAILURE);
linphonec_main_loop (linphonec, sipAddr);

View file

@ -95,7 +95,7 @@ static void call_received(SalOp *h){
linphone_address_clean(from_parsed);
tmp=linphone_address_as_string(from_parsed);
linphone_address_destroy(from_parsed);
linphone_call_set_state(call,LinphoneCallIncomingProgress,"Incoming call");
linphone_call_set_state(call,LinphoneCallIncomingReceived,"Incoming call");
barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"),
(sal_call_autoanswer_asked(h)) ?_(" and asked autoanswer."):_("."));
if (lc->vtable.show) lc->vtable.show(lc);
@ -190,10 +190,16 @@ static void call_accepted(SalOp *op){
call->media_pending=FALSE;
}
if (call->resultdesc && !sal_media_description_empty(call->resultdesc)){
if (call->state==LinphoneCallPausing || sal_media_description_has_dir(call->resultdesc,SalStreamSendOnly)){
if (sal_media_description_has_dir(call->resultdesc,SalStreamSendOnly)){
/*we initiated a pause*/
if (lc->vtable.display_status){
char *tmp=linphone_call_get_remote_address_as_string (call);
char *msg=ms_strdup_printf(_("Call with %s is paused."),tmp);
lc->vtable.display_status(lc,msg);
ms_free(tmp);
ms_free(msg);
}
linphone_call_set_state(call,LinphoneCallPaused,"Call paused");
linphone_call_set_media_streams_dir (call,SalStreamSendOnly);
linphone_call_start_media_streams (call);
}else{
linphone_connect_incoming(lc,call);
@ -252,21 +258,17 @@ static void call_updated(SalOp *op){
if(lc->vtable.display_status)
lc->vtable.display_status(lc,_("We have been resumed..."));
linphone_call_set_state (call,LinphoneCallStreamsRunning,"Connected (streams running)");
linphone_call_set_media_streams_dir (call,SalStreamSendRecv);
}
else if(call->state==LinphoneCallStreamsRunning &&
sal_media_description_has_dir(call->resultdesc,SalStreamRecvOnly) && !strcmp(call->resultdesc->addr,"0.0.0.0")){
if(lc->vtable.display_status)
lc->vtable.display_status(lc,_("We are being paused..."));
linphone_call_set_state (call,LinphoneCallPaused,"Call paused");
linphone_call_set_media_streams_dir (call,SalStreamRecvOnly);
}
else
{
linphone_call_stop_media_streams (call);
linphone_call_init_media_streams (call);
linphone_connect_incoming(lc,call);
}
linphone_call_stop_media_streams (call);
linphone_call_init_media_streams (call);
linphone_connect_incoming(lc,call);
}
}
@ -457,9 +459,17 @@ static void dtmf_received(SalOp *op, char dtmf){
static void refer_received(Sal *sal, SalOp *op, const char *referto){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal);
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
if (lc->vtable.refer_received){
lc->vtable.refer_received(lc,call,referto);
if (op) sal_refer_accept(op);
if (call){
linphone_call_set_state(call,LinphoneCallRefered,"Refered");
if (lc->vtable.display_status){
char *msg=ms_strdup_printf(_("We are transferred to %s"),referto);
lc->vtable.display_status(lc,msg);
ms_free(msg);
}
sal_refer_accept(op);
}else if (lc->vtable.refer_received){
lc->vtable.refer_received(lc,referto);
sal_refer_accept(op);
}
}

View file

@ -335,6 +335,16 @@ LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call){
return call->log;
}
/**
* Returns the refer-to uri (if the call received was transfered).
**/
const char *linphone_call_get_refer_to(const LinphoneCall *call){
return call->refer_to;
}
LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call){
return call->log->dir;
}
/**
* @}
@ -550,21 +560,35 @@ void linphone_call_start_media_streams(LinphoneCall *call){
{
const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
SalProtoRtpAvp,SalAudio);
if (stream && stream->port!=0){
if (stream){
MSSndCard *playcard=lc->sound_conf.lsd_card ?
lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
MSSndCard *captcard=lc->sound_conf.capt_sndcard;
const char *playfile=lc->play_file;
const char *recfile=lc->rec_file;
call->audio_profile=make_profile(lc,call->resultdesc,stream,&used_pt);
if (!lc->use_files){
MSSndCard *playcard=lc->sound_conf.lsd_card ?
lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
MSSndCard *captcard=lc->sound_conf.capt_sndcard;
if (used_pt!=-1){
if (playcard==NULL) {
ms_warning("No card defined for playback !");
goto end;
}
if (captcard==NULL) {
ms_warning("No card defined for capture !");
goto end;
}
audio_stream_start_now(
ms_message("streamdir is %i",stream->dir);
/*Replace soundcard filters by inactive file players or recorders
when placed in recvonly or sendonly mode*/
if (stream->port==0 || stream->dir==SalStreamRecvOnly){
captcard=NULL;
playfile=NULL;
}else if (stream->dir==SalStreamSendOnly){
playcard=NULL;
captcard=NULL;
recfile=NULL;
}
/*if playfile are supplied don't use soundcards*/
if (playfile) captcard=NULL;
if (recfile) playcard=NULL;
audio_stream_start_full(
call->audiostream,
call->audio_profile,
stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr,
@ -572,54 +596,63 @@ void linphone_call_start_media_streams(LinphoneCall *call){
stream->port+1,
used_pt,
jitt_comp,
playfile,
recfile,
playcard,
captcard,
linphone_core_echo_cancellation_enabled(lc));
}else{
audio_stream_start_with_files(
call->audiostream,
call->audio_profile,
stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr,
stream->port,
stream->port+1,
used_pt,
100,
lc->play_file,
lc->rec_file);
}
post_configure_audio_streams(call);
audio_stream_set_rtcp_information(call->audiostream, cname, tool);
}else ms_warning("No audio stream defined ?");
post_configure_audio_streams(call);
audio_stream_set_rtcp_information(call->audiostream, cname, tool);
}else ms_warning("No audio stream accepted ?");
}
}
#ifdef VIDEO_ENABLED
{
const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
SalProtoRtpAvp,SalVideo);
used_pt=-1;
/* shutdown preview */
if (lc->previewstream!=NULL) {
video_preview_stop(lc->previewstream);
lc->previewstream=NULL;
}
if (stream && stream->port!=0 && (lc->video_conf.display || lc->video_conf.capture)) {
if (stream) {
const char *addr=stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr;
call->video_profile=make_profile(lc,call->resultdesc,stream,&used_pt);
video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
video_stream_enable_self_view(call->videostream,lc->video_conf.selfview);
if (lc->video_conf.display && lc->video_conf.capture)
video_stream_start(call->videostream,
call->video_profile, addr, stream->port,
stream->port+1,
used_pt, jitt_comp, lc->video_conf.device);
else if (lc->video_conf.display)
video_stream_recv_only_start(call->videostream,
call->video_profile, addr, stream->port,
used_pt, jitt_comp);
else if (lc->video_conf.capture)
video_stream_send_only_start(call->videostream,
call->video_profile, addr, stream->port,
stream->port+1,
used_pt, jitt_comp, lc->video_conf.device);
video_stream_set_rtcp_information(call->videostream, cname,tool);
if (used_pt!=-1){
VideoStreamDir dir=VideoStreamSendRecv;
MSWebCam *cam=lc->video_conf.device;
bool_t is_inactive=FALSE;
video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
video_stream_enable_self_view(call->videostream,lc->video_conf.selfview);
if (stream->dir==SalStreamSendOnly && lc->video_conf.capture ){
cam=ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),"Static picture");
dir=VideoStreamSendOnly;
}else if (stream->dir==SalStreamRecvOnly && lc->video_conf.display ){
dir=VideoStreamRecvOnly;
}else if (stream->dir==SalStreamSendRecv){
if (lc->video_conf.display && lc->video_conf.capture)
dir=VideoStreamSendRecv;
else if (lc->video_conf.display)
dir=VideoStreamRecvOnly;
else
dir=VideoStreamSendOnly;
}else{
ms_warning("video stream is inactive.");
/*either inactive or incompatible with local capabilities*/
is_inactive=TRUE;
}
if (!is_inactive){
video_stream_set_direction (call->videostream, dir);
video_stream_start(call->videostream,
call->video_profile, addr, stream->port,
stream->port+1,
used_pt, jitt_comp, cam);
video_stream_set_rtcp_information(call->videostream, cname,tool);
}
}else ms_warning("No video stream accepted.");
}else{
ms_warning("No valid video stream defined.");
}
@ -638,7 +671,6 @@ static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){
}
void linphone_call_stop_media_streams(LinphoneCall *call){
LinphoneCore *lc=call->core;
if (call->audiostream!=NULL) {
linphone_call_log_fill_stats (call->log,call->audiostream);
audio_stream_stop(call->audiostream);
@ -646,12 +678,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
}
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL){
if (lc->video_conf.display && lc->video_conf.capture)
video_stream_stop(call->videostream);
else if (lc->video_conf.display)
video_stream_recv_only_stop(call->videostream);
else if (lc->video_conf.capture)
video_stream_send_only_stop(call->videostream);
video_stream_stop(call->videostream);
call->videostream=NULL;
}
@ -668,6 +695,4 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
}
}
void linphone_call_set_media_streams_dir(LinphoneCall *call, SalStreamDir dir){
}

View file

@ -1980,11 +1980,13 @@ LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddr
LinphoneCall *call;
if (linphone_core_in_call(lc)){
lc->vtable.display_warning(lc,_("Sorry, you have to pause or stop the current call first !"));
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Sorry, you have to pause or stop the current call first !"));
return NULL;
}
if(!linphone_core_can_we_add_call(lc)){
lc->vtable.display_warning(lc,_("Sorry, we have reached the maximum number of simultaneous calls"));
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Sorry, we have reached the maximum number of simultaneous calls"));
return NULL;
}
linphone_core_get_default_proxy(lc,&proxy);
@ -2013,10 +2015,12 @@ LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddr
if(linphone_core_add_call(lc,call)!= 0)
{
ms_warning("we had a problem in adding the call into the invite ... weird\n");
ms_warning("we had a problem in adding the call into the invite ... weird");
linphone_call_unref(call);
return NULL;
}
/* this call becomes now the current one*/
lc->current_call=call;
if (dest_proxy!=NULL || lc->sip_conf.ping_with_options==FALSE){
err=linphone_core_start_invite(lc,call,dest_proxy);
}else{
@ -2089,12 +2093,17 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
if (call==NULL){
//if just one call is present answer the only one ...
if(ms_list_size(linphone_core_get_calls(lc)) != 1)
if(linphone_core_get_calls_nb (lc) != 1)
return -1;
else
call = linphone_core_get_calls(lc)->data;
call = (LinphoneCall*)linphone_core_get_calls(lc)->data;
}
if (lc->current_call){
ms_warning("Cannot accept this call, there is already one running.");
return -1;
}
if (call->state==LinphoneCallConnected){
/*call already accepted*/
return -1;
@ -2119,10 +2128,6 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
ms_message("ring stopped");
lc->ringstream=NULL;
}
if(linphone_core_set_as_current_call(lc,call)!=0)
{
ms_message("another call is already in process\n");
}
linphone_core_get_default_proxy(lc,&cfg);
/*try to be best-effort in giving real local or routable contact address*/
@ -2135,6 +2140,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
sal_call_accept(call->op);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Connected."));
lc->current_call=call;
linphone_call_set_state(call,LinphoneCallConnected,"Connected");
call->resultdesc=sal_call_get_final_media_description(call->op);
if (call->resultdesc){
@ -2214,13 +2220,17 @@ int linphone_core_terminate_all_calls(LinphoneCore *lc){
}
/**
* Returns the calls MSList
* Returns the current list of calls.
*
* Note that this list is read-only and might be changed by the core after a function call to linphone_core_iterate().
* Similarly the LinphoneCall objects inside it might be destroyed without prior notice.
* To hold references to LinphoneCall object into your program, you must use linphone_call_ref().
*
* @ingroup call_control
**/
MSList *linphone_core_get_calls(LinphoneCore *lc)
const MSList *linphone_core_get_calls(LinphoneCore *lc)
{
return ms_list_copy(lc->calls);
return lc->calls;
}
/**
@ -2250,23 +2260,7 @@ LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc)
int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *the_call)
{
LinphoneCall *call = the_call;
if(lc == NULL)
{
ms_error("LinphoneCore was null\n");
return -1;
}
if(call == NULL)
{
if(linphone_core_in_call(lc))
{
call = linphone_core_get_current_call(lc);
}
else
{
ms_error("LinphoneCall was null");
return -1;
}
}
if(linphone_core_get_current_call(lc) != call)
{
ms_error("The call asked to be paused was not the current on");
@ -2280,6 +2274,7 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *the_call)
linphone_call_set_state(call,LinphoneCallPausing,"Pausing call");
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Pausing the current call..."));
lc->current_call=NULL;
return 0;
}
@ -2292,46 +2287,24 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call)
{
char temp[255]={0};
LinphoneCall *call = the_call;
if(lc == NULL)
{
ms_error("LinphoneCore was null\n");
return -1;
}
if(call == NULL)
{
MSList *calls = linphone_core_get_calls(lc);
if(ms_list_size(calls) == 1)
{
call = ((LinphoneCall *)calls->data);
ms_list_free(calls);
}
else
{
ms_error("LinphoneCall was null\n");
ms_list_free(calls);
return -2;
}
}
if(call->state!=LinphoneCallPaused )
{
if(call->state!=LinphoneCallPaused ){
ms_warning("we cannot resume a call when the communication is not established");
return -1;
}
if(linphone_core_get_current_call(lc) != NULL)
{
ms_error("There is already a call in process pause or stop it first\n");
if(linphone_core_get_current_call(lc) != NULL){
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("There is already a call in process, pause or stop it first."));
return -1;
}
if(sal_call_hold(call->op,FALSE) != 0)
{
lc->vtable.display_warning(lc,_("Could not resume the call"));
if(sal_call_hold(call->op,FALSE) != 0){
return -1;
}
linphone_call_set_state (call,LinphoneCallResuming,"Resuming");
linphone_core_set_as_current_call(lc,call);
snprintf(temp,sizeof(temp)-1,"Resuming the call with %s",linphone_call_get_remote_address_as_string(call));
if (lc->vtable.display_status)
lc->vtable.display_status(lc,temp);
lc->current_call=call;
return 0;
}
@ -3145,7 +3118,7 @@ int linphone_core_set_static_picture(LinphoneCore *lc, const char *path) {
unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc){
#ifdef VIDEO_ENABLED
LinphoneCall *call=linphone_core_get_current_call (lc);
if (call->videostream)
if (call && call->videostream)
return video_stream_get_native_window_id(call->videostream);
if (lc->previewstream)
return video_stream_get_native_window_id(lc->previewstream);
@ -3617,18 +3590,8 @@ void linphone_core_destroy(LinphoneCore *lc){
*
* @ingroup call_control
**/
int linphone_core_get_calls_nb(const LinphoneCore *lc)
{
int returned;
if(lc->calls == NULL)
{
returned = 0;
}
else
{
returned = ms_list_size(lc->calls);
}
return returned;
int linphone_core_get_calls_nb(const LinphoneCore *lc){
return ms_list_size(lc->calls);;
}
/**
@ -3644,44 +3607,12 @@ bool_t linphone_core_can_we_add_call(LinphoneCore *lc)
return FALSE;
}
/**
* Unset the current call
*
* @ingroup call_control
**/
int linphone_core_unset_the_current_call(LinphoneCore *lc)
{
if(lc->current_call == NULL)
return -1;
lc->current_call = NULL;
ms_message("Current call unset\n");
return 0;
}
/**
* Set the call in parameter as the new current call
*
* @ingroup call_control
**/
int linphone_core_set_as_current_call(LinphoneCore *lc, LinphoneCall *call)
{
if(lc->current_call != NULL)
return -1;
lc->current_call = call;
return 0;
}
int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call)
{
if(linphone_core_can_we_add_call(lc))
{
MSList *the_calls = lc->calls;
if (the_calls==NULL){
lc->current_call=call;
}
the_calls = ms_list_append(the_calls,call);
lc->calls = the_calls;
lc->calls = ms_list_append(lc->calls,call);
return 0;
}
return -1;
@ -3690,12 +3621,8 @@ int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call)
int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
{
MSList *it;
MSList *the_calls = lc->calls;
if(call == linphone_core_get_current_call(lc))
{
linphone_core_unset_the_current_call(lc);
}
it=ms_list_find(the_calls,call);
if (it)
{

View file

@ -167,9 +167,11 @@ 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);
char *linphone_call_get_remote_address_as_string(const LinphoneCall *call);
LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call);
void linphone_call_ref(LinphoneCall *call);
void linphone_call_unref(LinphoneCall *call);
LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
const char *linphone_call_get_refer_to(const LinphoneCall *call);
void *linphone_call_get_user_pointer(LinphoneCall *call);
void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
@ -364,7 +366,7 @@ void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr);
typedef enum _LinphoneCallState{
LinphoneCallIdle,
LinphoneCallIncomingProgress,
LinphoneCallIncomingReceived,
LinphoneCallOutgoingInit,
LinphoneCallOutgoingProgress,
LinphoneCallOutgoingRinging,
@ -431,7 +433,7 @@ typedef void (*TextMessageReceived)(struct _LinphoneCore *lc, LinphoneChatRoom *
/** Callback prototype */
typedef void (*DtmfReceived)(struct _LinphoneCore* lc, LinphoneCall *call, int dtmf);
/** Callback prototype */
typedef void (*ReferReceived)(struct _LinphoneCore *lc, LinphoneCall *call, const char *refer_to);
typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to);
/** Callback prototype */
typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf);
@ -449,7 +451,7 @@ typedef struct _LinphoneVTable{
CallLogUpdated call_log_updated; /**< Notifies that call log list has been updated */
TextMessageReceived text_received; /**< A text message has been received */
DtmfReceived dtmf_received; /**< A dtmf has been received received */
ReferReceived refer_received; /**< A refer was received */
ReferReceived refer_received; /**< An out of call refer was received */
BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/
NotifyReceivedCb notify_recv; /**< Other notifications*/
DisplayStatusCb display_status; /**< Callback that notifies various events with human readable text.*/
@ -813,10 +815,12 @@ void linphone_core_set_audio_transports(LinphoneCore *lc, RtpTransport *rtp, Rtp
int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, rtp_stats_t *remote);
const MSList *linphone_core_get_calls(LinphoneCore *lc);
#ifdef __cplusplus
}
#endif
MSList *linphone_core_get_calls(LinphoneCore *lc);
#endif

View file

@ -85,6 +85,8 @@ static void initiate_outgoing(const SalStreamDescription *local_offer,
result->payloads=match_payloads(local_offer->payloads,remote_answer->payloads);
result->proto=local_offer->proto;
result->type=local_offer->type;
result->dir=local_offer->dir;
if (result->payloads && !only_telephone_event(result->payloads)){
strcpy(result->addr,remote_answer->addr);
result->port=remote_answer->port;
@ -102,6 +104,13 @@ static void initiate_incoming(const SalStreamDescription *local_cap,
result->payloads=match_payloads(local_cap->payloads,remote_offer->payloads);
result->proto=local_cap->proto;
result->type=local_cap->type;
if (remote_offer->dir==SalStreamSendOnly)
result->dir=SalStreamRecvOnly;
else if (remote_offer->dir==SalStreamRecvOnly){
result->dir=SalStreamSendOnly;
}else if (remote_offer->dir==SalStreamInactive){
result->dir=SalStreamInactive;
}else result->dir=SalStreamSendRecv;
if (result->payloads && !only_telephone_event(result->payloads)){
strcpy(result->addr,local_cap->addr);
result->port=local_cap->port;

View file

@ -75,6 +75,7 @@ struct _LinphoneCall
int video_port;
struct _AudioStream *audiostream; /**/
struct _VideoStream *videostream;
char *refer_to;
bool_t media_pending;
bool_t audio_muted;
};

View file

@ -39,18 +39,18 @@ typedef struct _status_picture_tab_t{
} status_picture_tab_t;
status_picture_tab_t status_picture_tab[]={
{ LINPHONE_STATUS_ONLINE, "status-green.png" },
{ LINPHONE_STATUS_BUSY, "status-orange.png" },
{ LINPHONE_STATUS_BERIGHTBACK, "status-orange.png" },
{ LINPHONE_STATUS_AWAY, "status-orange.png" },
{ LINPHONE_STATUS_ONTHEPHONE, "status-orange.png" },
{ LINPHONE_STATUS_OUTTOLUNCH, "status-orange.png" },
{ LINPHONE_STATUS_NOT_DISTURB, "status-red.png" },
{ LINPHONE_STATUS_MOVED, "status-orange.png" },
{ LINPHONE_STATUS_ALT_SERVICE, "status-orange.png" },
{ LINPHONE_STATUS_OFFLINE, "status-offline.png" },
{ LINPHONE_STATUS_PENDING, "status-offline.png" },
{ LINPHONE_STATUS_END, NULL },
{ LinphoneStatusOnline, "status-green.png" },
{ LinphoneStatusBusy, "status-orange.png" },
{ LinphoneStatusBeRightBack, "status-orange.png" },
{ LinphoneStatusAway, "status-orange.png" },
{ LinphoneStatusOnThePhone, "status-orange.png" },
{ LinphoneStatusOutToLunch, "status-orange.png" },
{ LinphoneStatusDoNotDisturb, "status-red.png" },
{ LinphoneStatusMoved, "status-orange.png" },
{ LinphoneStatusAltService, "status-orange.png" },
{ LinphoneStatusOffline, "status-offline.png" },
{ LinphoneStatusPending, "status-offline.png" },
{ LinphoneStatusEnd, NULL },
};
static GdkPixbuf *create_status_picture(LinphoneOnlineStatus ss){
@ -132,7 +132,7 @@ static GtkWidget * create_presence_menu(){
GdkPixbuf *pbuf;
status_picture_tab_t *t;
for(t=status_picture_tab;t->img!=NULL;++t){
if (t->status==LINPHONE_STATUS_PENDING){
if (t->status==LinphoneStatusPending){
continue;
}
menu_item=gtk_image_menu_item_new_with_label(linphone_online_status_to_string(t->status));
@ -317,7 +317,7 @@ void linphone_gtk_show_friends(void){
continue;
}
}
if (!online_only || (linphone_friend_get_status(lf)!=LINPHONE_STATUS_OFFLINE)){
if (!online_only || (linphone_friend_get_status(lf)!=LinphoneStatusOffline)){
BuddyInfo *bi;
if (name==NULL || name[0]=='\0') display=uri;
gtk_list_store_append(store,&iter);

View file

@ -231,22 +231,29 @@ void linphone_gtk_draw_hold_button(GtkToggleButton *button, gboolean active){
}
void linphone_gtk_hold_toggled(GtkToggleButton *button){
GtkWidget *mw=linphone_gtk_get_main_window();
gboolean active=gtk_toggle_button_get_active(button);
if(active)
{
linphone_core_pause_call(linphone_gtk_get_core(),NULL);
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"terminate_call"),FALSE);
LinphoneCall *call=linphone_core_get_current_call (linphone_gtk_get_core());
if (call==NULL) return;
linphone_core_pause_call(linphone_gtk_get_core(),call);
}
else
{
linphone_core_resume_call(linphone_gtk_get_core(),NULL);
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"terminate_call"),TRUE);
const MSList *calls=linphone_core_get_calls(linphone_gtk_get_core());
if (calls==NULL) return;
if (ms_list_size(calls)>1){
g_warning("Simultaneously calls not yet implemented in gtk ui.");
return;
}
/*we are supposed to have only one */
linphone_core_resume_call(linphone_gtk_get_core(),(LinphoneCall*)calls->data);
}
linphone_gtk_draw_hold_button(button,active);
}
void linphone_gtk_enable_hold_button(GtkToggleButton *button, gboolean sensitive){
gtk_widget_set_sensitive(GTK_WIDGET(button),sensitive);
linphone_gtk_hold_toggled(button);
linphone_gtk_draw_hold_button(button,FALSE);
}

View file

@ -43,7 +43,6 @@ static GtkWidget *the_ui=NULL;
static void linphone_gtk_show(LinphoneCore *lc);
static void linphone_gtk_inv_recv(LinphoneCore *lc, LinphoneCall *call);
static void linphone_gtk_bye_recv(LinphoneCore *lc, LinphoneCall *call);
static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid);
static void linphone_gtk_new_unknown_subscriber(LinphoneCore *lc, LinphoneFriend *lf, const char *url);
static void linphone_gtk_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username);
@ -52,27 +51,10 @@ static void linphone_gtk_display_message(LinphoneCore *lc, const char *msg);
static void linphone_gtk_display_warning(LinphoneCore *lc, const char *warning);
static void linphone_gtk_display_url(LinphoneCore *lc, const char *msg, const char *url);
static void linphone_gtk_call_log_updated(LinphoneCore *lc, LinphoneCallLog *cl);
static void linphone_gtk_general_state(LinphoneCore *lc, LinphoneGeneralState *gstate, LinphoneGeneralStateContext gctx);
static void linphone_gtk_refer_received(LinphoneCore *lc, LinphoneCall *call, const char *refer_to);
static void linphone_gtk_refer_received(LinphoneCore *lc, const char *refer_to);
static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cs, const char *msg);
static gboolean linphone_gtk_auto_answer(GtkWidget *incall_window);
static LinphoneCoreVTable vtable={
.show=linphone_gtk_show,
.inv_recv=linphone_gtk_inv_recv,
.bye_recv=linphone_gtk_bye_recv,
.notify_presence_recv=linphone_gtk_notify_recv,
.new_unknown_subscriber=linphone_gtk_new_unknown_subscriber,
.auth_info_requested=linphone_gtk_auth_info_requested,
.display_status=linphone_gtk_display_status,
.display_message=linphone_gtk_display_message,
.display_warning=linphone_gtk_display_warning,
.display_url=linphone_gtk_display_url,
.call_log_updated=linphone_gtk_call_log_updated,
.text_received=linphone_gtk_text_received,
.general_state=linphone_gtk_general_state,
.refer_received=linphone_gtk_refer_received,
.buddy_info_updated=linphone_gtk_buddy_info_updated
};
static gboolean verbose=0;
static gboolean auto_answer = 0;
@ -209,6 +191,22 @@ static const char *linphone_gtk_get_factory_config_file(){
static void linphone_gtk_init_liblinphone(const char *config_file,
const char *factory_config_file) {
LinphoneCoreVTable vtable={0};
vtable.call_state_changed=linphone_gtk_call_state_changed;
vtable.show=linphone_gtk_show;
vtable.notify_presence_recv=linphone_gtk_notify_recv;
vtable.new_unknown_subscriber=linphone_gtk_new_unknown_subscriber;
vtable.auth_info_requested=linphone_gtk_auth_info_requested;
vtable.display_status=linphone_gtk_display_status;
vtable.display_message=linphone_gtk_display_message;
vtable.display_warning=linphone_gtk_display_warning;
vtable.display_url=linphone_gtk_display_url;
vtable.call_log_updated=linphone_gtk_call_log_updated;
vtable.text_received=linphone_gtk_text_received;
vtable.refer_received=linphone_gtk_refer_received;
vtable.buddy_info_updated=linphone_gtk_buddy_info_updated;
linphone_core_set_user_agent("Linphone", LINPHONE_VERSION);
the_core=linphone_core_new(&vtable,config_file,factory_config_file,NULL);
linphone_core_set_waiting_callback(the_core,linphone_gtk_wait,NULL);
@ -641,7 +639,9 @@ void linphone_gtk_uri_bar_activate(GtkWidget *w){
void linphone_gtk_terminate_call(GtkWidget *button){
linphone_core_terminate_call(linphone_gtk_get_core(),NULL);
const MSList *elem=linphone_core_get_calls(linphone_gtk_get_core());
if (elem==NULL) return;
linphone_core_terminate_call(linphone_gtk_get_core(),(LinphoneCall*)elem->data);
}
void linphone_gtk_decline_call(GtkWidget *button){
@ -729,10 +729,6 @@ static void linphone_gtk_inv_recv(LinphoneCore *lc, LinphoneCall *call){
ms_free(from);
}
static void linphone_gtk_bye_recv(LinphoneCore *lc, LinphoneCall *call){
}
static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid){
linphone_gtk_show_friends();
}
@ -873,22 +869,24 @@ static void linphone_gtk_call_log_updated(LinphoneCore *lc, LinphoneCallLog *cl)
if (w) linphone_gtk_call_log_update(w);
}
static void linphone_gtk_general_state(LinphoneCore *lc, LinphoneGeneralState *gstate, LinphoneGeneralStateContext gctx){
switch(gstate->new_state){
case GSTATE_CALL_OUT_CONNECTED:
case GSTATE_CALL_IN_CONNECTED:
static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cs, const char *msg){
switch(cs){
case LinphoneCallConnected:
if (linphone_gtk_use_in_call_view())
linphone_gtk_in_call_view_set_in_call();
linphone_gtk_enable_mute_button(
GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"main_mute")),
TRUE);
break;
case GSTATE_CALL_ERROR:
linphone_gtk_call_terminated(gstate->message);
case LinphoneCallError:
linphone_gtk_call_terminated(msg);
break;
case GSTATE_CALL_END:
case LinphoneCallEnd:
linphone_gtk_call_terminated(NULL);
break;
case LinphoneCallIncomingReceived:
linphone_gtk_inv_recv (lc,call);
break;
default:
break;
}
@ -1204,7 +1202,7 @@ void linphone_gtk_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){
}
static void linphone_gtk_refer_received(LinphoneCore *lc, LinphoneCall *call, const char *refer_to){
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();

View file

@ -119,17 +119,17 @@ void linphone_gtk_video_port_changed(GtkWidget *w){
void linphone_gtk_no_firewall_toggled(GtkWidget *w){
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)))
linphone_core_set_firewall_policy(linphone_gtk_get_core(),LINPHONE_POLICY_NO_FIREWALL);
linphone_core_set_firewall_policy(linphone_gtk_get_core(),LinphonePolicyNoFirewall);
}
void linphone_gtk_use_nat_address_toggled(GtkWidget *w){
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)))
linphone_core_set_firewall_policy(linphone_gtk_get_core(),LINPHONE_POLICY_USE_NAT_ADDRESS);
linphone_core_set_firewall_policy(linphone_gtk_get_core(),LinphonePolicyUseNatAddress);
}
void linphone_gtk_use_stun_toggled(GtkWidget *w){
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)))
linphone_core_set_firewall_policy(linphone_gtk_get_core(),LINPHONE_POLICY_USE_STUN);
linphone_core_set_firewall_policy(linphone_gtk_get_core(),LinphonePolicyUseStun);
}
void linphone_gtk_mtu_changed(GtkWidget *w){
@ -762,13 +762,13 @@ void linphone_gtk_show_parameters(void){
if (tmp) gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"stun_server")),tmp);
pol=linphone_core_get_firewall_policy(lc);
switch(pol){
case LINPHONE_POLICY_NO_FIREWALL:
case LinphonePolicyNoFirewall:
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"no_nat")),TRUE);
break;
case LINPHONE_POLICY_USE_NAT_ADDRESS:
case LinphonePolicyUseNatAddress:
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"use_nat_address")),TRUE);
break;
case LINPHONE_POLICY_USE_STUN:
case LinphonePolicyUseStun:
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"use_stun")),TRUE);
break;
}

@ -1 +1 @@
Subproject commit 04be0f4c3eac2d30828963b3617497bb9337e3bc
Subproject commit 236222b3f08baf502742b6c75633f50e3a14917f