fix some bugs, cleanups

This commit is contained in:
Simon Morlat 2010-08-09 14:55:09 +02:00
parent c7a2d74ea0
commit 725638c7bc
11 changed files with 116 additions and 98 deletions

View file

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT([linphone],[3.3.2],[linphone-developers@nongnu.org])
AC_INIT([linphone],[3.3.99],[linphone-developers@nongnu.org])
AC_CANONICAL_SYSTEM
dnl Source packaging numbers
@ -15,7 +15,12 @@ LINPHONE_VERSION=$LINPHONE_MAJOR_VERSION.$LINPHONE_MINOR_VERSION.${LINPHONE_MICR
if test "$LINPHONE_EXTRA_VERSION" != "" ;then
LINPHONE_VERSION=$LINPHONE_VERSION.${LINPHONE_EXTRA_VERSION}
fi
LIBLINPHONE_SO_VERSION=`expr $LINPHONE_MINOR_VERSION + $LINPHONE_MAJOR_VERSION`:$LINPHONE_MICRO_VERSION:$LINPHONE_MINOR_VERSION
LIBLINPHONE_SO_CURRENT=4 dnl increment this number when you add/change/remove an interface
LIBLINPHONE_SO_REVISION=0 dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT
LIBLINPHONE_SO_AGE=0 dnl increment this number when you add an interface, set to 0 if you remove an interface
LIBLINPHONE_SO_VERSION=$LIBLINPHONE_SO_CURRENT:$LIBLINPHONE_SO_REVISION:$LIBLINPHONE_SO_AGE
AC_SUBST(LIBLINPHONE_SO_VERSION, $LIBLINPHONE_SO_VERSION)
AC_SUBST(LINPHONE_VERSION)

View file

@ -194,13 +194,8 @@ LinphoneCoreVTable linphonec_vtable
.auth_info_requested = linphonec_prompt_for_auth,
.display_status = linphonec_display_status,
.display_message=linphonec_display_something,
#ifdef VINCENT_MAURY_RSVP
/* the yes/no dialog box */
.display_yes_no= (DisplayMessageCb) stub,
#endif
.display_warning=linphonec_display_warning,
.display_url=linphonec_display_url,
.display_question=(DisplayQuestionCb)stub,
.text_received=linphonec_text_received,
.general_state=linphonec_general_state,
.dtmf_received=linphonec_dtmf_received,

View file

@ -134,10 +134,9 @@ static void call_received(SalOp *h){
call->state=LinphoneCallRinging;
sal_call_notify_ringing(h);
#if !(__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000)
linphone_core_init_media_streams(lc,lc->call);
linphone_core_init_media_streams(lc,call);
#endif
if (lc->vtable.inv_recv) lc->vtable.inv_recv(lc,call);
#endif
ms_free(barmesg);
ms_free(tmp);
}
@ -205,7 +204,7 @@ static void call_accepted(SalOp *op){
}
gctx.call=call;
if (call->state==LinphoneCallAVRunning){
ms_message("GET ACK of resume\n");
ms_message("GET 200Ok of resume\n");
if(lc->vtable.ack_resumed_recv)
lc->vtable.ack_resumed_recv(lc,call);
return ; //already accepted
@ -226,20 +225,16 @@ static void call_accepted(SalOp *op){
call->media_pending=FALSE;
}
if (call->resultdesc && !sal_media_description_empty(call->resultdesc)){
//if we initiate a pause
//if we initiated a pause
if(call->state == LinphoneCallPaused)
{
ms_message("GET ACK of pause\n");
ms_message("GET 200Ok of pause\n");
if(lc->vtable.ack_paused_recv)
lc->vtable.ack_paused_recv(lc,call);
}//if there is an accepted incoming call
else
{
/*
* Do not set the call as current here,
* because we can go through this function not only when an incoming call is accepted
*/
//linphone_core_set_as_current_call (lc,call);
linphone_core_set_as_current_call (lc,call);
gstate_new_state(lc, GSTATE_CALL_OUT_CONNECTED, gctx, NULL);
linphone_connect_incoming(lc,call);
}

View file

@ -3983,16 +3983,15 @@ int linphone_core_set_as_current_call(LinphoneCore *lc, LinphoneCall *call)
return 0;
}
/**
* Add the call in the LinphoneCall list
*
* @ingroup call_control
**/
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;
return 0;
@ -4000,11 +3999,6 @@ int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call)
return -1;
}
/**
* Add the call in the LinphoneCall list
*
* @ingroup call_control
**/
int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
{
MSList *it;

View file

@ -179,7 +179,8 @@ char *linphone_call_get_remote_address_as_string(const LinphoneCall *call);
void linphone_call_ref(LinphoneCall *call);
void linphone_call_unref(LinphoneCall *call);
LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
void *linphone_call_get_user_pointer(LinphoneCall *call);
void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
typedef enum{
LinphoneSPWait,
@ -378,26 +379,28 @@ typedef enum _gstate_group {
} gstate_group_t;
typedef enum _gstate {
/* states for GSTATE_GROUP_POWER */
GSTATE_POWER_OFF = 0, /* initial state */
GSTATE_POWER_STARTUP,
GSTATE_POWER_ON,
GSTATE_POWER_SHUTDOWN,
/* states for GSTATE_GROUP_REG */
GSTATE_REG_NONE = 10, /* initial state */
GSTATE_REG_OK,
GSTATE_REG_FAILED,
GSTATE_REG_PENDING, /* a registration request is ongoing*/
/* states for GSTATE_GROUP_CALL */
GSTATE_CALL_IDLE = 20, /* initial state */
GSTATE_CALL_OUT_INVITE,
GSTATE_CALL_OUT_CONNECTED,
GSTATE_CALL_IN_INVITE,
GSTATE_CALL_IN_CONNECTED,
GSTATE_CALL_END,
GSTATE_CALL_ERROR,
GSTATE_INVALID,
GSTATE_CALL_OUT_RINGING /*remote ringing*/
/* states for GSTATE_GROUP_POWER */
GSTATE_POWER_OFF = 0, /* initial state */
GSTATE_POWER_STARTUP,
GSTATE_POWER_ON,
GSTATE_POWER_SHUTDOWN,
/* states for GSTATE_GROUP_REG */
GSTATE_REG_NONE = 10, /* initial state */
GSTATE_REG_OK,
GSTATE_REG_FAILED,
GSTATE_REG_PENDING, /* a registration request is ongoing*/
/* states for GSTATE_GROUP_CALL */
GSTATE_CALL_IDLE = 20, /* initial state */
GSTATE_CALL_OUT_INVITE,
GSTATE_CALL_OUT_CONNECTED,
GSTATE_CALL_IN_INVITE,
GSTATE_CALL_IN_CONNECTED,
GSTATE_CALL_END,
GSTATE_CALL_ERROR,
GSTATE_CALL_OUT_RINGING, /*remote ringing*/
GSTATE_CALL_PAUSED,
GSTATE_CALL_RESUMED,
GSTATE_INVALID
} gstate_t;
struct _LinphoneGeneralState {
@ -476,7 +479,6 @@ typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf);
**/
typedef struct _LinphoneVTable
{
ShowInterfaceCb show; /**< Notifies the application that it should show up*/
InviteReceivedCb inv_recv; /**< Notifies incoming calls */
ByeReceivedCb bye_recv; /**< Notify calls terminated by far end*/
RingingReceivedCb ringing_recv; /**< Notify that the distant phone is ringing*/
@ -486,21 +488,21 @@ typedef struct _LinphoneVTable
ResumedReceivedCb resumed_recv; /**< Notify that the call has been resumed*/
AckPausedReceivedCb ack_paused_recv;/**< Notify that the previous command pause sent to the call has been acknowledge*/
AckResumedReceivedCb ack_resumed_recv;/**< Notify that the previous command resumed sent to the call has been acknowledge*/
GeneralStateChange general_state; /**< State notification callback */
NotifyPresenceReceivedCb notify_presence_recv; /**< Notify received presence events*/
NewUnknownSubscriberCb new_unknown_subscriber; /**< Notify about unknown subscriber */
AuthInfoRequested auth_info_requested; /**< Ask the application some authentication information */
DisplayStatusCb display_status; /**< Callback that notifies various events with human readable text.*/
DisplayMessageCb display_message;/**< Callback to display a message to the user */
DisplayMessageCb display_warning;/** Callback to display a warning to the user */
DisplayUrlCb display_url;
DisplayQuestionCb display_question;
CallLogUpdated call_log_updated; /**< Notifies that call log list has been updated */
TextMessageReceived text_received; /**< A text message has been received */
GeneralStateChange general_state; /**< State notification callback */
DtmfReceived dtmf_received; /**< A dtmf has been received received */
ReferReceived refer_received; /**< A 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.*/
DisplayMessageCb display_message;/**< Callback to display a message to the user */
DisplayMessageCb display_warning;/** Callback to display a warning to the user */
DisplayUrlCb display_url;
ShowInterfaceCb show; /**< Notifies the application that it should show up*/
} LinphoneCoreVTable;
/**
@ -875,7 +877,6 @@ int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, r
}
#endif
MSList *linphone_core_get_calls(LinphoneCore *lc);
void *linphone_call_get_user_pointer(LinphoneCall *call);
void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
#endif

View file

@ -62,11 +62,28 @@ const SalStreamDescription *sal_media_description_find_stream(const SalMediaDesc
return NULL;
}
bool_t sal_media_description_empty(SalMediaDescription *md){
bool_t sal_media_description_empty(const SalMediaDescription *md){
int i;
for(i=0;i<md->nstreams;++i){
const SalStreamDescription *ss=&md->streams[i];
if (ss->port!=0) return FALSE;
}
return TRUE;
}
void sal_media_description_set_dir(SalMediaDescription *md, SalStreamDir stream_dir){
int i;
for(i=0;i<md->nstreams;++i){
SalStreamDescription *ss=&md->streams[i];
if (ss->port!=0) return FALSE;
ss->dir=stream_dir;
}
}
bool_t sal_media_description_has_dir(const SalMediaDescription *md, SalStreamDir stream_dir){
int i;
for(i=0;i<md->nstreams;++i){
const SalStreamDescription *ss=&md->streams[i];
if (ss->dir!=stream_dir) return FALSE;
}
return TRUE;
}

View file

@ -86,6 +86,13 @@ typedef enum{
SalProtoRtpSavp
}SalMediaProto;
typedef enum{
SalStreamSendRecv,
SalStreamSendOnly,
SalStreamRecvOnly,
SalStreamInactive
}SalStreamDir;
typedef struct SalEndpointCandidate{
char addr[64];
int port;
@ -102,7 +109,7 @@ typedef struct SalStreamDescription{
int bandwidth;
int ptime;
SalEndpointCandidate candidates[SAL_ENDPOINT_CANDIDATE_MAX];
bool_t notsending;
SalStreamDir dir;
} SalStreamDescription;
#define SAL_MEDIA_DESCRIPTION_MAX_STREAMS 4
@ -114,15 +121,16 @@ typedef struct SalMediaDescription{
int nstreams;
int bandwidth;
SalStreamDescription streams[SAL_MEDIA_DESCRIPTION_MAX_STREAMS];
bool_t notsending;
} SalMediaDescription;
SalMediaDescription *sal_media_description_new();
void sal_media_description_ref(SalMediaDescription *md);
void sal_media_description_unref(SalMediaDescription *md);
bool_t sal_media_description_empty(SalMediaDescription *md);
bool_t sal_media_description_empty(const SalMediaDescription *md);
bool_t sal_media_description_has_dir(const SalMediaDescription *md, SalStreamDir dir);
const SalStreamDescription *sal_media_description_find_stream(const SalMediaDescription *md,
SalMediaProto proto, SalStreamType type);
void sal_media_description_set_dir(SalMediaDescription *md, SalStreamDir stream_dir);
/*this structure must be at the first byte of the SalOp structure defined by implementors*/
typedef struct SalOpBase{

View file

@ -421,19 +421,6 @@ static void set_sdp(osip_message_t *sip,sdp_message_t *msg){
osip_free(sdp);
}
static void set_hold_status_to_desc(SalMediaDescription *desc, bool_t holdon)
{
int i;
if(desc == NULL)
return;
desc->notsending = holdon;
for(i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++)
{
if(desc->streams != NULL)
desc->streams[i].notsending = holdon;//Audio
}
}
static void set_sdp_from_desc(osip_message_t *sip, const SalMediaDescription *desc){
sdp_message_t *msg=media_description_to_sdp(desc);
if (msg==NULL) {
@ -1482,9 +1469,6 @@ static void other_request_reply(Sal *sal,eXosip_event_t *ev){
}
static bool_t process_event(Sal *sal, eXosip_event_t *ev){
#ifdef PRINTF_DEBUG
printf("EVENT (%d)\n",ev->type);
#endif
ms_message("linphone process event get a message %d\n",ev->type);
switch(ev->type){
case EXOSIP_CALL_ANSWERED:
@ -1809,11 +1793,9 @@ int sal_call_hold(SalOp *h, bool_t holdon)
{
int err=0;
osip_message_t *reinvite;
if(eXosip_call_build_request(h->did,"INVITE",&reinvite) != OSIP_SUCCESS)
osip_message_t *reinvite=NULL;
if(eXosip_call_build_request(h->did,"INVITE",&reinvite) != OSIP_SUCCESS || reinvite==NULL)
return -1;
if(reinvite==NULL)
return -2;
osip_message_set_subject(reinvite,osip_strdup("Phone Call Hold"));
osip_message_set_allow(reinvite, "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO");
if (h->base.root->session_expires!=0){
@ -1823,7 +1805,7 @@ int sal_call_hold(SalOp *h, bool_t holdon)
//add something to say that the distant sip phone will be in sendonly/sendrecv mode
if (h->base.local_media){
h->sdp_offering=TRUE;
set_hold_status_to_desc(h->base.local_media,holdon);
sal_media_description_set_dir(h->base.local_media, holdon ? SalStreamSendOnly : SalStreamSendRecv);
set_sdp_from_desc(reinvite,h->base.local_media);
}else h->sdp_offering=FALSE;
eXosip_lock();

View file

@ -106,6 +106,23 @@ static int _sdp_message_get_a_ptime(sdp_message_t *sdp, int mline){
return 0;
}
static int _sdp_message_get_mline_dir(sdp_message_t *sdp, int mline){
int i;
sdp_attribute_t *attr;
for (i=0;(attr=sdp_message_attribute_get(sdp,mline,i))!=NULL;i++){
if (keywordcmp("sendrecv",attr->a_att_field)==0){
return SalStreamSendRecv;
}else if (keywordcmp("sendonly",attr->a_att_field)==0){
return SalStreamSendOnly;
}else if (keywordcmp("recvonly",attr->a_att_field)==0){
return SalStreamSendOnly;
}else if (keywordcmp("inactive",attr->a_att_field)==0){
return SalStreamInactive;
}
}
return SalStreamSendRecv;
}
static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc)
{
sdp_message_t *local;
@ -121,7 +138,7 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc)
osip_strdup ("IN"), inet6 ? osip_strdup("IP6") : osip_strdup ("IP4"),
osip_strdup (desc->addr));
sdp_message_s_name_set (local, osip_strdup ("A conversation"));
if(!desc->notsending)
if(!sal_media_description_has_dir (desc,SalStreamSendOnly))
{
sdp_message_c_connection_add (local, -1,
osip_strdup ("IN"), inet6 ? osip_strdup ("IP6") : osip_strdup ("IP4"),
@ -131,7 +148,7 @@ static sdp_message_t *create_generic_sdp(const SalMediaDescription *desc)
{
sdp_message_c_connection_add (local, -1,
osip_strdup ("IN"), inet6 ? osip_strdup ("IP6") : osip_strdup ("IP4"),
inet6 ? osip_strdup ("0.0.0.0.0.0") : osip_strdup ("0.0.0.0"), NULL, NULL);
inet6 ? osip_strdup ("::0") : osip_strdup ("0.0.0.0"), NULL, NULL);
}
sdp_message_t_time_descr_add (local, osip_strdup ("0"), osip_strdup ("0"));
if (desc->bandwidth>0) sdp_message_b_bandwidth_add (local, -1, osip_strdup ("AS"),
@ -167,6 +184,7 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription
const char *mt=desc->type==SalAudio ? "audio" : "video";
const MSList *elem;
const char *addr;
const char *dir="sendrecv";
int port;
if (desc->candidates[0].addr[0]!='\0'){
addr=desc->candidates[0].addr;
@ -195,10 +213,21 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription
for(elem=desc->payloads;elem!=NULL;elem=elem->next){
add_payload(msg, lineno, (PayloadType*)elem->data);
}
if(desc->notsending)//to hold the distant SIP endpoint
sdp_message_a_attribute_add (msg, lineno, osip_strdup ("sendonly"),NULL);
else
sdp_message_a_attribute_add (msg, lineno, osip_strdup ("sendrecv"),NULL);
switch(desc->dir){
case SalStreamSendRecv:
dir="sendrecv";
break;
case SalStreamRecvOnly:
dir="recvonly";
break;
case SalStreamSendOnly:
dir="sendonly";
break;
case SalStreamInactive:
dir="inactive";
break;
}
sdp_message_a_attribute_add (msg, lineno, osip_strdup (dir),NULL);
}
sdp_message_t *media_description_to_sdp(const SalMediaDescription *desc){
@ -285,6 +314,7 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){
for(j=0;(sbw=sdp_message_bandwidth_get(msg,i,j))!=NULL;++j){
if (strcasecmp(sbw->b_bwtype,"AS")==0) stream->bandwidth=atoi(sbw->b_bandwidth);
}
stream->dir=_sdp_message_get_mline_dir(msg,i);
/* for each payload type */
for (j=0;((number=sdp_message_m_payload_get (msg, i,j)) != NULL); j++){
const char *rtpmap,*fmtp;

View file

@ -213,11 +213,9 @@ void linphone_gtk_enable_mute_button(GtkToggleButton *button, gboolean sensitive
}
void linphone_gtk_draw_hold_button(GtkToggleButton *button, gboolean active){
GtkWidget *status=linphone_gtk_get_widget(linphone_gtk_get_main_window(),"in_call_status");
if (active){
GtkWidget *image=create_pixmap("hold_off.png");
gtk_button_set_label(GTK_BUTTON(button),_("HoldOff"));
gtk_label_set_markup(GTK_LABEL(status),_("<b>In call holded with</b>"));
if (image!=NULL) {
gtk_button_set_image(GTK_BUTTON(button),image);
gtk_widget_show(image);
@ -225,7 +223,6 @@ void linphone_gtk_draw_hold_button(GtkToggleButton *button, gboolean active){
}else{
GtkWidget *image=create_pixmap("hold_on.png");
gtk_button_set_label(GTK_BUTTON(button),_("HoldOn"));
gtk_label_set_markup(GTK_LABEL(status),_("<b>In call with</b>"));
if (image!=NULL) {
gtk_button_set_image(GTK_BUTTON(button),image);
gtk_widget_show(image);

View file

@ -51,7 +51,6 @@ static void linphone_gtk_display_status(LinphoneCore *lc, const char *status);
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_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, LinphoneGeneralStateContext gctx);
static void linphone_gtk_refer_received(LinphoneCore *lc, LinphoneCall *call, const char *refer_to);
@ -68,7 +67,6 @@ static LinphoneCoreVTable vtable={
.display_message=linphone_gtk_display_message,
.display_warning=linphone_gtk_display_warning,
.display_url=linphone_gtk_display_url,
.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,
@ -870,10 +868,6 @@ static void linphone_gtk_display_url(LinphoneCore *lc, const char *msg, const ch
linphone_gtk_display_something(GTK_MESSAGE_INFO,richtext);
}
static void linphone_gtk_display_question(LinphoneCore *lc, const char *question){
linphone_gtk_display_something(GTK_MESSAGE_QUESTION,question);
}
static void linphone_gtk_call_log_updated(LinphoneCore *lc, LinphoneCallLog *cl){
GtkWidget *w=(GtkWidget*)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"call_logs");
if (w) linphone_gtk_call_log_update(w);