summaryrefslogtreecommitdiffstats
path: root/bindings/winrt/doubango_rt/src
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/winrt/doubango_rt/src')
-rw-r--r--bindings/winrt/doubango_rt/src/rt_ActionConfig.cxx76
-rw-r--r--bindings/winrt/doubango_rt/src/rt_DDebug.cxx78
-rw-r--r--bindings/winrt/doubango_rt/src/rt_Enums.cxx17
-rw-r--r--bindings/winrt/doubango_rt/src/rt_MediaContent.cxx17
-rw-r--r--bindings/winrt/doubango_rt/src/rt_MediaSessionMgr.cxx374
-rw-r--r--bindings/winrt/doubango_rt/src/rt_Msrp.cxx194
-rw-r--r--bindings/winrt/doubango_rt/src/rt_SMSEncoder.cxx17
-rw-r--r--bindings/winrt/doubango_rt/src/rt_SipCallback.cxx135
-rw-r--r--bindings/winrt/doubango_rt/src/rt_SipEvent.cxx239
-rw-r--r--bindings/winrt/doubango_rt/src/rt_SipMessage.cxx171
-rw-r--r--bindings/winrt/doubango_rt/src/rt_SipSession.cxx662
-rw-r--r--bindings/winrt/doubango_rt/src/rt_SipStack.cxx390
-rw-r--r--bindings/winrt/doubango_rt/src/rt_SipUri.cxx103
-rw-r--r--bindings/winrt/doubango_rt/src/rt_String.cxx58
-rw-r--r--bindings/winrt/doubango_rt/src/rt_Xcap.cxx17
15 files changed, 2548 insertions, 0 deletions
diff --git a/bindings/winrt/doubango_rt/src/rt_ActionConfig.cxx b/bindings/winrt/doubango_rt/src/rt_ActionConfig.cxx
new file mode 100644
index 0000000..02f713e
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_ActionConfig.cxx
@@ -0,0 +1,76 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/
+#include "rt_ActionConfig.h"
+#include "rt_String.h"
+
+#include "ActionConfig.h"
+
+using namespace doubango_rt::BackEnd;
+using namespace Platform;
+using namespace std;
+
+rtActionConfig::rtActionConfig()
+{
+ m_pActionConfig = new ActionConfig();
+}
+
+rtActionConfig::~rtActionConfig()
+{
+ rtSafeDelete(m_pActionConfig);
+}
+
+bool rtActionConfig::addHeader(String^ name, String^ value)
+{
+ return m_pActionConfig->addHeader(rtString::toUtf8(name).data(), rtString::toUtf8(value).data());
+}
+
+bool rtActionConfig::setActiveMedia(rt_twrap_media_type_t type)
+{
+ return m_pActionConfig->setActiveMedia((twrap_media_type_t)type);
+}
+
+#if COM_VISIBLE
+bool rtActionConfig::addPayload(Platform::String^ payload)
+{
+ static std::vector<char> _payload = rtString::toUtf8(payload);
+ return m_pActionConfig->addPayload(_payload.data(), _payload.size());
+}
+#else
+bool rtActionConfig::addPayload(IntPtr payload, unsigned len)
+{
+ return m_pActionConfig->addPayload((const void*)payload, len);
+}
+#endif /* COM_VISIBLE */
+
+rtActionConfig^ rtActionConfig::setResponseLine(short code, String^ phrase)
+{
+ m_pActionConfig->setResponseLine(code, rtString::toUtf8(phrase).data());
+ return this;
+}
+
+rtActionConfig^ rtActionConfig::setMediaString(rt_twrap_media_type_t type, String^ key, String^ value)
+{
+ m_pActionConfig->setMediaString((twrap_media_type_t)type, rtString::toUtf8(key).data(), rtString::toUtf8(value).data());
+ return this;
+}
+
+rtActionConfig^ rtActionConfig::setMediaInt(rt_twrap_media_type_t type, String^ key, int value)
+{
+ m_pActionConfig->setMediaInt((twrap_media_type_t)type, rtString::toUtf8(key).data(), value);
+ return this;
+} \ No newline at end of file
diff --git a/bindings/winrt/doubango_rt/src/rt_DDebug.cxx b/bindings/winrt/doubango_rt/src/rt_DDebug.cxx
new file mode 100644
index 0000000..a03300c
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_DDebug.cxx
@@ -0,0 +1,78 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/
+#include "rt_DDebug.h"
+#include "rt_String.h"
+
+#include "DDebug.h"
+
+using namespace doubango_rt::BackEnd;
+using namespace Platform;
+using namespace std;
+
+class DDebugCallbackProxy : public DDebugCallback
+{
+public:
+ DDebugCallbackProxy(rtDDebugCallback^ pCallback)
+ {
+ m_pCallback = pCallback;
+ }
+
+ ~DDebugCallbackProxy()
+ {
+
+ }
+
+ virtual int OnDebugInfo(const char* message)
+ {
+ return m_pCallback->m_pI->OnDebugInfo(rtString::toString(message));
+ }
+
+ virtual int OnDebugWarn(const char* message)
+ {
+ return m_pCallback->m_pI->OnDebugWarn(rtString::toString(message));
+ }
+
+ virtual int OnDebugError(const char* message)
+ {
+ return m_pCallback->m_pI->OnDebugError(rtString::toString(message));
+ }
+
+ virtual int OnDebugFatal(const char* message)
+ {
+ return m_pCallback->m_pI->OnDebugFatal(rtString::toString(message));
+ }
+
+private:
+ rtDDebugCallback^ m_pCallback;
+};
+
+rtDDebugCallback::rtDDebugCallback(rtIDDebugCallback^ pI)
+{
+ m_pI = pI;
+ m_pCallback = new DDebugCallbackProxy(this);
+}
+
+rtDDebugCallback::~rtDDebugCallback()
+{
+ rtSafeDelete(m_pCallback);
+}
+
+const DDebugCallback* rtDDebugCallback::getWrappedCallback()
+{
+ return dynamic_cast<const DDebugCallback*>(m_pCallback);
+} \ No newline at end of file
diff --git a/bindings/winrt/doubango_rt/src/rt_Enums.cxx b/bindings/winrt/doubango_rt/src/rt_Enums.cxx
new file mode 100644
index 0000000..fa2645c
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_Enums.cxx
@@ -0,0 +1,17 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/#include "rt_enums.h" \ No newline at end of file
diff --git a/bindings/winrt/doubango_rt/src/rt_MediaContent.cxx b/bindings/winrt/doubango_rt/src/rt_MediaContent.cxx
new file mode 100644
index 0000000..623cb1f
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_MediaContent.cxx
@@ -0,0 +1,17 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/ \ No newline at end of file
diff --git a/bindings/winrt/doubango_rt/src/rt_MediaSessionMgr.cxx b/bindings/winrt/doubango_rt/src/rt_MediaSessionMgr.cxx
new file mode 100644
index 0000000..7d2c6f0
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_MediaSessionMgr.cxx
@@ -0,0 +1,374 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/
+#include "rt_MediaSessionMgr.h"
+#include "rt_Enums.h"
+#include "rt_String.h"
+
+#include "MediaSessionMgr.h"
+
+using namespace doubango_rt::BackEnd;
+using namespace Platform;
+using namespace std;
+
+rtCodec::rtCodec(struct tmedia_codec_s* pCodec)
+{
+ m_pCodec = new Codec(pCodec);
+}
+
+rtCodec::~rtCodec()
+{
+ rtSafeDelete(m_pCodec);
+}
+
+enum class rt_twrap_media_type_t rtCodec::getMediaType()
+{
+ return (rt_twrap_media_type_t)m_pCodec->getMediaType();
+}
+
+Platform::String^ rtCodec::getName()
+{
+ return rtString::toString(m_pCodec->getName());
+}
+
+Platform::String^ rtCodec::getDescription()
+{
+ return rtString::toString(m_pCodec->getDescription());
+}
+
+Platform::String^ rtCodec::getNegFormat()
+{
+ return rtString::toString(m_pCodec->getNegFormat());
+}
+
+int rtCodec::getAudioSamplingRate()
+{
+ return m_pCodec->getAudioSamplingRate();
+}
+
+int rtCodec::getAudioChannels()
+{
+ return m_pCodec->getAudioChannels();
+}
+
+int rtCodec::getAudioPTime()
+{
+ return m_pCodec->getAudioPTime();
+}
+
+
+rtMediaSessionMgr::rtMediaSessionMgr(struct tmedia_session_mgr_s* pWrappedMgr)
+{
+ m_pMediaSessionMgr = new MediaSessionMgr(pWrappedMgr);
+}
+
+rtMediaSessionMgr::~rtMediaSessionMgr()
+{
+ rtSafeDelete(m_pMediaSessionMgr);
+}
+
+bool rtMediaSessionMgr::sessionSetInt32(rt_twrap_media_type_t media, Platform::String^ key, int32 value)
+{
+ return m_pMediaSessionMgr->sessionSetInt32((twrap_media_type_t)media, rtString::toUtf8(key).data(), value);
+}
+
+int32 rtMediaSessionMgr::sessionGetInt32(rt_twrap_media_type_t media, Platform::String^ key)
+{
+ return m_pMediaSessionMgr->sessionGetInt32((twrap_media_type_t)media, rtString::toUtf8(key).data());
+}
+
+bool rtMediaSessionMgr::consumerSetInt32(rt_twrap_media_type_t media, Platform::String^ key, int32 value)
+{
+ return m_pMediaSessionMgr->consumerSetInt32((twrap_media_type_t)media, rtString::toUtf8(key).data(), value);
+}
+
+bool rtMediaSessionMgr::consumerSetInt64(rt_twrap_media_type_t media, Platform::String^ key, int64 value)
+{
+ return m_pMediaSessionMgr->consumerSetInt64((twrap_media_type_t)media, rtString::toUtf8(key).data(), value);
+}
+
+bool rtMediaSessionMgr::producerSetInt32(rt_twrap_media_type_t media, Platform::String^ key, int32 value)
+{
+ return m_pMediaSessionMgr->producerSetInt32((twrap_media_type_t)media, rtString::toUtf8(key).data(), value);
+}
+
+bool rtMediaSessionMgr::producerSetInt64(rt_twrap_media_type_t media, Platform::String^ key, int64 value)
+{
+ return m_pMediaSessionMgr->producerSetInt64((twrap_media_type_t)media, rtString::toUtf8(key).data(), value);
+}
+
+rtCodec^ rtMediaSessionMgr::producerGetCodec(rt_twrap_media_type_t media)
+{
+ Codec* c = m_pMediaSessionMgr->producerGetCodec((twrap_media_type_t)media);
+ if(c)
+ {
+ rtCodec^ codec = ref new rtCodec(const_cast<struct tmedia_codec_s*>(c->getWrappedCodec()));
+ rtSafeDelete(c);
+ return codec;
+ }
+ return nullptr;
+}
+
+unsigned int rtMediaSessionMgr::registerAudioPluginFromFile(Platform::String^ path)
+{
+ return MediaSessionMgr::registerAudioPluginFromFile(rtString::toUtf8(path).data());
+}
+
+uint64 rtMediaSessionMgr::getSessionId(rt_twrap_media_type_t media)
+{
+ return m_pMediaSessionMgr->getSessionId((twrap_media_type_t)media);
+}
+
+bool rtMediaSessionMgr::defaultsSetProfile(rt_tmedia_profile_t profile)
+{
+ return MediaSessionMgr::defaultsSetProfile((tmedia_profile_t) profile);
+}
+
+rt_tmedia_profile_t rtMediaSessionMgr::defaultsGetProfile()
+{
+ return (rt_tmedia_profile_t)MediaSessionMgr::defaultsGetProfile();
+}
+
+bool rtMediaSessionMgr::defaultsSetPrefVideoSize(enum class rt_tmedia_pref_video_size_t pref_video_size)
+{
+ return MediaSessionMgr::defaultsSetPrefVideoSize((tmedia_pref_video_size_t) pref_video_size);
+}
+
+bool rtMediaSessionMgr::defaultsSetJbMargin(uint32 jb_margin_ms)
+{
+ return MediaSessionMgr::defaultsSetJbMargin(jb_margin_ms);
+}
+
+bool rtMediaSessionMgr::defaultsSetJbMaxLateRate(uint32 jb_late_rate_percent)
+{
+ return MediaSessionMgr::defaultsSetJbMaxLateRate(jb_late_rate_percent);
+}
+
+bool rtMediaSessionMgr::defaultsSetEchoTail(uint32 echo_tail)
+{
+ return MediaSessionMgr::defaultsSetEchoTail(echo_tail);
+}
+
+uint32 rtMediaSessionMgr::defaultsGetEchoTail()
+{
+ return MediaSessionMgr::defaultsGetEchoTail();
+}
+
+bool rtMediaSessionMgr::defaultsSetEchoSkew(uint32 echo_skew)
+{
+ return MediaSessionMgr::defaultsSetEchoSkew(echo_skew);
+}
+
+bool rtMediaSessionMgr::defaultsSetEchoSuppEnabled(bool echo_supp_enabled)
+{
+ return MediaSessionMgr::defaultsSetEchoSuppEnabled(echo_supp_enabled);
+}
+
+bool rtMediaSessionMgr::defaultsGetEchoSuppEnabled()
+{
+ return MediaSessionMgr::defaultsGetEchoSuppEnabled();
+}
+
+bool rtMediaSessionMgr::defaultsSetAgcEnabled(bool agc_enabled)
+{
+ return MediaSessionMgr::defaultsSetAgcEnabled(agc_enabled);
+}
+
+bool rtMediaSessionMgr::defaultsGetAgcEnabled()
+{
+ return MediaSessionMgr::defaultsGetAgcEnabled();
+}
+
+bool rtMediaSessionMgr::defaultsSetAgcLevel(float agc_level)
+{
+ return MediaSessionMgr::defaultsSetAgcLevel(agc_level);
+}
+
+float rtMediaSessionMgr::defaultsGetAgcLevel()
+{
+ return MediaSessionMgr::defaultsGetAgcLevel();
+}
+
+bool rtMediaSessionMgr::defaultsSetVadEnabled(bool vad_enabled)
+{
+ return MediaSessionMgr::defaultsSetVadEnabled(vad_enabled);
+}
+
+bool rtMediaSessionMgr::defaultsGetGetVadEnabled()
+{
+ return MediaSessionMgr::defaultsGetGetVadEnabled();
+}
+
+bool rtMediaSessionMgr::defaultsSetNoiseSuppEnabled(bool noise_supp_enabled)
+{
+ return MediaSessionMgr::defaultsSetNoiseSuppEnabled(noise_supp_enabled);
+}
+
+bool rtMediaSessionMgr::defaultsGetNoiseSuppEnabled()
+{
+ return MediaSessionMgr::defaultsGetNoiseSuppEnabled();
+}
+
+bool rtMediaSessionMgr::defaultsSetNoiseSuppLevel(int32 noise_supp_level)
+{
+ return MediaSessionMgr::defaultsSetNoiseSuppLevel(noise_supp_level);
+}
+
+int32 rtMediaSessionMgr::defaultsGetNoiseSuppLevel()
+{
+ return MediaSessionMgr::defaultsGetNoiseSuppLevel();
+}
+
+bool rtMediaSessionMgr::defaultsSet100relEnabled(bool _100rel_enabled)
+{
+ return MediaSessionMgr::defaultsSet100relEnabled(_100rel_enabled);
+}
+
+bool rtMediaSessionMgr::defaultsGet100relEnabled()
+{
+ return MediaSessionMgr::defaultsGet100relEnabled();
+}
+
+bool rtMediaSessionMgr::defaultsSetScreenSize(int32 sx, int32 sy)
+{
+ return MediaSessionMgr::defaultsSetScreenSize(sx, sy);
+}
+
+bool rtMediaSessionMgr::defaultsSetAudioGain(int32 producer_gain, int32 consumer_gain)
+{
+ return MediaSessionMgr::defaultsSetAudioGain(producer_gain, consumer_gain);
+}
+
+bool rtMediaSessionMgr::defaultsSetRtpPortRange(uint16 range_start, uint16 range_stop)
+{
+ return MediaSessionMgr::defaultsSetRtpPortRange(range_start, range_stop);
+}
+
+bool rtMediaSessionMgr::defaultsSetRtpSymetricEnabled(bool enabled)
+{
+ return MediaSessionMgr::defaultsSetRtpSymetricEnabled(enabled);
+}
+
+bool rtMediaSessionMgr::defaultsSetMediaType(enum class rt_twrap_media_type_t media_type)
+{
+ return MediaSessionMgr::defaultsSetMediaType((twrap_media_type_t) media_type);
+}
+
+bool rtMediaSessionMgr::defaultsSetVolume(int32 volume)
+{
+ return MediaSessionMgr::defaultsSetVolume(volume);
+}
+
+int32 rtMediaSessionMgr::defaultsGetVolume()
+{
+ return MediaSessionMgr::defaultsGetVolume();
+}
+
+bool rtMediaSessionMgr::defaultsSetInviteSessionTimers(int32 timeout, Platform::String^ refresher)
+{
+ return MediaSessionMgr::defaultsSetInviteSessionTimers(timeout, rtString::toUtf8(refresher).data());
+}
+
+bool rtMediaSessionMgr::defaultsSetSRtpMode(enum class rt_tmedia_srtp_mode_t mode)
+{
+ return MediaSessionMgr::defaultsSetSRtpMode((tmedia_srtp_mode_t) mode);
+}
+
+enum class rt_tmedia_srtp_mode_t rtMediaSessionMgr::defaultsGetSRtpMode()
+{
+ return (rt_tmedia_srtp_mode_t)MediaSessionMgr::defaultsGetSRtpMode();
+}
+
+bool rtMediaSessionMgr::defaultsSetSRtpType(enum class rt_tmedia_srtp_type_t srtp_type)
+{
+ return MediaSessionMgr::defaultsSetSRtpType((tmedia_srtp_type_t) srtp_type);
+}
+
+enum class rt_tmedia_srtp_type_t rtMediaSessionMgr::defaultsGetSRtpType()
+{
+ return (rt_tmedia_srtp_type_t)MediaSessionMgr::defaultsGetSRtpType();
+}
+
+bool rtMediaSessionMgr::defaultsSetRtcpEnabled(bool enabled)
+{
+ return MediaSessionMgr::defaultsSetRtcpEnabled(enabled);
+}
+
+bool rtMediaSessionMgr::defaultsGetRtcpEnabled()
+{
+ return MediaSessionMgr::defaultsGetRtcpEnabled();
+}
+
+bool rtMediaSessionMgr::defaultsSetRtcpMuxEnabled(bool enabled)
+{
+ return MediaSessionMgr::defaultsSetRtcpMuxEnabled(enabled);
+}
+
+bool rtMediaSessionMgr::defaultsGetRtcpMuxEnabled()
+{
+ return MediaSessionMgr::defaultsGetRtcpMuxEnabled();
+}
+
+bool rtMediaSessionMgr::defaultsSetIceEnabled(bool ice_enabled)
+{
+ return MediaSessionMgr::defaultsSetIceEnabled(ice_enabled);
+}
+
+bool rtMediaSessionMgr::defaultsSetByPassEncoding(bool enabled)
+{
+ return MediaSessionMgr::defaultsSetByPassEncoding(enabled);
+}
+
+bool rtMediaSessionMgr::defaultsGetByPassEncoding()
+{
+ return MediaSessionMgr::defaultsGetByPassEncoding();
+}
+
+bool rtMediaSessionMgr::defaultsSetByPassDecoding(bool enabled)
+{
+ return MediaSessionMgr::defaultsSetByPassDecoding(enabled);
+}
+
+bool rtMediaSessionMgr::defaultsGetByPassDecoding()
+{
+ return MediaSessionMgr::defaultsGetByPassDecoding();
+}
+
+bool rtMediaSessionMgr::defaultsSetVideoJbEnabled(bool enabled)
+{
+ return MediaSessionMgr::defaultsSetVideoJbEnabled(enabled);
+}
+
+bool rtMediaSessionMgr::defaultsGetVideoJbEnabled()
+{
+ return MediaSessionMgr::defaultsGetVideoJbEnabled();
+}
+
+bool rtMediaSessionMgr::defaultsSetRtpBuffSize(unsigned buffSize)
+{
+ return MediaSessionMgr::defaultsSetRtpBuffSize(buffSize);
+}
+
+unsigned rtMediaSessionMgr::defaultsGetRtpBuffSize()
+{
+ return MediaSessionMgr::defaultsGetRtpBuffSize();
+}
+
+bool rtMediaSessionMgr::defaultsSetAvpfTail(unsigned tail_min, unsigned tail_max)
+{
+ return MediaSessionMgr::defaultsSetAvpfTail(tail_min, tail_max);
+}
diff --git a/bindings/winrt/doubango_rt/src/rt_Msrp.cxx b/bindings/winrt/doubango_rt/src/rt_Msrp.cxx
new file mode 100644
index 0000000..1d09f06
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_Msrp.cxx
@@ -0,0 +1,194 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/
+#include "rt_Msrp.h"
+#include "rt_String.h"
+#include "rt_SipSession.h"
+
+#include "SipSession.h"
+#include "Msrp.h"
+
+#include <assert.h>
+
+using namespace doubango_rt::BackEnd;
+using namespace Platform;
+using namespace std;
+
+
+//
+// rtMsrpMessage
+//
+
+rtMsrpMessage::rtMsrpMessage(struct tmsrp_message_s *message)
+{
+ m_pMsrpMessage= new MsrpMessage(message);
+}
+
+rtMsrpMessage::~rtMsrpMessage()
+{
+ rtSafeDelete(m_pMsrpMessage);
+}
+
+bool rtMsrpMessage::isRequest()
+{
+ return m_pMsrpMessage->isRequest();
+}
+
+short rtMsrpMessage::getCode()
+{
+ return m_pMsrpMessage->getCode();
+}
+
+String^ rtMsrpMessage::getPhrase()
+{
+ return rtString::toString(m_pMsrpMessage->getPhrase());
+}
+
+rt_tmsrp_request_type_t rtMsrpMessage::getRequestType()
+{
+ return (rt_tmsrp_request_type_t)m_pMsrpMessage->getRequestType();
+}
+
+#if COM_VISIBLE
+rtMsrpByteRange^ rtMsrpMessage::getByteRange()
+{
+ int64_t _start = -1, _end = -1, _total = -1;
+ m_pMsrpMessage->getByteRange(&_start, &_end, &_total);
+ return ref new rtMsrpByteRange(_start, _end, _total);
+}
+#else
+void rtMsrpMessage::getByteRange(IntPtr start, IntPtr end, IntPtr total)
+{
+ int64_t _start = -1, _end = -1, _total = -1;
+ m_pMsrpMessage->getByteRange(&_start, &_end, &_total);
+ // IntPtr is 32bit or 64bit -> 32 to be sure not memory errors will raise
+ *((int32_t*)(void*)start) = (int32_t)_start;
+ *((int32_t*)(void*)end) = (int32_t)_end;
+ *((int32_t*)(void*)total) = (int32_t)_total;
+}
+#endif /* COM_VISIBLE */
+
+bool rtMsrpMessage::isLastChunck()
+{
+ return m_pMsrpMessage->isLastChunck();
+}
+
+bool rtMsrpMessage::isFirstChunck()
+{
+ return m_pMsrpMessage->isFirstChunck();
+}
+
+bool rtMsrpMessage::isSuccessReport()
+{
+ return m_pMsrpMessage->isSuccessReport();
+}
+
+String^ rtMsrpMessage::getMsrpHeaderValue(String^ name)
+{
+ return rtString::toString(m_pMsrpMessage->getMsrpHeaderValue(rtString::toUtf8(name).data()));
+}
+
+String^ rtMsrpMessage::getMsrpHeaderParamValue(String^ name, String^ param)
+{
+ return rtString::toString(m_pMsrpMessage->getMsrpHeaderParamValue(rtString::toUtf8(name).data(), rtString::toUtf8(param).data()));
+}
+
+unsigned rtMsrpMessage::getMsrpContentLength()
+{
+ return m_pMsrpMessage->getMsrpContentLength();
+}
+
+#if COM_VISIBLE
+String^ rtMsrpMessage::getMsrpContent(unsigned maxsize)
+{
+ if(maxsize)
+ {
+ void* _s = calloc(maxsize + 1, 1);
+ if(_s)
+ {
+ unsigned len = m_pMsrpMessage->getMsrpContent(_s, maxsize);
+ String^ s = rtString::toString((const char*)_s);
+ free(_s);
+ return s;
+ }
+ }
+ return nullptr;
+}
+#else
+unsigned rtMsrpMessage::getMsrpContent(IntPtr output, unsigned maxsize)
+{
+ return m_pMsrpMessage->getMsrpContent((void*)output, maxsize);
+}
+#endif /* COM_VISIBLE */
+
+
+//
+// rtMsrpEvent
+//
+
+rtMsrpEvent::rtMsrpEvent(const struct tmsrp_event_s *event)
+{
+ m_pMsrpEvent = new MsrpEvent(event);
+}
+
+rtMsrpEvent::~rtMsrpEvent()
+{
+ rtSafeDelete(m_pMsrpEvent);
+}
+
+rt_tmsrp_event_type_t rtMsrpEvent::getType()
+{
+ return (rt_tmsrp_event_type_t)m_pMsrpEvent->getType();
+}
+
+rtMsrpSession^ rtMsrpEvent::getSipSession()
+{
+ if(m_pMsrpEvent->getSipSession())
+ {
+ assert(0); // FIXME: Not implemented
+ return nullptr;
+ // return ref new rtMsrpSession(m_pMsrpEvent->getSipSession()->getWrappedSession());
+ }
+ return nullptr;
+}
+
+rtMsrpMessage^ rtMsrpEvent::getMessage()
+{
+ if(m_pMsrpEvent->getMessage())
+ {
+ return ref new rtMsrpMessage(const_cast<struct tmsrp_message_s *>(const_cast<MsrpMessage*>(m_pMsrpEvent->getMessage())->getWrappedMsrpMessage()));
+ }
+ return nullptr;
+}
+
+//
+// rtMsrpCallback
+//
+
+rtMsrpCallback::rtMsrpCallback(rtIMsrpCallback^ pI)
+{
+ m_pI = pI;
+ m_pCallback = new MsrpCallback();
+}
+
+rtMsrpCallback::~rtMsrpCallback()
+{
+ rtSafeDelete(m_pCallback);
+}
+
+
+ \ No newline at end of file
diff --git a/bindings/winrt/doubango_rt/src/rt_SMSEncoder.cxx b/bindings/winrt/doubango_rt/src/rt_SMSEncoder.cxx
new file mode 100644
index 0000000..623cb1f
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_SMSEncoder.cxx
@@ -0,0 +1,17 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/ \ No newline at end of file
diff --git a/bindings/winrt/doubango_rt/src/rt_SipCallback.cxx b/bindings/winrt/doubango_rt/src/rt_SipCallback.cxx
new file mode 100644
index 0000000..68c6299
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_SipCallback.cxx
@@ -0,0 +1,135 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/
+#include "rt_SipCallback.h"
+#include "rt_SipEvent.h"
+
+#include "SipEvent.h"
+#include "SipCallback.h"
+
+using namespace doubango_rt::BackEnd;
+using namespace Platform;
+using namespace std;
+
+class SipCallbackProxy : public SipCallback
+{
+public:
+ SipCallbackProxy(rtSipCallback^ rtCallback)
+ {
+ m_pCallback = rtCallback;
+ }
+
+ virtual int OnDialogEvent(const DialogEvent* e) override
+ {
+ if(e && m_pCallback && m_pCallback->m_pI)
+ {
+ return m_pCallback->m_pI->OnDialogEvent(ref new rtDialogEvent(const_cast<tsip_event_t*>(const_cast<DialogEvent*>(e)->getWrappedEvent())));
+ }
+ return 0;
+ }
+
+ virtual int OnStackEvent(const StackEvent* e) override
+ {
+ if(e && m_pCallback && m_pCallback->m_pI)
+ {
+ return m_pCallback->m_pI->OnStackEvent(ref new rtStackEvent(const_cast<tsip_event_t*>(const_cast<StackEvent*>(e)->getWrappedEvent())));
+ }
+ return 0;
+ }
+
+ virtual int OnInviteEvent(const InviteEvent* e) override
+ {
+ if(e && m_pCallback && m_pCallback->m_pI)
+ {
+ return m_pCallback->m_pI->OnInviteEvent(ref new rtInviteEvent(const_cast<tsip_event_t*>(const_cast<InviteEvent*>(e)->getWrappedEvent())));
+ }
+ return 0;
+ }
+
+ virtual int OnMessagingEvent(const MessagingEvent* e) override
+ {
+ if(e && m_pCallback && m_pCallback->m_pI)
+ {
+ return m_pCallback->m_pI->OnMessagingEvent(ref new rtMessagingEvent(const_cast<tsip_event_t*>(const_cast<MessagingEvent*>(e)->getWrappedEvent())));
+ }
+ return 0;
+ }
+
+ virtual int OnInfoEvent(const InfoEvent* e) override
+ {
+ if(m_pCallback && m_pCallback->m_pI)
+ {
+ return m_pCallback->m_pI->OnInfoEvent(ref new rtInfoEvent(const_cast<tsip_event_t*>(const_cast<InfoEvent*>(e)->getWrappedEvent())));
+ }
+ return 0;
+ }
+
+ virtual int OnOptionsEvent(const OptionsEvent* e) override
+ {
+ if(e && m_pCallback && m_pCallback->m_pI)
+ {
+ return m_pCallback->m_pI->OnOptionsEvent(ref new rtOptionsEvent(const_cast<tsip_event_t*>(const_cast<OptionsEvent*>(e)->getWrappedEvent())));
+ }
+ return 0;
+ }
+
+ virtual int OnPublicationEvent(const PublicationEvent* e) override
+ {
+ if(e && m_pCallback && m_pCallback->m_pI)
+ {
+ return m_pCallback->m_pI->OnPublicationEvent(ref new rtPublicationEvent(const_cast<tsip_event_t*>(const_cast<PublicationEvent*>(e)->getWrappedEvent())));
+ }
+ return 0;
+ }
+
+ virtual int OnRegistrationEvent(const RegistrationEvent* e) override
+ {
+ if(m_pCallback && m_pCallback->m_pI)
+ {
+ return m_pCallback->m_pI->OnRegistrationEvent(ref new rtRegistrationEvent(const_cast<tsip_event_t*>(const_cast<RegistrationEvent*>(e)->getWrappedEvent())));
+ }
+ return 0;
+ }
+
+ virtual int OnSubscriptionEvent(const SubscriptionEvent* e) override
+ {
+ if(e && m_pCallback && m_pCallback->m_pI)
+ {
+ return m_pCallback->m_pI->OnSubscriptionEvent(ref new rtSubscriptionEvent(const_cast<tsip_event_t*>(const_cast<SubscriptionEvent*>(e)->getWrappedEvent())));
+ }
+ return 0;
+ }
+
+private:
+ rtSipCallback^ m_pCallback;
+};
+
+rtSipCallback::rtSipCallback(rtISipCallback^ pI)
+{
+ m_pI = pI;
+ m_pCallback = new SipCallbackProxy(this);
+}
+
+rtSipCallback::~rtSipCallback()
+{
+ rtSafeDelete(m_pCallback);
+}
+
+const SipCallback* rtSipCallback::getWrappedCallback()
+{
+ return dynamic_cast<const SipCallback*>(m_pCallback);
+} \ No newline at end of file
diff --git a/bindings/winrt/doubango_rt/src/rt_SipEvent.cxx b/bindings/winrt/doubango_rt/src/rt_SipEvent.cxx
new file mode 100644
index 0000000..1bd414e
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_SipEvent.cxx
@@ -0,0 +1,239 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/
+#include "rt_SipEvent.h"
+#include "rt_String.h"
+#include "rt_SipMessage.h"
+#include "rt_SipSession.h"
+
+#include "tinysip/tsip_event.h"
+
+#include "SipMessage.h"
+#include "SipSession.h"
+#include "SipEvent.h"
+
+using namespace doubango_rt::BackEnd;
+using namespace Platform;
+using namespace std;
+
+#define rt_getSession_Implement(cls) \
+rt##cls##Session^ rt##cls##Event::getSession(){ \
+ const cls##Session* s = m_pEvent->getSession(); \
+ if(s){ \
+ return ref new rt##cls##Session(const_cast<SipStack*>(const_cast<##cls##Session*>(s)->getStack()), const_cast<tsip_ssession_handle_t*>(const_cast<##cls##Session*>(s)->getWrappedSession())); \
+ } \
+ return nullptr; \
+} \
+
+#define rt_takeOwnership_Implement(cls, name, session) \
+rt##name##Session^ rt##cls##Event::take##session##Ownership(){ \
+ name##Session* s = m_pEvent->take##session##Ownership(); \
+ if(s){ \
+ rt##name##Session^ _s = ref new rt##name##Session(const_cast<SipStack*>(s->getStack()), const_cast<tsip_ssession_handle_t*>(s->getWrappedSession())); \
+ rtSafeDelete(s); \
+ return _s; \
+ } \
+ return nullptr; \
+} \
+
+/* ======================== rtDialogEvent ========================*/
+rtISipEvent_Implement(rtDialogEvent);
+
+rtDialogEvent::rtDialogEvent(const struct tsip_event_s *e)
+{
+ m_pEvent = new DialogEvent(e);
+}
+
+rtDialogEvent::~rtDialogEvent()
+{
+ rtSafeDelete(m_pEvent);
+}
+
+
+/* ======================== rtStackEvent ========================*/
+rtISipEvent_Implement(rtStackEvent);
+
+rtStackEvent::rtStackEvent(const struct tsip_event_s *e)
+{
+ m_pEvent = new StackEvent(e);
+}
+
+rtStackEvent::~rtStackEvent()
+{
+ rtSafeDelete(m_pEvent);
+}
+
+
+ /* ======================== rtInviteEvent ========================*/
+rtISipEvent_Implement(rtInviteEvent);
+
+rtInviteEvent::rtInviteEvent(const struct tsip_event_s *e)
+{
+ m_pEvent = new InviteEvent(e);
+}
+
+rtInviteEvent::~rtInviteEvent()
+{
+ rtSafeDelete(m_pEvent);
+}
+
+rt_tsip_invite_event_type_t rtInviteEvent::getType()
+{
+ return (rt_tsip_invite_event_type_t)m_pEvent->getType();
+}
+
+rt_twrap_media_type_t rtInviteEvent::getMediaType()
+{
+ return (rt_twrap_media_type_t)m_pEvent->getMediaType();
+}
+
+rt_getSession_Implement(Invite);
+rt_takeOwnership_Implement(Invite, Call, CallSession);
+rt_takeOwnership_Implement(Invite, Msrp, MsrpSession);
+
+/* ======================== rtMessagingEvent ========================*/
+rtISipEvent_Implement(rtMessagingEvent);
+
+rtMessagingEvent::rtMessagingEvent(const struct tsip_event_s *e)
+{
+ m_pEvent = new MessagingEvent(e);
+}
+
+
+rtMessagingEvent::~rtMessagingEvent()
+{
+ rtSafeDelete(m_pEvent);
+}
+
+rt_tsip_message_event_type_t rtMessagingEvent::getType()
+{
+ return (rt_tsip_message_event_type_t)m_pEvent->getType();
+}
+
+rt_getSession_Implement(Messaging);
+rt_takeOwnership_Implement(Messaging, Messaging, Session);
+
+
+/* ======================== rtInfoEvent ========================*/
+rtISipEvent_Implement(rtInfoEvent);
+
+rtInfoEvent::rtInfoEvent(const struct tsip_event_s *e)
+{
+ m_pEvent = new InfoEvent(e);
+}
+
+rtInfoEvent::~rtInfoEvent()
+{
+ rtSafeDelete(m_pEvent);
+}
+
+rt_tsip_info_event_type_t rtInfoEvent::getType()
+{
+ return (rt_tsip_info_event_type_t)m_pEvent->getType();
+}
+
+rt_getSession_Implement(Info);
+rt_takeOwnership_Implement(Info, Info, Session);
+
+
+/* ======================== rtOptionsEvent ========================*/
+rtISipEvent_Implement(rtOptionsEvent);
+
+rtOptionsEvent::rtOptionsEvent(const struct tsip_event_s *e)
+{
+ m_pEvent = new OptionsEvent(e);
+}
+
+rtOptionsEvent::~rtOptionsEvent()
+{
+ rtSafeDelete(m_pEvent);
+}
+
+rt_tsip_options_event_type_t rtOptionsEvent::getType()
+{
+ return (rt_tsip_options_event_type_t)m_pEvent->getType();
+}
+
+rt_getSession_Implement(Options);
+rt_takeOwnership_Implement(Options, Options, Session);
+
+
+/* ======================== rtPublicationEvent ========================*/
+rtISipEvent_Implement(rtPublicationEvent);
+
+rtPublicationEvent::rtPublicationEvent(const struct tsip_event_s *e)
+{
+ m_pEvent = new PublicationEvent(e);
+}
+
+rtPublicationEvent::~rtPublicationEvent()
+{
+ rtSafeDelete(m_pEvent);
+}
+
+rt_tsip_publish_event_type_t rtPublicationEvent::getType()
+{
+ return (rt_tsip_publish_event_type_t)m_pEvent->getType();
+}
+
+rt_getSession_Implement(Publication);
+rt_takeOwnership_Implement(Publication, Publication, Session);
+
+
+
+/* ======================== rtRegistrationEvent ========================*/
+rtISipEvent_Implement(rtRegistrationEvent);
+
+rtRegistrationEvent::rtRegistrationEvent(const struct tsip_event_s *e)
+{
+ m_pEvent = new RegistrationEvent(e);
+}
+
+rtRegistrationEvent::~rtRegistrationEvent()
+{
+ rtSafeDelete(m_pEvent);
+}
+
+rt_tsip_register_event_type_t rtRegistrationEvent::getType()
+{
+ return (rt_tsip_register_event_type_t)m_pEvent->getType();
+}
+
+rt_getSession_Implement(Registration);
+rt_takeOwnership_Implement(Registration, Registration, Session);
+
+
+/* ======================== rtSubscriptionEvent ========================*/
+rtISipEvent_Implement(rtSubscriptionEvent);
+
+rtSubscriptionEvent::rtSubscriptionEvent(const struct tsip_event_s *e)
+{
+ m_pEvent = new SubscriptionEvent(e);
+}
+
+rtSubscriptionEvent::~rtSubscriptionEvent()
+{
+ rtSafeDelete(m_pEvent);
+}
+
+rt_tsip_subscribe_event_type_t rtSubscriptionEvent::getType()
+{
+ return (rt_tsip_subscribe_event_type_t)m_pEvent->getType();
+}
+
+rt_getSession_Implement(Subscription);
+rt_takeOwnership_Implement(Subscription, Subscription, Session); \ No newline at end of file
diff --git a/bindings/winrt/doubango_rt/src/rt_SipMessage.cxx b/bindings/winrt/doubango_rt/src/rt_SipMessage.cxx
new file mode 100644
index 0000000..55e05d9
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_SipMessage.cxx
@@ -0,0 +1,171 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/
+#include "rt_SipMessage.h"
+#include "rt_String.h"
+
+#include "SipMessage.h"
+
+using namespace doubango_rt::BackEnd;
+using namespace Platform;
+using namespace std;
+
+//
+// rtSdpMessage
+//
+
+rtSdpMessage::rtSdpMessage()
+ :m_pSdpMessage(NULL)
+{
+}
+
+rtSdpMessage::rtSdpMessage(struct tsdp_message_s *message)
+{
+ m_pSdpMessage = new SdpMessage(message);
+}
+
+rtSdpMessage::~rtSdpMessage()
+{
+ rtSafeDelete(m_pSdpMessage);
+}
+
+String^ rtSdpMessage::getSdpHeaderValue(String^ media, String^ name, unsigned index)
+{
+ if(m_pSdpMessage)
+ {
+ char * _str = m_pSdpMessage->getSdpHeaderValue
+ (rtString::toUtf8(media).data(),
+ rtString::toUtf8(media).data()[0],
+ index);
+ String^ str = rtString::toString(_str);
+ TSK_FREE(str);
+ return str;
+ }
+ return nullptr;
+}
+
+String^ rtSdpMessage::getSdpHeaderValue(String^ media, String^ name)
+{
+ return getSdpHeaderValue(media, name, 0);
+}
+
+String^ rtSdpMessage::getSdpHeaderAValue(String^ media, String^ attributeName)
+{
+ if(m_pSdpMessage)
+ {
+ char * _str = m_pSdpMessage->getSdpHeaderAValue
+ (rtString::toUtf8(media).data(),
+ rtString::toUtf8(attributeName).data());
+ String^ str = rtString::toString(_str);
+ TSK_FREE(str);
+ return str;
+ }
+ return nullptr;
+}
+
+//
+// rtSipMessage
+//
+
+rtSipMessage::rtSipMessage()
+ :m_pSipMessage(NULL)
+{
+}
+
+rtSipMessage::rtSipMessage(struct tsip_message_s* message)
+{
+ m_pSipMessage = new SipMessage(message);
+}
+
+rtSipMessage::~rtSipMessage()
+{
+ rtSafeDelete(m_pSipMessage);
+}
+
+bool rtSipMessage::isResponse()
+{
+ return m_pSipMessage ? m_pSipMessage->isResponse() : false;
+}
+
+rt_tsip_request_type_t rtSipMessage::getRequestType()
+{
+ return (rt_tsip_request_type_t)(m_pSipMessage ? m_pSipMessage->getRequestType() : 0);
+}
+
+short rtSipMessage::getResponseCode()
+{
+ return m_pSipMessage ? m_pSipMessage->getResponseCode() : 0;
+}
+
+String^ rtSipMessage::getResponsePhrase()
+{
+ return m_pSipMessage ? rtString::toString(m_pSipMessage->getResponsePhrase()) : nullptr;
+}
+
+String^ rtSipMessage::getSipHeaderValue(String^ name, unsigned index)
+{
+ return m_pSipMessage ? rtString::toString(m_pSipMessage->getSipHeaderValue(rtString::toUtf8(name).data(), index)) : nullptr;
+}
+
+String^ rtSipMessage::getSipHeaderValue(String^ name)
+{
+ return getSipHeaderValue(name, 0);
+}
+
+String^ rtSipMessage::getSipHeaderParamValue(String^ name, String^ param, unsigned index)
+{
+ return m_pSipMessage ? rtString::toString(m_pSipMessage->getSipHeaderParamValue(rtString::toUtf8(name).data(), rtString::toUtf8(param).data(), index)) : nullptr;
+}
+
+String^ rtSipMessage::getSipHeaderParamValue(String^ name, String^ param)
+{
+ return getSipHeaderParamValue(name, param, 0);
+}
+
+unsigned rtSipMessage::getSipContentLength()
+{
+ return m_pSipMessage ? m_pSipMessage->getSipContentLength() : 0;
+}
+
+#if COM_VISIBLE
+String^ rtSipMessage::getSipContent()
+{
+ unsigned len = getSipContentLength();
+ if(len > 0)
+ {
+ void* data_ptr = calloc(len, 1);
+ if(data_ptr)
+ {
+ m_pSipMessage->getSipContent(data_ptr, len);
+ String^ s = rtString::toString((const char*)data_ptr);
+ free(data_ptr);
+ return s;
+ }
+ }
+ return nullptr;
+}
+#else
+unsigned rtSipMessage::getSipContent(IntPtr output, unsigned maxsize)
+{
+ return m_pSipMessage ? m_pSipMessage->getSipContent((void*)output, maxsize) : 0;
+}
+#endif
+
+rtSdpMessage^ rtSipMessage::getSdpMessage()
+{
+ return m_pSipMessage ? ref new rtSdpMessage(const_cast<struct tsdp_message_s *>(const_cast<SdpMessage*>(m_pSipMessage->getSdpMessage())->getWrappedSdpMessage())) : nullptr;
+} \ No newline at end of file
diff --git a/bindings/winrt/doubango_rt/src/rt_SipSession.cxx b/bindings/winrt/doubango_rt/src/rt_SipSession.cxx
new file mode 100644
index 0000000..872a2e2
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_SipSession.cxx
@@ -0,0 +1,662 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/
+#include "rt_SipSession.h"
+#include "rt_String.h"
+#include "rt_SipStack.h"
+#include "rt_SipUri.h"
+#include "rt_Msrp.h"
+
+#include "SipSession.h"
+#include "MediaSessionMgr.h"
+
+using namespace doubango_rt::BackEnd;
+using namespace Platform;
+using namespace std;
+
+/* ======================== T140Callback ========================*/
+rtT140CallbackData::rtT140CallbackData(enum tmedia_t140_data_type_e data_type, const void* data_ptr, unsigned data_size)
+{
+ m_pData = new T140CallbackData(data_type, data_ptr, data_size);
+}
+
+rtT140CallbackData::~rtT140CallbackData()
+{
+ rtSafeDelete(m_pData);
+}
+
+/* ======================== rtT140Callback ========================*/
+
+rtT140Callback::rtT140Callback()
+{
+ m_pCallback = new T140Callback();
+}
+
+rtT140Callback::~rtT140Callback()
+{
+ rtSafeDelete(m_pCallback);
+}
+
+/* ======================== rtSipSession ========================*/
+rtISession_Implement(rtSipSession);
+
+rtSipSession::rtSipSession(rtSipStack^ pStack)
+{
+ m_pSipSession = new SipSession(const_cast<SipStack*>(pStack->getWrappedStack()));
+}
+
+rtSipSession::rtSipSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
+{
+ m_pSipSession = new SipSession(pStack, pHandle);
+}
+
+rtSipSession::~rtSipSession()
+{
+ rtSafeDelete(m_pSipSession);
+}
+
+
+/* ======================== rtInviteSession ========================*/
+rtISession_Implement(rtInviteSession);
+rtIInviteSession_Implement(rtInviteSession);
+
+rtInviteSession::rtInviteSession(rtSipStack^ pStack)
+{
+ m_pSipSession = new InviteSession(const_cast<SipStack*>(pStack->getWrappedStack()));
+}
+
+rtInviteSession::rtInviteSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
+{
+ m_pSipSession = new InviteSession(pStack, pHandle);
+}
+
+rtInviteSession::~rtInviteSession()
+{
+ rtSafeDelete(m_pSipSession);
+}
+
+
+/* ======================== rtCallSession ========================*/
+rtISession_Implement(rtCallSession);
+rtIInviteSession_Implement(rtCallSession);
+
+rtCallSession::rtCallSession(rtSipStack^ pStack)
+{
+ m_pSipSession = new CallSession(const_cast<SipStack*>(pStack->getWrappedStack()));
+}
+
+rtCallSession::rtCallSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
+{
+ m_pSipSession = new CallSession(pStack, pHandle);
+}
+
+rtCallSession::~rtCallSession()
+{
+ rtSafeDelete(m_pSipSession);
+}
+
+
+bool rtCallSession::call(String^ remoteUriString, rt_twrap_media_type_t media, rtActionConfig^ config)
+{
+ return m_pSipSession->call(rtString::toUtf8(remoteUriString).data(), (twrap_media_type_t)media, config ? config->getWrappedActionConfig() : tsk_null);
+
+}
+
+bool rtCallSession::call(String^ remoteUriString, rt_twrap_media_type_t media)
+{
+ return call(remoteUriString, media, nullptr);
+}
+
+bool rtCallSession::call(rtSipUri^ remoteUri, rt_twrap_media_type_t media, rtActionConfig^ config)
+{
+ return m_pSipSession->call(remoteUri->getWrappedUri(), (twrap_media_type_t)media, config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtCallSession::call(rtSipUri^ remoteUri, rt_twrap_media_type_t media)
+{
+ return call(remoteUri, media, nullptr);
+}
+
+bool rtCallSession::setSessionTimer(unsigned timeout, String^ refresher)
+{
+ return m_pSipSession->setSessionTimer(timeout, rtString::toUtf8(refresher).data());
+}
+
+bool rtCallSession::set100rel(bool enabled)
+{
+ return m_pSipSession->set100rel(enabled);
+}
+
+bool rtCallSession::setRtcp(bool enabled)
+{
+ return m_pSipSession->setRtcp(enabled);
+}
+
+bool rtCallSession::setRtcpMux(bool enabled)
+{
+ return m_pSipSession->setRtcpMux(enabled);
+}
+
+bool rtCallSession::setICE(bool enabled)
+{
+ return m_pSipSession->setICE(enabled);
+}
+
+bool rtCallSession::setQoS(rt_tmedia_qos_stype_t type, rt_tmedia_qos_strength_t strength)
+{
+ return m_pSipSession->setQoS((tmedia_qos_stype_t) type, (tmedia_qos_strength_t) strength);
+}
+
+bool rtCallSession::setVideoFps(int32_t fps)
+{
+ return m_pSipSession->setVideoFps(fps);
+}
+
+bool rtCallSession::setVideoBandwidthUploadMax(int32_t max)
+{
+ return m_pSipSession->setVideoBandwidthUploadMax(max);
+}
+
+bool rtCallSession::setVideoBandwidthDownloadMax(int32_t max)
+{
+ return m_pSipSession->setVideoBandwidthDownloadMax(max);
+}
+
+bool rtCallSession::setVideoPrefSize(rt_tmedia_pref_video_size_t pref_video_size)
+{
+ return m_pSipSession->setVideoPrefSize((tmedia_pref_video_size_t)pref_video_size);
+}
+
+bool rtCallSession::hold(rtActionConfig^ config)
+{
+ return m_pSipSession->hold(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtCallSession::hold()
+{
+ return hold(nullptr);
+}
+
+bool rtCallSession::resume(rtActionConfig^ config)
+{
+ return m_pSipSession->resume(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtCallSession::resume()
+{
+ return resume(nullptr);
+}
+
+bool rtCallSession::transfer(String^ referToUriString, rtActionConfig^ config)
+{
+ return m_pSipSession->transfer(rtString::toUtf8(referToUriString).data(), config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtCallSession::transfer(String^ referToUriString)
+{
+ return transfer(referToUriString, nullptr);
+}
+
+bool rtCallSession::acceptTransfer(rtActionConfig^ config)
+{
+ return m_pSipSession->acceptTransfer(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtCallSession::acceptTransfer()
+{
+ return acceptTransfer(nullptr);
+}
+
+bool rtCallSession::rejectTransfer(rtActionConfig^ config)
+{
+ return m_pSipSession->rejectTransfer(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtCallSession::rejectTransfer()
+{
+ return rejectTransfer(nullptr);
+}
+
+bool rtCallSession::sendDTMF(int number)
+{
+ return m_pSipSession->sendDTMF(number);
+}
+
+unsigned rtCallSession::getSessionTransferId()
+{
+ return m_pSipSession->getSessionTransferId();
+}
+
+#if COM_VISIBLE
+bool rtCallSession::sendT140Data(rt_tmedia_t140_data_type_t data_type, String^ data)
+{
+ std::vector<char> _data = rtString::toUtf8(data);
+ return m_pSipSession->sendT140Data((tmedia_t140_data_type_t) data_type, (const void*)_data.data(), _data.size());
+}
+#else
+bool rtCallSession::sendT140Data(rt_tmedia_t140_data_type_t data_type, IntPtr data_ptr, unsigned data_size)
+{
+ return m_pSipSession->sendT140Data((tmedia_t140_data_type_t) data_type, (const void*)data_ptr, data_size);
+}
+
+#endif
+
+bool rtCallSession::sendT140Data(rt_tmedia_t140_data_type_t data_type)
+{
+ return sendT140Data(data_type, nullptr
+#if !COM_VISIBLE
+ , 0
+#endif
+ );
+}
+
+bool rtCallSession::setT140Callback(rtT140Callback^ pT140Callback)
+{
+ return m_pSipSession->setT140Callback(const_cast<T140Callback*>(pT140Callback->getWrappedCallback()));
+}
+
+
+/* ======================== rtMsrpSession ========================*/
+rtISession_Implement(rtMsrpSession);
+rtIInviteSession_Implement(rtMsrpSession);
+
+rtMsrpSession::rtMsrpSession(rtSipStack^ pStack, rtIMsrpCallback^ pCallback)
+{
+ m_pCallback = ref new rtMsrpCallback(pCallback);
+ m_pSipSession = new MsrpSession(const_cast<SipStack*>(pStack->getWrappedStack()), const_cast<MsrpCallback*>(m_pCallback->getWrappedCallback()));
+}
+
+rtMsrpSession::rtMsrpSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
+{
+ m_pSipSession = new MsrpSession(pStack, pHandle);
+}
+
+rtMsrpSession::~rtMsrpSession()
+{
+ rtSafeDelete(m_pSipSession);
+ rtSafeDelete(m_pCallback);
+}
+
+bool rtMsrpSession::setCallback(rtIMsrpCallback^ pCallback)
+{
+ rtSafeDelete(m_pCallback);
+ if(!pCallback)
+ {
+ return m_pSipSession->setCallback(tsk_null);
+ return true;
+ }
+ m_pCallback = ref new rtMsrpCallback(pCallback);
+ return m_pSipSession->setCallback(const_cast<MsrpCallback*>(m_pCallback->getWrappedCallback()));
+}
+
+bool rtMsrpSession::callMsrp(Platform::String^ remoteUriString, rtActionConfig^ config)
+{
+ return m_pSipSession->callMsrp(rtString::toUtf8(remoteUriString).data(), config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtMsrpSession::callMsrp(Platform::String^ remoteUriString)
+{
+ return callMsrp(remoteUriString, nullptr);
+}
+
+bool rtMsrpSession::callMsrp(rtSipUri^ remoteUri, rtActionConfig^ config)
+{
+ return m_pSipSession->callMsrp(remoteUri->getWrappedUri(), config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtMsrpSession::callMsrp(rtSipUri^ remoteUri)
+{
+ return callMsrp(remoteUri, nullptr);
+}
+
+#if COM_VISIBLE
+bool rtMsrpSession::sendMessage(String^ payload, rtActionConfig^ config)
+{
+ std::vector<char> _payload = rtString::toUtf8(payload);
+ return m_pSipSession->sendMessage((const void*)_payload.data(), _payload.size(), config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtMsrpSession::sendMessage(Platform::String^ payload)
+{
+ return sendMessage(payload, nullptr);
+}
+
+#else
+bool rtMsrpSession::sendMessage(Platform::IntPtr payload, unsigned len, rtActionConfig^ config)
+{
+ return m_pSipSession->sendMessage((const void*)payload, len, config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtMsrpSession::sendMessage(Platform::IntPtr payload, unsigned len)
+{
+ return sendMessage(payload, len, nullptr);
+}
+#endif /* COM_VISIBLE */
+
+
+/* ======================== rtMessagingSession ========================*/
+rtISession_Implement(rtMessagingSession);
+
+rtMessagingSession::rtMessagingSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
+{
+ m_pSipSession = new MessagingSession(pStack, pHandle);
+}
+
+rtMessagingSession::rtMessagingSession(rtSipStack^ pStack)
+{
+ m_pSipSession = new MessagingSession(const_cast<SipStack*>(pStack->getWrappedStack()));
+}
+
+rtMessagingSession::~rtMessagingSession()
+{
+ rtSafeDelete(m_pSipSession);
+}
+
+#if COM_VISIBLE
+bool rtMessagingSession::send(String^ payload, rtActionConfig^ config)
+{
+ std::vector<char>_payload = rtString::toUtf8(payload);
+ return m_pSipSession->send((const void*)_payload.data(), _payload.size(), config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtMessagingSession::send(Platform::String^ payload)
+{
+ return send(payload, nullptr);
+}
+
+#else
+bool rtMessagingSession::send(IntPtr payload, unsigned len, rtActionConfig^ config)
+{
+ return m_pSipSession->send((const void*)payload, len, config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtMessagingSession::send(IntPtr payload, unsigned len)
+{
+ return send(payload, len, nullptr);
+}
+#endif
+
+bool rtMessagingSession::accept(rtActionConfig^ config)
+{
+ return m_pSipSession->accept(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtMessagingSession::accept()
+{
+ return accept(nullptr);
+}
+
+bool rtMessagingSession::reject(rtActionConfig^ config)
+{
+ return m_pSipSession->reject(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtMessagingSession::reject()
+{
+ return reject(nullptr);
+}
+
+/* ======================== rtInfoSession ========================*/
+rtISession_Implement(rtInfoSession);
+
+rtInfoSession::rtInfoSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
+{
+ m_pSipSession = new InfoSession(pStack, pHandle);
+}
+
+rtInfoSession::rtInfoSession(rtSipStack^ pStack)
+{
+ m_pSipSession = new InfoSession(const_cast<SipStack*>(pStack->getWrappedStack()));
+}
+
+rtInfoSession::~rtInfoSession()
+{
+ rtSafeDelete(m_pSipSession);
+}
+
+#if COM_VISIBLE
+bool rtInfoSession::send(Platform::String^ payload, rtActionConfig^ config)
+{
+ std::vector<char>_payload = rtString::toUtf8(payload);
+ return m_pSipSession->send((const void*)_payload.data(), _payload.size(), config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtInfoSession::send(Platform::String^ payload)
+{
+ return send(payload, nullptr);
+}
+#else
+bool rtInfoSession::send(IntPtr payload, unsigned len, rtActionConfig^ config)
+{
+ return m_pSipSession->send((const void*)payload, len, config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtInfoSession::send(IntPtr payload, unsigned len)
+{
+ return send(payload, len, nullptr);
+}
+#endif
+
+bool rtInfoSession::accept(rtActionConfig^ config)
+{
+ return m_pSipSession->accept(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtInfoSession::accept()
+{
+ return accept(nullptr);
+}
+
+bool rtInfoSession::reject(rtActionConfig^ config)
+{
+ return m_pSipSession->reject(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtInfoSession::reject()
+{
+ return reject(nullptr);
+}
+
+
+
+/* ======================== rtOptionsSession ========================*/
+rtISession_Implement(rtOptionsSession);
+
+rtOptionsSession::rtOptionsSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
+{
+ m_pSipSession = new OptionsSession(pStack, pHandle);
+}
+
+rtOptionsSession::rtOptionsSession(rtSipStack^ pStack)
+{
+ m_pSipSession = new OptionsSession(const_cast<SipStack*>(pStack->getWrappedStack()));
+}
+
+rtOptionsSession::~rtOptionsSession()
+{
+ rtSafeDelete(m_pSipSession);
+}
+
+bool rtOptionsSession::send(rtActionConfig^ config)
+{
+ return m_pSipSession->send(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtOptionsSession::send()
+{
+ return send(nullptr);
+}
+
+bool rtOptionsSession::accept(rtActionConfig^ config)
+{
+ return m_pSipSession->accept(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtOptionsSession::accept()
+{
+ return accept(nullptr);
+}
+
+bool rtOptionsSession::reject(rtActionConfig^ config)
+{
+ return m_pSipSession->reject(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtOptionsSession::reject()
+{
+ return reject(nullptr);
+}
+
+
+
+/* ======================== rtPublicationSession ========================*/
+rtISession_Implement(rtPublicationSession);
+
+rtPublicationSession::rtPublicationSession(rtSipStack^ pStack)
+{
+ m_pSipSession = new PublicationSession(const_cast<SipStack*>(pStack->getWrappedStack()));
+}
+
+rtPublicationSession::rtPublicationSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
+{
+ m_pSipSession = new PublicationSession(pStack, pHandle);
+}
+
+rtPublicationSession::~rtPublicationSession()
+{
+ rtSafeDelete(m_pSipSession);
+}
+
+#if COM_VISIBLE
+bool rtPublicationSession::publish(String^ payload, rtActionConfig^ config)
+{
+ std::vector<char>_payload = rtString::toUtf8(payload);
+ return m_pSipSession->publish((const void*)_payload.data(), _payload.size(), config ? config->getWrappedActionConfig() : tsk_null);
+}
+bool rtPublicationSession::publish(Platform::String^ payload)
+{
+ return publish(payload, nullptr);
+}
+#else
+bool rtPublicationSession::publish(Platform::IntPtr payload, unsigned len, rtActionConfig^ config)
+{
+ return m_pSipSession->publish((const void*)payload, len, config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtPublicationSession::publish(Platform::IntPtr payload, unsigned len)
+{
+ return publish(payload, len, nullptr);
+}
+#endif
+
+bool rtPublicationSession::unPublish(rtActionConfig^ config)
+{
+ return m_pSipSession->unPublish(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtPublicationSession::unPublish()
+{
+ return unPublish(nullptr);
+}
+
+
+/* ======================== rtRegistrationSession ========================*/
+rtISession_Implement(rtRegistrationSession);
+
+rtRegistrationSession::rtRegistrationSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
+{
+ m_pSipSession = new RegistrationSession(pStack, pHandle);
+}
+
+rtRegistrationSession::rtRegistrationSession(rtSipStack^ pStack)
+{
+ m_pSipSession = new RegistrationSession(const_cast<SipStack*>(pStack->getWrappedStack()));
+}
+
+rtRegistrationSession::~rtRegistrationSession()
+{
+ rtSafeDelete(m_pSipSession);
+}
+
+bool rtRegistrationSession::register_(rtActionConfig^ config)
+{
+ return m_pSipSession->register_(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtRegistrationSession::register_()
+{
+ return register_(nullptr);
+}
+
+bool rtRegistrationSession::unRegister(rtActionConfig^ config)
+{
+ return m_pSipSession->unRegister(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtRegistrationSession::unRegister()
+{
+ return unRegister(nullptr);
+}
+
+bool rtRegistrationSession::accept(rtActionConfig^ config)
+{
+ return m_pSipSession->accept(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtRegistrationSession::accept()
+{
+ return accept(nullptr);
+}
+
+bool rtRegistrationSession::reject(rtActionConfig^ config)
+{
+ return m_pSipSession->reject(config ? config->getWrappedActionConfig() : tsk_null);
+}
+
+bool rtRegistrationSession::reject()
+{
+ return reject(nullptr);
+}
+
+
+/* ======================== rtSubscriptionSession ========================*/
+rtISession_Implement(rtSubscriptionSession);
+
+rtSubscriptionSession::rtSubscriptionSession(rtSipStack^ pStack)
+{
+ m_pSipSession = new SubscriptionSession(const_cast<SipStack*>(pStack->getWrappedStack()));
+}
+
+rtSubscriptionSession::rtSubscriptionSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
+{
+ m_pSipSession = new SubscriptionSession(pStack, pHandle);
+}
+
+rtSubscriptionSession::~rtSubscriptionSession()
+{
+ rtSafeDelete(m_pSipSession);
+}
+
+bool rtSubscriptionSession::subscribe()
+{
+ return m_pSipSession->subscribe();
+}
+
+bool rtSubscriptionSession::unSubscribe()
+{
+ return m_pSipSession->unSubscribe();
+} \ No newline at end of file
diff --git a/bindings/winrt/doubango_rt/src/rt_SipStack.cxx b/bindings/winrt/doubango_rt/src/rt_SipStack.cxx
new file mode 100644
index 0000000..753a881
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_SipStack.cxx
@@ -0,0 +1,390 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/
+#include "rt_SipStack.h"
+#include "rt_SipCallback.h"
+#include "rt_DDebug.h"
+#include "rt_String.h"
+#include "rt_Enums.h"
+
+#include "SipStack.h"
+
+
+using namespace doubango_rt::BackEnd;
+using namespace Platform;
+using namespace std;
+
+rtSipStack::rtSipStack(rtISipCallback^ callback, Platform::String^ realmUri, Platform::String^ impiString, Platform::String^ impuUri)
+{
+ m_pSipCallback = ref new rtSipCallback(callback);
+ m_pSipStack = new SipStack(
+ const_cast<SipCallback*>(m_pSipCallback->getWrappedCallback()),
+ rtString::toUtf8(realmUri).data(),
+ rtString::toUtf8(impiString).data(),
+ rtString::toUtf8(impuUri).data()
+ );
+}
+
+rtSipStack::~rtSipStack()
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ rtSafeDelete(m_pSipStack);
+ rtSafeDelete(m_pSipCallback);
+ rtSafeDelete(m_pDebugCallback);
+}
+
+bool rtSipStack::start()
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->start();
+}
+
+bool rtSipStack::setDebugCallback(rtIDDebugCallback^ pCallback)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ m_pSipStack->setDebugCallback(tsk_null);
+ rtSafeDelete(m_pDebugCallback);
+ if(!pCallback)
+ {
+ return true;
+ }
+
+ m_pDebugCallback = ref new rtDDebugCallback(pCallback);
+ return m_pSipStack->setDebugCallback(const_cast<DDebugCallback*>(m_pDebugCallback->getWrappedCallback()));
+}
+
+bool rtSipStack::setDisplayName(Platform::String^ display_name)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setDisplayName(rtString::toUtf8(display_name).data());
+}
+
+bool rtSipStack::setRealm(Platform::String^ realm_uri)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setRealm(rtString::toUtf8(realm_uri).data());
+}
+
+bool rtSipStack::setIMPI(Platform::String^ impi)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setIMPI(rtString::toUtf8(impi).data());
+}
+
+bool rtSipStack::setIMPU(Platform::String^ impu_uri)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setIMPU(rtString::toUtf8(impu_uri).data());
+}
+
+bool rtSipStack::setPassword(Platform::String^ password)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setPassword(rtString::toUtf8(password).data());
+}
+
+bool rtSipStack::setAMF(Platform::String^ amf)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setAMF(rtString::toUtf8(amf).data());
+}
+
+bool rtSipStack::setOperatorId(Platform::String^ opid)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setOperatorId(rtString::toUtf8(opid).data());
+}
+
+
+bool rtSipStack::setProxyCSCF(Platform::String^ fqdn, unsigned short port, Platform::String^ transport, Platform::String^ ipversion)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setProxyCSCF(
+ rtString::toUtf8(fqdn).data(),
+ port,
+ rtString::toUtf8(transport).data(),
+ rtString::toUtf8(ipversion).data()
+ );
+}
+bool rtSipStack::setLocalIP(Platform::String^ ip, Platform::String^ transport)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setLocalIP(rtString::toUtf8(ip).data(), rtString::toUtf8(transport).data());
+}
+
+bool rtSipStack::setLocalIP(Platform::String^ ip)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setLocalIP(rtString::toUtf8(ip).data());
+}
+
+bool rtSipStack::setLocalPort(unsigned short port, Platform::String^ transport)
+{
+ return m_pSipStack->setLocalPort(port, rtString::toUtf8(transport).data());
+}
+
+bool rtSipStack::setLocalPort(unsigned short port)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setLocalPort(port);
+}
+
+bool rtSipStack::setEarlyIMS(bool enabled)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setEarlyIMS(enabled);
+}
+
+bool rtSipStack::addHeader(Platform::String^ name, Platform::String^ value)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->addHeader(rtString::toUtf8(name).data(), rtString::toUtf8(value).data());
+}
+
+bool rtSipStack::removeHeader(Platform::String^ name)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->removeHeader(rtString::toUtf8(name).data());
+}
+
+bool rtSipStack::addDnsServer(Platform::String^ ip)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->removeHeader(rtString::toUtf8(ip).data());
+}
+
+bool rtSipStack::setDnsDiscovery(bool enabled)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setDnsDiscovery(enabled);
+}
+
+bool rtSipStack::setAoR(Platform::String^ ip, int port)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setAoR(rtString::toUtf8(ip).data(), port);
+}
+
+bool rtSipStack::setSigCompParams(unsigned dms, unsigned sms, unsigned cpb, bool enablePresDict)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setSigCompParams(dms, sms, cpb, enablePresDict);
+}
+
+bool rtSipStack::addSigCompCompartment(Platform::String^ compId)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->addSigCompCompartment(rtString::toUtf8(compId).data());
+}
+
+bool rtSipStack::removeSigCompCompartment(Platform::String^ compId)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->removeSigCompCompartment(rtString::toUtf8(compId).data());
+}
+
+bool rtSipStack::setSTUNServer(Platform::String^ ip, unsigned short port)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setSTUNServer(rtString::toUtf8(ip).data(), port);
+}
+
+bool rtSipStack::setSTUNCred(Platform::String^ login, Platform::String^ password)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setSTUNCred(rtString::toUtf8(login).data(), rtString::toUtf8(password).data());
+}
+
+bool rtSipStack::setTLSSecAgree(bool enabled)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setTLSSecAgree(enabled);
+}
+
+bool rtSipStack::setSSLCertificates(Platform::String^ privKey, Platform::String^ pubKey, Platform::String^ caKey, bool verify)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setSSLCertificates(rtString::toUtf8(privKey).data(), rtString::toUtf8(pubKey).data(), rtString::toUtf8(caKey).data(), verify);
+}
+
+bool rtSipStack::setSSLCertificates(Platform::String^ privKey, Platform::String^ pubKey, Platform::String^ caKey)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return setSSLCertificates(privKey, pubKey, caKey, false);
+}
+
+bool rtSipStack::setIPSecSecAgree(bool enabled)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setIPSecSecAgree(enabled);
+}
+
+bool rtSipStack::setIPSecParameters(Platform::String^ algo, Platform::String^ ealgo, Platform::String^ mode, Platform::String^ proto)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->setIPSecParameters(rtString::toUtf8(algo).data(), rtString::toUtf8(ealgo).data(), rtString::toUtf8(mode).data(), rtString::toUtf8(proto).data());
+}
+
+Platform::String^ rtSipStack::dnsENUM(Platform::String^ service, Platform::String^ e164num, Platform::String^ domain)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return rtString::toString(m_pSipStack->dnsENUM(rtString::toUtf8(service).data(), rtString::toUtf8(e164num).data(), rtString::toUtf8(domain).data()));
+}
+
+#if COM_VISIBLE
+rtDnsResult^ rtSipStack::dnsNaptrSrv(String^ domain, String^ service)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ unsigned short _port = 0;
+ String^ address = rtString::toString(m_pSipStack->dnsNaptrSrv(rtString::toUtf8(domain).data(), rtString::toUtf8(service).data(), &_port));
+ return ref new rtDnsResult(_port, address);
+}
+
+rtDnsResult^ rtSipStack::dnsSrv(String^ service)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ unsigned short _port = 0;
+ String^ address = rtString::toString(m_pSipStack->dnsSrv(rtString::toUtf8(service).data(), &_port));
+ return ref new rtDnsResult(_port, address);
+}
+
+String^ rtSipStack::getLocalIP(String^ protocol)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ char* _ip = m_pSipStack->getLocalIPnPort(rtString::toUtf8(protocol).data(), tsk_null);
+ String^ ip = rtString::toString(_ip);
+ TSK_FREE(_ip);
+ return ip;
+}
+
+uint16 rtSipStack::getLocalPort(String^ protocol)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ uint16 port = 0;
+ char* _ip = m_pSipStack->getLocalIPnPort(rtString::toUtf8(protocol).data(), &port);
+ TSK_FREE(_ip);
+ return port;
+}
+#else
+String^ rtSipStack::dnsNaptrSrv(String^ domain, String^ service, IntPtr port)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return rtString::toString(m_pSipStack->dnsNaptrSrv(rtString::toUtf8(domain).data(), rtString::toUtf8(service).data(), ((unsigned short*)(void*)port)));
+}
+
+String^ rtSipStack::dnsSrv(String^ service, IntPtr port)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return rtString::toString(m_pSipStack->dnsSrv(rtString::toUtf8(service).data(), ((unsigned short*)(void*)port)));
+}
+
+Platform::String^ rtSipStack::getLocalIPnPort(String^ protocol, IntPtr port)
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ char* _ip = m_pSipStack->getLocalIPnPort(rtString::toUtf8(protocol).data(), ((unsigned short*)(void*)port));
+ String^ ip = rtString::toString();
+ TSK_FREE(_ip);
+ return ip;
+}
+#endif /* COM_VISIBLE */
+
+Platform::String^ rtSipStack::getPreferredIdentity()
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return rtString::toString(m_pSipStack->getPreferredIdentity());
+}
+
+bool rtSipStack::isValid()
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->isValid();
+}
+
+bool rtSipStack::stop()
+{
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ return m_pSipStack->stop();
+}
+
+bool rtSipStack::initialize()
+{
+ return SipStack::initialize();
+}
+
+bool rtSipStack::deInitialize()
+{
+ return SipStack::deInitialize();
+}
+
+void rtSipStack::setCodecs(enum class rt_tdav_codec_id_t codecs)
+{
+ return SipStack::setCodecs((tdav_codec_id_t) codecs);
+}
+
+bool rtSipStack::setCodecPriority(enum class rt_tdav_codec_id_t codec_id, int priority)
+{
+ return SipStack::setCodecPriority((tdav_codec_id_t)codec_id, priority);
+}
+
+bool rtSipStack::isCodecSupported(enum class rt_tdav_codec_id_t codec_id)
+{
+ return SipStack::isCodecSupported((tdav_codec_id_t) codec_id);
+}
+
+
+
diff --git a/bindings/winrt/doubango_rt/src/rt_SipUri.cxx b/bindings/winrt/doubango_rt/src/rt_SipUri.cxx
new file mode 100644
index 0000000..1398325
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_SipUri.cxx
@@ -0,0 +1,103 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/
+#include "rt_SipUri.h"
+#include "rt_String.h"
+
+#include "SipUri.h"
+
+using namespace doubango_rt::BackEnd;
+using namespace Platform;
+using namespace std;
+
+
+rtSipUri::rtSipUri(Platform::String^ uriString, Platform::String^ displayName)
+{
+ m_pSipUri = new SipUri(
+ rtString::toUtf8(uriString).data(),
+ rtString::toUtf8(displayName).data());
+}
+
+rtSipUri::rtSipUri(Platform::String^ uriString)
+{
+ m_pSipUri = new SipUri(rtString::toUtf8(uriString).data());
+}
+
+rtSipUri::~rtSipUri()
+{
+ rtSafeDelete(m_pSipUri);
+}
+
+bool rtSipUri::isValid(Platform::String^ uri)
+{
+ return SipUri::isValid(rtString::toUtf8(uri).data());
+}
+
+// MIDL4069: Static members and instance members cannot have the same name on a runtime class. isValid
+
+#if COM_VISIBLE
+bool rtSipUri::isValid_()
+#else
+bool rtSipUri::isValid()
+#endif
+{
+ return (m_pSipUri && m_pSipUri->isValid());
+}
+
+Platform::String^ rtSipUri::getScheme()
+{
+ return m_pSipUri ? rtString::toString(m_pSipUri->getScheme()) : nullptr;
+}
+
+Platform::String^ rtSipUri::getHost()
+{
+ return m_pSipUri ? rtString::toString(m_pSipUri->getHost()) : nullptr;
+}
+
+unsigned short rtSipUri::getPort()
+{
+ return m_pSipUri ? m_pSipUri->getPort() : 0;
+}
+
+Platform::String^ rtSipUri::getUserName()
+{
+ return m_pSipUri ? rtString::toString(m_pSipUri->getUserName()) : nullptr;
+}
+
+Platform::String^ rtSipUri::getPassword()
+{
+ return m_pSipUri ? rtString::toString(m_pSipUri->getPassword()) : nullptr;
+}
+
+Platform::String^ rtSipUri::getDisplayName()
+{
+ return m_pSipUri ? rtString::toString(m_pSipUri->getDisplayName()) : nullptr;
+}
+
+Platform::String^ rtSipUri::getParamValue(Platform::String^ name)
+{
+ return m_pSipUri ? rtString::toString(m_pSipUri->getParamValue(rtString::toUtf8(name).data())) : nullptr;
+}
+
+void rtSipUri::setDisplayName(Platform::String^ displayName)
+{
+ if(m_pSipUri)
+ {
+ m_pSipUri->setDisplayName(rtString::toUtf8(displayName).data());
+ }
+}
+
diff --git a/bindings/winrt/doubango_rt/src/rt_String.cxx b/bindings/winrt/doubango_rt/src/rt_String.cxx
new file mode 100644
index 0000000..7d17f03
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_String.cxx
@@ -0,0 +1,58 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/
+#include "rt_String.h"
+
+#include <Windows.h>
+
+using namespace doubango_rt::BackEnd;
+using namespace Platform;
+using namespace std;
+
+vector<char> rtString::toUtf8(String^ str)
+{
+ if(str != nullptr && !str->IsEmpty())
+ {
+ int len = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, str->Data(), str->Length(), nullptr, 0, nullptr, nullptr);
+ if (len > 0)
+ {
+ vector<char> vec(len + 1);
+ if (WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, str->Data(), str->Length(), vec.data(), len, nullptr, nullptr) == len)
+ {
+ return std::move(vec);
+ }
+ }
+ }
+ return std::move(vector<char>(0));
+}
+
+String^ rtString::toString(char const* str)
+{
+ if(str)
+ {
+ int len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, nullptr, 0);
+ if (len > 0)
+ {
+ vector<wchar_t> vec(len);
+ if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, vec.data(), len) == len)
+ {
+ return ref new String(vec.data());
+ }
+ }
+ }
+ return nullptr;
+} \ No newline at end of file
diff --git a/bindings/winrt/doubango_rt/src/rt_Xcap.cxx b/bindings/winrt/doubango_rt/src/rt_Xcap.cxx
new file mode 100644
index 0000000..623cb1f
--- /dev/null
+++ b/bindings/winrt/doubango_rt/src/rt_Xcap.cxx
@@ -0,0 +1,17 @@
+/*Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO 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 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO 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 DOUBANGO.
+*/ \ No newline at end of file
OpenPOWER on IntegriCloud