From d55430f35103fce5d2174139545d52473267108b Mon Sep 17 00:00:00 2001 From: smorlat Date: Wed, 4 Mar 2009 15:43:23 +0000 Subject: [PATCH] work in progress, bugfixes, enrich OPTIONS responses. git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@296 3f6dc0c8-ddfe-455d-9043-3cd528dc4637 --- linphone/console/Makefile.am | 2 +- linphone/coreapi/Makefile.am | 2 +- linphone/coreapi/exevents.c | 18 ++++++++-- linphone/coreapi/linphonecore.c | 1 + linphone/coreapi/linphonecore.h | 5 +++ linphone/coreapi/sipsetup.h | 64 +++++++++++++++++++-------------- linphone/gtk-glade/Makefile.am | 2 +- 7 files changed, 62 insertions(+), 32 deletions(-) diff --git a/linphone/console/Makefile.am b/linphone/console/Makefile.am index 2c5caab81..d06323c89 100644 --- a/linphone/console/Makefile.am +++ b/linphone/console/Makefile.am @@ -36,7 +36,7 @@ linphonecsh_LDADD = $(ORTP_LIBS) endif -AM_CFLAGS=$(STRICT_OPTIONS) -DENABLE_TRACE -D_ORTP_SOURCE $(VIDEO_CFLAGS) $(READLINE_CFLAGS) $(OSIP_CFLAGS) +AM_CFLAGS=$(STRICT_OPTIONS) -DIN_LINPHONE -DENABLE_TRACE -D_ORTP_SOURCE $(VIDEO_CFLAGS) $(READLINE_CFLAGS) $(OSIP_CFLAGS) diff --git a/linphone/coreapi/Makefile.am b/linphone/coreapi/Makefile.am index 10c996574..78c6b3043 100644 --- a/linphone/coreapi/Makefile.am +++ b/linphone/coreapi/Makefile.am @@ -35,7 +35,7 @@ liblinphone_la_LIBADD= \ $(top_builddir)/mediastreamer2/src/libmediastreamer.la -AM_CFLAGS=$(STRICT_OPTIONS) \ +AM_CFLAGS=$(STRICT_OPTIONS) -DIN_LINPHONE \ $(OSIP_CFLAGS) \ $(EXOSIP_CFLAGS) \ $(ORTP_CFLAGS) \ diff --git a/linphone/coreapi/exevents.c b/linphone/coreapi/exevents.c index 6e1b9611a..c91bec058 100644 --- a/linphone/coreapi/exevents.c +++ b/linphone/coreapi/exevents.c @@ -964,7 +964,15 @@ 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){ - eXosip_options_send_answer(ev->tid,200,NULL); +#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); @@ -972,7 +980,13 @@ static void linphone_other_request(LinphoneCore *lc, eXosip_event_t *ev){ if (lc->vtable.show) lc->vtable.show(lc); }else { - ms_message("Unsupported request received."); + char *tmp=NULL; + size_t msglen=0; + osip_message_to_str(ev->request,&tmp,&msglen); + if (tmp){ + ms_message("Unsupported request received:\n%s",tmp); + osip_free(tmp); + } /*answer with a 501 Not implemented*/ eXosip_message_send_answer(ev->tid,501,NULL); } diff --git a/linphone/coreapi/linphonecore.c b/linphone/coreapi/linphonecore.c index d58a67a36..bf3c4aa3c 100644 --- a/linphone/coreapi/linphonecore.c +++ b/linphone/coreapi/linphonecore.c @@ -2314,6 +2314,7 @@ void sound_config_uninit(LinphoneCore *lc) if (config->local_ring) ms_free(config->local_ring); if (config->remote_ring) ms_free(config->remote_ring); + ms_snd_card_manager_destroy(); } void video_config_uninit(LinphoneCore *lc) diff --git a/linphone/coreapi/linphonecore.h b/linphone/coreapi/linphonecore.h index f48a43105..2193bc333 100644 --- a/linphone/coreapi/linphonecore.h +++ b/linphone/coreapi/linphonecore.h @@ -25,7 +25,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "ortp/payloadtype.h" #include "mediastreamer2/mscommon.h" #include "mediastreamer2/msvideo.h" + +#ifdef IN_LINPHONE #include "sipsetup.h" +#else +#include "linphone/sipsetup.h" +#endif #define LINPHONE_IPADDR_SIZE 64 #define LINPHONE_HOSTNAME_SIZE 128 diff --git a/linphone/coreapi/sipsetup.h b/linphone/coreapi/sipsetup.h index df0b9d93b..42bcf83af 100644 --- a/linphone/coreapi/sipsetup.h +++ b/linphone/coreapi/sipsetup.h @@ -43,25 +43,14 @@ typedef struct _SipSetupContext SipSetupContext; #define SIP_SETUP_CAP_BUDDY_LOOKUP (1<<3) #define SIP_SETUP_CAP_ACCOUNT_MANAGER (1<<4) - -struct _SipSetup{ - char *name; - unsigned int capabilities; - bool_t (*init)(void); - int (*init_instance)(SipSetupContext *ctx); - int (*create_account)( const char *uri, const char *passwd); - int (*login_account)(SipSetupContext *ctx, const char *uri, const char *passwd); - int (*get_proxy)(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz); - int (*get_stun_servers)(SipSetupContext *ctx, char *stun1, char *stun2, size_t size); - int (*get_relay)(SipSetupContext *ctx, char *relay, size_t size); - int (*lookup_buddy)(SipSetupContext *ctx, const char *key); - int (*get_buddy_lookup_status)(SipSetupContext *ctx); - int (*get_buddy_lookup_results)(SipSetupContext *ctx, MSList **results); - void (*exit)(void); - bool_t initialized; -}; - -typedef struct _SipSetup SipSetup; +typedef enum _BuddyLookupStatus{ + BuddyLookupNone, + BuddyLookupConnecting, + BuddyLookupConnected, + BuddyLookupReceivingResponse, + BuddyLookupDone, + BuddyLookupFailure +}BuddyLookupStatus; typedef struct _BuddyAddress{ char street[64]; @@ -78,14 +67,30 @@ typedef struct _BuddyInfo{ BuddyAddress address; }BuddyInfo; -typedef enum _BuddyLookupStatus{ - BuddyLookupNone, - BuddyLookupConnecting, - BuddyLookupConnected, - BuddyLookupReceivingResponse, - BuddyLookupDone, - BuddyLookupFailure -}BuddyLookupStatus; + +struct _SipSetup{ + char *name; + unsigned int capabilities; + bool_t (*init)(void); + int (*init_instance)(SipSetupContext *ctx); + int (*create_account)( const char *uri, const char *passwd); + int (*login_account)(SipSetupContext *ctx, const char *uri, const char *passwd); + int (*get_proxy)(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz); + int (*get_stun_servers)(SipSetupContext *ctx, char *stun1, char *stun2, size_t size); + int (*get_relay)(SipSetupContext *ctx, char *relay, size_t size); + int (*lookup_buddy)(SipSetupContext *ctx, const char *key); + BuddyLookupStatus (*get_buddy_lookup_status)(SipSetupContext *ctx); + int (*get_buddy_lookup_results)(SipSetupContext *ctx, MSList **results); + void (*exit)(void); + bool_t initialized; +}; + +typedef struct _SipSetup SipSetup; + + +#ifdef __cplusplus +extern "C"{ +#endif void sip_setup_register(SipSetup *ss); void sip_setup_register_all(void); @@ -104,6 +109,11 @@ BuddyLookupStatus sip_setup_context_get_buddy_lookup_status(SipSetupContext *ctx int sip_setup_context_get_buddy_lookup_results(SipSetupContext *ctx, MSList **results /*of BuddyInfo */); void sip_setup_context_free_results(MSList *results); void sip_setup_context_free(SipSetupContext *ctx); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/linphone/gtk-glade/Makefile.am b/linphone/gtk-glade/Makefile.am index 5757acf6c..6aa91c7d5 100644 --- a/linphone/gtk-glade/Makefile.am +++ b/linphone/gtk-glade/Makefile.am @@ -53,7 +53,7 @@ glade_DATA=$(GLADE_FILES) $(PIXMAPS) endif -AM_CFLAGS= -I$(top_srcdir)/coreapi/ \ +AM_CFLAGS= -DIN_LINPHONE -I$(top_srcdir)/coreapi/ \ -I$(top_srcdir)/mediastreamer2/include/ \ $(LIBGLADE_CFLAGS) $(STRICT_OPTIONS) $(LIBGTK_CFLAGS) $(IPV6_CFLAGS) \ $(ORTP_CFLAGS) $(OSIP_CFLAGS)