* #36737: switch back to svn repo, remove assert in sip_transaction.c
diff --git a/jni/pjproject-android/.svn/pristine/b3/b326efb443e8984b2e3d6e36e0c59f991c353250.svn-base b/jni/pjproject-android/.svn/pristine/b3/b326efb443e8984b2e3d6e36e0c59f991c353250.svn-base
new file mode 100644
index 0000000..190eb00
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/b3/b326efb443e8984b2e3d6e36e0c59f991c353250.svn-base
@@ -0,0 +1,80 @@
+
+   /******************************************************************
+
+       iLBC Speech Coder ANSI-C Source Code
+
+       syntFilter.c
+
+       Copyright (C) The Internet Society (2004).
+       All Rights Reserved.
+
+   ******************************************************************/
+
+   #include "iLBC_define.h"
+
+   /*----------------------------------------------------------------*
+    *  LP synthesis filter.
+    *---------------------------------------------------------------*/
+
+   void syntFilter(
+       float *Out,     /* (i/o) Signal to be filtered */
+       float *a,       /* (i) LP parameters */
+       int len,    /* (i) Length of signal */
+
+
+
+
+
+       float *mem      /* (i/o) Filter state */
+   ){
+       int i, j;
+       float *po, *pi, *pa, *pm;
+
+       po=Out;
+
+       /* Filter first part using memory from past */
+
+       for (i=0; i<LPC_FILTERORDER; i++) {
+           pi=&Out[i-1];
+           pa=&a[1];
+           pm=&mem[LPC_FILTERORDER-1];
+           for (j=1; j<=i; j++) {
+               *po-=(*pa++)*(*pi--);
+           }
+           for (j=i+1; j<LPC_FILTERORDER+1; j++) {
+               *po-=(*pa++)*(*pm--);
+           }
+           po++;
+       }
+
+       /* Filter last part where the state is entirely in
+          the output vector */
+
+       for (i=LPC_FILTERORDER; i<len; i++) {
+           pi=&Out[i-1];
+           pa=&a[1];
+           for (j=1; j<LPC_FILTERORDER+1; j++) {
+               *po-=(*pa++)*(*pi--);
+           }
+           po++;
+       }
+
+       /* Update state vector */
+
+       memcpy(mem, &Out[len-LPC_FILTERORDER],
+           LPC_FILTERORDER*sizeof(float));
+   }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jni/pjproject-android/.svn/pristine/b3/b363e3edbb6512838f527bf66f45671035b41eab.svn-base b/jni/pjproject-android/.svn/pristine/b3/b363e3edbb6512838f527bf66f45671035b41eab.svn-base
new file mode 100644
index 0000000..bb23112
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/b3/b363e3edbb6512838f527bf66f45671035b41eab.svn-base
@@ -0,0 +1,540 @@
+/* $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 <pjlib.h>
+#include <pjlib-util.h>
+#include <pjmedia.h>
+#include <pjmedia-codec.h>
+
+static const char *USAGE =
+"pcaputil [options] INPUT OUTPUT\n"
+"\n"
+"  Convert captured RTP packets in PCAP file to WAV file or play it\n"
+"  to audio device.\n"
+"\n"
+"  INPUT  is the PCAP file name/path.\n"
+"  OUTPUT is the WAV file name/path to store the output, or set to \"-\",\n"
+"         to play the output to audio device. The program will decode\n"
+"         the RTP contents using codec that is available in PJMEDIA,\n"
+"         and optionally decrypt the content using the SRTP crypto and\n"
+"         keys below.\n"
+"\n"
+"Options to filter packets from PCAP file:\n"
+"(you can always select the relevant packets from Wireshark of course!)\n"
+"  --src-ip=IP            Only include packets from this source address\n"
+"  --dst-ip=IP            Only include packets destined to this address\n"
+"  --src-port=port        Only include packets from this source port number\n"
+"  --dst-port=port        Only include packets destined to this port number\n"
+"\n"
+"Options for RTP packet processing:\n"
+""
+"  --codec=codec_id	  The codec ID formatted \"name/clock-rate/channel-count\"\n"
+"                         must be specified for codec with dynamic PT,\n"
+"                         e.g: \"Speex/8000\"\n"
+"  --srtp-crypto=TAG, -c  Set crypto to be used to decrypt SRTP packets. Valid\n"
+"                         tags are: \n"
+"                           AES_CM_128_HMAC_SHA1_80 \n"
+"                           AES_CM_128_HMAC_SHA1_32\n"
+"  --srtp-key=KEY, -k     Set the base64 key to decrypt SRTP packets.\n"
+"\n"
+"Options for playing to audio device:\n"
+""
+"  --play-dev-id=dev_id   Audio device ID for playback.\n"
+"\n"
+"  Example:\n"
+"    pcaputil file.pcap output.wav\n"
+"    pcaputil -c AES_CM_128_HMAC_SHA1_80 \\\n"
+"             -k VLDONbsbGl2Puqy+0PV7w/uGfpSPKFevDpxGsxN3 \\\n"
+"             file.pcap output.wav\n"
+"\n"
+;
+
+static struct app
+{
+    pj_caching_pool	 cp;
+    pj_pool_t		*pool;
+    pjmedia_endpt	*mept;
+    pj_pcap_file	*pcap;
+    pjmedia_port	*wav;
+    pjmedia_codec	*codec;
+    pjmedia_aud_stream  *aud_strm;
+    unsigned		 pt;
+    pjmedia_transport	*srtp;
+    pjmedia_rtp_session	 rtp_sess;
+    pj_bool_t		 rtp_sess_init;
+} app;
+
+
+static void cleanup()
+{
+    if (app.srtp) pjmedia_transport_close(app.srtp);
+    if (app.wav) {
+        pj_ssize_t pos = pjmedia_wav_writer_port_get_pos(app.wav);
+        if (pos >= 0) {
+            unsigned msec;
+            msec = (unsigned)pos / 2 * 1000 / PJMEDIA_PIA_SRATE(&app.wav->info);
+            printf("Written: %dm:%02ds.%03d\n",
+                    msec / 1000 / 60,
+                    (msec / 1000) % 60,
+                    msec % 1000);
+        }
+	pjmedia_port_destroy(app.wav);
+    }
+    if (app.pcap) pj_pcap_close(app.pcap);
+    if (app.codec) {
+	pjmedia_codec_mgr *cmgr;
+	pjmedia_codec_close(app.codec);
+	cmgr = pjmedia_endpt_get_codec_mgr(app.mept);
+	pjmedia_codec_mgr_dealloc_codec(cmgr, app.codec);
+    }
+    if (app.aud_strm) {
+	pjmedia_aud_stream_stop(app.aud_strm);
+	pjmedia_aud_stream_destroy(app.aud_strm);
+    }
+    if (app.mept) pjmedia_endpt_destroy(app.mept);
+    if (app.pool) pj_pool_release(app.pool);
+    pj_caching_pool_destroy(&app.cp);
+    pj_shutdown();
+}
+
+static void err_exit(const char *title, pj_status_t status)
+{
+    if (status != PJ_SUCCESS) {
+	char errmsg[PJ_ERR_MSG_SIZE];
+	pj_strerror(status, errmsg, sizeof(errmsg));
+	printf("Error: %s: %s\n", title, errmsg);
+    } else {
+	printf("Error: %s\n", title);
+    }
+    cleanup();
+    exit(1);
+}
+
+#define T(op)	    do { \
+			status = op; \
+			if (status != PJ_SUCCESS) \
+    			    err_exit(#op, status); \
+		    } while (0)
+
+
+static void read_rtp(pj_uint8_t *buf, pj_size_t bufsize,
+		     pjmedia_rtp_hdr **rtp,
+		     pj_uint8_t **payload,
+		     unsigned *payload_size,
+		     pj_bool_t check_pt)
+{
+    pj_status_t status;
+
+    /* Init RTP session */
+    if (!app.rtp_sess_init) {
+	T(pjmedia_rtp_session_init(&app.rtp_sess, 0, 0));
+	app.rtp_sess_init = PJ_TRUE;
+    }
+
+    /* Loop reading until we have a good RTP packet */
+    for (;;) {
+	pj_size_t sz = bufsize;
+	const pjmedia_rtp_hdr *r;
+	const void *p;
+	pjmedia_rtp_status seq_st;
+
+	status = pj_pcap_read_udp(app.pcap, NULL, buf, &sz);
+	if (status != PJ_SUCCESS)
+	    err_exit("Error reading PCAP file", status);
+
+	/* Decode RTP packet to make sure that this is an RTP packet.
+	 * We will decode it again to get the payload after we do
+	 * SRTP decoding
+	 */
+	status = pjmedia_rtp_decode_rtp(&app.rtp_sess, buf, (int)sz, &r, 
+					&p, payload_size);
+	if (status != PJ_SUCCESS) {
+	    char errmsg[PJ_ERR_MSG_SIZE];
+	    pj_strerror(status, errmsg, sizeof(errmsg));
+	    printf("Not RTP packet, skipping packet: %s\n", errmsg);
+	    continue;
+	}
+
+	/* Decrypt SRTP */
+#if PJMEDIA_HAS_SRTP
+	if (app.srtp) {
+	    int len = (int)sz;
+	    status = pjmedia_transport_srtp_decrypt_pkt(app.srtp, PJ_TRUE, 
+						        buf, &len);
+	    if (status != PJ_SUCCESS) {
+		char errmsg[PJ_ERR_MSG_SIZE];
+		pj_strerror(status, errmsg, sizeof(errmsg));
+		printf("SRTP packet decryption failed, skipping packet: %s\n", 
+			errmsg);
+		continue;
+	    }
+	    sz = len;
+
+	    /* Decode RTP packet again */
+	    status = pjmedia_rtp_decode_rtp(&app.rtp_sess, buf, (int)sz, &r,
+					    &p, payload_size);
+	    if (status != PJ_SUCCESS) {
+		char errmsg[PJ_ERR_MSG_SIZE];
+		pj_strerror(status, errmsg, sizeof(errmsg));
+		printf("Not RTP packet, skipping packet: %s\n", errmsg);
+		continue;
+	    }
+	}
+#endif
+
+	/* Update RTP session */
+	pjmedia_rtp_session_update2(&app.rtp_sess, r, &seq_st, PJ_FALSE);
+
+	/* Skip out-of-order packet */
+	if (seq_st.diff == 0) {
+	    printf("Skipping out of order packet\n");
+	    continue;
+	}
+
+	/* Skip if payload type is different */
+	if (check_pt && r->pt != app.pt) {
+	    printf("Skipping RTP packet with bad payload type\n");
+	    continue;
+	}
+
+	/* Skip bad packet */
+	if (seq_st.status.flag.bad) {
+	    printf("Skipping bad RTP\n");
+	    continue;
+	}
+
+
+	*rtp = (pjmedia_rtp_hdr*)r;
+	*payload = (pj_uint8_t*)p;
+
+	/* We have good packet */
+	break;
+    }
+}
+
+pjmedia_frame play_frm;
+static pj_bool_t play_frm_copied, play_frm_ready;
+
+static pj_status_t wait_play(pjmedia_frame *f)
+{
+    play_frm_copied = PJ_FALSE;
+    play_frm = *f;
+    play_frm_ready = PJ_TRUE;
+    while (!play_frm_copied) {
+	pj_thread_sleep(1);
+    }
+    play_frm_ready = PJ_FALSE;
+
+    return PJ_SUCCESS;
+}
+
+static pj_status_t play_cb(void *user_data, pjmedia_frame *f)
+{
+    PJ_UNUSED_ARG(user_data);
+
+    if (!play_frm_ready) {
+	PJ_LOG(3, ("play_cb()", "Warning! Play frame not ready")); 
+	return PJ_SUCCESS;
+    }
+
+    pj_memcpy(f->buf, play_frm.buf, play_frm.size);
+    f->size = play_frm.size;
+
+    play_frm_copied = PJ_TRUE;
+    return PJ_SUCCESS;
+}
+
+static void pcap2wav(const pj_str_t *codec,
+		     const pj_str_t *wav_filename,
+		     pjmedia_aud_dev_index dev_id,
+		     const pj_str_t *srtp_crypto,
+		     const pj_str_t *srtp_key)
+{
+    const pj_str_t WAV = {".wav", 4};
+    struct pkt
+    {
+	pj_uint8_t	 buffer[320];
+	pjmedia_rtp_hdr	*rtp;
+	pj_uint8_t	*payload;
+	unsigned	 payload_len;
+    } pkt0;
+    pjmedia_codec_mgr *cmgr;
+    const pjmedia_codec_info *ci;
+    pjmedia_codec_param param;
+    unsigned samples_per_frame;
+    pj_status_t status;
+
+    /* Initialize all codecs */
+    T( pjmedia_codec_register_audio_codecs(app.mept, NULL) );
+
+    /* Create SRTP transport is needed */
+#if PJMEDIA_HAS_SRTP
+    if (srtp_crypto->slen) {
+	pjmedia_srtp_crypto crypto;
+
+	pj_bzero(&crypto, sizeof(crypto));
+	crypto.key = *srtp_key;
+	crypto.name = *srtp_crypto;
+	T( pjmedia_transport_srtp_create(app.mept, NULL, NULL, &app.srtp) );
+	T( pjmedia_transport_srtp_start(app.srtp, &crypto, &crypto) );
+    }
+#else
+    PJ_UNUSED_ARG(srtp_crypto);
+    PJ_UNUSED_ARG(srtp_key);
+#endif
+
+    /* Read first packet */
+    read_rtp(pkt0.buffer, sizeof(pkt0.buffer), &pkt0.rtp, 
+	     &pkt0.payload, &pkt0.payload_len, PJ_FALSE);
+
+    cmgr = pjmedia_endpt_get_codec_mgr(app.mept);
+
+    /* Get codec info and param for the specified payload type */
+    app.pt = pkt0.rtp->pt;
+    if (app.pt >=0 && app.pt < 96) {
+	T( pjmedia_codec_mgr_get_codec_info(cmgr, pkt0.rtp->pt, &ci) );
+    } else {
+	unsigned cnt = 2;
+	const pjmedia_codec_info *info[2];
+	T( pjmedia_codec_mgr_find_codecs_by_id(cmgr, codec, &cnt, 
+					       info, NULL) );
+	if (cnt != 1)
+	    err_exit("Codec ID must be specified and unique!", 0);
+
+	ci = info[0];
+    }
+    T( pjmedia_codec_mgr_get_default_param(cmgr, ci, &param) );
+
+    /* Alloc and init codec */
+    T( pjmedia_codec_mgr_alloc_codec(cmgr, ci, &app.codec) );
+    T( pjmedia_codec_init(app.codec, app.pool) );
+    T( pjmedia_codec_open(app.codec, &param) );
+
+    /* Init audio device or WAV file */
+    samples_per_frame = ci->clock_rate * param.info.frm_ptime / 1000;
+    if (pj_strcmp2(wav_filename, "-") == 0) {
+	pjmedia_aud_param aud_param;
+
+	/* Open audio device */
+	T( pjmedia_aud_dev_default_param(dev_id, &aud_param) );
+	aud_param.dir = PJMEDIA_DIR_PLAYBACK;
+	aud_param.channel_count = ci->channel_cnt;
+	aud_param.clock_rate = ci->clock_rate;
+	aud_param.samples_per_frame = samples_per_frame;
+	T( pjmedia_aud_stream_create(&aud_param, NULL, &play_cb, 
+				     NULL, &app.aud_strm) );
+	T( pjmedia_aud_stream_start(app.aud_strm) );
+    } else if (pj_stristr(wav_filename, &WAV)) {
+	/* Open WAV file */
+	T( pjmedia_wav_writer_port_create(app.pool, wav_filename->ptr,
+					  ci->clock_rate, ci->channel_cnt,
+					  samples_per_frame,
+					  param.info.pcm_bits_per_sample, 0, 0,
+					  &app.wav) );
+    } else {
+	err_exit("invalid output file", PJ_EINVAL);
+    }
+
+    /* Loop reading PCAP and writing WAV file */
+    for (;;) {
+	struct pkt pkt1;
+	pj_timestamp ts;
+	pjmedia_frame frames[16], pcm_frame;
+	short pcm[320];
+	unsigned i, frame_cnt;
+	long samples_cnt, ts_gap;
+
+	pj_assert(sizeof(pcm) >= samples_per_frame);
+
+	/* Parse first packet */
+	ts.u64 = 0;
+	frame_cnt = PJ_ARRAY_SIZE(frames);
+	T( pjmedia_codec_parse(app.codec, pkt0.payload, pkt0.payload_len, 
+				&ts, &frame_cnt, frames) );
+
+	/* Decode and write to WAV file */
+	samples_cnt = 0;
+	for (i=0; i<frame_cnt; ++i) {
+	    pjmedia_frame pcm_frame;
+
+	    pcm_frame.buf = pcm;
+	    pcm_frame.size = samples_per_frame * 2;
+
+	    T( pjmedia_codec_decode(app.codec, &frames[i], 
+				    (unsigned)pcm_frame.size, &pcm_frame) );
+	    if (app.wav) {
+		T( pjmedia_port_put_frame(app.wav, &pcm_frame) );
+	    }
+	    if (app.aud_strm) {
+		T( wait_play(&pcm_frame) );
+	    }
+	    samples_cnt += samples_per_frame;
+	}
+
+	/* Read next packet */
+	read_rtp(pkt1.buffer, sizeof(pkt1.buffer), &pkt1.rtp,
+		 &pkt1.payload, &pkt1.payload_len, PJ_TRUE);
+
+	/* Fill in the gap (if any) between pkt0 and pkt1 */
+	ts_gap = pj_ntohl(pkt1.rtp->ts) - pj_ntohl(pkt0.rtp->ts) -
+		 samples_cnt;
+	while (ts_gap >= (long)samples_per_frame) {
+
+	    pcm_frame.buf = pcm;
+	    pcm_frame.size = samples_per_frame * 2;
+
+	    if (app.codec->op->recover) {
+		T( pjmedia_codec_recover(app.codec, (unsigned)pcm_frame.size, 
+					 &pcm_frame) );
+	    } else {
+		pj_bzero(pcm_frame.buf, pcm_frame.size);
+	    }
+
+	    if (app.wav) {
+		T( pjmedia_port_put_frame(app.wav, &pcm_frame) );
+	    }
+	    if (app.aud_strm) {
+		T( wait_play(&pcm_frame) );
+	    }
+	    ts_gap -= samples_per_frame;
+	}
+	
+	/* Next */
+	pkt0 = pkt1;
+	pkt0.rtp = (pjmedia_rtp_hdr*)pkt0.buffer;
+	pkt0.payload = pkt0.buffer + (pkt1.payload - pkt1.buffer);
+    }
+}
+
+
+int main(int argc, char *argv[])
+{
+    pj_str_t input, output, srtp_crypto, srtp_key, codec;
+    pjmedia_aud_dev_index dev_id = PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV;
+    pj_pcap_filter filter;
+    pj_status_t status;
+
+    enum { 
+	OPT_SRC_IP = 1, OPT_DST_IP, OPT_SRC_PORT, OPT_DST_PORT,
+	OPT_CODEC, OPT_PLAY_DEV_ID
+    };
+    struct pj_getopt_option long_options[] = {
+	{ "srtp-crypto",    1, 0, 'c' },
+	{ "srtp-key",	    1, 0, 'k' },
+	{ "src-ip",	    1, 0, OPT_SRC_IP },
+	{ "dst-ip",	    1, 0, OPT_DST_IP },
+	{ "src-port",	    1, 0, OPT_SRC_PORT },
+	{ "dst-port",	    1, 0, OPT_DST_PORT },
+	{ "codec",	    1, 0, OPT_CODEC },
+	{ "play-dev-id",    1, 0, OPT_PLAY_DEV_ID },
+	{ NULL, 0, 0, 0}
+    };
+    int c;
+    int option_index;
+    char key_bin[32];
+
+    srtp_crypto.slen = srtp_key.slen = 0;
+    codec.slen = 0;
+
+    pj_pcap_filter_default(&filter);
+    filter.link = PJ_PCAP_LINK_TYPE_ETH;
+    filter.proto = PJ_PCAP_PROTO_TYPE_UDP;
+
+    /* Parse arguments */
+    pj_optind = 0;
+    while((c=pj_getopt_long(argc,argv, "c:k:", long_options, &option_index))!=-1) {
+	switch (c) {
+	case 'c':
+	    srtp_crypto = pj_str(pj_optarg);
+	    break;
+	case 'k':
+	    {
+		int key_len = sizeof(key_bin);
+		srtp_key = pj_str(pj_optarg);
+		if (pj_base64_decode(&srtp_key, (pj_uint8_t*)key_bin, &key_len)) {
+		    puts("Error: invalid key");
+		    return 1;
+		}
+		srtp_key.ptr = key_bin;
+		srtp_key.slen = key_len;
+	    }
+	    break;
+	case OPT_SRC_IP:
+	    {
+		pj_str_t t = pj_str(pj_optarg);
+		pj_in_addr a = pj_inet_addr(&t);
+		filter.ip_src = a.s_addr;
+	    }
+	    break;
+	case OPT_DST_IP:
+	    {
+		pj_str_t t = pj_str(pj_optarg);
+		pj_in_addr a = pj_inet_addr(&t);
+		filter.ip_dst = a.s_addr;
+	    }
+	    break;
+	case OPT_SRC_PORT:
+	    filter.src_port = pj_htons((pj_uint16_t)atoi(pj_optarg));
+	    break;
+	case OPT_DST_PORT:
+	    filter.dst_port = pj_htons((pj_uint16_t)atoi(pj_optarg));
+	    break;
+	case OPT_CODEC:
+	    codec = pj_str(pj_optarg);
+	    break;
+	case OPT_PLAY_DEV_ID:
+	    dev_id = atoi(pj_optarg);
+	    break;
+	default:
+	    puts("Error: invalid option");
+	    return 1;
+	}
+    }
+
+    if (pj_optind != argc - 2) {
+	puts(USAGE);
+	return 1;
+    }
+
+    if (!(srtp_crypto.slen) != !(srtp_key.slen)) {
+	puts("Error: both SRTP crypto and key must be specified");
+	puts(USAGE);
+	return 1;
+    }
+
+    input = pj_str(argv[pj_optind]);
+    output = pj_str(argv[pj_optind+1]);
+    
+    T( pj_init() );
+
+    pj_caching_pool_init(&app.cp, NULL, 0);
+    app.pool = pj_pool_create(&app.cp.factory, "pcaputil", 1000, 1000, NULL);
+
+    T( pjlib_util_init() );
+    T( pjmedia_endpt_create(&app.cp.factory, NULL, 0, &app.mept) );
+
+    T( pj_pcap_open(app.pool, input.ptr, &app.pcap) );
+    T( pj_pcap_set_filter(app.pcap, &filter) );
+
+    pcap2wav(&codec, &output, dev_id, &srtp_crypto, &srtp_key);
+
+    cleanup();
+    return 0;
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/b3/b3648a4cf8c12c0db6c74ebbf2477a2245657b9b.svn-base b/jni/pjproject-android/.svn/pristine/b3/b3648a4cf8c12c0db6c74ebbf2477a2245657b9b.svn-base
new file mode 100644
index 0000000..4d835b7
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/b3/b3648a4cf8c12c0db6c74ebbf2477a2245657b9b.svn-base
@@ -0,0 +1,66 @@
+/* $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 <pj/os.h>
+#include <linux/time.h>
+
+///////////////////////////////////////////////////////////////////////////////
+
+PJ_DEF(pj_status_t) pj_gettimeofday(pj_time_val *tv)
+{
+    struct timeval tval;
+  
+    do_gettimeofday(&tval);
+    tv->sec = tval.tv_sec;
+    tv->msec = tval.tv_usec / 1000;
+
+    return 0;
+}
+
+PJ_DEF(pj_status_t) pj_time_decode(const pj_time_val *tv, pj_parsed_time *pt)
+{
+    pt->year = 2005;
+    pt->mon = 8;
+    pt->day = 20;
+    pt->hour = 16;
+    pt->min = 30;
+    pt->sec = 30;
+    pt->wday = 3;
+    pt->yday = 200;
+    pt->msec = 777;
+
+    return -1;
+}
+
+/**
+ * Encode parsed time to time value.
+ */
+PJ_DEF(pj_status_t) pj_time_encode(const pj_parsed_time *pt, pj_time_val *tv);
+
+/**
+ * Convert local time to GMT.
+ */
+PJ_DEF(pj_status_t) pj_time_local_to_gmt(pj_time_val *tv);
+
+/**
+ * Convert GMT to local time.
+ */
+PJ_DEF(pj_status_t) pj_time_gmt_to_local(pj_time_val *tv);
+
+
diff --git a/jni/pjproject-android/.svn/pristine/b3/b3682c4392047839af9d3528bbb3a5bdd36165ea.svn-base b/jni/pjproject-android/.svn/pristine/b3/b3682c4392047839af9d3528bbb3a5bdd36165ea.svn-base
new file mode 100644
index 0000000..7b45755
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/b3/b3682c4392047839af9d3528bbb3a5bdd36165ea.svn-base
@@ -0,0 +1,26 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=tester
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 4000 RTP/AVP 0 101
+a=rtpmap:0 PCMU/8000
+a=sendrecv
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=crypto:1 CRYPTO_X inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
+include = []
+exclude = ["a=crypto"]
+
+sendto_cfg = sip.SendtoCfg( "caller has used unsupported crypto, callee (SRTP optional) accept the call without crypto", 
+			    pjsua_args=args, sdp=sdp, resp_code=200, 
+			    resp_inc=include, resp_exc=exclude)
diff --git a/jni/pjproject-android/.svn/pristine/b3/b36df47cebce602068ea0366264066f9b8d33078.svn-base b/jni/pjproject-android/.svn/pristine/b3/b36df47cebce602068ea0366264066f9b8d33078.svn-base
new file mode 100644
index 0000000..0ed6f70
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/b3/b36df47cebce602068ea0366264066f9b8d33078.svn-base
@@ -0,0 +1,63 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
+ * details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/table.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */
+
+/*  Most of these tables are inlined at their point of use.
+ */
+
+/*  4.4 TABLES USED IN THE FIXED POINT IMPLEMENTATION OF THE RPE-LTP
+ *      CODER AND DECODER
+ *
+ *	(Most of them inlined, so watch out.)
+ */
+
+#define	GSM_TABLE_C
+#include "private.h"
+#include	"gsm.h"
+
+/*  Table 4.1  Quantization of the Log.-Area Ratios
+ */
+/* i 		     1      2      3        4      5      6        7       8 */
+word gsm_A[8]   = {20480, 20480, 20480,  20480,  13964,  15360,   8534,  9036};
+word gsm_B[8]   = {    0,     0,  2048,  -2560,     94,  -1792,   -341, -1144};
+word gsm_MIC[8] = { -32,   -32,   -16,    -16,     -8,     -8,     -4,    -4 };
+word gsm_MAC[8] = {  31,    31,    15,     15,      7,      7,      3,     3 };
+
+
+/*  Table 4.2  Tabulation  of 1/A[1..8]
+ */
+word gsm_INVA[8]={ 13107, 13107,  13107, 13107,  19223, 17476,  31454, 29708 };
+
+
+/*   Table 4.3a  Decision level of the LTP gain quantizer
+ */
+/*  bc		      0	        1	  2	     3			*/
+word gsm_DLB[4] = {  6554,    16384,	26214,	   32767	};
+
+
+/*   Table 4.3b   Quantization levels of the LTP gain quantizer
+ */
+/* bc		      0          1        2          3			*/
+word gsm_QLB[4] = {  3277,    11469,	21299,	   32767	};
+
+
+/*   Table 4.4	 Coefficients of the weighting filter
+ */
+/* i		    0      1   2    3   4      5      6     7   8   9    10  */
+word gsm_H[11] = {-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 };
+
+
+/*   Table 4.5 	 Normalized inverse mantissa used to compute xM/xmax 
+ */
+/* i		 	0        1    2      3      4      5     6      7   */
+word gsm_NRFAC[8] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 };
+
+
+/*   Table 4.6	 Normalized direct mantissa used to compute xM/xmax
+ */
+/* i                  0      1       2      3      4      5      6      7   */
+word gsm_FAC[8]	= { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 };
diff --git a/jni/pjproject-android/.svn/pristine/b3/b3bbd924f49935c0c79af0881ed0dc160caf3f08.svn-base b/jni/pjproject-android/.svn/pristine/b3/b3bbd924f49935c0c79af0881ed0dc160caf3f08.svn-base
new file mode 100644
index 0000000..ebb364e
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/b3/b3bbd924f49935c0c79af0881ed0dc160caf3f08.svn-base
@@ -0,0 +1,133 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2012-2012 Teluu Inc. (http://www.teluu.com)
+ * Contributed by Regis Montoya (aka r3gis - www.r3gis.fr)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+#ifndef __PJMEDIA_CODEC_SILK_H__
+#define __PJMEDIA_CODEC_SILK_H__
+
+/**
+ * @file silk.h
+ * @brief SILK codec.
+ */
+
+#include <pjmedia-codec/types.h>
+
+/**
+ * @defgroup PJMED_SILK SILK Codec Family
+ * @ingroup PJMEDIA_CODEC_CODECS
+ * @brief Implementation of SILK codecs (narrow/medium/wide/superwide-band).
+ * @{
+ *
+ * This section describes functions to initialize and register SILK codec
+ * factory to the codec manager. After the codec factory has been registered,
+ * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
+ *
+ * The SILK codec uses multiple bit rates, and supports super wideband 
+ * (24 kHz sampling rate), wideband (16 kHz sampling rate), medium (12kHz
+ * sampling rate), and narrowband (telephone quality, 8 kHz sampling rate).
+ *
+ * By default, the SILK codec factory registers two SILK codecs:
+ * "SILK/8000" narrowband codec and "SILK/16000" wideband codec. This behavior
+ * can be changed by specifying #pjmedia_codec_silk_options flags during
+ * initialization.
+ *
+ *
+ * \section codec_setting Codec Settings
+ *
+ * \subsection general_setting General Settings
+ *
+ * General codec settings for this codec such as VAD and PLC can be 
+ * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param. 
+ * Please see the documentation of #pjmedia_codec_param for more info.
+ *
+ * \subsection specific_setting Codec Specific Settings
+ *
+ * The following settings are applicable for this codec.
+ *
+ * \subsubsection quality_vs_complexity Quality vs Complexity
+ *
+ * The SILK codec quality versus computational complexity and bandwidth
+ * requirement can be adjusted by modifying the quality and complexity
+ * setting, by calling #pjmedia_codec_silk_set_config().
+ *
+ * The default setting of quality is specified in 
+ * #PJMEDIA_CODEC_SILK_DEFAULT_QUALITY. And the default setting of
+ * complexity is specified in #PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY.
+ */
+
+PJ_BEGIN_DECL
+
+typedef struct pjmedia_codec_silk_setting
+{
+    pj_bool_t	enabled;    /**< Enable/disable.			    */
+    int		quality;    /**< Encoding quality, or use -1 for default 
+ 				 (@see PJMEDIA_CODEC_SILK_DEFAULT_QUALITY). */
+    int 	complexity; /**< Encoding complexity, or use -1 for default
+			         (@see PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY)*/
+} pjmedia_codec_silk_setting;
+
+
+/**
+ * Initialize and register SILK codec factory to pjmedia endpoint. By default,
+ * only narrowband (8kHz sampling rate) and wideband (16kHz sampling rate)
+ * will be enabled. Quality and complexity for those sampling rate modes
+ * will be set to the default values (see #PJMEDIA_CODEC_SILK_DEFAULT_QUALITY
+ * and #PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY), application may modify these
+ * settings via #pjmedia_codec_silk_set_config().
+ *
+ * @param endpt		The pjmedia endpoint.
+ *
+ * @return		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_codec_silk_init(pjmedia_endpt *endpt);
+
+
+/**
+ * Change the configuration setting of the SILK codec for the specified
+ * clock rate.
+ *
+ * @param clock_rate	PCM sampling rate, in Hz, valid values are 8000,
+ *			12000, 16000 and 24000.
+ * @param opt		The setting to be applied for the specified
+ *			clock rate.
+ *
+ * @return		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_codec_silk_set_config(
+				    unsigned clock_rate, 
+				    const pjmedia_codec_silk_setting *opt);
+
+
+/**
+ * Unregister SILK codec factory from pjmedia endpoint and deinitialize
+ * the SILK codec library.
+ *
+ * @return	    PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_codec_silk_deinit(void);
+
+
+PJ_END_DECL
+
+
+/**
+ * @}
+ */
+
+#endif	/* __PJMEDIA_CODEC_SILK_H__ */
+
diff --git a/jni/pjproject-android/.svn/pristine/b3/b3c1ff68804f4add61b55ea609d0890bbad642a3.svn-base b/jni/pjproject-android/.svn/pristine/b3/b3c1ff68804f4add61b55ea609d0890bbad642a3.svn-base
new file mode 100644
index 0000000..a707a96
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/b3/b3c1ff68804f4add61b55ea609d0890bbad642a3.svn-base
@@ -0,0 +1,263 @@
+/* $Id$ */
+/*
+ * Modified 2/07
+ * By Benny Prijono <benny@prijono.org>
+ * Still 100% Public Domain
+ *
+ * This is the implementation of SHA-1 encryption algorithm based on
+ * Steve Reid work. Modified to work with PJLIB.
+ */
+
+/*
+SHA-1 in C
+By Steve Reid <sreid@sea-to-sky.net>
+100% Public Domain
+
+-----------------
+Modified 7/98 
+By James H. Brown <jbrown@burgoyne.com>
+Still 100% Public Domain
+
+Corrected a problem which generated improper hash values on 16 bit machines
+Routine SHA1Update changed from
+	void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int
+len)
+to
+	void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned
+long len)
+
+The 'len' parameter was declared an int which works fine on 32 bit machines.
+However, on 16 bit machines an int is too small for the shifts being done
+against
+it.  This caused the hash function to generate incorrect values if len was
+greater than 8191 (8K - 1) due to the 'len << 3' on line 3 of SHA1Update().
+
+Since the file IO in main() reads 16K at a time, any file 8K or larger would
+be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million
+"a"s).
+
+I also changed the declaration of variables i & j in SHA1Update to 
+unsigned long from unsigned int for the same reason.
+
+These changes should make no difference to any 32 bit implementations since
+an
+int and a long are the same size in those environments.
+
+--
+I also corrected a few compiler warnings generated by Borland C.
+1. Added #include <process.h> for exit() prototype
+2. Removed unused variable 'j' in SHA1Final
+3. Changed exit(0) to return(0) at end of main.
+
+ALL changes I made can be located by searching for comments containing 'JHB'
+-----------------
+Modified 8/98
+By Steve Reid <sreid@sea-to-sky.net>
+Still 100% public domain
+
+1- Removed #include <process.h> and used return() instead of exit()
+2- Fixed overwriting of finalcount in SHA1Final() (discovered by Chris Hall)
+3- Changed email address from steve@edmweb.com to sreid@sea-to-sky.net
+
+-----------------
+Modified 4/01
+By Saul Kravitz <Saul.Kravitz@celera.com>
+Still 100% PD
+Modified to run on Compaq Alpha hardware.  
+
+-----------------
+Modified 07/2002
+By Ralph Giles <giles@ghostscript.com>
+Still 100% public domain
+modified for use with stdint types, autoconf
+code cleanup, removed attribution comments
+switched SHA1Final() argument order for consistency
+use SHA1_ prefix for public api
+move public api to sha1.h
+*/
+
+/*
+Test Vectors (from FIPS PUB 180-1)
+"abc"
+  A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
+"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
+  84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
+A million repetitions of "a"
+  34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
+*/
+
+/* #define SHA1HANDSOFF  */
+/* blp:
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+
+#include "os_types.h"
+
+#include "sha1.h"
+*/
+#include <pjlib-util/sha1.h>
+#include <pj/string.h>
+
+#undef SHA1HANDSOFF
+
+
+static void SHA1_Transform(pj_uint32_t state[5], pj_uint8_t buffer[64]);
+
+#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
+
+/* blk0() and blk() perform the initial expand. */
+/* I got the idea of expanding during the round function from SSLeay */
+/* FIXME: can we do this in an endian-proof way? */
+/* #ifdef WORDS_BIGENDIAN */
+#if defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN != 0
+#define blk0(i) block->l[i]
+#else
+#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
+    |(rol(block->l[i],8)&0x00FF00FF))
+#endif
+#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
+    ^block->l[(i+2)&15]^block->l[i&15],1))
+
+/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
+#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
+#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
+#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
+#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
+#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
+
+
+/* Hash a single 512-bit block. This is the core of the algorithm. */
+static void SHA1_Transform(pj_uint32_t state[5], pj_uint8_t buffer[64])
+{
+    pj_uint32_t a, b, c, d, e;
+    typedef union {
+        pj_uint8_t c[64];
+        pj_uint32_t l[16];
+    } CHAR64LONG16;
+    CHAR64LONG16* block;
+
+#ifdef SHA1HANDSOFF
+    static pj_uint8_t workspace[64];
+    block = (CHAR64LONG16*)workspace;
+    pj_memcpy(block, buffer, 64);
+#else
+    block = (CHAR64LONG16*)buffer;
+#endif
+
+    /* Copy context->state[] to working vars */
+    a = state[0];
+    b = state[1];
+    c = state[2];
+    d = state[3];
+    e = state[4];
+
+    /* 4 rounds of 20 operations each. Loop unrolled. */
+    R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
+    R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
+    R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
+    R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
+    R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
+    R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
+    R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
+    R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
+    R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
+    R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
+    R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
+    R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
+    R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
+    R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
+    R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
+    R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
+    R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
+    R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
+    R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
+    R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
+
+    /* Add the working vars back into context.state[] */
+    state[0] += a;
+    state[1] += b;
+    state[2] += c;
+    state[3] += d;
+    state[4] += e;
+
+    /* Wipe variables */
+    a = b = c = d = e = 0;
+}
+
+
+/* SHA1Init - Initialize new context */
+PJ_DEF(void) pj_sha1_init(pj_sha1_context* context)
+{
+    /* SHA1 initialization constants */
+    context->state[0] = 0x67452301;
+    context->state[1] = 0xEFCDAB89;
+    context->state[2] = 0x98BADCFE;
+    context->state[3] = 0x10325476;
+    context->state[4] = 0xC3D2E1F0;
+    context->count[0] = context->count[1] = 0;
+}
+
+
+/* Run your data through this. */
+PJ_DEF(void) pj_sha1_update(pj_sha1_context* context, 
+			    const pj_uint8_t* data, const pj_size_t len)
+{
+    pj_size_t i, j;
+
+    j = (context->count[0] >> 3) & 63;
+    if ((context->count[0] += (pj_uint32_t)len << 3) < (len << 3)) 
+	context->count[1]++;
+    context->count[1] += ((pj_uint32_t)len >> 29);
+    if ((j + len) > 63) {
+        pj_memcpy(&context->buffer[j], data, (i = 64-j));
+        SHA1_Transform(context->state, context->buffer);
+        for ( ; i + 63 < len; i += 64) {
+	    pj_uint8_t tmp[64];
+	    pj_memcpy(tmp, data + i, 64);
+            SHA1_Transform(context->state, tmp);
+        }
+        j = 0;
+    }
+    else i = 0;
+    pj_memcpy(&context->buffer[j], &data[i], len - i);
+
+}
+
+
+/* Add padding and return the message digest. */
+PJ_DEF(void) pj_sha1_final(pj_sha1_context* context, 
+			   pj_uint8_t digest[PJ_SHA1_DIGEST_SIZE])
+{
+    pj_uint32_t i;
+    pj_uint8_t  finalcount[8];
+
+    for (i = 0; i < 8; i++) {
+        finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
+         >> ((3-(i & 3)) * 8) ) & 255);  /* Endian independent */
+    }
+    pj_sha1_update(context, (pj_uint8_t *)"\200", 1);
+    while ((context->count[0] & 504) != 448) {
+        pj_sha1_update(context, (pj_uint8_t *)"\0", 1);
+    }
+    pj_sha1_update(context, finalcount, 8);  /* Should cause a SHA1_Transform() */
+    for (i = 0; i < PJ_SHA1_DIGEST_SIZE; i++) {
+        digest[i] = (pj_uint8_t)
+         ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
+    }
+    
+    /* Wipe variables */
+    i = 0;
+    pj_memset(context->buffer, 0, 64);
+    pj_memset(context->state, 0, 20);
+    pj_memset(context->count, 0, 8);
+    pj_memset(finalcount, 0, 8);	/* SWR */
+
+#ifdef SHA1HANDSOFF  /* make SHA1Transform overwrite its own static vars */
+    SHA1_Transform(context->state, context->buffer);
+#endif
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/b3/b3ee4c4bf5662159c96671f55cd4e6c29e5c4f35.svn-base b/jni/pjproject-android/.svn/pristine/b3/b3ee4c4bf5662159c96671f55cd4e6c29e5c4f35.svn-base
new file mode 100644
index 0000000..19695c0
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/b3/b3ee4c4bf5662159c96671f55cd4e6c29e5c4f35.svn-base
@@ -0,0 +1,241 @@
+
+   /******************************************************************
+
+       iLBC Speech Coder ANSI-C Source Code
+
+       LPCencode.c
+
+       Copyright (C) The Internet Society (2004).
+       All Rights Reserved.
+
+   ******************************************************************/
+
+   #include <string.h>
+
+   #include "iLBC_define.h"
+   #include "helpfun.h"
+   #include "lsf.h"
+   #include "constants.h"
+
+
+
+
+
+   /*----------------------------------------------------------------*
+    *  lpc analysis (subrutine to LPCencode)
+    *---------------------------------------------------------------*/
+
+   void SimpleAnalysis(
+       float *lsf,         /* (o) lsf coefficients */
+       float *data,    /* (i) new data vector */
+       iLBC_Enc_Inst_t *iLBCenc_inst
+                           /* (i/o) the encoder state structure */
+   ){
+       int k, is;
+       float temp[BLOCKL_MAX], lp[LPC_FILTERORDER + 1];
+       float lp2[LPC_FILTERORDER + 1];
+       float r[LPC_FILTERORDER + 1];
+
+       is=LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl;
+       memcpy(iLBCenc_inst->lpc_buffer+is,data,
+           iLBCenc_inst->blockl*sizeof(float));
+
+       /* No lookahead, last window is asymmetric */
+
+       for (k = 0; k < iLBCenc_inst->lpc_n; k++) {
+
+           is = LPC_LOOKBACK;
+
+           if (k < (iLBCenc_inst->lpc_n - 1)) {
+               window(temp, lpc_winTbl,
+                   iLBCenc_inst->lpc_buffer, BLOCKL_MAX);
+           } else {
+               window(temp, lpc_asymwinTbl,
+                   iLBCenc_inst->lpc_buffer + is, BLOCKL_MAX);
+           }
+
+           autocorr(r, temp, BLOCKL_MAX, LPC_FILTERORDER);
+           window(r, r, lpc_lagwinTbl, LPC_FILTERORDER + 1);
+
+           levdurb(lp, temp, r, LPC_FILTERORDER);
+           bwexpand(lp2, lp, LPC_CHIRP_SYNTDENUM, LPC_FILTERORDER+1);
+
+           a2lsf(lsf + k*LPC_FILTERORDER, lp2);
+       }
+       is=LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl;
+       memmove(iLBCenc_inst->lpc_buffer,
+           iLBCenc_inst->lpc_buffer+LPC_LOOKBACK+BLOCKL_MAX-is,
+           is*sizeof(float));
+   }
+
+   /*----------------------------------------------------------------*
+
+
+
+
+
+    *  lsf interpolator and conversion from lsf to a coefficients
+    *  (subrutine to SimpleInterpolateLSF)
+    *---------------------------------------------------------------*/
+
+   void LSFinterpolate2a_enc(
+       float *a,       /* (o) lpc coefficients */
+       float *lsf1,/* (i) first set of lsf coefficients */
+       float *lsf2,/* (i) second set of lsf coefficients */
+       float coef,     /* (i) weighting coefficient to use between
+                              lsf1 and lsf2 */
+       long length      /* (i) length of coefficient vectors */
+   ){
+       float  lsftmp[LPC_FILTERORDER];
+
+       interpolate(lsftmp, lsf1, lsf2, coef, length);
+       lsf2a(a, lsftmp);
+   }
+
+   /*----------------------------------------------------------------*
+    *  lsf interpolator (subrutine to LPCencode)
+    *---------------------------------------------------------------*/
+
+   void SimpleInterpolateLSF(
+       float *syntdenum,   /* (o) the synthesis filter denominator
+                                  resulting from the quantized
+                                  interpolated lsf */
+       float *weightdenum, /* (o) the weighting filter denominator
+                                  resulting from the unquantized
+                                  interpolated lsf */
+       float *lsf,         /* (i) the unquantized lsf coefficients */
+       float *lsfdeq,      /* (i) the dequantized lsf coefficients */
+       float *lsfold,      /* (i) the unquantized lsf coefficients of
+                                  the previous signal frame */
+       float *lsfdeqold, /* (i) the dequantized lsf coefficients of
+                                  the previous signal frame */
+       int length,         /* (i) should equate LPC_FILTERORDER */
+       iLBC_Enc_Inst_t *iLBCenc_inst
+                           /* (i/o) the encoder state structure */
+   ){
+       int    i, pos, lp_length;
+       float  lp[LPC_FILTERORDER + 1], *lsf2, *lsfdeq2;
+
+       lsf2 = lsf + length;
+       lsfdeq2 = lsfdeq + length;
+       lp_length = length + 1;
+
+       if (iLBCenc_inst->mode==30) {
+           /* sub-frame 1: Interpolation between old and first
+
+
+
+
+
+              set of lsf coefficients */
+
+           LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq,
+               lsf_weightTbl_30ms[0], length);
+           memcpy(syntdenum,lp,lp_length*sizeof(float));
+           LSFinterpolate2a_enc(lp, lsfold, lsf,
+               lsf_weightTbl_30ms[0], length);
+           bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
+
+           /* sub-frame 2 to 6: Interpolation between first
+              and second set of lsf coefficients */
+
+           pos = lp_length;
+           for (i = 1; i < iLBCenc_inst->nsub; i++) {
+               LSFinterpolate2a_enc(lp, lsfdeq, lsfdeq2,
+                   lsf_weightTbl_30ms[i], length);
+               memcpy(syntdenum + pos,lp,lp_length*sizeof(float));
+
+               LSFinterpolate2a_enc(lp, lsf, lsf2,
+                   lsf_weightTbl_30ms[i], length);
+               bwexpand(weightdenum + pos, lp,
+                   LPC_CHIRP_WEIGHTDENUM, lp_length);
+               pos += lp_length;
+           }
+       }
+       else {
+           pos = 0;
+           for (i = 0; i < iLBCenc_inst->nsub; i++) {
+               LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq,
+                   lsf_weightTbl_20ms[i], length);
+               memcpy(syntdenum+pos,lp,lp_length*sizeof(float));
+               LSFinterpolate2a_enc(lp, lsfold, lsf,
+                   lsf_weightTbl_20ms[i], length);
+               bwexpand(weightdenum+pos, lp,
+                   LPC_CHIRP_WEIGHTDENUM, lp_length);
+               pos += lp_length;
+           }
+       }
+
+       /* update memory */
+
+       if (iLBCenc_inst->mode==30) {
+           memcpy(lsfold, lsf2, length*sizeof(float));
+           memcpy(lsfdeqold, lsfdeq2, length*sizeof(float));
+       }
+       else {
+           memcpy(lsfold, lsf, length*sizeof(float));
+           memcpy(lsfdeqold, lsfdeq, length*sizeof(float));
+
+
+
+
+
+       }
+   }
+
+   /*----------------------------------------------------------------*
+    *  lsf quantizer (subrutine to LPCencode)
+    *---------------------------------------------------------------*/
+
+   void SimplelsfQ(
+       float *lsfdeq,    /* (o) dequantized lsf coefficients
+                              (dimension FILTERORDER) */
+       int *index,     /* (o) quantization index */
+       float *lsf,      /* (i) the lsf coefficient vector to be
+                              quantized (dimension FILTERORDER ) */
+       int lpc_n     /* (i) number of lsf sets to quantize */
+   ){
+       /* Quantize first LSF with memoryless split VQ */
+       SplitVQ(lsfdeq, index, lsf, lsfCbTbl, LSF_NSPLIT,
+           dim_lsfCbTbl, size_lsfCbTbl);
+
+       if (lpc_n==2) {
+           /* Quantize second LSF with memoryless split VQ */
+           SplitVQ(lsfdeq + LPC_FILTERORDER, index + LSF_NSPLIT,
+               lsf + LPC_FILTERORDER, lsfCbTbl, LSF_NSPLIT,
+               dim_lsfCbTbl, size_lsfCbTbl);
+       }
+   }
+
+   /*----------------------------------------------------------------*
+    *  lpc encoder
+    *---------------------------------------------------------------*/
+
+   void LPCencode(
+       float *syntdenum, /* (i/o) synthesis filter coefficients
+                                  before/after encoding */
+       float *weightdenum, /* (i/o) weighting denumerator
+                                  coefficients before/after
+                                  encoding */
+       int *lsf_index,     /* (o) lsf quantization index */
+       float *data,    /* (i) lsf coefficients to quantize */
+       iLBC_Enc_Inst_t *iLBCenc_inst
+                           /* (i/o) the encoder state structure */
+   ){
+       float lsf[LPC_FILTERORDER * LPC_N_MAX];
+       float lsfdeq[LPC_FILTERORDER * LPC_N_MAX];
+       int change=0;
+
+       SimpleAnalysis(lsf, data, iLBCenc_inst);
+       SimplelsfQ(lsfdeq, lsf_index, lsf, iLBCenc_inst->lpc_n);
+
+
+
+
+
+       change=LSF_check(lsfdeq, LPC_FILTERORDER, iLBCenc_inst->lpc_n);
+       SimpleInterpolateLSF(syntdenum, weightdenum,
+           lsf, lsfdeq, iLBCenc_inst->lsfold,
+           iLBCenc_inst->lsfdeqold, LPC_FILTERORDER, iLBCenc_inst);
+   }
+