* #36737: switch back to svn repo, remove assert in sip_transaction.c
diff --git a/jni/pjproject-android/.svn/pristine/d9/d905dd20c5f8566f99bcb92e0ad99a16290342c5.svn-base b/jni/pjproject-android/.svn/pristine/d9/d905dd20c5f8566f99bcb92e0ad99a16290342c5.svn-base
new file mode 100644
index 0000000..da258b7
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/d9/d905dd20c5f8566f99bcb92e0ad99a16290342c5.svn-base
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical" >
+
+    <ImageView
+        android:id="@+id/imageApp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_above="@+id/textApp"
+        android:layout_centerHorizontal="true"
+        android:contentDescription="@string/app_name"
+        android:src="@drawable/main_image" />
+
+    <TextView
+        android:id="@+id/textApp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerHorizontal="true"
+        android:layout_centerVertical="true"
+        android:text="@string/app_name"
+        android:textSize="40sp"
+        android:typeface="serif" />
+
+    <TextView
+        android:id="@+id/textStatus"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:layout_centerHorizontal="true" 
+        android:textIsSelectable="false"/>
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/jni/pjproject-android/.svn/pristine/d9/d92bb0eb1dce3f8eff97f6c4467a2ac74234bb7c.svn-base b/jni/pjproject-android/.svn/pristine/d9/d92bb0eb1dce3f8eff97f6c4467a2ac74234bb7c.svn-base
new file mode 100644
index 0000000..ca421d2
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/d9/d92bb0eb1dce3f8eff97f6c4467a2ac74234bb7c.svn-base
@@ -0,0 +1,2018 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2009-2011 Teluu Inc. (http://www.teluu.com)
+ *
+ * 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 
+ */
+#include <pjmedia-audiodev/audiodev_imp.h>
+#include <pjmedia-audiodev/errno.h>
+#include <pjmedia/alaw_ulaw.h>
+#include <pjmedia/resample.h>
+#include <pjmedia/stereo.h>
+#include <pj/assert.h>
+#include <pj/log.h>
+#include <pj/math.h>
+#include <pj/os.h>
+#include <pj/string.h>
+
+#if PJMEDIA_AUDIO_DEV_HAS_SYMB_VAS
+
+/* VAS headers */
+#include <VoIPUtilityFactory.h>
+#include <VoIPDownlinkStream.h>
+#include <VoIPUplinkStream.h>
+#include <VoIPFormatIntfc.h>
+#include <VoIPG711DecoderIntfc.h>
+#include <VoIPG711EncoderIntfc.h>
+#include <VoIPG729DecoderIntfc.h>
+#include <VoIPILBCDecoderIntfc.h>
+#include <VoIPILBCEncoderIntfc.h>
+
+/* AMR helper */  
+#include <pjmedia-codec/amr_helper.h>
+
+/* Pack/unpack G.729 frame of S60 DSP codec, taken from:  
+ * http://wiki.forum.nokia.com/index.php/TSS000776_-_Payload_conversion_for_G.729_audio_format
+ */
+#include "s60_g729_bitstream.h"
+
+
+#define THIS_FILE			"symb_vas_dev.c"
+#define BITS_PER_SAMPLE			16
+
+
+/* When this macro is set, VAS will use EPCM16 format for PCM input/output,
+ * otherwise VAS will use EG711 then transcode it to PCM.
+ * Note that using native EPCM16 format may introduce (much) delay.
+ */
+//#define USE_NATIVE_PCM
+
+#if 1
+#   define TRACE_(st) PJ_LOG(3, st)
+#else
+#   define TRACE_(st)
+#endif
+
+/* VAS G.711 frame length */
+static pj_uint8_t vas_g711_frame_len;
+
+
+/* VAS factory */
+struct vas_factory
+{
+    pjmedia_aud_dev_factory	 base;
+    pj_pool_t			*pool;
+    pj_pool_factory		*pf;
+    pjmedia_aud_dev_info	 dev_info;
+};
+
+
+/* Forward declaration of CPjAudioEngine */
+class CPjAudioEngine;
+
+
+/* VAS stream. */
+struct vas_stream
+{
+    // Base
+    pjmedia_aud_stream	 base;			/**< Base class.	*/
+    
+    // Pool
+    pj_pool_t		*pool;			/**< Memory pool.       */
+
+    // Common settings.
+    pjmedia_aud_param 	 param;			/**< Stream param.	*/
+    pjmedia_aud_rec_cb   rec_cb;		/**< Record callback.  	*/
+    pjmedia_aud_play_cb	 play_cb;		/**< Playback callback. */
+    void                *user_data;		/**< Application data.  */
+
+    // Audio engine
+    CPjAudioEngine	*engine;		/**< Internal engine.	*/
+
+    pj_timestamp  	 ts_play;		/**< Playback timestamp.*/
+    pj_timestamp	 ts_rec;		/**< Record timestamp.	*/
+
+    pj_int16_t		*play_buf;		/**< Playback buffer.	*/
+    pj_uint16_t		 play_buf_len;		/**< Playback buffer length. */
+    pj_uint16_t		 play_buf_start;	/**< Playback buffer start index. */
+    pj_int16_t		*rec_buf;		/**< Record buffer.	*/
+    pj_uint16_t		 rec_buf_len;		/**< Record buffer length. */
+    void                *strm_data;		/**< Stream data.	*/
+
+    /* Resampling is needed, in case audio device is opened with clock rate 
+     * other than 8kHz (only for PCM format).
+     */
+    pjmedia_resample	*play_resample;		/**< Resampler for playback. */
+    pjmedia_resample	*rec_resample;		/**< Resampler for recording */
+    pj_uint16_t		 resample_factor;	/**< Resample factor, requested
+						     clock rate / 8000	     */
+
+    /* When stream is working in PCM format, where the samples may need to be
+     * resampled from/to different clock rate and/or channel count, PCM buffer
+     * is needed to perform such resampling operations.
+     */
+    pj_int16_t		*pcm_buf;		/**< PCM buffer.	     */
+};
+
+
+/* Prototypes */
+static pj_status_t factory_init(pjmedia_aud_dev_factory *f);
+static pj_status_t factory_destroy(pjmedia_aud_dev_factory *f);
+static pj_status_t factory_refresh(pjmedia_aud_dev_factory *f);
+static unsigned    factory_get_dev_count(pjmedia_aud_dev_factory *f);
+static pj_status_t factory_get_dev_info(pjmedia_aud_dev_factory *f, 
+					unsigned index,
+					pjmedia_aud_dev_info *info);
+static pj_status_t factory_default_param(pjmedia_aud_dev_factory *f,
+					 unsigned index,
+					 pjmedia_aud_param *param);
+static pj_status_t factory_create_stream(pjmedia_aud_dev_factory *f,
+					 const pjmedia_aud_param *param,
+					 pjmedia_aud_rec_cb rec_cb,
+					 pjmedia_aud_play_cb play_cb,
+					 void *user_data,
+					 pjmedia_aud_stream **p_aud_strm);
+
+static pj_status_t stream_get_param(pjmedia_aud_stream *strm,
+				    pjmedia_aud_param *param);
+static pj_status_t stream_get_cap(pjmedia_aud_stream *strm,
+				  pjmedia_aud_dev_cap cap,
+				  void *value);
+static pj_status_t stream_set_cap(pjmedia_aud_stream *strm,
+				  pjmedia_aud_dev_cap cap,
+				  const void *value);
+static pj_status_t stream_start(pjmedia_aud_stream *strm);
+static pj_status_t stream_stop(pjmedia_aud_stream *strm);
+static pj_status_t stream_destroy(pjmedia_aud_stream *strm);
+
+
+/* Operations */
+static pjmedia_aud_dev_factory_op factory_op =
+{
+    &factory_init,
+    &factory_destroy,
+    &factory_get_dev_count,
+    &factory_get_dev_info,
+    &factory_default_param,
+    &factory_create_stream,
+    &factory_refresh
+};
+
+static pjmedia_aud_stream_op stream_op = 
+{
+    &stream_get_param,
+    &stream_get_cap,
+    &stream_set_cap,
+    &stream_start,
+    &stream_stop,
+    &stream_destroy
+};
+
+
+/****************************************************************************
+ * Internal VAS Engine
+ */
+
+/*
+ * Utility: print sound device error
+ */
+static void snd_perror(const char *title, TInt rc)
+{
+    PJ_LOG(1,(THIS_FILE, "%s (error code=%d)", title, rc));
+}
+
+typedef void(*PjAudioCallback)(CVoIPDataBuffer *buf, void *user_data);
+
+/*
+ * Audio setting for CPjAudioEngine.
+ */
+class CPjAudioSetting
+{
+public:
+    TVoIPCodecFormat	 format;
+    TInt		 mode;
+    TBool		 plc;
+    TBool		 vad;
+    TBool		 cng;
+    TBool		 loudspk;
+};
+
+/*
+ * Implementation: Symbian Input & Output Stream.
+ */
+class CPjAudioEngine :  public CBase,
+			public MVoIPDownlinkObserver,
+			public MVoIPUplinkObserver,
+			public MVoIPFormatObserver
+{
+public:
+    enum State
+    {
+	STATE_NULL,
+	STATE_STARTING,
+	STATE_READY,
+	STATE_STREAMING
+    };
+
+    ~CPjAudioEngine();
+
+    static CPjAudioEngine *NewL(struct vas_stream *parent_strm,
+			        PjAudioCallback rec_cb,
+				PjAudioCallback play_cb,
+				void *user_data,
+				const CPjAudioSetting &setting);
+
+    TInt Start();
+    void Stop();
+
+    TInt ActivateSpeaker(TBool active);
+    
+    TInt SetVolume(TInt vol) { return iVoIPDnlink->SetVolume(vol); }
+    TInt GetVolume() { TInt vol;iVoIPDnlink->GetVolume(vol);return vol; }
+    TInt GetMaxVolume() { TInt vol;iVoIPDnlink->GetMaxVolume(vol);return vol; }
+    
+    TInt SetGain(TInt gain) { return iVoIPUplink->SetGain(gain); }
+    TInt GetGain() { TInt gain;iVoIPUplink->GetGain(gain);return gain; }
+    TInt GetMaxGain() { TInt gain;iVoIPUplink->GetMaxGain(gain);return gain; }
+
+    TBool IsStarted();
+    
+private:
+    CPjAudioEngine(struct vas_stream *parent_strm,
+		   PjAudioCallback rec_cb,
+		   PjAudioCallback play_cb,
+		   void *user_data,
+		   const CPjAudioSetting &setting);
+    void ConstructL();
+
+    TInt InitPlay();
+    TInt InitRec();
+
+    TInt StartPlay();
+    TInt StartRec();
+
+    // From MVoIPDownlinkObserver
+    void FillBuffer(const CVoIPAudioDownlinkStream& aSrc,
+                            CVoIPDataBuffer* aBuffer);
+    void Event(const CVoIPAudioDownlinkStream& aSrc,
+                       TInt aEventType,
+                       TInt aError);
+
+    // From MVoIPUplinkObserver
+    void EmptyBuffer(const CVoIPAudioUplinkStream& aSrc,
+                             CVoIPDataBuffer* aBuffer);
+    void Event(const CVoIPAudioUplinkStream& aSrc,
+                       TInt aEventType,
+                       TInt aError);
+
+    // From MVoIPFormatObserver
+    void Event(const CVoIPFormatIntfc& aSrc, TInt aEventType);
+
+    State			 dn_state_;
+    State			 up_state_;
+    struct vas_stream		*parentStrm_;
+    CPjAudioSetting		 setting_;
+    PjAudioCallback 		 rec_cb_;
+    PjAudioCallback 		 play_cb_;
+    void 			*user_data_;
+
+    // VAS objects
+    CVoIPUtilityFactory         *iFactory;
+    CVoIPAudioDownlinkStream    *iVoIPDnlink;
+    CVoIPAudioUplinkStream      *iVoIPUplink;
+    CVoIPFormatIntfc		*enc_fmt_if;
+    CVoIPFormatIntfc		*dec_fmt_if;
+};
+
+
+CPjAudioEngine* CPjAudioEngine::NewL(struct vas_stream *parent_strm,
+				     PjAudioCallback rec_cb,
+				     PjAudioCallback play_cb,
+				     void *user_data,
+				     const CPjAudioSetting &setting)
+{
+    CPjAudioEngine* self = new (ELeave) CPjAudioEngine(parent_strm,
+						       rec_cb, play_cb,
+						       user_data,
+						       setting);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+void CPjAudioEngine::ConstructL()
+{
+    TInt err;
+    const TVersion ver(1, 0, 0); /* Not really used at this time */
+
+    err = CVoIPUtilityFactory::CreateFactory(iFactory);
+    User::LeaveIfError(err);
+
+    if (parentStrm_->param.dir != PJMEDIA_DIR_CAPTURE) {
+	err = iFactory->CreateDownlinkStream(ver, 
+					     CVoIPUtilityFactory::EVoIPCall,
+					     iVoIPDnlink);
+	User::LeaveIfError(err);
+    }
+
+    if (parentStrm_->param.dir != PJMEDIA_DIR_PLAYBACK) {
+	err = iFactory->CreateUplinkStream(ver, 
+					   CVoIPUtilityFactory::EVoIPCall,
+					   iVoIPUplink);
+	User::LeaveIfError(err);
+    }
+}
+
+CPjAudioEngine::CPjAudioEngine(struct vas_stream *parent_strm,
+			       PjAudioCallback rec_cb,
+			       PjAudioCallback play_cb,
+			       void *user_data,
+			       const CPjAudioSetting &setting)
+      : dn_state_(STATE_NULL),
+        up_state_(STATE_NULL),
+	parentStrm_(parent_strm),
+	setting_(setting),
+        rec_cb_(rec_cb),
+        play_cb_(play_cb),
+        user_data_(user_data),
+        iFactory(NULL),
+        iVoIPDnlink(NULL),
+        iVoIPUplink(NULL),
+        enc_fmt_if(NULL),
+        dec_fmt_if(NULL)
+{
+}
+
+CPjAudioEngine::~CPjAudioEngine()
+{
+    Stop();
+    
+    if (iVoIPUplink)
+	iVoIPUplink->Close();
+    
+    if (iVoIPDnlink)
+	iVoIPDnlink->Close();
+
+    delete enc_fmt_if;
+    delete dec_fmt_if;
+    delete iVoIPDnlink;
+    delete iVoIPUplink;
+    delete iFactory;
+    
+    TRACE_((THIS_FILE, "Sound device destroyed"));
+}
+
+TBool CPjAudioEngine::IsStarted()
+{
+    return ((((parentStrm_->param.dir & PJMEDIA_DIR_CAPTURE) == 0) || 
+	       up_state_ == STATE_STREAMING) &&
+	    (((parentStrm_->param.dir & PJMEDIA_DIR_PLAYBACK) == 0) || 
+	       dn_state_ == STATE_STREAMING));
+}
+
+TInt CPjAudioEngine::InitPlay()
+{
+    TInt err;
+
+    pj_assert(iVoIPDnlink);
+
+    delete dec_fmt_if;
+    dec_fmt_if = NULL;
+    err = iVoIPDnlink->SetFormat(setting_.format, dec_fmt_if);
+    if (err != KErrNone)
+	return err;
+    
+    err = dec_fmt_if->SetObserver(*this);
+    if (err != KErrNone)
+	return err;
+
+    return iVoIPDnlink->Open(*this);
+}
+
+TInt CPjAudioEngine::InitRec()
+{
+    TInt err;
+    
+    pj_assert(iVoIPUplink);
+
+    delete enc_fmt_if;
+    enc_fmt_if = NULL;
+    err = iVoIPUplink->SetFormat(setting_.format, enc_fmt_if);
+    if (err != KErrNone)
+	return err;
+    
+    err = enc_fmt_if->SetObserver(*this);
+    if (err != KErrNone)
+	return err;
+    
+    return iVoIPUplink->Open(*this);
+}
+
+TInt CPjAudioEngine::StartPlay()
+{
+    TInt err = KErrNone;
+    
+    pj_assert(iVoIPDnlink);
+    pj_assert(dn_state_ == STATE_READY);
+
+    /* Configure specific codec setting */
+    switch (setting_.format) {
+    case EG711:
+	{
+	    CVoIPG711DecoderIntfc *g711dec_if = (CVoIPG711DecoderIntfc*)
+						dec_fmt_if;
+	    err = g711dec_if->SetMode((CVoIPFormatIntfc::TG711CodecMode)
+				      setting_.mode);
+	}
+	break;
+	
+    case EILBC:
+	{
+	    CVoIPILBCDecoderIntfc *ilbcdec_if = (CVoIPILBCDecoderIntfc*)
+						dec_fmt_if;
+	    err = ilbcdec_if->SetMode((CVoIPFormatIntfc::TILBCCodecMode)
+				      setting_.mode);
+	}
+	break;
+
+    case EAMR_NB:
+	/* Ticket #1008: AMR playback issue on few devices, e.g: E72, E52 */
+	err = dec_fmt_if->SetFrameMode(ETrue);
+	break;
+	
+    default:
+	break;
+    }
+
+    if (err != KErrNone)
+	goto on_return;
+    
+    /* Configure audio routing */
+    ActivateSpeaker(setting_.loudspk);
+
+    /* Start player */
+    err = iVoIPDnlink->Start();
+
+on_return:
+    if (err == KErrNone) {
+	dn_state_ = STATE_STREAMING;
+	TRACE_((THIS_FILE, "Downlink started"));
+    } else {
+	snd_perror("Failed starting downlink", err);
+    }
+
+    return err;
+}
+
+TInt CPjAudioEngine::StartRec()
+{
+    TInt err = KErrNone;
+    
+    pj_assert(iVoIPUplink);
+    pj_assert(up_state_ == STATE_READY);
+
+    /* Configure specific codec setting */
+    switch (setting_.format) {
+    case EG711:
+	{
+	    CVoIPG711EncoderIntfc *g711enc_if = (CVoIPG711EncoderIntfc*)
+						enc_fmt_if;
+	    err = g711enc_if->SetMode((CVoIPFormatIntfc::TG711CodecMode)
+				      setting_.mode);
+	}
+	break;
+
+    case EILBC:
+	{
+	    CVoIPILBCEncoderIntfc *ilbcenc_if = (CVoIPILBCEncoderIntfc*)
+						enc_fmt_if;
+	    err = ilbcenc_if->SetMode((CVoIPFormatIntfc::TILBCCodecMode)
+				      setting_.mode);
+	}
+	break;
+	
+    case EAMR_NB:
+	err = enc_fmt_if->SetBitRate(setting_.mode);
+	break;
+	
+    default:
+	break;
+    }
+    
+    if (err != KErrNone)
+	goto on_return;
+    
+    /* Configure general codec setting */
+    enc_fmt_if->SetVAD(setting_.vad);
+    
+    /* Start recorder */
+    err = iVoIPUplink->Start();
+
+on_return:
+    if (err == KErrNone) {
+	up_state_ = STATE_STREAMING;
+	TRACE_((THIS_FILE, "Uplink started"));
+    } else {
+	snd_perror("Failed starting uplink", err);
+    }
+
+    return err;
+}
+
+TInt CPjAudioEngine::Start()
+{
+    TInt err = KErrNone;
+    
+    if (iVoIPDnlink) {
+	switch(dn_state_) {
+	case STATE_READY:
+	    err = StartPlay();
+	    break;
+	case STATE_NULL:
+	    err = InitPlay();
+	    if (err != KErrNone)
+		return err;
+	    dn_state_ = STATE_STARTING;
+	    break;
+	default:
+	    break;
+	}
+    }
+    
+    if (iVoIPUplink) {
+	switch(up_state_) {
+	case STATE_READY:
+	    err = StartRec();
+	    break;
+	case STATE_NULL:
+	    err = InitRec();
+	    if (err != KErrNone)
+		return err;
+	    up_state_ = STATE_STARTING;
+	    break;
+	default:
+	    break;
+	}
+    }
+
+    return err;
+}
+
+void CPjAudioEngine::Stop()
+{
+    if (iVoIPDnlink) {
+	switch(dn_state_) {
+	case STATE_STREAMING:
+	    iVoIPDnlink->Stop();
+	    dn_state_ = STATE_READY;
+	    break;
+	case STATE_STARTING:
+	    dn_state_ = STATE_NULL;
+	    break;
+	default:
+	    break;
+	}
+    }
+
+    if (iVoIPUplink) {
+	switch(up_state_) {
+	case STATE_STREAMING:
+	    iVoIPUplink->Stop();
+	    up_state_ = STATE_READY;
+	    break;
+	case STATE_STARTING:
+	    up_state_ = STATE_NULL;
+	    break;
+	default:
+	    break;
+	}
+    }
+}
+
+
+TInt CPjAudioEngine::ActivateSpeaker(TBool active)
+{
+    TInt err = KErrNotSupported;
+    
+    if (iVoIPDnlink) {
+	err = iVoIPDnlink->SetAudioDevice(active?
+				    CVoIPAudioDownlinkStream::ELoudSpeaker :
+				    CVoIPAudioDownlinkStream::EHandset);
+	TRACE_((THIS_FILE, "Loudspeaker turned %s", (active? "on":"off")));
+    }
+    
+    return err;
+}
+
+// Callback from MVoIPDownlinkObserver
+void CPjAudioEngine::FillBuffer(const CVoIPAudioDownlinkStream& aSrc,
+                                CVoIPDataBuffer* aBuffer)
+{
+    play_cb_(aBuffer, user_data_);
+    iVoIPDnlink->BufferFilled(aBuffer);
+}
+
+// Callback from MVoIPUplinkObserver
+void CPjAudioEngine::EmptyBuffer(const CVoIPAudioUplinkStream& aSrc,
+                                 CVoIPDataBuffer* aBuffer)
+{
+    rec_cb_(aBuffer, user_data_);
+    iVoIPUplink->BufferEmptied(aBuffer);
+}
+
+// Callback from MVoIPDownlinkObserver
+void CPjAudioEngine::Event(const CVoIPAudioDownlinkStream& /*aSrc*/,
+                           TInt aEventType,
+                           TInt aError)
+{
+    switch (aEventType) {
+    case MVoIPDownlinkObserver::KOpenComplete:
+	if (aError == KErrNone) {
+	    State last_state = dn_state_;
+
+	    dn_state_ = STATE_READY;
+	    TRACE_((THIS_FILE, "Downlink opened"));
+
+	    if (last_state == STATE_STARTING)
+		StartPlay();
+	}
+	break;
+
+    case MVoIPDownlinkObserver::KDownlinkClosed:
+	dn_state_ = STATE_NULL;
+	TRACE_((THIS_FILE, "Downlink closed"));
+	break;
+
+    case MVoIPDownlinkObserver::KDownlinkError:
+	dn_state_ = STATE_READY;
+	snd_perror("Downlink problem", aError);
+	break;
+    default:
+	break;
+    }
+}
+
+// Callback from MVoIPUplinkObserver
+void CPjAudioEngine::Event(const CVoIPAudioUplinkStream& /*aSrc*/,
+                           TInt aEventType,
+                           TInt aError)
+{
+    switch (aEventType) {
+    case MVoIPUplinkObserver::KOpenComplete:
+	if (aError == KErrNone) {
+	    State last_state = up_state_;
+
+	    up_state_ = STATE_READY;
+	    TRACE_((THIS_FILE, "Uplink opened"));
+	    
+	    if (last_state == STATE_STARTING)
+		StartRec();
+	}
+	break;
+
+    case MVoIPUplinkObserver::KUplinkClosed:
+	up_state_ = STATE_NULL;
+	TRACE_((THIS_FILE, "Uplink closed"));
+	break;
+
+    case MVoIPUplinkObserver::KUplinkError:
+	up_state_ = STATE_READY;
+	snd_perror("Uplink problem", aError);
+	break;
+    default:
+	break;
+    }
+}
+
+// Callback from MVoIPFormatObserver
+void CPjAudioEngine::Event(const CVoIPFormatIntfc& /*aSrc*/, 
+			   TInt aEventType)
+{
+    snd_perror("Format event", aEventType);
+}
+
+/****************************************************************************
+ * Internal VAS callbacks for PCM format
+ */
+
+#ifdef USE_NATIVE_PCM
+
+static void RecCbPcm2(CVoIPDataBuffer *buf, void *user_data)
+{
+    struct vas_stream *strm = (struct vas_stream*) user_data;
+    TPtr8 buffer(0, 0, 0);
+    pj_int16_t *p_buf;
+    unsigned buf_len;
+
+    /* Get the buffer */
+    buf->GetPayloadPtr(buffer);
+    
+    /* Call parent callback */
+    p_buf = (pj_int16_t*) buffer.Ptr();
+    buf_len = buffer.Length() >> 1;
+    while (buf_len) {
+	unsigned req;
+	
+	req = strm->param.samples_per_frame - strm->rec_buf_len;
+	if (req > buf_len)
+	    req = buf_len;
+	pjmedia_copy_samples(strm->rec_buf + strm->rec_buf_len, p_buf, req);
+	p_buf += req;
+	buf_len -= req;
+	strm->rec_buf_len += req;
+	
+	if (strm->rec_buf_len >= strm->param.samples_per_frame) {
+	    pjmedia_frame f;
+
+	    f.buf = strm->rec_buf;
+	    f.type = PJMEDIA_FRAME_TYPE_AUDIO;
+	    f.size = strm->param.samples_per_frame << 1;
+	    strm->rec_cb(strm->user_data, &f);
+	    strm->rec_buf_len = 0;
+	}
+    }
+}
+
+static void PlayCbPcm2(CVoIPDataBuffer *buf, void *user_data)
+{
+    struct vas_stream *strm = (struct vas_stream*) user_data;
+    TPtr8 buffer(0, 0, 0);
+    pjmedia_frame f;
+
+    /* Get the buffer */
+    buf->GetPayloadPtr(buffer);
+
+    /* Call parent callback */
+    f.buf = strm->play_buf;
+    f.size = strm->param.samples_per_frame << 1;
+    strm->play_cb(strm->user_data, &f);
+    if (f.type != PJMEDIA_FRAME_TYPE_AUDIO) {
+	pjmedia_zero_samples((pj_int16_t*)f.buf, 
+			     strm->param.samples_per_frame);
+    }
+    f.size = strm->param.samples_per_frame << 1;
+
+    /* Init buffer attributes and header. */
+    buffer.Zero();
+    buffer.Append((TUint8*)f.buf, f.size);
+
+    /* Set the buffer */
+    buf->SetPayloadPtr(buffer);
+}
+
+#else // not USE_NATIVE_PCM
+
+static void RecCbPcm(CVoIPDataBuffer *buf, void *user_data)
+{
+    struct vas_stream *strm = (struct vas_stream*) user_data;
+    TPtr8 buffer(0, 0, 0);
+
+    /* Get the buffer */
+    buf->GetPayloadPtr(buffer);
+    
+    /* Buffer has to contain normal speech. */
+    pj_assert(buffer[0] == 1 && buffer[1] == 0);
+
+    /* Detect the recorder G.711 frame size, player frame size will follow
+     * this recorder frame size.
+     */
+    if (vas_g711_frame_len == 0) {
+	vas_g711_frame_len = buffer.Length() < 160? 80 : 160;
+	TRACE_((THIS_FILE, "Detected VAS G.711 frame size = %u samples",
+		vas_g711_frame_len));
+    }
+
+    /* Decode VAS buffer (coded in G.711) and put the PCM result into rec_buf.
+     * Whenever rec_buf is full, call parent stream callback.
+     */
+    unsigned samples_processed = 0;
+
+    while (samples_processed < vas_g711_frame_len) {
+	unsigned samples_to_process;
+	unsigned samples_req;
+
+	samples_to_process = vas_g711_frame_len - samples_processed;
+	samples_req = (strm->param.samples_per_frame /
+		       strm->param.channel_count /
+		       strm->resample_factor) -
+		      strm->rec_buf_len;
+	if (samples_to_process > samples_req)
+	    samples_to_process = samples_req;
+
+	pjmedia_ulaw_decode(&strm->rec_buf[strm->rec_buf_len],
+			    buffer.Ptr() + 2 + samples_processed,
+			    samples_to_process);
+
+	strm->rec_buf_len += samples_to_process;
+	samples_processed += samples_to_process;
+
+	/* Buffer is full, time to call parent callback */
+	if (strm->rec_buf_len == strm->param.samples_per_frame / 
+				 strm->param.channel_count /
+				 strm->resample_factor) 
+	{
+	    pjmedia_frame f;
+
+	    /* Need to resample clock rate? */
+	    if (strm->rec_resample) {
+		unsigned resampled = 0;
+		
+		while (resampled < strm->rec_buf_len) {
+		    pjmedia_resample_run(strm->rec_resample, 
+				&strm->rec_buf[resampled],
+				strm->pcm_buf + 
+				resampled * strm->resample_factor);
+		    resampled += 80;
+		}
+		f.buf = strm->pcm_buf;
+	    } else {
+		f.buf = strm->rec_buf;
+	    }
+
+	    /* Need to convert channel count? */
+	    if (strm->param.channel_count != 1) {
+		pjmedia_convert_channel_1ton((pj_int16_t*)f.buf,
+					     (pj_int16_t*)f.buf,
+					     strm->param.channel_count,
+					     strm->param.samples_per_frame /
+					     strm->param.channel_count,
+					     0);
+	    }
+
+	    /* Call parent callback */
+	    f.type = PJMEDIA_FRAME_TYPE_AUDIO;
+	    f.size = strm->param.samples_per_frame << 1;
+	    strm->rec_cb(strm->user_data, &f);
+	    strm->rec_buf_len = 0;
+	}
+    }
+}
+
+#endif // USE_NATIVE_PCM
+
+static void PlayCbPcm(CVoIPDataBuffer *buf, void *user_data)
+{
+    struct vas_stream *strm = (struct vas_stream*) user_data;
+    unsigned g711_frame_len = vas_g711_frame_len;
+    TPtr8 buffer(0, 0, 0);
+
+    /* Get the buffer */
+    buf->GetPayloadPtr(buffer);
+
+    /* Init buffer attributes and header. */
+    buffer.Zero();
+    buffer.Append(1);
+    buffer.Append(0);
+
+    /* Assume frame size is 10ms if frame size hasn't been known. */
+    if (g711_frame_len == 0)
+	g711_frame_len = 80;
+
+    /* Call parent stream callback to get PCM samples to play,
+     * encode the PCM samples into G.711 and put it into VAS buffer.
+     */
+    unsigned samples_processed = 0;
+    
+    while (samples_processed < g711_frame_len) {
+	/* Need more samples to play, time to call parent callback */
+	if (strm->play_buf_len == 0) {
+	    pjmedia_frame f;
+	    unsigned samples_got;
+	    
+	    f.size = strm->param.samples_per_frame << 1;
+	    if (strm->play_resample || strm->param.channel_count != 1)
+		f.buf = strm->pcm_buf;
+	    else
+		f.buf = strm->play_buf;
+
+	    /* Call parent callback */
+	    strm->play_cb(strm->user_data, &f);
+	    if (f.type != PJMEDIA_FRAME_TYPE_AUDIO) {
+		pjmedia_zero_samples((pj_int16_t*)f.buf, 
+				     strm->param.samples_per_frame);
+	    }
+	    
+	    samples_got = strm->param.samples_per_frame / 
+			  strm->param.channel_count /
+			  strm->resample_factor;
+
+	    /* Need to convert channel count? */
+	    if (strm->param.channel_count != 1) {
+		pjmedia_convert_channel_nto1((pj_int16_t*)f.buf,
+					     (pj_int16_t*)f.buf,
+					     strm->param.channel_count,
+					     strm->param.samples_per_frame,
+					     PJ_FALSE,
+					     0);
+	    }
+
+	    /* Need to resample clock rate? */
+	    if (strm->play_resample) {
+		unsigned resampled = 0;
+		
+		while (resampled < samples_got) 
+		{
+		    pjmedia_resample_run(strm->play_resample, 
+				strm->pcm_buf + 
+				resampled * strm->resample_factor,
+				&strm->play_buf[resampled]);
+		    resampled += 80;
+		}
+	    }
+	    
+	    strm->play_buf_len = samples_got;
+	    strm->play_buf_start = 0;
+	}
+
+	unsigned tmp;
+
+	tmp = PJ_MIN(strm->play_buf_len, g711_frame_len - samples_processed);
+	pjmedia_ulaw_encode((pj_uint8_t*)&strm->play_buf[strm->play_buf_start],
+			    &strm->play_buf[strm->play_buf_start],
+			    tmp);
+	buffer.Append((TUint8*)&strm->play_buf[strm->play_buf_start], tmp);
+	samples_processed += tmp;
+	strm->play_buf_len -= tmp;
+	strm->play_buf_start += tmp;
+    }
+
+    /* Set the buffer */
+    buf->SetPayloadPtr(buffer);
+}
+
+/****************************************************************************
+ * Internal VAS callbacks for non-PCM format
+ */
+
+static void RecCb(CVoIPDataBuffer *buf, void *user_data)
+{
+    struct vas_stream *strm = (struct vas_stream*) user_data;
+    pjmedia_frame_ext *frame = (pjmedia_frame_ext*) strm->rec_buf;
+    TPtr8 buffer(0, 0, 0);
+
+    /* Get the buffer */
+    buf->GetPayloadPtr(buffer);
+    
+    switch(strm->param.ext_fmt.id) {
+    case PJMEDIA_FORMAT_AMR:
+	{
+	    const pj_uint8_t *p = (const pj_uint8_t*)buffer.Ptr() + 1;
+	    unsigned len = buffer.Length() - 1;
+	    
+	    pjmedia_frame_ext_append_subframe(frame, p, len << 3, 160);
+	    if (frame->samples_cnt == strm->param.samples_per_frame) {
+		frame->base.type = PJMEDIA_FRAME_TYPE_EXTENDED;
+		strm->rec_cb(strm->user_data, (pjmedia_frame*)frame);
+		frame->samples_cnt = 0;
+		frame->subframe_cnt = 0;
+	    }
+	}
+	break;
+	
+    case PJMEDIA_FORMAT_G729:
+	{
+	    /* Check if we got a normal or SID frame. */
+	    if (buffer[0] != 0) {
+		enum { NORMAL_LEN = 22, SID_LEN = 8 };
+		TBitStream *bitstream = (TBitStream*)strm->strm_data;
+		unsigned src_len = buffer.Length()- 2;
+		
+		pj_assert(src_len == NORMAL_LEN || src_len == SID_LEN);
+		
+		const TDesC8& p = bitstream->CompressG729Frame(
+					    buffer.Right(src_len), 
+					    src_len == SID_LEN);
+		
+		pjmedia_frame_ext_append_subframe(frame, p.Ptr(), 
+						  p.Length() << 3, 80);
+	    } else { /* We got null frame. */
+		pjmedia_frame_ext_append_subframe(frame, NULL, 0, 80);
+	    }
+	    
+	    if (frame->samples_cnt == strm->param.samples_per_frame) {
+		frame->base.type = PJMEDIA_FRAME_TYPE_EXTENDED;
+		strm->rec_cb(strm->user_data, (pjmedia_frame*)frame);
+		frame->samples_cnt = 0;
+		frame->subframe_cnt = 0;
+	    }
+	}
+	break;
+
+    case PJMEDIA_FORMAT_ILBC:
+	{
+	    unsigned samples_got;
+	    
+	    samples_got =
+	        strm->param.ext_fmt.det.aud.avg_bps == 15200? 160 : 240;
+	    
+	    /* Check if we got a normal or SID frame. */
+	    if (buffer[0] != 0) {
+		const pj_uint8_t *p = (const pj_uint8_t*)buffer.Ptr() + 2;
+		unsigned len = buffer.Length() - 2;
+		
+		pjmedia_frame_ext_append_subframe(frame, p, len << 3,
+						  samples_got);
+	    } else { /* We got null frame. */
+		pjmedia_frame_ext_append_subframe(frame, NULL, 0, samples_got);
+	    }
+	    
+	    if (frame->samples_cnt == strm->param.samples_per_frame) {
+		frame->base.type = PJMEDIA_FRAME_TYPE_EXTENDED;
+		strm->rec_cb(strm->user_data, (pjmedia_frame*)frame);
+		frame->samples_cnt = 0;
+		frame->subframe_cnt = 0;
+	    }
+	}
+	break;
+	
+    case PJMEDIA_FORMAT_PCMU:
+    case PJMEDIA_FORMAT_PCMA:
+	{
+	    unsigned samples_processed = 0;
+	    
+	    /* Make sure it is normal frame. */
+	    pj_assert(buffer[0] == 1 && buffer[1] == 0);
+
+	    /* Detect the recorder G.711 frame size, player frame size will 
+	     * follow this recorder frame size.
+	     */
+	    if (vas_g711_frame_len == 0) {
+		vas_g711_frame_len = buffer.Length() < 160? 80 : 160;
+		TRACE_((THIS_FILE, "Detected VAS G.711 frame size = %u samples",
+			vas_g711_frame_len));
+	    }
+	    
+	    /* Convert VAS buffer format into pjmedia_frame_ext. Whenever 
+	     * samples count in the frame is equal to stream's samples per 
+	     * frame, call parent stream callback.
+	     */
+	    while (samples_processed < vas_g711_frame_len) {
+		unsigned tmp;
+		const pj_uint8_t *pb = (const pj_uint8_t*)buffer.Ptr() +
+				       2 + samples_processed;
+    
+		tmp = PJ_MIN(strm->param.samples_per_frame - frame->samples_cnt,
+			     vas_g711_frame_len - samples_processed);
+		
+		pjmedia_frame_ext_append_subframe(frame, pb, tmp << 3, tmp);
+		samples_processed += tmp;
+    
+		if (frame->samples_cnt == strm->param.samples_per_frame) {
+		    frame->base.type = PJMEDIA_FRAME_TYPE_EXTENDED;
+		    strm->rec_cb(strm->user_data, (pjmedia_frame*)frame);
+		    frame->samples_cnt = 0;
+		    frame->subframe_cnt = 0;
+		}
+	    }
+	}
+	break;
+	
+    default:
+	break;
+    }
+}
+
+static void PlayCb(CVoIPDataBuffer *buf, void *user_data)
+{
+    struct vas_stream *strm = (struct vas_stream*) user_data;
+    pjmedia_frame_ext *frame = (pjmedia_frame_ext*) strm->play_buf;
+    TPtr8 buffer(0, 0, 0);
+
+    /* Get the buffer */
+    buf->GetPayloadPtr(buffer);
+
+    /* Init buffer attributes and header. */
+    buffer.Zero();
+
+    switch(strm->param.ext_fmt.id) {
+    case PJMEDIA_FORMAT_AMR:
+	{
+	    if (frame->samples_cnt == 0) {
+		frame->base.type = PJMEDIA_FRAME_TYPE_EXTENDED;
+		strm->play_cb(strm->user_data, (pjmedia_frame*)frame);
+		pj_assert(frame->base.type==PJMEDIA_FRAME_TYPE_EXTENDED ||
+			  frame->base.type==PJMEDIA_FRAME_TYPE_NONE);
+	    }
+
+	    if (frame->base.type == PJMEDIA_FRAME_TYPE_EXTENDED) { 
+		pjmedia_frame_ext_subframe *sf;
+		unsigned samples_cnt;
+		
+		sf = pjmedia_frame_ext_get_subframe(frame, 0);
+		samples_cnt = frame->samples_cnt / frame->subframe_cnt;
+		
+		if (sf->data && sf->bitlen) {
+		    /* AMR header for VAS is one byte, the format (may be!):
+		     * 0xxxxy00, where xxxx:frame type, y:not sure. 
+		     */
+		    unsigned len = (sf->bitlen+7)>>3;
+		    enum {SID_FT = 8 };
+		    pj_uint8_t amr_header = 4, ft = SID_FT;
+
+		    if (len >= pjmedia_codec_amrnb_framelen[0])
+			ft = pjmedia_codec_amr_get_mode2(PJ_TRUE, len);
+		    
+		    amr_header |= ft << 3;
+		    buffer.Append(amr_header);
+		    
+		    buffer.Append((TUint8*)sf->data, len);
+		} else {
+		    enum {NO_DATA_FT = 15 };
+		    pj_uint8_t amr_header = 4 | (NO_DATA_FT << 3);
+
+		    buffer.Append(amr_header);
+		}
+
+		pjmedia_frame_ext_pop_subframes(frame, 1);
+	    
+	    } else { /* PJMEDIA_FRAME_TYPE_NONE */
+		enum {NO_DATA_FT = 15 };
+		pj_uint8_t amr_header = 4 | (NO_DATA_FT << 3);
+
+		buffer.Append(amr_header);
+		
+		frame->samples_cnt = 0;
+		frame->subframe_cnt = 0;
+	    }
+	}
+	break;
+	
+    case PJMEDIA_FORMAT_G729:
+	{
+	    if (frame->samples_cnt == 0) {
+		frame->base.type = PJMEDIA_FRAME_TYPE_EXTENDED;
+		strm->play_cb(strm->user_data, (pjmedia_frame*)frame);
+		pj_assert(frame->base.type==PJMEDIA_FRAME_TYPE_EXTENDED ||
+			  frame->base.type==PJMEDIA_FRAME_TYPE_NONE);
+	    }
+
+	    if (frame->base.type == PJMEDIA_FRAME_TYPE_EXTENDED) { 
+		pjmedia_frame_ext_subframe *sf;
+		unsigned samples_cnt;
+		
+		sf = pjmedia_frame_ext_get_subframe(frame, 0);
+		samples_cnt = frame->samples_cnt / frame->subframe_cnt;
+		
+		if (sf->data && sf->bitlen) {
+		    enum { NORMAL_LEN = 10, SID_LEN = 2 };
+		    pj_bool_t sid_frame = ((sf->bitlen >> 3) == SID_LEN);
+		    TBitStream *bitstream = (TBitStream*)strm->strm_data;
+		    const TPtrC8 src(sf->data, sf->bitlen>>3);
+		    const TDesC8 &dst = bitstream->ExpandG729Frame(src,
+								   sid_frame); 
+		    if (sid_frame) {
+			buffer.Append(2);
+			buffer.Append(0);
+		    } else {
+			buffer.Append(1);
+			buffer.Append(0);
+		    }
+		    buffer.Append(dst);
+		} else {
+		    buffer.Append(2);
+		    buffer.Append(0);
+
+		    buffer.AppendFill(0, 22);
+		}
+
+		pjmedia_frame_ext_pop_subframes(frame, 1);
+	    
+	    } else { /* PJMEDIA_FRAME_TYPE_NONE */
+		buffer.Append(2);
+		buffer.Append(0);
+		
+		buffer.AppendFill(0, 22);
+	    }
+	}
+	break;
+	
+    case PJMEDIA_FORMAT_ILBC:
+	{
+	    if (frame->samples_cnt == 0) {
+		frame->base.type = PJMEDIA_FRAME_TYPE_EXTENDED;
+		strm->play_cb(strm->user_data, (pjmedia_frame*)frame);
+		pj_assert(frame->base.type==PJMEDIA_FRAME_TYPE_EXTENDED ||
+			  frame->base.type==PJMEDIA_FRAME_TYPE_NONE);
+	    }
+
+	    if (frame->base.type == PJMEDIA_FRAME_TYPE_EXTENDED) { 
+		pjmedia_frame_ext_subframe *sf;
+		unsigned samples_cnt;
+		
+		sf = pjmedia_frame_ext_get_subframe(frame, 0);
+		samples_cnt = frame->samples_cnt / frame->subframe_cnt;
+		
+		pj_assert((strm->param.ext_fmt.det.aud.avg_bps == 15200 && 
+			   samples_cnt == 160) ||
+			  (strm->param.ext_fmt.det.aud.avg_bps != 15200 &&
+			   samples_cnt == 240));
+		
+		if (sf->data && sf->bitlen) {
+		    buffer.Append(1);
+		    buffer.Append(0);
+		    buffer.Append((TUint8*)sf->data, sf->bitlen>>3);
+		} else {
+		    unsigned frame_len;
+		    
+		    buffer.Append(1);
+		    buffer.Append(0);
+		    
+		    /* VAS iLBC frame is 20ms or 30ms */
+		    frame_len =
+		        strm->param.ext_fmt.det.aud.avg_bps == 15200? 38 : 50;
+		    buffer.AppendFill(0, frame_len);
+		}
+
+		pjmedia_frame_ext_pop_subframes(frame, 1);
+	    
+	    } else { /* PJMEDIA_FRAME_TYPE_NONE */
+		
+		unsigned frame_len;
+		
+		buffer.Append(1);
+		buffer.Append(0);
+		
+		/* VAS iLBC frame is 20ms or 30ms */
+		frame_len =
+		    strm->param.ext_fmt.det.aud.avg_bps == 15200? 38 : 50;
+		buffer.AppendFill(0, frame_len);
+
+	    }
+	}
+	break;
+	
+    case PJMEDIA_FORMAT_PCMU:
+    case PJMEDIA_FORMAT_PCMA:
+	{
+	    unsigned samples_ready = 0;
+	    unsigned samples_req = vas_g711_frame_len;
+	    
+	    /* Assume frame size is 10ms if frame size hasn't been known. */
+	    if (samples_req == 0)
+		samples_req = 80;
+	    
+	    buffer.Append(1);
+	    buffer.Append(0);
+	    
+	    /* Call parent stream callback to get samples to play. */
+	    while (samples_ready < samples_req) {
+		if (frame->samples_cnt == 0) {
+		    frame->base.type = PJMEDIA_FRAME_TYPE_EXTENDED;
+		    strm->play_cb(strm->user_data, (pjmedia_frame*)frame);
+		    pj_assert(frame->base.type==PJMEDIA_FRAME_TYPE_EXTENDED ||
+			      frame->base.type==PJMEDIA_FRAME_TYPE_NONE);
+		}
+    
+		if (frame->base.type == PJMEDIA_FRAME_TYPE_EXTENDED) { 
+		    pjmedia_frame_ext_subframe *sf;
+		    unsigned samples_cnt;
+		    
+		    sf = pjmedia_frame_ext_get_subframe(frame, 0);
+		    samples_cnt = frame->samples_cnt / frame->subframe_cnt;
+		    if (sf->data && sf->bitlen) {
+			buffer.Append((TUint8*)sf->data, sf->bitlen>>3);
+		    } else {
+			pj_uint8_t silc;
+			silc = (strm->param.ext_fmt.id==PJMEDIA_FORMAT_PCMU)?
+				pjmedia_linear2ulaw(0) : pjmedia_linear2alaw(0);
+			buffer.AppendFill(silc, samples_cnt);
+		    }
+		    samples_ready += samples_cnt;
+		    
+		    pjmedia_frame_ext_pop_subframes(frame, 1);
+		
+		} else { /* PJMEDIA_FRAME_TYPE_NONE */
+		    pj_uint8_t silc;
+		    
+		    silc = (strm->param.ext_fmt.id==PJMEDIA_FORMAT_PCMU)?
+			    pjmedia_linear2ulaw(0) : pjmedia_linear2alaw(0);
+		    buffer.AppendFill(silc, samples_req - samples_ready);
+
+		    samples_ready = samples_req;
+		    frame->samples_cnt = 0;
+		    frame->subframe_cnt = 0;
+		}
+	    }
+	}
+	break;
+	
+    default:
+	break;
+    }
+
+    /* Set the buffer */
+    buf->SetPayloadPtr(buffer);
+}
+
+
+/****************************************************************************
+ * Factory operations
+ */
+
+/*
+ * C compatible declaration of VAS factory.
+ */
+PJ_BEGIN_DECL
+PJ_DECL(pjmedia_aud_dev_factory*)pjmedia_symb_vas_factory(pj_pool_factory *pf);
+PJ_END_DECL
+
+/*
+ * Init VAS audio driver.
+ */
+PJ_DEF(pjmedia_aud_dev_factory*) pjmedia_symb_vas_factory(pj_pool_factory *pf)
+{
+    struct vas_factory *f;
+    pj_pool_t *pool;
+
+    pool = pj_pool_create(pf, "VAS", 1000, 1000, NULL);
+    f = PJ_POOL_ZALLOC_T(pool, struct vas_factory);
+    f->pf = pf;
+    f->pool = pool;
+    f->base.op = &factory_op;
+
+    return &f->base;
+}
+
+/* API: init factory */
+static pj_status_t factory_init(pjmedia_aud_dev_factory *f)
+{
+    struct vas_factory *af = (struct vas_factory*)f;
+    CVoIPUtilityFactory *vas_factory_;
+    CVoIPAudioUplinkStream *vas_uplink;
+    CVoIPAudioDownlinkStream *vas_dnlink;
+    RArray<TVoIPCodecFormat> uplink_formats, dnlink_formats;
+    unsigned ext_fmt_cnt = 0;
+    TVersion vas_version(1, 0, 0); /* Not really used at this time */
+    TInt err;
+
+    pj_ansi_strcpy(af->dev_info.name, "S60 VAS");
+    af->dev_info.default_samples_per_sec = 8000;
+    af->dev_info.caps = PJMEDIA_AUD_DEV_CAP_EXT_FORMAT |
+			//PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING |
+			PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING |
+			PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE |
+			PJMEDIA_AUD_DEV_CAP_VAD |
+			PJMEDIA_AUD_DEV_CAP_CNG;
+    af->dev_info.routes = PJMEDIA_AUD_DEV_ROUTE_EARPIECE | 
+			  PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER;
+    af->dev_info.input_count = 1;
+    af->dev_info.output_count = 1;
+    af->dev_info.ext_fmt_cnt = 0;
+
+    /* Enumerate supported formats */
+    err = CVoIPUtilityFactory::CreateFactory(vas_factory_);
+    if (err != KErrNone)
+	goto on_error;
+
+    /* On VAS 2.0, uplink & downlink stream should be instantiated before 
+     * querying formats.
+     */
+    err = vas_factory_->CreateUplinkStream(vas_version, 
+				          CVoIPUtilityFactory::EVoIPCall,
+				          vas_uplink);
+    if (err != KErrNone)
+	goto on_error;
+    
+    err = vas_factory_->CreateDownlinkStream(vas_version, 
+				            CVoIPUtilityFactory::EVoIPCall,
+				            vas_dnlink);
+    if (err != KErrNone)
+	goto on_error;
+    
+    uplink_formats.Reset();
+    err = vas_factory_->GetSupportedUplinkFormats(uplink_formats);
+    if (err != KErrNone)
+	goto on_error;
+
+    dnlink_formats.Reset();
+    err = vas_factory_->GetSupportedDownlinkFormats(dnlink_formats);
+    if (err != KErrNone)
+	goto on_error;
+
+    /* Free the streams, they are just used for querying formats */
+    delete vas_uplink;
+    vas_uplink = NULL;
+    delete vas_dnlink;
+    vas_dnlink = NULL;
+    delete vas_factory_;
+    vas_factory_ = NULL;
+    
+    for (TInt i = 0; i < dnlink_formats.Count(); i++) {
+	pjmedia_format ext_fmt;
+	
+	/* Format must be supported by both downlink & uplink. */
+	if (uplink_formats.Find(dnlink_formats[i]) == KErrNotFound)
+	    continue;
+	
+	switch (dnlink_formats[i]) {
+	case EAMR_NB:
+	    pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_AMR,
+				      8000, 1, 16, 20, 7400, 12200);
+	    af->dev_info.ext_fmt[ext_fmt_cnt] = ext_fmt;
+	    //af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_TRUE;
+	    break;
+
+	case EG729:
+	    pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_G729,
+				      8000, 1, 16, 20, 8000, 8000);
+	    af->dev_info.ext_fmt[ext_fmt_cnt] = ext_fmt;
+	    //af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_FALSE;
+	    break;
+
+	case EILBC:
+	    pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_ILBC,
+				      8000, 1, 16, 30, 13333, 15200);
+	    af->dev_info.ext_fmt[ext_fmt_cnt] = ext_fmt;
+	    //af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_TRUE;
+	    break;
+
+	case EG711:
+#if PJMEDIA_AUDIO_DEV_SYMB_VAS_VERSION==2
+	case EG711_10MS:
+#endif
+	    pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_PCMU,
+				      8000, 1, 16, 20, 64000, 64000);
+	    af->dev_info.ext_fmt[ext_fmt_cnt] = ext_fmt;
+	    //af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_FALSE;
+	    ++ext_fmt_cnt;
+	    pjmedia_format_init_audio(&ext_fmt, PJMEDIA_FORMAT_PCMA,
+				      8000, 1, 16, 20, 64000, 64000);
+	    af->dev_info.ext_fmt[ext_fmt_cnt] = ext_fmt;
+	    //af->dev_info.ext_fmt[ext_fmt_cnt].vad = PJ_FALSE;
+	    break;
+	
+	default:
+	    continue;
+	}
+	
+	++ext_fmt_cnt;
+    }
+    
+    af->dev_info.ext_fmt_cnt = ext_fmt_cnt;
+
+    uplink_formats.Close();
+    dnlink_formats.Close();
+    
+    PJ_LOG(3, (THIS_FILE, "VAS initialized"));
+
+    return PJ_SUCCESS;
+    
+on_error:
+    return PJ_RETURN_OS_ERROR(err);
+}
+
+/* API: destroy factory */
+static pj_status_t factory_destroy(pjmedia_aud_dev_factory *f)
+{
+    struct vas_factory *af = (struct vas_factory*)f;
+    pj_pool_t *pool = af->pool;
+
+    af->pool = NULL;
+    pj_pool_release(pool);
+
+    PJ_LOG(3, (THIS_FILE, "VAS destroyed"));
+    
+    return PJ_SUCCESS;
+}
+
+/* API: refresh the device list */
+static pj_status_t factory_refresh(pjmedia_aud_dev_factory *f)
+{
+    PJ_UNUSED_ARG(f);
+    return PJ_ENOTSUP;
+}
+
+/* API: get number of devices */
+static unsigned factory_get_dev_count(pjmedia_aud_dev_factory *f)
+{
+    PJ_UNUSED_ARG(f);
+    return 1;
+}
+
+/* API: get device info */
+static pj_status_t factory_get_dev_info(pjmedia_aud_dev_factory *f, 
+					unsigned index,
+					pjmedia_aud_dev_info *info)
+{
+    struct vas_factory *af = (struct vas_factory*)f;
+
+    PJ_ASSERT_RETURN(index == 0, PJMEDIA_EAUD_INVDEV);
+
+    pj_memcpy(info, &af->dev_info, sizeof(*info));
+
+    return PJ_SUCCESS;
+}
+
+/* API: create default device parameter */
+static pj_status_t factory_default_param(pjmedia_aud_dev_factory *f,
+					 unsigned index,
+					 pjmedia_aud_param *param)
+{
+    struct vas_factory *af = (struct vas_factory*)f;
+
+    PJ_ASSERT_RETURN(index == 0, PJMEDIA_EAUD_INVDEV);
+
+    pj_bzero(param, sizeof(*param));
+    param->dir = PJMEDIA_DIR_CAPTURE_PLAYBACK;
+    param->rec_id = index;
+    param->play_id = index;
+    param->clock_rate = af->dev_info.default_samples_per_sec;
+    param->channel_count = 1;
+    param->samples_per_frame = af->dev_info.default_samples_per_sec * 20 / 1000;
+    param->bits_per_sample = BITS_PER_SAMPLE;
+    param->flags = PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE;
+    param->output_route = PJMEDIA_AUD_DEV_ROUTE_EARPIECE;
+
+    return PJ_SUCCESS;
+}
+
+
+/* API: create stream */
+static pj_status_t factory_create_stream(pjmedia_aud_dev_factory *f,
+					 const pjmedia_aud_param *param,
+					 pjmedia_aud_rec_cb rec_cb,
+					 pjmedia_aud_play_cb play_cb,
+					 void *user_data,
+					 pjmedia_aud_stream **p_aud_strm)
+{
+    struct vas_factory *af = (struct vas_factory*)f;
+    pj_pool_t *pool;
+    struct vas_stream *strm;
+
+    CPjAudioSetting vas_setting;
+    PjAudioCallback vas_rec_cb;
+    PjAudioCallback vas_play_cb;
+
+    /* Can only support 16bits per sample */
+    PJ_ASSERT_RETURN(param->bits_per_sample == BITS_PER_SAMPLE, PJ_EINVAL);
+
+    /* Supported clock rates:
+     * - for non-PCM format: 8kHz  
+     * - for PCM format: 8kHz and 16kHz  
+     */
+    PJ_ASSERT_RETURN(param->clock_rate == 8000 ||
+		     (param->clock_rate == 16000 && 
+		      param->ext_fmt.id == PJMEDIA_FORMAT_L16),
+		     PJ_EINVAL);
+
+    /* Supported channels number:
+     * - for non-PCM format: mono
+     * - for PCM format: mono and stereo  
+     */
+    PJ_ASSERT_RETURN(param->channel_count == 1 || 
+		     (param->channel_count == 2 &&
+		      param->ext_fmt.id == PJMEDIA_FORMAT_L16),
+		     PJ_EINVAL);
+
+    /* Create and Initialize stream descriptor */
+    pool = pj_pool_create(af->pf, "vas-dev", 1000, 1000, NULL);
+    PJ_ASSERT_RETURN(pool, PJ_ENOMEM);
+
+    strm = PJ_POOL_ZALLOC_T(pool, struct vas_stream);
+    strm->pool = pool;
+    strm->param = *param;
+
+    if (strm->param.flags & PJMEDIA_AUD_DEV_CAP_EXT_FORMAT == 0)
+	strm->param.ext_fmt.id = PJMEDIA_FORMAT_L16;
+	
+    /* Set audio engine fourcc. */
+    switch(strm->param.ext_fmt.id) {
+    case PJMEDIA_FORMAT_L16:
+#ifdef USE_NATIVE_PCM	
+	vas_setting.format = EPCM16;
+#else
+	vas_setting.format = EG711;
+#endif
+	break;
+    case PJMEDIA_FORMAT_PCMU:
+    case PJMEDIA_FORMAT_PCMA:
+	vas_setting.format = EG711;
+	break;
+    case PJMEDIA_FORMAT_AMR:
+	vas_setting.format = EAMR_NB;
+	break;
+    case PJMEDIA_FORMAT_G729:
+	vas_setting.format = EG729;
+	break;
+    case PJMEDIA_FORMAT_ILBC:
+	vas_setting.format = EILBC;
+	break;
+    default:
+	vas_setting.format = ENULL;
+	break;
+    }
+
+    /* Set audio engine mode. */
+    if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_L16)
+    {
+#ifdef USE_NATIVE_PCM	
+	vas_setting.mode = 0;
+#else
+	vas_setting.mode = CVoIPFormatIntfc::EG711uLaw;
+#endif
+    } 
+    else if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_AMR)
+    {
+	vas_setting.mode = strm->param.ext_fmt.det.aud.avg_bps;
+    } 
+    else if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_PCMU)
+    {
+	vas_setting.mode = CVoIPFormatIntfc::EG711uLaw;
+    }
+    else if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_PCMA)
+    {
+	vas_setting.mode = CVoIPFormatIntfc::EG711ALaw;
+    }
+    else if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_ILBC)
+    {
+	if (strm->param.ext_fmt.det.aud.avg_bps == 15200)
+	    vas_setting.mode = CVoIPFormatIntfc::EiLBC20mSecFrame;
+	else
+	    vas_setting.mode = CVoIPFormatIntfc::EiLBC30mSecFrame;
+    } else {
+	vas_setting.mode = 0;
+    }
+
+    /* Disable VAD on L16, G711, iLBC, and also G729 (G729's SID 
+     * potentially cause noise?).
+     */
+    if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_PCMU ||
+	strm->param.ext_fmt.id == PJMEDIA_FORMAT_PCMA ||
+	strm->param.ext_fmt.id == PJMEDIA_FORMAT_L16 ||
+	strm->param.ext_fmt.id == PJMEDIA_FORMAT_ILBC ||
+	strm->param.ext_fmt.id == PJMEDIA_FORMAT_G729)
+    {
+	vas_setting.vad = EFalse;
+    } else {
+	vas_setting.vad = (strm->param.flags & PJMEDIA_AUD_DEV_CAP_VAD) &&
+			  strm->param.vad_enabled;
+    }
+    
+    /* Set other audio engine attributes. */
+    vas_setting.plc = (strm->param.flags & PJMEDIA_AUD_DEV_CAP_PLC) &&
+		      strm->param.plc_enabled;
+    vas_setting.cng = vas_setting.vad;
+    vas_setting.loudspk = 
+		strm->param.output_route==PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER;
+
+    /* Set audio engine callbacks. */
+    if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_L16) {
+#ifdef USE_NATIVE_PCM
+	vas_play_cb = &PlayCbPcm2;
+	vas_rec_cb  = &RecCbPcm2;
+#else
+	vas_play_cb = &PlayCbPcm;
+	vas_rec_cb  = &RecCbPcm;
+#endif
+    } else {
+	vas_play_cb = &PlayCb;
+	vas_rec_cb  = &RecCb;
+    }
+
+    strm->rec_cb = rec_cb;
+    strm->play_cb = play_cb;
+    strm->user_data = user_data;
+    strm->resample_factor = strm->param.clock_rate / 8000;
+
+    /* play_buf size is samples per frame scaled in to 8kHz mono. */
+    strm->play_buf = (pj_int16_t*)pj_pool_zalloc(
+					pool, 
+					(strm->param.samples_per_frame / 
+					strm->resample_factor /
+					strm->param.channel_count) << 1);
+    strm->play_buf_len = 0;
+    strm->play_buf_start = 0;
+
+    /* rec_buf size is samples per frame scaled in to 8kHz mono. */
+    strm->rec_buf  = (pj_int16_t*)pj_pool_zalloc(
+					pool, 
+					(strm->param.samples_per_frame / 
+					strm->resample_factor /
+					strm->param.channel_count) << 1);
+    strm->rec_buf_len = 0;
+
+    if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_G729) {
+	TBitStream *g729_bitstream = new TBitStream;
+	
+	PJ_ASSERT_RETURN(g729_bitstream, PJ_ENOMEM);
+	strm->strm_data = (void*)g729_bitstream;
+    }
+	
+    /* Init resampler when format is PCM and clock rate is not 8kHz */
+    if (strm->param.clock_rate != 8000 && 
+	strm->param.ext_fmt.id == PJMEDIA_FORMAT_L16)
+    {
+	pj_status_t status;
+	
+	if (strm->param.dir & PJMEDIA_DIR_CAPTURE) {
+	    /* Create resample for recorder */
+	    status = pjmedia_resample_create( pool, PJ_TRUE, PJ_FALSE, 1, 
+					      8000,
+					      strm->param.clock_rate,
+					      80,
+					      &strm->rec_resample);
+	    if (status != PJ_SUCCESS)
+		return status;
+	}
+    
+	if (strm->param.dir & PJMEDIA_DIR_PLAYBACK) {
+	    /* Create resample for player */
+	    status = pjmedia_resample_create( pool, PJ_TRUE, PJ_FALSE, 1, 
+					      strm->param.clock_rate,
+					      8000,
+					      80 * strm->resample_factor,
+					      &strm->play_resample);
+	    if (status != PJ_SUCCESS)
+		return status;
+	}
+    }
+
+    /* Create PCM buffer, when the clock rate is not 8kHz or not mono */
+    if (strm->param.ext_fmt.id == PJMEDIA_FORMAT_L16 &&
+	(strm->resample_factor > 1 || strm->param.channel_count != 1)) 
+    {
+	strm->pcm_buf = (pj_int16_t*)pj_pool_zalloc(pool, 
+					strm->param.samples_per_frame << 1);
+    }
+
+    
+    /* Create the audio engine. */
+    TRAPD(err, strm->engine = CPjAudioEngine::NewL(strm,
+						   vas_rec_cb, vas_play_cb,
+						   strm, vas_setting));
+    if (err != KErrNone) {
+    	pj_pool_release(pool);
+	return PJ_RETURN_OS_ERROR(err);
+    }
+
+    /* Done */
+    strm->base.op = &stream_op;
+    *p_aud_strm = &strm->base;
+
+    return PJ_SUCCESS;
+}
+
+/* API: Get stream info. */
+static pj_status_t stream_get_param(pjmedia_aud_stream *s,
+				    pjmedia_aud_param *pi)
+{
+    struct vas_stream *strm = (struct vas_stream*)s;
+
+    PJ_ASSERT_RETURN(strm && pi, PJ_EINVAL);
+
+    pj_memcpy(pi, &strm->param, sizeof(*pi));
+
+    /* Update the output volume setting */
+    if (stream_get_cap(s, PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING,
+		       &pi->output_vol) == PJ_SUCCESS)
+    {
+	pi->flags |= PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING;
+    }
+    
+    return PJ_SUCCESS;
+}
+
+/* API: get capability */
+static pj_status_t stream_get_cap(pjmedia_aud_stream *s,
+				  pjmedia_aud_dev_cap cap,
+				  void *pval)
+{
+    struct vas_stream *strm = (struct vas_stream*)s;
+    pj_status_t status = PJ_ENOTSUP;
+
+    PJ_ASSERT_RETURN(s && pval, PJ_EINVAL);
+
+    switch (cap) {
+    case PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE: 
+	if (strm->param.dir & PJMEDIA_DIR_PLAYBACK) {
+	    *(pjmedia_aud_dev_route*)pval = strm->param.output_route;
+	    status = PJ_SUCCESS;
+	}
+	break;
+    
+    /* There is a case that GetMaxGain() stucks, e.g: in N95. */ 
+    /*
+    case PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING:
+	if (strm->param.dir & PJMEDIA_DIR_CAPTURE) {
+	    PJ_ASSERT_RETURN(strm->engine, PJ_EINVAL);
+	    
+	    TInt max_gain = strm->engine->GetMaxGain();
+	    TInt gain = strm->engine->GetGain();
+	    
+	    if (max_gain > 0 && gain >= 0) {
+		*(unsigned*)pval = gain * 100 / max_gain; 
+		status = PJ_SUCCESS;
+	    } else {
+		status = PJMEDIA_EAUD_NOTREADY;
+	    }
+	}
+	break;
+    */
+
+    case PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING:
+	if (strm->param.dir & PJMEDIA_DIR_PLAYBACK) {
+	    PJ_ASSERT_RETURN(strm->engine, PJ_EINVAL);
+	    
+	    TInt max_vol = strm->engine->GetMaxVolume();
+	    TInt vol = strm->engine->GetVolume();
+	    
+	    if (max_vol > 0 && vol >= 0) {
+		*(unsigned*)pval = vol * 100 / max_vol; 
+		status = PJ_SUCCESS;
+	    } else {
+		status = PJMEDIA_EAUD_NOTREADY;
+	    }
+	}
+	break;
+    default:
+	break;
+    }
+    
+    return status;
+}
+
+/* API: set capability */
+static pj_status_t stream_set_cap(pjmedia_aud_stream *s,
+				  pjmedia_aud_dev_cap cap,
+				  const void *pval)
+{
+    struct vas_stream *strm = (struct vas_stream*)s;
+    pj_status_t status = PJ_ENOTSUP;
+
+    PJ_ASSERT_RETURN(s && pval, PJ_EINVAL);
+
+    switch (cap) {
+    case PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE: 
+	if (strm->param.dir & PJMEDIA_DIR_PLAYBACK) {
+	    pjmedia_aud_dev_route r = *(const pjmedia_aud_dev_route*)pval;
+	    TInt err;
+
+	    PJ_ASSERT_RETURN(strm->engine, PJ_EINVAL);
+	    
+	    switch (r) {
+	    case PJMEDIA_AUD_DEV_ROUTE_DEFAULT:
+	    case PJMEDIA_AUD_DEV_ROUTE_EARPIECE:
+		err = strm->engine->ActivateSpeaker(EFalse);
+		status = (err==KErrNone)? PJ_SUCCESS:PJ_RETURN_OS_ERROR(err);
+		break;
+	    case PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER:
+		err = strm->engine->ActivateSpeaker(ETrue);
+		status = (err==KErrNone)? PJ_SUCCESS:PJ_RETURN_OS_ERROR(err);
+		break;
+	    default:
+		status = PJ_EINVAL;
+		break;
+	    }
+	    if (status == PJ_SUCCESS)
+		strm->param.output_route = r; 
+	}
+	break;
+
+    /* There is a case that GetMaxGain() stucks, e.g: in N95. */ 
+    /*
+    case PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING:
+	if (strm->param.dir & PJMEDIA_DIR_CAPTURE) {
+	    PJ_ASSERT_RETURN(strm->engine, PJ_EINVAL);
+	    
+	    TInt max_gain = strm->engine->GetMaxGain();
+	    if (max_gain > 0) {
+		TInt gain, err;
+		
+		gain = *(unsigned*)pval * max_gain / 100;
+		err = strm->engine->SetGain(gain);
+		status = (err==KErrNone)? PJ_SUCCESS:PJ_RETURN_OS_ERROR(err);
+	    } else {
+		status = PJMEDIA_EAUD_NOTREADY;
+	    }
+	    if (status == PJ_SUCCESS)
+		strm->param.input_vol = *(unsigned*)pval;
+	}
+	break;
+    */
+
+    case PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING:
+	if (strm->param.dir & PJMEDIA_DIR_PLAYBACK) {
+	    PJ_ASSERT_RETURN(strm->engine, PJ_EINVAL);
+	    
+	    TInt max_vol = strm->engine->GetMaxVolume();
+	    if (max_vol > 0) {
+		TInt vol, err;
+		
+		vol = *(unsigned*)pval * max_vol / 100;
+		err = strm->engine->SetVolume(vol);
+		status = (err==KErrNone)? PJ_SUCCESS:PJ_RETURN_OS_ERROR(err);
+	    } else {
+		status = PJMEDIA_EAUD_NOTREADY;
+	    }
+	    if (status == PJ_SUCCESS)
+		strm->param.output_vol = *(unsigned*)pval;
+	}
+	break;
+    default:
+	break;
+    }
+    
+    return status;
+}
+
+/* API: Start stream. */
+static pj_status_t stream_start(pjmedia_aud_stream *strm)
+{
+    struct vas_stream *stream = (struct vas_stream*)strm;
+
+    PJ_ASSERT_RETURN(stream, PJ_EINVAL);
+
+    if (stream->engine) {
+	enum { VAS_WAIT_START = 2000 }; /* in msecs */
+	TTime start, now;
+	TInt err = stream->engine->Start();
+	
+    	if (err != KErrNone)
+    	    return PJ_RETURN_OS_ERROR(err);
+
+    	/* Perform synchronous start, timeout after VAS_WAIT_START ms */
+	start.UniversalTime();
+	do {
+    	    pj_symbianos_poll(-1, 100);
+    	    now.UniversalTime();
+    	} while (!stream->engine->IsStarted() &&
+		 (now.MicroSecondsFrom(start) < VAS_WAIT_START * 1000));
+	
+	if (stream->engine->IsStarted()) {
+	    
+	    /* Apply output volume setting if specified */
+	    if (stream->param.flags & 
+		PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING) 
+	    {
+		stream_set_cap(strm,
+			       PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING, 
+			       &stream->param.output_vol);
+	    }
+
+	    return PJ_SUCCESS;
+	} else {
+	    return PJ_ETIMEDOUT;
+	}
+    }    
+
+    return PJ_EINVALIDOP;
+}
+
+/* API: Stop stream. */
+static pj_status_t stream_stop(pjmedia_aud_stream *strm)
+{
+    struct vas_stream *stream = (struct vas_stream*)strm;
+
+    PJ_ASSERT_RETURN(stream, PJ_EINVAL);
+
+    if (stream->engine) {
+    	stream->engine->Stop();
+    }
+
+    return PJ_SUCCESS;
+}
+
+
+/* API: Destroy stream. */
+static pj_status_t stream_destroy(pjmedia_aud_stream *strm)
+{
+    struct vas_stream *stream = (struct vas_stream*)strm;
+
+    PJ_ASSERT_RETURN(stream, PJ_EINVAL);
+
+    stream_stop(strm);
+
+    delete stream->engine;
+    stream->engine = NULL;
+
+    if (stream->param.ext_fmt.id == PJMEDIA_FORMAT_G729) {
+	TBitStream *g729_bitstream = (TBitStream*)stream->strm_data;
+	stream->strm_data = NULL;
+	delete g729_bitstream;
+    }
+
+    pj_pool_t *pool;
+    pool = stream->pool;
+    if (pool) {
+    	stream->pool = NULL;
+    	pj_pool_release(pool);
+    }
+
+    return PJ_SUCCESS;
+}
+
+#endif // PJMEDIA_AUDIO_DEV_HAS_SYMB_VAS
+
diff --git a/jni/pjproject-android/.svn/pristine/d9/d931aee1d2dc4ee459e9bbcbf986b22e7eebae70.svn-base b/jni/pjproject-android/.svn/pristine/d9/d931aee1d2dc4ee459e9bbcbf986b22e7eebae70.svn-base
new file mode 100644
index 0000000..e810251
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/d9/d931aee1d2dc4ee459e9bbcbf986b22e7eebae70.svn-base
@@ -0,0 +1,4011 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="8.00"

+	Name="pjlib_util_test"

+	ProjectGUID="{ED02BE13-8297-4770-8097-27DC2CCABF9A}"

+	RootNamespace="pjlib_util_test"

+	>

+	<Platforms>

+		<Platform

+			Name="Win32"

+		/>

+		<Platform

+			Name="Pocket PC 2003 (ARMV4)"

+		/>

+		<Platform

+			Name="Smartphone 2003 (ARMV4)"

+		/>

+		<Platform

+			Name="x64"

+		/>

+		<Platform

+			Name="Windows Mobile 6 Standard SDK (ARMV4I)"

+		/>

+		<Platform

+			Name="Windows Mobile 6 Professional SDK (ARMV4I)"

+		/>

+		<Platform

+			Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+		/>

+		<Platform

+			Name="Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+		/>

+	</Platforms>

+	<ToolFiles>

+	</ToolFiles>

+	<Configurations>

+		<Configuration

+			Name="Release|Win32"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-win32-release-defaults.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PreprocessorDefinitions="_CONSOLE;"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib oleaut32.lib ole32.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-$(PlatformName)-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|Pocket PC 2003 (ARMV4)"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm2003-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm2003ppc-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|Smartphone 2003 (ARMV4)"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm2003-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm2003sp-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|x64"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-win64-release-defaults.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PreprocessorDefinitions="_CONSOLE;"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib oleaut32.lib ole32.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-$(PlatformName)-vc$(VSVer)-$(ConfigurationName).exe"

+				TargetMachine="17"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|Win32"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-win32-common-defaults.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PreprocessorDefinitions="_CONSOLE;"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib oleaut32.lib ole32.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-$(PlatformName)-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|Pocket PC 2003 (ARMV4)"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm2003-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm2003ppc-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|Smartphone 2003 (ARMV4)"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm2003-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm2003sp-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|x64"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-win64-common-defaults.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PreprocessorDefinitions="_CONSOLE;"

+				PrecompiledHeaderFile=""

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib oleaut32.lib ole32.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-$(PlatformName)-vc$(VSVer)-$(ConfigurationName).exe"

+				TargetMachine="17"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Static|Win32"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-win32-common-defaults.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PreprocessorDefinitions="_CONSOLE;"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib oleaut32.lib ole32.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-$(PlatformName)-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Static|Pocket PC 2003 (ARMV4)"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm2003-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm2003ppc-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Static|Smartphone 2003 (ARMV4)"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm2003-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm2003sp-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Static|x64"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-win64-common-defaults.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PreprocessorDefinitions="_CONSOLE;"

+				PrecompiledHeaderFile=""

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib oleaut32.lib ole32.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-$(PlatformName)-vc$(VSVer)-$(ConfigurationName).exe"

+				TargetMachine="17"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Dynamic|Win32"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-win32-release-defaults.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PreprocessorDefinitions="_CONSOLE;"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib oleaut32.lib ole32.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-$(PlatformName)-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Dynamic|Pocket PC 2003 (ARMV4)"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm2003-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm2003ppc-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Dynamic|Smartphone 2003 (ARMV4)"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm2003-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm2003sp-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Dynamic|x64"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-win64-release-defaults.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PreprocessorDefinitions="_CONSOLE;"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib oleaut32.lib ole32.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-$(PlatformName)-vc$(VSVer)-$(ConfigurationName).exe"

+				TargetMachine="17"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Dynamic|Win32"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-win32-common-defaults.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PreprocessorDefinitions="_CONSOLE;"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib oleaut32.lib ole32.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-$(PlatformName)-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Dynamic|Pocket PC 2003 (ARMV4)"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm2003-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm2003ppc-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Dynamic|Smartphone 2003 (ARMV4)"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm2003-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm2003sp-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Dynamic|x64"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-win64-common-defaults.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PreprocessorDefinitions="_CONSOLE;"

+				PrecompiledHeaderFile=""

+				DebugInformationFormat="3"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib oleaut32.lib ole32.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-$(PlatformName)-vc$(VSVer)-$(ConfigurationName).exe"

+				TargetMachine="17"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Static|Win32"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-win32-release-defaults.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PreprocessorDefinitions="_CONSOLE;"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib oleaut32.lib ole32.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-$(PlatformName)-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Static|Pocket PC 2003 (ARMV4)"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm2003-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm2003ppc-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Static|Smartphone 2003 (ARMV4)"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm2003-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm2003sp-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Static|x64"

+			ConfigurationType="1"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-win64-release-defaults.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				TargetEnvironment="3"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PreprocessorDefinitions="_CONSOLE;"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="netapi32.lib mswsock.lib ws2_32.lib odbc32.lib odbccp32.lib oleaut32.lib ole32.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-$(PlatformName)-vc$(VSVer)-$(ConfigurationName).exe"

+				TargetMachine="17"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm6-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm6std-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm6-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm6pro-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|Windows Mobile 6 Standard SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm6-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm6std-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm6-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm6pro-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Static|Windows Mobile 6 Standard SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm6-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm6std-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Static|Windows Mobile 6 Professional SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm6-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm6pro-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm6-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm6std-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Dynamic|Windows Mobile 6 Professional SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm6-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm6pro-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm6-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm6std-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Dynamic|Windows Mobile 6 Professional SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm6-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm6pro-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Static|Windows Mobile 6 Standard SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm6-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm6std-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Static|Windows Mobile 6 Professional SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm6-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm6pro-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm5-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm5ppc-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm5-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm5ppc-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Static|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm5-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm5ppc-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm5-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm5ppc-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm5-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm5ppc-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Static|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm5-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm5ppc-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm5-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm5sp-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm5-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm5sp-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Static|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm5-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm5sp-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Dynamic|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm5-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm5sp-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug-Dynamic|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-debug-dynamic-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm5-common-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm5sp-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+		<Configuration

+			Name="Release-Static|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+			InheritedPropertySheets="..\..\build\vs\pjproject-vs8-release-static-defaults.vsprops;..\..\build\vs\pjproject-vs8-wm5-release-defaults.vsprops"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="1"

+			ConfigurationType="1"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				ExecutionBucket="7"

+				AdditionalIncludeDirectories="../include,../../pjlib/include"

+				PrecompiledHeaderFile=""

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				AdditionalDependencies="ws2.lib"

+				OutputFile="..\bin\pjlib-util-test-$(TargetCPU)-wm5sp-vc$(VSVer)-$(ConfigurationName).exe"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCCodeSignTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+			/>

+			<DeploymentTool

+				ForceDirty="-1"

+				RemoteDirectory=""

+				RegisterOutput="0"

+				AdditionalFiles=""

+			/>

+			<DebuggerTool

+			/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<Filter

+			Name="Source Files"

+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"

+			>

+			<File

+				RelativePath="..\src\pjlib-util-test\encryption.c"

+				>

+			</File>

+			<File

+				RelativePath="..\src\pjlib-util-test\http_client.c"

+				>

+			</File>

+			<File

+				RelativePath="..\src\pjlib-util-test\main.c"

+				>

+				<FileConfiguration

+					Name="Release|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Pocket PC 2003 (ARMV4)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Smartphone 2003 (ARMV4)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Pocket PC 2003 (ARMV4)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Smartphone 2003 (ARMV4)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|Pocket PC 2003 (ARMV4)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|Smartphone 2003 (ARMV4)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|Pocket PC 2003 (ARMV4)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|Smartphone 2003 (ARMV4)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|Pocket PC 2003 (ARMV4)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|Smartphone 2003 (ARMV4)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|Pocket PC 2003 (ARMV4)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|Smartphone 2003 (ARMV4)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Windows Mobile 6 Standard SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|Windows Mobile 6 Standard SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|Windows Mobile 6 Professional SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|Windows Mobile 6 Professional SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|Windows Mobile 6 Professional SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|Windows Mobile 6 Standard SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|Windows Mobile 6 Professional SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath="..\src\pjlib-util-test\main_win32.c"

+				>

+				<FileConfiguration

+					Name="Release|Win32"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|x64"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Win32"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|x64"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|Win32"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|x64"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|Win32"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|x64"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|Win32"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|x64"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|Win32"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|x64"

+					ExcludedFromBuild="true"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath="..\src\pjlib-util-test\resolver_test.c"

+				>

+			</File>

+			<File

+				RelativePath="..\src\pjlib-util-test\stun.c"

+				>

+			</File>

+			<File

+				RelativePath="..\src\pjlib-util-test\test.c"

+				>

+				<FileConfiguration

+					Name="Release|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+			</File>

+			<File

+				RelativePath="..\src\pjlib-util-test\xml.c"

+				>

+				<FileConfiguration

+					Name="Release|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Static|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Dynamic|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Debug-Dynamic|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|Win32"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+				<FileConfiguration

+					Name="Release-Static|x64"

+					>

+					<Tool

+						Name="VCCLCompilerTool"

+						AdditionalIncludeDirectories=""

+						PreprocessorDefinitions=""

+					/>

+				</FileConfiguration>

+			</File>

+		</Filter>

+		<Filter

+			Name="Header Files"

+			Filter="h;hpp;hxx;hm;inl"

+			>

+			<File

+				RelativePath="..\src\pjlib-util-test\test.h"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Resource Files"

+			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"

+			>

+		</Filter>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/jni/pjproject-android/.svn/pristine/d9/d983359adfcd5a592b475d3d06210ae921f49179.svn-base b/jni/pjproject-android/.svn/pristine/d9/d983359adfcd5a592b475d3d06210ae921f49179.svn-base
new file mode 100644
index 0000000..e7e0744
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/d9/d983359adfcd5a592b475d3d06210ae921f49179.svn-base
@@ -0,0 +1,82 @@
+/*
+ * key.h
+ *
+ * key usage limits enforcement
+ * 
+ * David A. Mcgrew
+ * Cisco Systems, Inc.
+ */
+/*
+ *	
+ * Copyright (c) 2001-2006 Cisco Systems, Inc.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ *   Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * 
+ *   Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials provided
+ *   with the distribution.
+ * 
+ *   Neither the name of the Cisco Systems, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef KEY_H
+#define KEY_H
+
+#include "rdbx.h"   /* for xtd_seq_num_t */
+#include "err.h"
+
+typedef struct key_limit_ctx_t *key_limit_t;
+
+typedef enum {
+   key_event_normal,
+   key_event_soft_limit,
+   key_event_hard_limit
+} key_event_t;
+
+err_status_t
+key_limit_set(key_limit_t key, const xtd_seq_num_t s);
+
+err_status_t
+key_limit_clone(key_limit_t original, key_limit_t *new_key);
+
+err_status_t
+key_limit_check(const key_limit_t key);
+
+key_event_t
+key_limit_update(key_limit_t key);
+
+typedef enum { 
+   key_state_normal,
+   key_state_past_soft_limit,
+   key_state_expired
+} key_state_t;
+
+typedef struct key_limit_ctx_t {
+  xtd_seq_num_t num_left;
+  key_state_t   state;
+} key_limit_ctx_t;
+
+#endif /* KEY_H */
diff --git a/jni/pjproject-android/.svn/pristine/d9/d9cb161974f18f42632be1c3546466a786b111a3.svn-base b/jni/pjproject-android/.svn/pristine/d9/d9cb161974f18f42632be1c3546466a786b111a3.svn-base
new file mode 100644
index 0000000..aa2498c
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/d9/d9cb161974f18f42632be1c3546466a786b111a3.svn-base
@@ -0,0 +1,2184 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
+ * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
+ *
+ * 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 
+ */
+#include <pjsip-simple/evsub.h>
+#include <pjsip-simple/evsub_msg.h>
+#include <pjsip-simple/errno.h>
+#include <pjsip/sip_errno.h>
+#include <pjsip/sip_module.h>
+#include <pjsip/sip_endpoint.h>
+#include <pjsip/sip_dialog.h>
+#include <pjsip/sip_auth.h>
+#include <pjsip/sip_transaction.h>
+#include <pjsip/sip_event.h>
+#include <pj/assert.h>
+#include <pj/guid.h>
+#include <pj/log.h>
+#include <pj/os.h>
+#include <pj/pool.h>
+#include <pj/rand.h>
+#include <pj/string.h>
+
+
+#define THIS_FILE	"evsub.c"
+
+/*
+ * Global constant
+ */
+
+/* Let's define this enum, so that it'll trigger compilation error
+ * when somebody define the same enum in sip_msg.h
+ */
+enum
+{
+    PJSIP_SUBSCRIBE_METHOD = PJSIP_OTHER_METHOD,
+    PJSIP_NOTIFY_METHOD = PJSIP_OTHER_METHOD
+};
+
+PJ_DEF_DATA(const pjsip_method) pjsip_subscribe_method = 
+{
+    (pjsip_method_e) PJSIP_SUBSCRIBE_METHOD,
+    { "SUBSCRIBE", 9 }
+};
+
+PJ_DEF_DATA(const pjsip_method) pjsip_notify_method = 
+{
+    (pjsip_method_e) PJSIP_NOTIFY_METHOD,
+    { "NOTIFY", 6 }
+};
+
+/**
+ * SUBSCRIBE method constant.
+ */
+PJ_DEF(const pjsip_method*) pjsip_get_subscribe_method()
+{
+    return &pjsip_subscribe_method;
+}
+
+/**
+ * NOTIFY method constant.
+ */
+PJ_DEF(const pjsip_method*) pjsip_get_notify_method()
+{
+    return &pjsip_notify_method;
+}
+
+
+/*
+ * Static prototypes.
+ */
+static void	   mod_evsub_on_tsx_state(pjsip_transaction*, pjsip_event*);
+static pj_status_t mod_evsub_unload(void);
+
+
+/*
+ * State names.
+ */
+static pj_str_t evsub_state_names[] = 
+{
+    { "NULL",	    4},
+    { "SENT",	    4},
+    { "ACCEPTED",   8},
+    { "PENDING",    7},
+    { "ACTIVE",	    6},
+    { "TERMINATED", 10},
+    { "UNKNOWN",    7}
+};
+
+/*
+ * Timer constants.
+ */
+
+/* Number of seconds to send SUBSCRIBE before the actual expiration */
+#define TIME_UAC_REFRESH	PJSIP_EVSUB_TIME_UAC_REFRESH
+
+/* Time to wait for the final NOTIFY after sending unsubscription */
+#define TIME_UAC_TERMINATE	PJSIP_EVSUB_TIME_UAC_TERMINATE
+
+/* If client responds NOTIFY with non-2xx final response (such as 401),
+ * wait for this seconds for further NOTIFY, otherwise client will
+ * unsubscribe
+ */
+#define TIME_UAC_WAIT_NOTIFY	PJSIP_EVSUB_TIME_UAC_WAIT_NOTIFY
+
+
+/*
+ * Timer id
+ */
+enum timer_id
+{
+    /* No timer. */
+    TIMER_TYPE_NONE,
+
+    /* Time to refresh client subscription. 
+     * The action is to call on_client_refresh() callback.
+     */
+    TIMER_TYPE_UAC_REFRESH,
+
+    /* UAS timeout after to subscription refresh. 
+     * The action is to call on_server_timeout() callback.
+     */
+    TIMER_TYPE_UAS_TIMEOUT,
+
+    /* UAC waiting for final NOTIFY after unsubscribing 
+     * The action is to terminate.
+     */
+    TIMER_TYPE_UAC_TERMINATE,
+
+    /* UAC waiting for further NOTIFY after sending non-2xx response to 
+     * NOTIFY. The action is to unsubscribe.
+     */
+    TIMER_TYPE_UAC_WAIT_NOTIFY,
+
+    /* Max nb of timer types. */
+    TIMER_TYPE_MAX
+};
+
+static const char *timer_names[] = 
+{
+    "None",
+    "UAC_REFRESH",
+    "UAS_TIMEOUT"
+    "UAC_TERMINATE",
+    "UAC_WAIT_NOTIFY",
+    "INVALID_TIMER"
+};
+
+/*
+ * Definition of event package.
+ */
+struct evpkg
+{
+    PJ_DECL_LIST_MEMBER(struct evpkg);
+
+    pj_str_t		 pkg_name;
+    pjsip_module	*pkg_mod;
+    unsigned		 pkg_expires;
+    pjsip_accept_hdr	*pkg_accept;
+};
+
+
+/*
+ * Event subscription module (mod-evsub).
+ */
+static struct mod_evsub
+{
+    pjsip_module	     mod;
+    pj_pool_t		    *pool;
+    pjsip_endpoint	    *endpt;
+    struct evpkg	     pkg_list;
+    pjsip_allow_events_hdr  *allow_events_hdr;
+
+} mod_evsub = 
+{
+    {
+	NULL, NULL,			    /* prev, next.		*/
+	{ "mod-evsub", 9 },		    /* Name.			*/
+	-1,				    /* Id			*/
+	PJSIP_MOD_PRIORITY_DIALOG_USAGE,    /* Priority			*/
+	NULL,				    /* load()			*/
+	NULL,				    /* start()			*/
+	NULL,				    /* stop()			*/
+	&mod_evsub_unload,		    /* unload()			*/
+	NULL,				    /* on_rx_request()		*/
+	NULL,				    /* on_rx_response()		*/
+	NULL,				    /* on_tx_request.		*/
+	NULL,				    /* on_tx_response()		*/
+	&mod_evsub_on_tsx_state,	    /* on_tsx_state()		*/
+    }
+};
+
+
+/*
+ * Event subscription session.
+ */
+struct pjsip_evsub
+{
+    char		  obj_name[PJ_MAX_OBJ_NAME]; /**< Name.		    */
+    pj_pool_t		 *pool;		/**< Pool.			    */
+    pjsip_endpoint	 *endpt;	/**< Endpoint instance.		    */
+    pjsip_dialog	 *dlg;		/**< Underlying dialog.		    */
+    struct evpkg	 *pkg;		/**< The event package.		    */
+    unsigned		  option;	/**< Options.			    */
+    pjsip_evsub_user	  user;		/**< Callback.			    */
+    pj_bool_t		  call_cb;	/**< Notify callback?		    */
+    pjsip_role_e	  role;		/**< UAC=subscriber, UAS=notifier   */
+    pjsip_evsub_state	  state;	/**< Subscription state.	    */
+    pj_str_t		  state_str;	/**< String describing the state.   */
+    pjsip_evsub_state	  dst_state;	/**< Pending state to be set.	    */
+    pj_str_t		  dst_state_str;/**< Pending state to be set.	    */
+    pj_str_t		  term_reason;	/**< Termination reason.	    */
+    pjsip_method	  method;	/**< Method that established subscr.*/
+    pjsip_event_hdr	 *event;	/**< Event description.		    */
+    pjsip_expires_hdr	 *expires;	/**< Expires header		    */
+    pjsip_accept_hdr	 *accept;	/**< Local Accept header.	    */
+    pjsip_hdr             sub_hdr_list; /**< User-defined header.           */
+
+    pj_time_val		  refresh_time;	/**< Time to refresh.		    */
+    pj_timer_entry	  timer;	/**< Internal timer.		    */
+    int			  pending_tsx;	/**< Number of pending transactions.*/
+    pjsip_transaction	 *pending_sub;	/**< Pending UAC SUBSCRIBE tsx.	    */
+
+    void		 *mod_data[PJSIP_MAX_MODULE];	/**< Module data.   */
+};
+
+
+/*
+ * This is the structure that will be "attached" to dialog.
+ * The purpose is to allow multiple subscriptions inside a dialog.
+ */
+struct dlgsub
+{
+    PJ_DECL_LIST_MEMBER(struct dlgsub);
+    pjsip_evsub *sub;
+};
+
+
+/* Static vars. */
+static const pj_str_t STR_EVENT	     = { "Event", 5 };
+static const pj_str_t STR_EVENT_S    = { "Event", 5 };
+static const pj_str_t STR_SUB_STATE  = { "Subscription-State", 18 };
+static const pj_str_t STR_TERMINATED = { "terminated", 10 };
+static const pj_str_t STR_ACTIVE     = { "active", 6 };
+static const pj_str_t STR_PENDING    = { "pending", 7 };
+static const pj_str_t STR_TIMEOUT    = { "timeout", 7};
+
+
+/*
+ * On unload module.
+ */
+static pj_status_t mod_evsub_unload(void)
+{
+    pjsip_endpt_release_pool(mod_evsub.endpt, mod_evsub.pool);
+    mod_evsub.pool = NULL;
+
+    return PJ_SUCCESS;
+}
+
+/* Proto for pjsipsimple_strerror().
+ * Defined in errno.c
+ */
+PJ_DECL(pj_str_t) pjsipsimple_strerror( pj_status_t statcode, 
+				        char *buf, pj_size_t bufsize );
+
+/*
+ * Init and register module.
+ */
+PJ_DEF(pj_status_t) pjsip_evsub_init_module(pjsip_endpoint *endpt)
+{
+    pj_status_t status;
+    pj_str_t method_tags[] = {
+	{ "SUBSCRIBE", 9},
+	{ "NOTIFY", 6}
+    };
+
+    status = pj_register_strerror(PJSIP_SIMPLE_ERRNO_START,
+				  PJ_ERRNO_SPACE_SIZE,
+				  &pjsipsimple_strerror);
+    pj_assert(status == PJ_SUCCESS);
+
+    PJ_ASSERT_RETURN(endpt != NULL, PJ_EINVAL);
+    PJ_ASSERT_RETURN(mod_evsub.mod.id == -1, PJ_EINVALIDOP);
+
+    /* Keep endpoint for future reference: */
+    mod_evsub.endpt = endpt;
+
+    /* Init event package list: */
+    pj_list_init(&mod_evsub.pkg_list);
+
+    /* Create pool: */
+    mod_evsub.pool = pjsip_endpt_create_pool(endpt, "evsub", 512, 512);
+    if (!mod_evsub.pool)
+	return PJ_ENOMEM;
+
+    /* Register module: */
+    status = pjsip_endpt_register_module(endpt, &mod_evsub.mod);
+    if (status  != PJ_SUCCESS)
+	goto on_error;
+ 
+    /* Create Allow-Events header: */
+    mod_evsub.allow_events_hdr = pjsip_allow_events_hdr_create(mod_evsub.pool);
+
+    /* Register SIP-event specific headers parser: */
+    pjsip_evsub_init_parser();
+
+    /* Register new methods SUBSCRIBE and NOTIFY in Allow-ed header */
+    pjsip_endpt_add_capability(endpt, &mod_evsub.mod, PJSIP_H_ALLOW, NULL,
+			       2, method_tags);
+
+    /* Done. */
+    return PJ_SUCCESS;
+
+on_error:
+    if (mod_evsub.pool) {
+	pjsip_endpt_release_pool(endpt, mod_evsub.pool);
+	mod_evsub.pool = NULL;
+    }
+    mod_evsub.endpt = NULL;
+    return status;
+}
+
+
+/*
+ * Get the instance of the module.
+ */
+PJ_DEF(pjsip_module*) pjsip_evsub_instance(void)
+{
+    PJ_ASSERT_RETURN(mod_evsub.mod.id != -1, NULL);
+
+    return &mod_evsub.mod;
+}
+
+
+/*
+ * Get the event subscription instance in the transaction.
+ */
+PJ_DEF(pjsip_evsub*) pjsip_tsx_get_evsub(pjsip_transaction *tsx)
+{
+    return (pjsip_evsub*) tsx->mod_data[mod_evsub.mod.id];
+}
+
+
+/*
+ * Set event subscription's module data.
+ */
+PJ_DEF(void) pjsip_evsub_set_mod_data( pjsip_evsub *sub, unsigned mod_id,
+				       void *data )
+{
+    PJ_ASSERT_ON_FAIL(mod_id < PJSIP_MAX_MODULE, return);
+    sub->mod_data[mod_id] = data;
+}
+
+
+/*
+ * Get event subscription's module data.
+ */
+PJ_DEF(void*) pjsip_evsub_get_mod_data( pjsip_evsub *sub, unsigned mod_id )
+{
+    PJ_ASSERT_RETURN(mod_id < PJSIP_MAX_MODULE, NULL);
+    return sub->mod_data[mod_id];
+}
+
+
+/*
+ * Find registered event package with matching name.
+ */
+static struct evpkg* find_pkg(const pj_str_t *event_name)
+{
+    struct evpkg *pkg;
+
+    pkg = mod_evsub.pkg_list.next;
+    while (pkg != &mod_evsub.pkg_list) {
+
+	if (pj_stricmp(&pkg->pkg_name, event_name) == 0) {
+	    return pkg;
+	}
+
+	pkg = pkg->next;
+    }
+
+    return NULL;
+}
+
+/*
+ * Register an event package
+ */
+PJ_DEF(pj_status_t) pjsip_evsub_register_pkg( pjsip_module *pkg_mod,
+					      const pj_str_t *event_name,
+					      unsigned expires,
+					      unsigned accept_cnt,
+					      const pj_str_t accept[])
+{
+    struct evpkg *pkg;
+    unsigned i;
+
+    PJ_ASSERT_RETURN(pkg_mod && event_name, PJ_EINVAL);
+    PJ_ASSERT_RETURN(accept_cnt < PJ_ARRAY_SIZE(pkg->pkg_accept->values), 
+		     PJ_ETOOMANY);
+
+    /* Make sure evsub module has been initialized */
+    PJ_ASSERT_RETURN(mod_evsub.mod.id != -1, PJ_EINVALIDOP);
+
+    /* Make sure no module with the specified name already registered: */
+
+    PJ_ASSERT_RETURN(find_pkg(event_name) == NULL, PJSIP_SIMPLE_EPKGEXISTS);
+
+
+    /* Create new event package: */
+
+    pkg = PJ_POOL_ALLOC_T(mod_evsub.pool, struct evpkg);
+    pkg->pkg_mod = pkg_mod;
+    pkg->pkg_expires = expires;
+    pj_strdup(mod_evsub.pool, &pkg->pkg_name, event_name);
+
+    pkg->pkg_accept = pjsip_accept_hdr_create(mod_evsub.pool);
+    pkg->pkg_accept->count = accept_cnt;
+    for (i=0; i<accept_cnt; ++i) {
+	pj_strdup(mod_evsub.pool, &pkg->pkg_accept->values[i], &accept[i]);
+    }
+
+    /* Add to package list: */
+
+    pj_list_push_back(&mod_evsub.pkg_list, pkg);
+
+    /* Add to Allow-Events header: */
+
+    if (mod_evsub.allow_events_hdr->count !=
+	PJ_ARRAY_SIZE(mod_evsub.allow_events_hdr->values))
+    {
+	mod_evsub.allow_events_hdr->values[mod_evsub.allow_events_hdr->count] =
+	    pkg->pkg_name;
+	++mod_evsub.allow_events_hdr->count;
+    }
+    
+    /* Add to endpoint's Accept header */
+    pjsip_endpt_add_capability(mod_evsub.endpt, &mod_evsub.mod,
+			       PJSIP_H_ACCEPT, NULL,
+			       pkg->pkg_accept->count,
+			       pkg->pkg_accept->values);
+
+
+    /* Done */
+
+    PJ_LOG(5,(THIS_FILE, "Event pkg \"%.*s\" registered by %.*s",
+	      (int)event_name->slen, event_name->ptr,
+	      (int)pkg_mod->name.slen, pkg_mod->name.ptr));
+
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * Retrieve Allow-Events header
+ */
+PJ_DEF(const pjsip_hdr*) pjsip_evsub_get_allow_events_hdr(pjsip_module *m)
+{
+    struct mod_evsub *mod;
+
+    if (m == NULL)
+	m = pjsip_evsub_instance();
+
+    mod = (struct mod_evsub*)m;
+
+    return (pjsip_hdr*) mod->allow_events_hdr;
+}
+
+
+/*
+ * Update expiration time.
+ */
+static void update_expires( pjsip_evsub *sub, pj_uint32_t interval )
+{
+    pj_gettimeofday(&sub->refresh_time);
+    sub->refresh_time.sec += interval;
+}
+
+
+/* 
+ * Schedule timer.
+ */
+static void set_timer( pjsip_evsub *sub, int timer_id,
+		       pj_int32_t seconds)
+{
+    if (sub->timer.id != TIMER_TYPE_NONE) {
+	PJ_LOG(5,(sub->obj_name, "%s %s timer", 
+		  (timer_id==sub->timer.id ? "Updating" : "Cancelling"),
+		  timer_names[sub->timer.id]));
+	pjsip_endpt_cancel_timer(sub->endpt, &sub->timer);
+	sub->timer.id = TIMER_TYPE_NONE;
+    }
+
+    if (timer_id != TIMER_TYPE_NONE) {
+	pj_time_val timeout;
+
+	PJ_ASSERT_ON_FAIL(seconds > 0, return);
+	PJ_ASSERT_ON_FAIL(timer_id>TIMER_TYPE_NONE && timer_id<TIMER_TYPE_MAX,
+			  return);
+
+	timeout.sec = seconds;
+	timeout.msec = 0;
+	sub->timer.id = timer_id;
+
+	pjsip_endpt_schedule_timer(sub->endpt, &sub->timer, &timeout);
+
+	PJ_LOG(5,(sub->obj_name, "Timer %s scheduled in %d seconds", 
+		  timer_names[sub->timer.id], timeout.sec));
+    }
+}
+
+
+/*
+ * Destroy session.
+ */
+static void evsub_destroy( pjsip_evsub *sub )
+{
+    struct dlgsub *dlgsub_head, *dlgsub;
+
+    PJ_LOG(4,(sub->obj_name, "Subscription destroyed"));
+
+    /* Kill timer */
+    set_timer(sub, TIMER_TYPE_NONE, 0);
+
+    /* Remove this session from dialog's list of subscription */
+    dlgsub_head = (struct dlgsub *) sub->dlg->mod_data[mod_evsub.mod.id];
+    dlgsub = dlgsub_head->next;
+    while (dlgsub != dlgsub_head) {
+	
+	if (dlgsub->sub == sub) {
+	    pj_list_erase(dlgsub);
+	    break;
+	}
+
+	dlgsub = dlgsub->next;
+    }
+
+    /* Decrement dialog's session */
+    pjsip_dlg_dec_session(sub->dlg, &mod_evsub.mod);
+}
+
+/*
+ * Set subscription session state.
+ */
+static void set_state( pjsip_evsub *sub, pjsip_evsub_state state,
+		       const pj_str_t *state_str, pjsip_event *event,
+		       const pj_str_t *reason)
+{
+    pjsip_evsub_state prev_state = sub->state;
+    pj_str_t old_state_str = sub->state_str;
+    pjsip_event dummy_event;
+
+    sub->state = state;
+
+    if (state_str && state_str->slen)
+	pj_strdup_with_null(sub->pool, &sub->state_str, state_str);
+    else
+	sub->state_str = evsub_state_names[state];
+
+    if (reason && sub->term_reason.slen==0)
+	pj_strdup(sub->pool, &sub->term_reason, reason);
+
+    PJ_LOG(4,(sub->obj_name, 
+	      "Subscription state changed %.*s --> %.*s",
+	      (int)old_state_str.slen,
+	      old_state_str.ptr,
+	      (int)sub->state_str.slen,
+	      sub->state_str.ptr));
+    pj_log_push_indent();
+
+    /* don't call the callback with NULL event, it may crash the app! */
+    if (!event) {
+	PJSIP_EVENT_INIT_USER(dummy_event, 0, 0, 0, 0);
+	event = &dummy_event;
+    }
+
+    if (sub->user.on_evsub_state && sub->call_cb)
+	(*sub->user.on_evsub_state)(sub, event);
+
+    if (state == PJSIP_EVSUB_STATE_TERMINATED &&
+	prev_state != PJSIP_EVSUB_STATE_TERMINATED) 
+    {
+	if (sub->pending_tsx == 0) {
+	    evsub_destroy(sub);
+	}
+    }
+
+    pj_log_pop_indent();
+}
+
+
+/*
+ * Timer callback.
+ */
+static void on_timer( pj_timer_heap_t *timer_heap,
+		      struct pj_timer_entry *entry)
+{
+    pjsip_evsub *sub;
+    int timer_id;
+
+    PJ_UNUSED_ARG(timer_heap);
+
+    sub = (pjsip_evsub*) entry->user_data;
+
+    pjsip_dlg_inc_lock(sub->dlg);
+
+    timer_id = entry->id;
+    entry->id = TIMER_TYPE_NONE;
+
+    switch (timer_id) {
+
+    case TIMER_TYPE_UAC_REFRESH:
+	/* Time for UAC to refresh subscription */
+	if (sub->user.on_client_refresh && sub->call_cb) {
+	    (*sub->user.on_client_refresh)(sub);
+	} else {
+	    pjsip_tx_data *tdata;
+	    pj_status_t status;
+
+	    PJ_LOG(5,(sub->obj_name, "Refreshing subscription."));
+	    pj_log_push_indent();
+	    status = pjsip_evsub_initiate(sub, NULL, 
+					  sub->expires->ivalue,
+					  &tdata);
+	    if (status == PJ_SUCCESS)
+		pjsip_evsub_send_request(sub, tdata);
+
+	    pj_log_pop_indent();
+	}
+	break;
+
+    case TIMER_TYPE_UAS_TIMEOUT:
+	/* Refresh from UAC has not been received */
+	if (sub->user.on_server_timeout && sub->call_cb) {
+	    (*sub->user.on_server_timeout)(sub);
+	} else {
+	    pjsip_tx_data *tdata;
+	    pj_status_t status;
+
+	    PJ_LOG(5,(sub->obj_name, "Timeout waiting for refresh. "
+				     "Sending NOTIFY to terminate."));
+	    pj_log_push_indent();
+	    status = pjsip_evsub_notify( sub, PJSIP_EVSUB_STATE_TERMINATED, 
+					 NULL, &STR_TIMEOUT, &tdata);
+	    if (status == PJ_SUCCESS)
+		pjsip_evsub_send_request(sub, tdata);
+
+	    pj_log_pop_indent();
+	}
+	break;
+
+    case TIMER_TYPE_UAC_TERMINATE:
+	{
+	    pj_str_t timeout = {"timeout", 7};
+
+	    PJ_LOG(5,(sub->obj_name, "Timeout waiting for final NOTIFY. "
+				     "Terminating.."));
+	    pj_log_push_indent();
+	    set_state(sub, PJSIP_EVSUB_STATE_TERMINATED, NULL, NULL, 
+		      &timeout);
+	    pj_log_pop_indent();
+	}
+	break;
+
+    case TIMER_TYPE_UAC_WAIT_NOTIFY:
+	{
+	    pjsip_tx_data *tdata;
+	    pj_status_t status;
+
+	    PJ_LOG(5,(sub->obj_name, 
+		     "Timeout waiting for subsequent NOTIFY (we did "
+		     "send non-2xx response for previous NOTIFY). "
+		     "Unsubscribing.."));
+	    pj_log_push_indent();
+	    status = pjsip_evsub_initiate( sub, NULL, 0, &tdata);
+	    if (status == PJ_SUCCESS)
+		pjsip_evsub_send_request(sub, tdata);
+
+	    pj_log_pop_indent();
+	}
+	break;
+
+    default:
+	pj_assert(!"Invalid timer id");
+    }
+
+    pjsip_dlg_dec_lock(sub->dlg);
+}
+
+
+/*
+ * Create subscription session, used for both client and notifier.
+ */
+static pj_status_t evsub_create( pjsip_dialog *dlg,
+				 pjsip_role_e role,
+				 const pjsip_evsub_user *user_cb,
+				 const pj_str_t *event,
+				 unsigned option,
+				 pjsip_evsub **p_evsub )
+{
+    pjsip_evsub *sub;
+    struct evpkg *pkg;
+    struct dlgsub *dlgsub_head, *dlgsub;
+    pj_status_t status;
+
+    /* Make sure there's package register for the event name: */
+
+    pkg = find_pkg(event);
+    if (pkg == NULL)
+	return PJSIP_SIMPLE_ENOPKG;
+
+
+    /* Must lock dialog before using pool etc. */
+    pjsip_dlg_inc_lock(dlg);
+
+    /* Init attributes: */
+
+    sub = PJ_POOL_ZALLOC_T(dlg->pool, struct pjsip_evsub);
+    sub->pool = dlg->pool;
+    sub->endpt = dlg->endpt;
+    sub->dlg = dlg;
+    sub->pkg = pkg;
+    sub->role = role;
+    sub->call_cb = PJ_TRUE;
+    sub->option = option;
+    sub->state = PJSIP_EVSUB_STATE_NULL;
+    sub->state_str = evsub_state_names[sub->state];
+    sub->expires = pjsip_expires_hdr_create(sub->pool, pkg->pkg_expires);
+    sub->accept = (pjsip_accept_hdr*) 
+    		  pjsip_hdr_clone(sub->pool, pkg->pkg_accept);
+    pj_list_init(&sub->sub_hdr_list);
+
+    sub->timer.user_data = sub;
+    sub->timer.cb = &on_timer;
+
+    /* Set name. */
+    pj_ansi_snprintf(sub->obj_name, PJ_ARRAY_SIZE(sub->obj_name),
+		     "evsub%p", sub);
+
+
+    /* Copy callback, if any: */
+    if (user_cb)
+	pj_memcpy(&sub->user, user_cb, sizeof(pjsip_evsub_user));
+
+
+    /* Create Event header: */
+    sub->event = pjsip_event_hdr_create(sub->pool);
+    pj_strdup(sub->pool, &sub->event->event_type, event);
+
+
+    /* Check if another subscription has been registered to the dialog. In
+     * that case, just add ourselves to the subscription list, otherwise
+     * create and register a new subscription list.
+     */
+    if (pjsip_dlg_has_usage(dlg, &mod_evsub.mod)) {
+	dlgsub_head = (struct dlgsub*) dlg->mod_data[mod_evsub.mod.id];
+	dlgsub = PJ_POOL_ALLOC_T(sub->pool, struct dlgsub);
+	dlgsub->sub = sub;
+	pj_list_push_back(dlgsub_head, dlgsub);
+    } else {
+	dlgsub_head = PJ_POOL_ALLOC_T(sub->pool, struct dlgsub);
+	dlgsub = PJ_POOL_ALLOC_T(sub->pool, struct dlgsub);
+	dlgsub->sub = sub;
+
+	pj_list_init(dlgsub_head);
+	pj_list_push_back(dlgsub_head, dlgsub);
+
+
+	/* Register as dialog usage: */
+
+	status = pjsip_dlg_add_usage(dlg, &mod_evsub.mod, dlgsub_head);
+	if (status != PJ_SUCCESS) {
+	    pjsip_dlg_dec_lock(dlg);
+	    return status;
+	}
+    }
+
+    PJ_LOG(5,(sub->obj_name, "%s subscription created, using dialog %s",
+	      (role==PJSIP_ROLE_UAC ? "UAC" : "UAS"),
+	      dlg->obj_name));
+
+    *p_evsub = sub;
+    pjsip_dlg_dec_lock(dlg);
+
+    return PJ_SUCCESS;
+}
+
+
+
+/*
+ * Create client subscription session.
+ */
+PJ_DEF(pj_status_t) pjsip_evsub_create_uac( pjsip_dialog *dlg,
+					    const pjsip_evsub_user *user_cb,
+					    const pj_str_t *event,
+					    unsigned option,
+					    pjsip_evsub **p_evsub)
+{
+    pjsip_evsub *sub;
+    pj_status_t status;
+
+    PJ_ASSERT_RETURN(dlg && event && p_evsub, PJ_EINVAL);
+
+    pjsip_dlg_inc_lock(dlg);
+    status = evsub_create(dlg, PJSIP_UAC_ROLE, user_cb, event, option, &sub);
+    if (status != PJ_SUCCESS)
+	goto on_return;
+
+    /* Add unique Id to Event header, only when PJSIP_EVSUB_NO_EVENT_ID
+     * is not specified.
+     */
+    if ((option & PJSIP_EVSUB_NO_EVENT_ID) == 0) {
+	pj_create_unique_string(sub->pool, &sub->event->id_param);
+    }
+
+    /* Increment dlg session. */
+    pjsip_dlg_inc_session(sub->dlg, &mod_evsub.mod);
+
+    /* Done */
+    *p_evsub = sub;
+
+on_return:
+    pjsip_dlg_dec_lock(dlg);
+    return status;
+}
+
+
+/*
+ * Create server subscription session from incoming request.
+ */
+PJ_DEF(pj_status_t) pjsip_evsub_create_uas( pjsip_dialog *dlg,
+					    const pjsip_evsub_user *user_cb,
+					    pjsip_rx_data *rdata,
+					    unsigned option,
+					    pjsip_evsub **p_evsub)
+{
+    pjsip_evsub *sub;
+    pjsip_transaction *tsx;
+    pjsip_accept_hdr *accept_hdr;
+    pjsip_event_hdr *event_hdr;
+    pjsip_expires_hdr *expires_hdr;
+    pj_status_t status;
+
+    /* Check arguments: */
+    PJ_ASSERT_RETURN(dlg && rdata && p_evsub, PJ_EINVAL);
+
+    /* MUST be request message: */
+    PJ_ASSERT_RETURN(rdata->msg_info.msg->type == PJSIP_REQUEST_MSG,
+		     PJSIP_ENOTREQUESTMSG);
+
+    /* Transaction MUST have been created (in the dialog) */
+    tsx = pjsip_rdata_get_tsx(rdata);
+    PJ_ASSERT_RETURN(tsx != NULL, PJSIP_ENOTSX);
+
+    /* No subscription must have been attached to transaction */
+    PJ_ASSERT_RETURN(tsx->mod_data[mod_evsub.mod.id] == NULL, 
+		     PJSIP_ETYPEEXISTS);
+
+    /* Package MUST implement on_rx_refresh */
+    PJ_ASSERT_RETURN(user_cb->on_rx_refresh, PJ_EINVALIDOP);
+
+    /* Request MUST have "Event" header. We need the Event header to get 
+     * the package name (don't want to add more arguments in the function).
+     */
+    event_hdr = (pjsip_event_hdr*) 
+		 pjsip_msg_find_hdr_by_names(rdata->msg_info.msg, &STR_EVENT,
+					     &STR_EVENT_S, NULL);
+    if (event_hdr == NULL) {
+	return PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_BAD_REQUEST);
+    }
+
+    /* Start locking the mutex: */
+
+    pjsip_dlg_inc_lock(dlg);
+
+    /* Create the session: */
+
+    status = evsub_create(dlg, PJSIP_UAS_ROLE, user_cb, 
+			  &event_hdr->event_type, option, &sub);
+    if (status != PJ_SUCCESS)
+	goto on_return;
+
+    /* Just duplicate Event header from the request */
+    sub->event = (pjsip_event_hdr*) pjsip_hdr_clone(sub->pool, event_hdr);
+
+    /* Set the method: */
+    pjsip_method_copy(sub->pool, &sub->method, 
+		      &rdata->msg_info.msg->line.req.method);
+
+    /* Update expiration time according to client request: */
+
+    expires_hdr = (pjsip_expires_hdr*)
+	pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_EXPIRES, NULL);
+    if (expires_hdr) {
+	sub->expires->ivalue = expires_hdr->ivalue;
+    }
+
+    /* Update time. */
+    update_expires(sub, sub->expires->ivalue);
+
+    /* Update Accept header: */
+
+    accept_hdr = (pjsip_accept_hdr*)
+	pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_ACCEPT, NULL);
+    if (accept_hdr)
+	sub->accept = (pjsip_accept_hdr*)pjsip_hdr_clone(sub->pool,accept_hdr);
+
+    /* We can start the session: */
+
+    pjsip_dlg_inc_session(dlg, &mod_evsub.mod);
+    sub->pending_tsx++;
+    tsx->mod_data[mod_evsub.mod.id] = sub;
+
+
+    /* Done. */
+    *p_evsub = sub;
+
+
+on_return:
+    pjsip_dlg_dec_lock(dlg);
+    return status;
+}
+
+
+/*
+ * Forcefully destroy subscription.
+ */
+PJ_DEF(pj_status_t) pjsip_evsub_terminate( pjsip_evsub *sub,
+					   pj_bool_t notify )
+{
+    PJ_ASSERT_RETURN(sub, PJ_EINVAL);
+
+    pjsip_dlg_inc_lock(sub->dlg);
+
+    /* I think it's pretty safe to disable this check.
+     
+    if (sub->pending_tsx) {
+	pj_assert(!"Unable to terminate when there's pending tsx");
+	pjsip_dlg_dec_lock(sub->dlg);
+	return PJ_EINVALIDOP;
+    }
+    */
+
+    sub->call_cb = notify;
+    set_state(sub, PJSIP_EVSUB_STATE_TERMINATED, NULL, NULL, NULL);
+
+    pjsip_dlg_dec_lock(sub->dlg);
+    return PJ_SUCCESS;
+}
+
+/*
+ * Get subscription state.
+ */
+PJ_DEF(pjsip_evsub_state) pjsip_evsub_get_state(pjsip_evsub *sub)
+{
+    return sub->state;
+}
+
+/*
+ * Get state name.
+ */
+PJ_DEF(const char*) pjsip_evsub_get_state_name(pjsip_evsub *sub)
+{
+    return sub->state_str.ptr;
+}
+
+/*
+ * Get termination reason.
+ */
+PJ_DEF(const pj_str_t*) pjsip_evsub_get_termination_reason(pjsip_evsub *sub)
+{
+    return &sub->term_reason;
+}
+
+/*
+ * Initiate client subscription
+ */
+PJ_DEF(pj_status_t) pjsip_evsub_initiate( pjsip_evsub *sub,
+					  const pjsip_method *method,
+					  pj_int32_t expires,
+					  pjsip_tx_data **p_tdata)
+{
+    pjsip_tx_data *tdata;
+    pj_status_t status;
+
+    PJ_ASSERT_RETURN(sub!=NULL && p_tdata!=NULL, PJ_EINVAL);
+
+    /* Use SUBSCRIBE if method is not specified */
+    if (method == NULL)
+	method = &pjsip_subscribe_method;
+
+    pjsip_dlg_inc_lock(sub->dlg);
+
+    /* Update method: */
+    if (sub->state == PJSIP_EVSUB_STATE_NULL)
+	pjsip_method_copy(sub->pool, &sub->method, method);
+
+    status = pjsip_dlg_create_request( sub->dlg, method, -1, &tdata);
+    if (status != PJ_SUCCESS)
+	goto on_return;
+
+
+    /* Add Event header: */
+    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
+		       pjsip_hdr_shallow_clone(tdata->pool, sub->event));
+
+    /* Update and add expires header: */
+    if (expires >= 0)
+	sub->expires->ivalue = expires;
+    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
+		       pjsip_hdr_shallow_clone(tdata->pool, sub->expires));
+
+    /* Add Supported header (it's optional in RFC 3265, but some event package
+     * RFC may bring this requirement to SHOULD strength - e.g. RFC 5373)
+     */
+    {
+       const pjsip_hdr *hdr = pjsip_endpt_get_capability(sub->endpt,
+						         PJSIP_H_SUPPORTED,
+						         NULL);
+       if (hdr) {
+	   pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)
+			     pjsip_hdr_shallow_clone(tdata->pool, hdr));
+       }
+    }
+
+    /* Add Accept header: */
+    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
+		       pjsip_hdr_shallow_clone(tdata->pool, sub->accept));
+    
+
+    /* Add Allow-Events header: */
+    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
+		       pjsip_hdr_shallow_clone(tdata->pool, 
+					       mod_evsub.allow_events_hdr));
+
+
+    /* Add custom headers */
+    {
+	const pjsip_hdr *hdr = sub->sub_hdr_list.next;
+	while (hdr != &sub->sub_hdr_list) {
+	    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
+			       pjsip_hdr_shallow_clone(tdata->pool, hdr));
+	    hdr = hdr->next;
+	}
+    }
+
+
+    *p_tdata = tdata;
+
+
+on_return:
+
+    pjsip_dlg_dec_lock(sub->dlg);
+    return status;
+}
+
+
+/*
+ * Add custom headers.
+ */
+PJ_DEF(pj_status_t) pjsip_evsub_add_header( pjsip_evsub *sub,
+					    const pjsip_hdr *hdr_list )
+{
+    const pjsip_hdr *hdr;
+
+    PJ_ASSERT_RETURN(sub && hdr_list, PJ_EINVAL);
+
+    hdr = hdr_list->next;
+    while (hdr != hdr_list) {
+        pj_list_push_back(&sub->sub_hdr_list, (pjsip_hdr*)
+		          pjsip_hdr_clone(sub->pool, hdr));
+	hdr = hdr->next;
+    }
+
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * Accept incoming subscription request.
+ */
+PJ_DEF(pj_status_t) pjsip_evsub_accept( pjsip_evsub *sub,
+					pjsip_rx_data *rdata,
+				        int st_code,
+					const pjsip_hdr *hdr_list )
+{
+    pjsip_tx_data *tdata;
+    pjsip_transaction *tsx;
+    pj_status_t status;
+
+    /* Check arguments */
+    PJ_ASSERT_RETURN(sub && rdata, PJ_EINVAL);
+
+    /* Can only be for server subscription: */
+    PJ_ASSERT_RETURN(sub->role == PJSIP_ROLE_UAS, PJ_EINVALIDOP);
+
+    /* Only expect 2xx status code (for now) */
+    PJ_ASSERT_RETURN(st_code/100 == 2, PJ_EINVALIDOP);
+
+    /* Subscription MUST have been attached to the transaction.
+     * Initial subscription request will be attached on evsub_create_uas(),
+     * while subsequent requests will be attached in tsx_state()
+     */
+    tsx = pjsip_rdata_get_tsx(rdata);
+    PJ_ASSERT_RETURN(tsx->mod_data[mod_evsub.mod.id] != NULL,
+		     PJ_EINVALIDOP);
+
+    /* Lock dialog */
+    pjsip_dlg_inc_lock(sub->dlg);
+
+    /* Create response: */
+    status = pjsip_dlg_create_response( sub->dlg, rdata, st_code, NULL, 
+					&tdata);
+    if (status != PJ_SUCCESS)
+	goto on_return;
+
+
+    /* Add expires header: */
+    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
+		       pjsip_hdr_shallow_clone(tdata->pool, sub->expires));
+
+    /* Add additional header, if any. */
+    if (hdr_list) {
+	const pjsip_hdr *hdr = hdr_list->next;
+	while (hdr != hdr_list) {
+	    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
+			       pjsip_hdr_clone(tdata->pool, hdr));
+	    hdr = hdr->next;
+	}
+    }
+
+    /* Send the response: */
+    status = pjsip_dlg_send_response( sub->dlg, tsx, tdata );
+    if (status != PJ_SUCCESS)
+	goto on_return;
+
+
+on_return:
+
+    pjsip_dlg_dec_lock(sub->dlg);
+    return status;
+}
+
+
+/*
+ * Create Subscription-State header based on current server subscription
+ * state.
+ */
+static pjsip_sub_state_hdr* sub_state_create( pj_pool_t *pool,
+					      pjsip_evsub *sub,
+					      pjsip_evsub_state state,
+					      const pj_str_t *state_str,
+					      const pj_str_t *reason )
+{
+    pjsip_sub_state_hdr *sub_state;
+    pj_time_val now, delay;
+
+    /* Get the remaining time before refresh is required */
+    pj_gettimeofday(&now);
+    delay = sub->refresh_time;
+    PJ_TIME_VAL_SUB(delay, now);
+
+    /* Create the Subscription-State header */
+    sub_state = pjsip_sub_state_hdr_create(pool);
+
+    /* Fill up the header */
+    switch (state) {
+    case PJSIP_EVSUB_STATE_NULL:
+    case PJSIP_EVSUB_STATE_SENT:
+	pj_assert(!"Invalid state!");
+	/* Treat as pending */
+
+    case PJSIP_EVSUB_STATE_ACCEPTED:
+    case PJSIP_EVSUB_STATE_PENDING:
+	sub_state->sub_state = STR_PENDING;
+	sub_state->expires_param = delay.sec;
+	break;
+
+    case PJSIP_EVSUB_STATE_ACTIVE:
+	sub_state->sub_state = STR_ACTIVE;
+	sub_state->expires_param = delay.sec;
+	break;
+
+    case PJSIP_EVSUB_STATE_TERMINATED:
+	sub_state->sub_state = STR_TERMINATED;
+	if (reason != NULL)
+	    pj_strdup(pool, &sub_state->reason_param, reason);
+	break;
+
+    case PJSIP_EVSUB_STATE_UNKNOWN:
+	pj_assert(state_str != NULL);
+	pj_strdup(pool, &sub_state->sub_state, state_str);
+	break;
+    }
+    
+    return sub_state;
+}
+
+/*
+ * Create and send NOTIFY request.
+ */
+PJ_DEF(pj_status_t) pjsip_evsub_notify( pjsip_evsub *sub,
+					pjsip_evsub_state state,
+					const pj_str_t *state_str,
+					const pj_str_t *reason,
+					pjsip_tx_data **p_tdata)
+{
+    pjsip_tx_data *tdata;
+    pjsip_sub_state_hdr *sub_state;
+    pj_status_t status;
+
+    /* Check arguments. */
+    PJ_ASSERT_RETURN(sub!=NULL && p_tdata!=NULL, PJ_EINVAL);
+
+    /* Lock dialog. */
+    pjsip_dlg_inc_lock(sub->dlg);
+
+    /* Create NOTIFY request */
+    status = pjsip_dlg_create_request( sub->dlg, pjsip_get_notify_method(), 
+				       -1, &tdata);
+    if (status != PJ_SUCCESS)
+	goto on_return;
+
+    /* Add Event header */
+    pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)
+		      pjsip_hdr_shallow_clone(tdata->pool, sub->event));
+
+    /* Add Subscription-State header */
+    sub_state = sub_state_create(tdata->pool, sub, state, state_str,
+				 reason);
+    pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)sub_state);
+
+    /* Add Allow-Events header */
+    pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)
+		      pjsip_hdr_shallow_clone(tdata->pool, mod_evsub.allow_events_hdr));
+
+    /* Add Authentication headers. */
+    pjsip_auth_clt_init_req( &sub->dlg->auth_sess, tdata );
+
+    /* Update reason */
+    if (reason)
+	pj_strdup(sub->dlg->pool, &sub->term_reason, reason);
+
+    /* Save destination state. */
+    sub->dst_state = state;
+    if (state_str)
+	pj_strdup(sub->pool, &sub->dst_state_str, state_str);
+    else
+	sub->dst_state_str.slen = 0;
+
+
+    *p_tdata = tdata;
+
+on_return:
+    /* Unlock dialog */
+    pjsip_dlg_dec_lock(sub->dlg);
+    return status;
+}
+
+
+/*
+ * Create NOTIFY to reflect current status.
+ */
+PJ_DEF(pj_status_t) pjsip_evsub_current_notify( pjsip_evsub *sub,
+						pjsip_tx_data **p_tdata )
+{
+    return pjsip_evsub_notify( sub, sub->state, &sub->state_str, 
+			       NULL, p_tdata );
+}
+
+
+/*
+ * Send request.
+ */
+PJ_DEF(pj_status_t) pjsip_evsub_send_request( pjsip_evsub *sub,
+					      pjsip_tx_data *tdata)
+{
+    pj_status_t status;
+
+    /* Must be request message. */
+    PJ_ASSERT_RETURN(tdata->msg->type == PJSIP_REQUEST_MSG,
+		     PJSIP_ENOTREQUESTMSG);
+
+    /* Lock */
+    pjsip_dlg_inc_lock(sub->dlg);
+
+    /* Send the request. */
+    status = pjsip_dlg_send_request(sub->dlg, tdata, -1, NULL);
+    if (status != PJ_SUCCESS)
+	goto on_return;
+
+
+    /* Special case for NOTIFY:
+     * The new state was set in pjsip_evsub_notify(), but we apply the
+     * new state now, when the request was actually sent.
+     */
+    if (pjsip_method_cmp(&tdata->msg->line.req.method, 
+			 &pjsip_notify_method)==0) 
+    {
+	PJ_ASSERT_ON_FAIL(  sub->dst_state!=PJSIP_EVSUB_STATE_NULL,
+			    {goto on_return;});
+
+	set_state(sub, sub->dst_state, 
+		  (sub->dst_state_str.slen ? &sub->dst_state_str : NULL), 
+		  NULL, NULL);
+
+	sub->dst_state = PJSIP_EVSUB_STATE_NULL;
+	sub->dst_state_str.slen = 0;
+
+    }
+
+
+on_return:
+    pjsip_dlg_dec_lock(sub->dlg);
+    return status;
+}
+
+
+/* Callback to be called to terminate transaction. */
+static void terminate_timer_cb(pj_timer_heap_t *timer_heap,
+			       struct pj_timer_entry *entry)
+{
+    pj_str_t *key;
+    pjsip_transaction *tsx;
+
+    PJ_UNUSED_ARG(timer_heap);
+
+    key = (pj_str_t*)entry->user_data;
+    tsx = pjsip_tsx_layer_find_tsx(key, PJ_FALSE);
+    /* Chance of race condition here */
+    if (tsx) {
+	pjsip_tsx_terminate(tsx, PJSIP_SC_REQUEST_UPDATED);
+    }
+}
+
+
+/*
+ * Attach subscription session to newly created transaction, if appropriate.
+ */
+static pjsip_evsub *on_new_transaction( pjsip_transaction *tsx,
+				        pjsip_event *event)
+{
+    /*
+     * Newly created transaction will not have subscription session
+     * attached to it. Find the subscription session from the dialog,
+     * by matching the Event header.
+     */
+    pjsip_dialog *dlg;
+    pjsip_event_hdr *event_hdr;
+    pjsip_msg *msg;
+    struct dlgsub *dlgsub_head, *dlgsub;
+    pjsip_evsub *sub;
+    
+    dlg = pjsip_tsx_get_dlg(tsx);
+    if (!dlg) {
+	pj_assert(!"Transaction should have a dialog instance!");
+	return NULL;
+    }
+
+
+    switch (event->body.tsx_state.type) {
+    case PJSIP_EVENT_RX_MSG:
+	msg = event->body.tsx_state.src.rdata->msg_info.msg;
+	break;
+    case PJSIP_EVENT_TX_MSG:
+	msg = event->body.tsx_state.src.tdata->msg;
+	break;
+    default:
+	if (tsx->role == PJSIP_ROLE_UAC)
+	    msg = tsx->last_tx->msg;
+	else
+	    msg = NULL;
+	break;
+    }
+    
+    if (!msg) {
+	//Note:
+	// this transaction can be other transaction in the dialog.
+	// The assertion below probably only valid for dialog that
+	// only has one event subscription usage.
+	//pj_assert(!"First transaction event is not TX or RX!");
+	return NULL;
+    }
+
+    event_hdr = (pjsip_event_hdr*)
+    		pjsip_msg_find_hdr_by_names(msg, &STR_EVENT, 
+					    &STR_EVENT_S, NULL);
+    if (!event_hdr) {
+	/* Not subscription related message */
+	return NULL;
+    }
+
+    /* Find the subscription in the dialog, based on the content
+     * of Event header: 
+     */
+
+    dlgsub_head = (struct dlgsub*) dlg->mod_data[mod_evsub.mod.id];
+    if (dlgsub_head == NULL) {
+	dlgsub_head = PJ_POOL_ALLOC_T(dlg->pool, struct dlgsub);
+	pj_list_init(dlgsub_head);
+	dlg->mod_data[mod_evsub.mod.id] = dlgsub_head;
+    }
+    dlgsub = dlgsub_head->next;
+
+    while (dlgsub != dlgsub_head) {
+
+	if (pj_stricmp(&dlgsub->sub->event->event_type, 
+		       &event_hdr->event_type)==0)
+	{
+	    /* Event type matched. 
+	     * Check if event ID matched too.
+	     */
+	    if (pj_strcmp(&dlgsub->sub->event->id_param, 
+			  &event_hdr->id_param)==0)
+	    {
+		/* Skip this subscription if it has no event ID and has been
+		 * terminated (see ticket #1647).
+		 */
+		if ((dlgsub->sub->option & PJSIP_EVSUB_NO_EVENT_ID) &&
+		    (pjsip_evsub_get_state(dlgsub->sub)==
+					PJSIP_EVSUB_STATE_TERMINATED))
+		{
+		    dlgsub = dlgsub->next;
+    		    continue;
+		} else {
+		    break;
+		}
+
+	    }
+	    /*
+	     * Otherwise if it is an UAC subscription, AND
+	     * PJSIP_EVSUB_NO_EVENT_ID flag is set, AND
+	     * the session's event id is NULL, AND
+	     * the incoming request is NOTIFY with event ID, then
+	     * we consider it as a match, and update the
+	     * session's event id.
+	     */
+	    else if (dlgsub->sub->role == PJSIP_ROLE_UAC &&
+		     (dlgsub->sub->option & PJSIP_EVSUB_NO_EVENT_ID)!=0 &&
+		     dlgsub->sub->event->id_param.slen==0 &&
+		     !pjsip_method_cmp(&tsx->method, &pjsip_notify_method))
+	    {
+		/* Update session's event id. */
+		pj_strdup(dlgsub->sub->pool, 
+			  &dlgsub->sub->event->id_param,
+			  &event_hdr->id_param);
+
+		break;
+	    }
+	}
+	
+
+
+	dlgsub = dlgsub->next;
+    }
+
+    /* Note: 
+     *  the second condition is for http://trac.pjsip.org/repos/ticket/911 
+     */
+    if (dlgsub == dlgsub_head ||
+	(dlgsub->sub && 
+	    pjsip_evsub_get_state(dlgsub->sub)==PJSIP_EVSUB_STATE_TERMINATED))
+    {
+	const char *reason_msg = 
+	    (dlgsub == dlgsub_head ? "Subscription Does Not Exist" :
+	     "Subscription already terminated");
+
+	/* This could be incoming request to create new subscription */
+	PJ_LOG(4,(THIS_FILE, 
+		  "%s for %.*s, event=%.*s;id=%.*s",
+		  reason_msg,
+		  (int)tsx->method.name.slen,
+		  tsx->method.name.ptr,
+		  (int)event_hdr->event_type.slen,
+		  event_hdr->event_type.ptr,
+		  (int)event_hdr->id_param.slen,
+		  event_hdr->id_param.ptr));
+
+	/* If this is an incoming NOTIFY, reject with 481 */
+	if (tsx->state == PJSIP_TSX_STATE_TRYING &&
+	    pjsip_method_cmp(&tsx->method, &pjsip_notify_method)==0)
+	{
+	    pj_str_t reason;
+	    pjsip_tx_data *tdata;
+	    pj_status_t status;
+
+	    pj_cstr(&reason, reason_msg);
+	    status = pjsip_dlg_create_response(dlg, 
+					       event->body.tsx_state.src.rdata, 
+					       481, &reason, 
+					       &tdata);
+	    if (status == PJ_SUCCESS) {
+		status = pjsip_dlg_send_response(dlg, tsx, tdata);
+	    }
+	}
+	return NULL;
+    }
+
+    /* Found! */
+    sub = dlgsub->sub;
+
+    /* Attach session to the transaction */
+    tsx->mod_data[mod_evsub.mod.id] = sub;
+    sub->pending_tsx++;
+
+    /* Special case for outgoing/UAC SUBSCRIBE/REFER transaction. 
+     * We can only have one pending UAC SUBSCRIBE/REFER, so if another 
+     * transaction is started while previous one still alive, terminate
+     * the older one.
+     *
+     * Sample scenario:
+     *	- subscribe sent to destination that doesn't exist, transaction
+     *	  is still retransmitting request, then unsubscribe is sent.
+     */
+    if (tsx->role == PJSIP_ROLE_UAC &&
+	tsx->state == PJSIP_TSX_STATE_CALLING &&
+	(pjsip_method_cmp(&tsx->method, &sub->method) == 0  ||
+	 pjsip_method_cmp(&tsx->method, &pjsip_subscribe_method) == 0))
+    {
+
+	if (sub->pending_sub && 
+	    sub->pending_sub->state < PJSIP_TSX_STATE_COMPLETED) 
+	{
+	    pj_timer_entry *timer;
+	    pj_str_t *key;
+	    pj_time_val timeout = {0, 0};
+
+	    PJ_LOG(4,(sub->obj_name, 
+		      "Cancelling pending subscription request"));
+
+	    /* By convention, we use 490 (Request Updated) status code.
+	     * When transaction handler (below) see this status code, it
+	     * will ignore the transaction.
+	     */
+	    /* This unfortunately may cause deadlock, because at the moment
+	     * we are holding dialog's mutex. If a response to this
+	     * transaction is in progress in another thread, that thread
+	     * will deadlock when trying to acquire dialog mutex, because
+	     * it is holding the transaction mutex.
+	     *
+	     * So the solution is to register timer to kill this transaction.
+	     */
+	    //pjsip_tsx_terminate(sub->pending_sub, PJSIP_SC_REQUEST_UPDATED);
+	    timer = PJ_POOL_ZALLOC_T(dlg->pool, pj_timer_entry);
+	    key = PJ_POOL_ALLOC_T(dlg->pool, pj_str_t);
+	    pj_strdup(dlg->pool, key, &sub->pending_sub->transaction_key);
+	    timer->cb = &terminate_timer_cb;
+	    timer->user_data = key;
+
+	    pjsip_endpt_schedule_timer(dlg->endpt, timer, &timeout);
+	}
+
+	sub->pending_sub = tsx;
+
+    }
+
+    return sub;
+}
+
+
+/*
+ * Create response, adding custome headers and msg body.
+ */
+static pj_status_t create_response( pjsip_evsub *sub,
+				    pjsip_rx_data *rdata,
+				    int st_code,
+				    const pj_str_t *st_text,
+				    const pjsip_hdr *res_hdr,
+				    const pjsip_msg_body *body,
+				    pjsip_tx_data **p_tdata)
+{
+    pjsip_tx_data *tdata;
+    pjsip_hdr *hdr;
+    pj_status_t status;
+
+    status = pjsip_dlg_create_response(sub->dlg, rdata,
+				       st_code, st_text, &tdata);
+    if (status != PJ_SUCCESS)
+	return status;
+
+    *p_tdata = tdata;
+
+    /* Add response headers. */
+    hdr = res_hdr->next;
+    while (hdr != res_hdr) {
+	pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
+			   pjsip_hdr_clone(tdata->pool, hdr));
+	hdr = hdr->next;
+    }
+
+    /* Add msg body, if any */
+    if (body) {
+	tdata->msg->body = pjsip_msg_body_clone(tdata->pool, body);
+	if (tdata->msg->body == NULL) {
+
+	    PJ_LOG(4,(THIS_FILE, "Error: unable to clone msg body"));
+
+	    /* Ignore */
+	    return PJ_SUCCESS;
+	}
+    }
+
+    return PJ_SUCCESS;
+}
+
+/*
+ * Get subscription state from the value of Subscription-State header.
+ */
+static void get_hdr_state( pjsip_sub_state_hdr *sub_state,
+			   pjsip_evsub_state *state,
+			   pj_str_t **state_str )
+{
+    if (pj_stricmp(&sub_state->sub_state, &STR_TERMINATED)==0) {
+
+	*state = PJSIP_EVSUB_STATE_TERMINATED;
+	*state_str = NULL;
+
+    } else if (pj_stricmp(&sub_state->sub_state, &STR_ACTIVE)==0) {
+
+	*state = PJSIP_EVSUB_STATE_ACTIVE;
+	*state_str = NULL;
+
+    } else if (pj_stricmp(&sub_state->sub_state, &STR_PENDING)==0) {
+
+	*state = PJSIP_EVSUB_STATE_PENDING;
+	*state_str = NULL;
+
+    } else {
+
+	*state = PJSIP_EVSUB_STATE_UNKNOWN;
+	*state_str = &sub_state->sub_state;
+
+    }
+}
+
+/*
+ * Transaction event processing by UAC, after subscription is sent.
+ */
+static void on_tsx_state_uac( pjsip_evsub *sub, pjsip_transaction *tsx,
+			      pjsip_event *event )
+{
+
+    if (pjsip_method_cmp(&tsx->method, &sub->method)==0 || 
+	pjsip_method_cmp(&tsx->method, &pjsip_subscribe_method)==0) 
+    {
+
+	/* Received response to outgoing request that establishes/refresh
+	 * subscription. 
+	 */
+
+	/* First time initial request is sent. */
+	if (sub->state == PJSIP_EVSUB_STATE_NULL &&
+	    tsx->state == PJSIP_TSX_STATE_CALLING)
+	{
+	    set_state(sub, PJSIP_EVSUB_STATE_SENT, NULL, event, NULL);
+	    return;
+	}
+
+	/* Only interested in final response */
+	if (tsx->state != PJSIP_TSX_STATE_COMPLETED &&
+	    tsx->state != PJSIP_TSX_STATE_TERMINATED)
+	{
+	    return;
+	}
+
+	/* Clear pending subscription */
+	if (tsx == sub->pending_sub) {
+	    sub->pending_sub = NULL;
+	} else if (sub->pending_sub != NULL) {
+	    /* This SUBSCRIBE transaction has been "renewed" with another
+	     * SUBSCRIBE, so we can just ignore this. For example, user
+	     * sent SUBSCRIBE followed immediately with UN-SUBSCRIBE.
+	     */
+	    return;
+	}
+
+	/* Handle authentication. */
+	if (tsx->status_code==401 || tsx->status_code==407) {
+	    pjsip_tx_data *tdata;
+	    pj_status_t status;
+
+	    if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
+		/* Previously failed transaction has terminated */
+		return;
+	    }
+
+	    status = pjsip_auth_clt_reinit_req(&sub->dlg->auth_sess,
+					       event->body.tsx_state.src.rdata,
+					       tsx->last_tx, &tdata);
+	    if (status == PJ_SUCCESS) 
+		status = pjsip_dlg_send_request(sub->dlg, tdata, -1, NULL);
+	    
+	    if (status != PJ_SUCCESS) {
+		/* Authentication failed! */
+		set_state(sub, PJSIP_EVSUB_STATE_TERMINATED,
+			  NULL, event, &tsx->status_text);
+		return;
+	    }
+
+	    return;
+	}
+
+	if (tsx->status_code/100 == 2) {
+
+	    /* Successfull SUBSCRIBE request! 
+	     * This could be:
+	     *	- response to initial SUBSCRIBE request
+	     *	- response to subsequent refresh
+	     *	- response to unsubscription
+	     */
+
+	    if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
+		/* Ignore; this transaction has been processed before */
+		return;
+	    }
+
+	    /* Update UAC refresh time, if response contains Expires header,
+	     * only when we're not unsubscribing. 
+	     */
+	    if (sub->expires->ivalue != 0) {
+		pjsip_msg *msg;
+		pjsip_expires_hdr *expires;
+
+		msg = event->body.tsx_state.src.rdata->msg_info.msg;
+		expires = (pjsip_expires_hdr*)
+			  pjsip_msg_find_hdr(msg, PJSIP_H_EXPIRES, NULL);
+		if (expires) {
+		    sub->expires->ivalue = expires->ivalue;
+		}
+	    }
+
+	    /* Update time */
+	    update_expires(sub, sub->expires->ivalue);
+
+	    /* Start UAC refresh timer, only when we're not unsubscribing */
+	    if (sub->expires->ivalue != 0) {
+		unsigned timeout = (sub->expires->ivalue > TIME_UAC_REFRESH) ?
+		    sub->expires->ivalue - TIME_UAC_REFRESH : sub->expires->ivalue;
+
+		/* Reduce timeout by about 1 - 10 secs (randomized) */
+		if (timeout > 10)
+		    timeout += -10 + (pj_rand() % 10);
+
+		PJ_LOG(5,(sub->obj_name, "Will refresh in %d seconds", 
+			  timeout));
+		set_timer(sub, TIMER_TYPE_UAC_REFRESH, timeout);
+
+	    } else {
+		/* Otherwise set timer to terminate client subscription when
+		 * NOTIFY to end subscription is not received.
+		 */
+		set_timer(sub, TIMER_TYPE_UAC_TERMINATE, TIME_UAC_TERMINATE);
+	    }
+	    
+	    /* Set state, if necessary */
+	    pj_assert(sub->state != PJSIP_EVSUB_STATE_NULL);
+	    if (sub->state == PJSIP_EVSUB_STATE_SENT) {
+		set_state(sub, PJSIP_EVSUB_STATE_ACCEPTED, NULL, event, NULL);
+	    }
+
+	} else {
+
+	    /* Failed SUBSCRIBE request! 
+	     *
+	     * The RFC 3265 says that if outgoing SUBSCRIBE fails with status
+	     * other than 481, the subscription is still considered valid for
+	     * the duration of the last Expires.
+	     *
+	     * Since we send refresh about 5 seconds (TIME_UAC_REFRESH) before 
+	     * expiration, theoritically the expiration is still valid for the 
+	     * next 5 seconds even when we receive non-481 failed response.
+	     *
+	     * Ah, what the heck!
+	     *
+	     * Just terminate now!
+	     *
+	     */
+
+	    if (sub->state == PJSIP_EVSUB_STATE_TERMINATED) {
+		/* Ignore, has been handled before */
+		return;
+	    }
+
+	    /* Ignore 490 (Request Updated) status. 
+	     * This happens when application sends SUBSCRIBE/REFER while 
+	     * another one is still in progress.
+	     */
+	    if (tsx->status_code == PJSIP_SC_REQUEST_UPDATED) {
+		return;
+	    }
+
+	    /* Kill any timer. */
+	    set_timer(sub, TIMER_TYPE_NONE, 0);
+
+	    /* Set state to TERMINATED */
+	    set_state(sub, PJSIP_EVSUB_STATE_TERMINATED, 
+		      NULL, event, &tsx->status_text);
+
+	}
+
+    } else if (pjsip_method_cmp(&tsx->method, &pjsip_notify_method) == 0) {
+
+	/* Incoming NOTIFY. 
+	 * This can be the result of:
+	 *  - Initial subscription response
+	 *  - UAS updating the resource info.
+	 *  - Unsubscription response.
+	 */
+	int st_code = 200;
+	pj_str_t *st_text = NULL;
+	pjsip_hdr res_hdr;
+	pjsip_msg_body *body = NULL;
+
+	pjsip_rx_data *rdata;
+	pjsip_msg *msg;
+	pjsip_sub_state_hdr *sub_state;
+
+	pjsip_evsub_state new_state;
+	pj_str_t *new_state_str;
+
+	pjsip_tx_data *tdata;
+	pj_status_t status;
+
+	/* Only want to handle initial NOTIFY receive event. */
+	if (tsx->state != PJSIP_TSX_STATE_TRYING)
+	    return;
+
+
+	rdata = event->body.tsx_state.src.rdata;
+	msg = rdata->msg_info.msg;
+
+	pj_list_init(&res_hdr);
+
+	/* Get subscription state header. */
+	sub_state = (pjsip_sub_state_hdr*)
+		    pjsip_msg_find_hdr_by_name(msg, &STR_SUB_STATE, NULL);
+	if (sub_state == NULL) {
+
+	    pjsip_warning_hdr *warn_hdr;
+	    pj_str_t warn_text = { "Missing Subscription-State header", 33};
+
+	    /* Bad request! Add warning header. */
+	    st_code = PJSIP_SC_BAD_REQUEST;
+	    warn_hdr = pjsip_warning_hdr_create(rdata->tp_info.pool, 399,
+					        pjsip_endpt_name(sub->endpt),
+						&warn_text);
+	    pj_list_push_back(&res_hdr, warn_hdr);
+	}
+
+	/* Call application registered callback to handle incoming NOTIFY,
+	 * if any.
+	 */
+	if (st_code==200 && sub->user.on_rx_notify && sub->call_cb) {
+	    (*sub->user.on_rx_notify)(sub, rdata, &st_code, &st_text, 
+				      &res_hdr, &body);
+
+	    /* Application MUST specify final response! */
+	    PJ_ASSERT_ON_FAIL(st_code >= 200, {st_code=200; });
+
+	    /* Must be a valid status code */
+	    PJ_ASSERT_ON_FAIL(st_code <= 699, {st_code=500; });
+	}
+
+
+	/* If non-2xx should be returned, then send the response.
+	 * No need to update server subscription state.
+	 */
+	if (st_code >= 300) {
+	    status = create_response(sub, rdata, st_code, st_text, &res_hdr,
+				     body, &tdata);
+	    if (status == PJ_SUCCESS) {
+		status = pjsip_dlg_send_response(sub->dlg, tsx, tdata);
+	    }
+
+	    /* Start timer to terminate subscription, just in case server
+	     * is not able to generate NOTIFY to our response.
+	     */
+	    if (status == PJ_SUCCESS) {
+		unsigned timeout = TIME_UAC_WAIT_NOTIFY;
+		set_timer(sub, TIMER_TYPE_UAC_WAIT_NOTIFY, timeout);
+	    } else {
+		char errmsg[PJ_ERR_MSG_SIZE];
+		pj_str_t reason;
+
+		reason = pj_strerror(status, errmsg, sizeof(errmsg));
+		set_state(sub, PJSIP_EVSUB_STATE_TERMINATED, NULL, NULL, 
+			  &reason);
+	    }
+
+	    return;
+	}
+
+	/* Update expiration from the value of expires param in
+	 * Subscription-State header, but ONLY when subscription state 
+	 * is "active" or "pending", AND the header contains expires param.
+	 */
+	if (sub->expires->ivalue != 0 &&
+	    sub_state->expires_param >= 0 &&
+	    (pj_stricmp(&sub_state->sub_state, &STR_ACTIVE)==0 ||
+	     pj_stricmp(&sub_state->sub_state, &STR_PENDING)==0))
+	{
+	    int next_refresh = sub_state->expires_param;
+	    unsigned timeout;
+
+	    update_expires(sub, next_refresh);
+
+	    /* Start UAC refresh timer, only when we're not unsubscribing */
+	    timeout = (next_refresh > TIME_UAC_REFRESH) ?
+			next_refresh - TIME_UAC_REFRESH : next_refresh;
+
+	    PJ_LOG(5,(sub->obj_name, "Will refresh in %d seconds", timeout));
+	    set_timer(sub, TIMER_TYPE_UAC_REFRESH, timeout);
+	}
+	
+	/* Find out the state */
+	get_hdr_state(sub_state, &new_state, &new_state_str);
+
+	/* Send response. */
+	status = create_response(sub, rdata, st_code, st_text, &res_hdr,
+				 body, &tdata);
+	if (status == PJ_SUCCESS)
+	    status = pjsip_dlg_send_response(sub->dlg, tsx, tdata);
+
+	/* Set the state */
+	if (status == PJ_SUCCESS) {
+	    set_state(sub, new_state, new_state_str, event, 
+		      &sub_state->reason_param);
+	} else {
+	    char errmsg[PJ_ERR_MSG_SIZE];
+	    pj_str_t reason;
+
+	    reason = pj_strerror(status, errmsg, sizeof(errmsg));
+	    set_state(sub, PJSIP_EVSUB_STATE_TERMINATED, NULL, event, 
+		      &reason);
+	}
+
+
+    } else {
+
+	/*
+	 * Unexpected method!
+	 */
+	PJ_LOG(4,(sub->obj_name, "Unexpected transaction method %.*s",
+		 (int)tsx->method.name.slen, tsx->method.name.ptr));
+    }
+}
+
+
+/*
+ * Transaction event processing by UAS, after subscription is accepted.
+ */
+static void on_tsx_state_uas( pjsip_evsub *sub, pjsip_transaction *tsx,
+			      pjsip_event *event)
+{
+
+    if (pjsip_method_cmp(&tsx->method, &sub->method) == 0 ||
+	pjsip_method_cmp(&tsx->method, &pjsip_subscribe_method) == 0) 
+    {
+	
+	/*
+	 * Incoming request (e.g. SUBSCRIBE or REFER) to refresh subsciption.
+	 *
+	 */
+	pjsip_rx_data *rdata;
+	pjsip_event_hdr *event_hdr;
+	pjsip_expires_hdr *expires;
+	pjsip_msg *msg;
+	pjsip_tx_data *tdata;
+	int st_code = 200;
+	pj_str_t *st_text = NULL;
+	pjsip_hdr res_hdr;
+	pjsip_msg_body *body = NULL;
+	pjsip_evsub_state old_state;
+	pj_str_t old_state_str;
+	pj_str_t reason = { NULL, 0 };
+	pj_status_t status;
+
+
+	/* Only wants to handle the first event when the request is 
+	 * received.
+	 */
+	if (tsx->state != PJSIP_TSX_STATE_TRYING)
+	    return;
+
+	rdata = event->body.tsx_state.src.rdata;
+	msg = rdata->msg_info.msg;
+
+	/* Set expiration time based on client request (in Expires header),
+	 * or package default expiration time.
+	 */
+	event_hdr = (pjsip_event_hdr*)
+		    pjsip_msg_find_hdr_by_names(msg, &STR_EVENT, 
+					        &STR_EVENT, NULL);
+	expires = (pjsip_expires_hdr*)
+		  pjsip_msg_find_hdr(msg, PJSIP_H_EXPIRES, NULL);
+	if (event_hdr && expires) {
+	    struct evpkg *evpkg;
+
+	    evpkg = find_pkg(&event_hdr->event_type);
+	    if (evpkg) {
+		if (expires->ivalue < (pj_int32_t)evpkg->pkg_expires)
+		    sub->expires->ivalue = expires->ivalue;
+		else
+		    sub->expires->ivalue = evpkg->pkg_expires;
+	    }
+	}
+	
+	/* Update time (before calling on_rx_refresh, since application
+	 * will send NOTIFY.
+	 */
+	update_expires(sub, sub->expires->ivalue);
+
+
+	/* Save old state.
+	 * If application respond with non-2xx, revert to old state.
+	 */
+	old_state = sub->state;
+	old_state_str = sub->state_str;
+
+	if (sub->expires->ivalue == 0) {
+	    sub->state = PJSIP_EVSUB_STATE_TERMINATED;
+	    sub->state_str = evsub_state_names[sub->state];
+	} else  if (sub->state == PJSIP_EVSUB_STATE_NULL) {
+	    sub->state = PJSIP_EVSUB_STATE_ACCEPTED;
+	    sub->state_str = evsub_state_names[sub->state];
+	}
+
+	/* Call application's on_rx_refresh, just in case it wants to send
+	 * response other than 200 (OK)
+	 */
+	pj_list_init(&res_hdr);
+
+	if (sub->user.on_rx_refresh && sub->call_cb) {
+	    (*sub->user.on_rx_refresh)(sub, rdata, &st_code, &st_text, 
+				       &res_hdr, &body);
+	}
+
+	/* Application MUST specify final response! */
+	PJ_ASSERT_ON_FAIL(st_code >= 200, {st_code=200; });
+
+	/* Must be a valid status code */
+	PJ_ASSERT_ON_FAIL(st_code <= 699, {st_code=500; });
+
+
+	/* Create and send response */
+	status = create_response(sub, rdata, st_code, st_text, &res_hdr,
+				 body, &tdata);
+	if (status == PJ_SUCCESS) {
+	    /* Add expires header: */
+	    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
+			       pjsip_hdr_shallow_clone(tdata->pool, 
+						       sub->expires));
+
+	    /* Send */
+	    status = pjsip_dlg_send_response(sub->dlg, tsx, tdata);
+	}
+
+	/* Update state or revert state */
+	if (st_code/100==2) {
+	    
+	    if (sub->expires->ivalue == 0) {
+		set_state(sub, sub->state, NULL, event, &reason);
+	    } else  if (sub->state == PJSIP_EVSUB_STATE_NULL) {
+		set_state(sub, sub->state, NULL, event, &reason);
+	    }
+
+	    /* Set UAS timeout timer, when state is not terminated. */
+	    if (sub->state != PJSIP_EVSUB_STATE_TERMINATED) {
+		PJ_LOG(5,(sub->obj_name, "UAS timeout in %d seconds",
+			  sub->expires->ivalue));
+		set_timer(sub, TIMER_TYPE_UAS_TIMEOUT, 
+			  sub->expires->ivalue);
+	    }
+
+	}  else {
+	    sub->state = old_state;
+	    sub->state_str = old_state_str;
+	}
+
+
+    } else if (pjsip_method_cmp(&tsx->method, &pjsip_notify_method)==0) {
+
+	/* Handle authentication */ 
+	if (tsx->state == PJSIP_TSX_STATE_COMPLETED &&
+	    (tsx->status_code==401 || tsx->status_code==407))
+	{
+	    pjsip_rx_data *rdata = event->body.tsx_state.src.rdata;
+	    pjsip_tx_data *tdata;
+	    pj_status_t status;
+
+	    status = pjsip_auth_clt_reinit_req( &sub->dlg->auth_sess, rdata, 
+						tsx->last_tx, &tdata);
+	    if (status == PJ_SUCCESS)
+		status = pjsip_dlg_send_request( sub->dlg, tdata, -1, NULL );
+
+	    if (status != PJ_SUCCESS) {
+		/* Can't authenticate. Terminate session (?) */
+		set_state(sub, PJSIP_EVSUB_STATE_TERMINATED, NULL, NULL, 
+			  &tsx->status_text);
+		return;
+	    }
+
+	}
+	/*
+	 * Terminate event usage if we receive 481, 408, and 7 class
+	 * responses.
+	 */
+	if (sub->state != PJSIP_EVSUB_STATE_TERMINATED &&
+	    (tsx->status_code==481 || tsx->status_code==408 ||
+	     tsx->status_code/100 == 7))
+	{
+	    set_state(sub, PJSIP_EVSUB_STATE_TERMINATED, NULL, event,
+		      &tsx->status_text);
+	    return;
+	}
+
+    } else {
+
+	/*
+	 * Unexpected method!
+	 */
+	PJ_LOG(4,(sub->obj_name, "Unexpected transaction method %.*s",
+		 (int)tsx->method.name.slen, tsx->method.name.ptr));
+    
+    }
+}
+
+
+/*
+ * Notification when transaction state has changed!
+ */
+static void mod_evsub_on_tsx_state(pjsip_transaction *tsx, pjsip_event *event)
+{
+    pjsip_evsub *sub = pjsip_tsx_get_evsub(tsx);
+
+    if (sub == NULL) {
+	sub = on_new_transaction(tsx, event);
+	if (sub == NULL)
+	    return;
+    }
+
+
+    /* Call on_tsx_state callback, if any. */
+    if (sub->user.on_tsx_state && sub->call_cb)
+	(*sub->user.on_tsx_state)(sub, tsx, event);
+
+
+    /* Process the event: */
+
+    if (sub->role == PJSIP_ROLE_UAC) {
+	on_tsx_state_uac(sub, tsx, event);
+    } else {
+	on_tsx_state_uas(sub, tsx, event);
+    }
+
+
+    /* Check transaction TERMINATE event */
+    if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
+
+	--sub->pending_tsx;
+
+	if (sub->state == PJSIP_EVSUB_STATE_TERMINATED &&
+	    sub->pending_tsx == 0)
+	{
+	    evsub_destroy(sub);
+	}
+
+    }
+}
+
+
diff --git a/jni/pjproject-android/.svn/pristine/d9/d9d37ac76c323c75cccc408da6f07df091545584.svn-base b/jni/pjproject-android/.svn/pristine/d9/d9d37ac76c323c75cccc408da6f07df091545584.svn-base
new file mode 100644
index 0000000..e10a32e
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/d9/d9d37ac76c323c75cccc408da6f07df091545584.svn-base
@@ -0,0 +1,366 @@
+/* Copyright (C) 2002-2006 Jean-Marc Valin 
+   File: modes.c
+
+   Describes the different modes of the codec
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "modes.h"
+#include "ltp.h"
+#include "quant_lsp.h"
+#include "cb_search.h"
+#include "sb_celp.h"
+#include "nb_celp.h"
+#include "vbr.h"
+#include "arch.h"
+#include <math.h>
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+
+/* Extern declarations for all codebooks we use here */
+extern const signed char gain_cdbk_nb[];
+extern const signed char gain_cdbk_lbr[];
+extern const signed char exc_5_256_table[];
+extern const signed char exc_5_64_table[];
+extern const signed char exc_8_128_table[];
+extern const signed char exc_10_32_table[];
+extern const signed char exc_10_16_table[];
+extern const signed char exc_20_32_table[];
+
+
+/* Parameters for Long-Term Prediction (LTP)*/
+static const ltp_params ltp_params_nb = {
+   gain_cdbk_nb,
+   7,
+   7
+};
+
+/* Parameters for Long-Term Prediction (LTP)*/
+static const ltp_params ltp_params_vlbr = {
+   gain_cdbk_lbr,
+   5,
+   0
+};
+
+/* Parameters for Long-Term Prediction (LTP)*/
+static const ltp_params ltp_params_lbr = {
+   gain_cdbk_lbr,
+   5,
+   7
+};
+
+/* Parameters for Long-Term Prediction (LTP)*/
+static const ltp_params ltp_params_med = {
+   gain_cdbk_lbr,
+   5,
+   7
+};
+
+/* Split-VQ innovation parameters for very low bit-rate narrowband */
+static const split_cb_params split_cb_nb_vlbr = {
+   10,               /*subvect_size*/
+   4,               /*nb_subvect*/
+   exc_10_16_table, /*shape_cb*/
+   4,               /*shape_bits*/
+   0,
+};
+
+/* Split-VQ innovation parameters for very low bit-rate narrowband */
+static const split_cb_params split_cb_nb_ulbr = {
+   20,               /*subvect_size*/
+   2,               /*nb_subvect*/
+   exc_20_32_table, /*shape_cb*/
+   5,               /*shape_bits*/
+   0,
+};
+
+/* Split-VQ innovation parameters for low bit-rate narrowband */
+static const split_cb_params split_cb_nb_lbr = {
+   10,              /*subvect_size*/
+   4,               /*nb_subvect*/
+   exc_10_32_table, /*shape_cb*/
+   5,               /*shape_bits*/
+   0,
+};
+
+
+/* Split-VQ innovation parameters narrowband */
+static const split_cb_params split_cb_nb = {
+   5,               /*subvect_size*/
+   8,               /*nb_subvect*/
+   exc_5_64_table, /*shape_cb*/
+   6,               /*shape_bits*/
+   0,
+};
+
+/* Split-VQ innovation parameters narrowband */
+static const split_cb_params split_cb_nb_med = {
+   8,               /*subvect_size*/
+   5,               /*nb_subvect*/
+   exc_8_128_table, /*shape_cb*/
+   7,               /*shape_bits*/
+   0,
+};
+
+/* Split-VQ innovation for low-band wideband */
+static const split_cb_params split_cb_sb = {
+   5,               /*subvect_size*/
+   8,              /*nb_subvect*/
+   exc_5_256_table,    /*shape_cb*/
+   8,               /*shape_bits*/
+   0,
+};
+
+
+
+/* 2150 bps "vocoder-like" mode for comfort noise */
+static const SpeexSubmode nb_submode1 = {
+   0,
+   1,
+   0,
+   0,
+   /* LSP quantization */
+   lsp_quant_lbr,
+   lsp_unquant_lbr,
+   /* No pitch quantization */
+   forced_pitch_quant,
+   forced_pitch_unquant,
+   NULL,
+   /* No innovation quantization (noise only) */
+   noise_codebook_quant,
+   noise_codebook_unquant,
+   NULL,
+   -1,
+   43
+};
+
+/* 3.95 kbps very low bit-rate mode */
+static const SpeexSubmode nb_submode8 = {
+   0,
+   1,
+   0,
+   0,
+   /*LSP quantization*/
+   lsp_quant_lbr,
+   lsp_unquant_lbr,
+   /*No pitch quantization*/
+   forced_pitch_quant,
+   forced_pitch_unquant,
+   NULL,
+   /*Innovation quantization*/
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
+   &split_cb_nb_ulbr,
+   QCONST16(.5,15),
+   79
+};
+
+/* 5.95 kbps very low bit-rate mode */
+static const SpeexSubmode nb_submode2 = {
+   0,
+   0,
+   0,
+   0,
+   /*LSP quantization*/
+   lsp_quant_lbr,
+   lsp_unquant_lbr,
+   /*No pitch quantization*/
+   pitch_search_3tap,
+   pitch_unquant_3tap,
+   &ltp_params_vlbr,
+   /*Innovation quantization*/
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
+   &split_cb_nb_vlbr,
+   QCONST16(.6,15),
+   119
+};
+
+/* 8 kbps low bit-rate mode */
+static const SpeexSubmode nb_submode3 = {
+   -1,
+   0,
+   1,
+   0,
+   /*LSP quantization*/
+   lsp_quant_lbr,
+   lsp_unquant_lbr,
+   /*Pitch quantization*/
+   pitch_search_3tap,
+   pitch_unquant_3tap,
+   &ltp_params_lbr,
+   /*Innovation quantization*/
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
+   &split_cb_nb_lbr,
+   QCONST16(.55,15),
+   160
+};
+
+/* 11 kbps medium bit-rate mode */
+static const SpeexSubmode nb_submode4 = {
+   -1,
+   0,
+   1,
+   0,
+   /*LSP quantization*/
+   lsp_quant_lbr,
+   lsp_unquant_lbr,
+   /*Pitch quantization*/
+   pitch_search_3tap,
+   pitch_unquant_3tap,
+   &ltp_params_med,
+   /*Innovation quantization*/
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
+   &split_cb_nb_med,
+   QCONST16(.45,15),
+   220
+};
+
+/* 15 kbps high bit-rate mode */
+static const SpeexSubmode nb_submode5 = {
+   -1,
+   0,
+   3,
+   0,
+   /*LSP quantization*/
+   lsp_quant_nb,
+   lsp_unquant_nb,
+   /*Pitch quantization*/
+   pitch_search_3tap,
+   pitch_unquant_3tap,
+   &ltp_params_nb,
+   /*Innovation quantization*/
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
+   &split_cb_nb,
+   QCONST16(.3,15),
+   300
+};
+
+/* 18.2 high bit-rate mode */
+static const SpeexSubmode nb_submode6 = {
+   -1,
+   0,
+   3,
+   0,
+   /*LSP quantization*/
+   lsp_quant_nb,
+   lsp_unquant_nb,
+   /*Pitch quantization*/
+   pitch_search_3tap,
+   pitch_unquant_3tap,
+   &ltp_params_nb,
+   /*Innovation quantization*/
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
+   &split_cb_sb,
+   QCONST16(.2,15),
+   364
+};
+
+/* 24.6 kbps high bit-rate mode */
+static const SpeexSubmode nb_submode7 = {
+   -1,
+   0,
+   3,
+   1,
+   /*LSP quantization*/
+   lsp_quant_nb,
+   lsp_unquant_nb,
+   /*Pitch quantization*/
+   pitch_search_3tap,
+   pitch_unquant_3tap,
+   &ltp_params_nb,
+   /*Innovation quantization*/
+   split_cb_search_shape_sign,
+   split_cb_shape_sign_unquant,
+   &split_cb_nb,
+   QCONST16(.1,15),
+   492
+};
+
+
+/* Default mode for narrowband */
+static const SpeexNBMode nb_mode = {
+   160,    /*frameSize*/
+   40,     /*subframeSize*/
+   10,     /*lpcSize*/
+   17,     /*pitchStart*/
+   144,    /*pitchEnd*/
+#ifdef FIXED_POINT
+   29491, 19661, /* gamma1, gamma2 */
+#else
+   0.9, 0.6, /* gamma1, gamma2 */
+#endif
+   QCONST16(.0002,15), /*lpc_floor*/
+   {NULL, &nb_submode1, &nb_submode2, &nb_submode3, &nb_submode4, &nb_submode5, &nb_submode6, &nb_submode7,
+   &nb_submode8, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+   5,
+   {1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7}
+};
+
+
+/* Default mode for narrowband */
+EXPORT const SpeexMode speex_nb_mode = {
+   &nb_mode,
+   nb_mode_query,
+   "narrowband",
+   0,
+   4,
+   &nb_encoder_init,
+   &nb_encoder_destroy,
+   &nb_encode,
+   &nb_decoder_init,
+   &nb_decoder_destroy,
+   &nb_decode,
+   &nb_encoder_ctl,
+   &nb_decoder_ctl,
+};
+
+
+
+EXPORT int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
+{
+   return mode->query(mode->mode, request, ptr);
+}
+
+#ifdef FIXED_DEBUG
+long long spx_mips=0;
+#endif
+