$(GITVERSION_FILE)
if BUILD_UPNP
-liblinphone_la_SOURCES+=upnp.c
+liblinphone_la_SOURCES+=upnp.c upnp.h
endif
if BUILD_WIZARD
if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) {
call->ping_time=linphone_core_run_stun_tests(call->core,call);
}
+#ifdef BUILD_UPNP
+ if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseUpnp) {
+ call->upnp_session = upnp_session_new();
+ }
+#endif //BUILD_UPNP
call->camera_active=params->has_video;
discover_mtu(lc,linphone_address_get_domain (to));
#ifdef TUNNEL_ENABLED
lc->tunnel=linphone_core_tunnel_new(lc);
if (lc->tunnel) linphone_tunnel_configure(lc->tunnel);
+#endif
+#ifdef BUILD_UPNP
+ upnp_context_init(lc);
#endif
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Ready"));
#ifdef TUNNEL_ENABLED
if (lc->tunnel) linphone_tunnel_destroy(lc->tunnel);
#endif
+#ifdef BUILD_UPNP
+ upnp_context_uninit(lc);
+#endif
}
static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime){
LinphonePolicyNoFirewall,
LinphonePolicyUseNatAddress,
LinphonePolicyUseStun,
- LinphonePolicyUseIce
+ LinphonePolicyUseIce,
+ LinphonePolicyUseUpnp,
} LinphoneFirewallPolicy;
typedef enum _LinphoneWaitingState{
extern "C" {
#endif
#include "linphonecore.h"
+#include "linphonefriend.h"
#include "linphone_tunnel.h"
#include "linphonecore_utils.h"
#include "sal.h"
+#include "sipsetup.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#include "mediastreamer2/mediastream.h"
#include "mediastreamer2/msconference.h"
#ifdef BUILD_UPNP
-#include "mediastreamer2/upnp_igd.h"
+#include "upnp.h"
#endif
#ifndef LIBLINPHONE_VERSION
OrtpEvQueue *videostream_app_evq;
CallCallbackObj nextVideoFrameDecoded;
LinphoneCallStats stats[2];
+#ifdef BUILD_UPNP
+ UpnpSession *upnp_session;
+#endif //BUILD_UPNP
IceSession *ice_session;
LinphoneChatMessage* pending_message;
int ping_time;
char* device_id;
MSList *last_recv_msg_ids;
#ifdef BUILD_UPNP
- upnp_igd_context *upnp_igd_ctxt;
-#endif
+ UpnpContext upnp;
+#endif //BUILD_UPNP
};
LinphoneTunnel *linphone_core_tunnel_new(LinphoneCore *lc);
void linphone_tunnel_destroy(LinphoneTunnel *tunnel);
void linphone_tunnel_configure(LinphoneTunnel *tunnel);
void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, OrtpLogFunc logHandler);
-
+
bool_t linphone_core_can_we_add_call(LinphoneCore *lc);
int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call);
int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call);
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include "upnp.h"
#include "private.h"
-#include "mediastreamer2/upnp_igd.h"
/* Convert uPnP IGD logs to ortp logs */
void linphone_upnp_igd_print(void *cookie, upnp_igd_print_level level, const char *fmt, va_list list) {
default:
break;
}
- ortp_logv(level, fmt, list);
+ ortp_logv(ortp_level, fmt, list);
}
void linphone_upnp_igd_callback(void *cookie, upnp_igd_event event, void *arg) {
+ LinphoneCore *lc = (LinphoneCore *)cookie;
+ UpnpContext *lupnp = &lc->upnp;
+ switch(event) {
+ case UPNP_IGD_EXTERNAL_IPADDRESS_CHANGED:
+ case UPNP_IGD_NAT_ENABLED_CHANGED:
+ case UPNP_IGD_CONNECTION_STATUS_CHANGED:
+ break;
+
+ default:
+ break;
+ }
}
-int linphone_upnp_init(LinphoneCore *lc) {
- lc->upnp_igd_ctxt = NULL;
+int upnp_context_init(LinphoneCore *lc) {
+ UpnpContext *lupnp = &lc->upnp;
+ lupnp->upnp_igd_ctxt = NULL;
+ lupnp->upnp_igd_ctxt = upnp_igd_create(linphone_upnp_igd_callback, linphone_upnp_igd_print, lc);
+ if(lupnp->upnp_igd_ctxt == NULL) {
+ ms_error("Can't create uPnP IGD context");
+ return -1;
+ }
return 0;
}
-void linphone_upnp_destroy(LinphoneCore *lc) {
+void upnp_context_uninit(LinphoneCore *lc) {
+ UpnpContext *lupnp = &lc->upnp;
+ if(lupnp->upnp_igd_ctxt != NULL) {
+ upnp_igd_destroy(lupnp->upnp_igd_ctxt);
+ }
+}
+
+UpnpSession* upnp_session_new() {
+ return NULL;
}
--- /dev/null
+/*
+linphone
+Copyright (C) 2012 Belledonne Communications SARL
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef LINPHONE_UPNP_H
+#define LINPHONE_UPNP_H
+
+#include "mediastreamer2/upnp_igd.h"
+#include "linphonecore.h"
+
+typedef struct _UpnpSession {
+
+} UpnpSession;
+
+typedef struct _UpnpContext {
+ upnp_igd_context *upnp_igd_ctxt;
+} UpnpContext;
+
+UpnpSession* upnp_session_new();
+int upnp_context_init(LinphoneCore *lc);
+void upnp_context_uninit(LinphoneCore *lc);
+
+#endif //LINPHONE_UPNP_H
-Subproject commit 2093868ac68ffe62310cd0ad20b58ffa6860d7e3
+Subproject commit a1f113529f506aa178765cf70773db80e5768139