* #36737: switch back to svn repo, remove assert in sip_transaction.c
diff --git a/jni/pjproject-android/.svn/pristine/de/de076ac5c515836faccb782beb3068e1f65e5de3.svn-base b/jni/pjproject-android/.svn/pristine/de/de076ac5c515836faccb782beb3068e1f65e5de3.svn-base
new file mode 100644
index 0000000..2b85421
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/de076ac5c515836faccb782beb3068e1f65e5de3.svn-base
@@ -0,0 +1,631 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2008-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 <pjsua-lib/pjsua.h>
+#include <pjsua-lib/pjsua_internal.h>
+
+#if defined(PJSUA_MEDIA_HAS_PJMEDIA) && PJSUA_MEDIA_HAS_PJMEDIA != 0
+#  error The PJSUA_MEDIA_HAS_PJMEDIA should be declared as zero
+#endif
+
+
+#define THIS_FILE		"alt_pjsua_aud.c"
+#define UNIMPLEMENTED(func)	PJ_LOG(2,(THIS_FILE, "*** Call to unimplemented function %s ***", #func));
+
+
+/*****************************************************************************
+ * Our dummy codecs. Since we won't use any PJMEDIA codecs, we need to declare
+ * our own codecs and register them to PJMEDIA's codec manager. We just need
+ * the info so that they can be listed in SDP. The encoding and decoding will
+ * happen in your third party media stream and will not use these codecs,
+ * hence the "dummy" name.
+ */
+static struct alt_codec
+{
+    pj_str_t	encoding_name;
+    pj_uint8_t	payload_type;
+    unsigned	clock_rate;
+    unsigned	channel_cnt;
+    unsigned	frm_ptime;
+    unsigned	avg_bps;
+    unsigned	max_bps;
+} codec_list[] =
+{
+    /* G.729 */
+    { { "G729", 4 }, 18, 8000, 1, 10, 8000, 8000 },
+    /* PCMU */
+    { { "PCMU", 4 }, 0, 8000, 1, 10, 64000, 64000 },
+    /* Our proprietary high end low bit rate (5kbps) codec, if you wish */
+    { { "FOO", 3 }, PJMEDIA_RTP_PT_START+0, 16000, 1, 20, 5000, 5000 },
+};
+
+static struct alt_codec_factory
+{
+    pjmedia_codec_factory	base;
+} alt_codec_factory;
+
+static pj_status_t alt_codec_test_alloc( pjmedia_codec_factory *factory,
+                                         const pjmedia_codec_info *id )
+{
+    unsigned i;
+    for (i=0; i<PJ_ARRAY_SIZE(codec_list); ++i) {
+	if (pj_stricmp(&id->encoding_name, &codec_list[i].encoding_name)==0)
+	    return PJ_SUCCESS;
+    }
+    return PJ_ENOTSUP;
+}
+
+static pj_status_t alt_codec_default_attr( pjmedia_codec_factory *factory,
+                                           const pjmedia_codec_info *id,
+                                           pjmedia_codec_param *attr )
+{
+    struct alt_codec *ac;
+    unsigned i;
+
+    PJ_UNUSED_ARG(factory);
+
+    for (i=0; i<PJ_ARRAY_SIZE(codec_list); ++i) {
+	if (pj_stricmp(&id->encoding_name, &codec_list[i].encoding_name)==0)
+	    break;
+    }
+    if (i == PJ_ARRAY_SIZE(codec_list))
+	return PJ_ENOTFOUND;
+
+    ac = &codec_list[i];
+
+    pj_bzero(attr, sizeof(pjmedia_codec_param));
+    attr->info.clock_rate = ac->clock_rate;
+    attr->info.channel_cnt = ac->channel_cnt;
+    attr->info.avg_bps = ac->avg_bps;
+    attr->info.max_bps = ac->max_bps;
+    attr->info.pcm_bits_per_sample = 16;
+    attr->info.frm_ptime = ac->frm_ptime;
+    attr->info.pt = ac->payload_type;
+
+    attr->setting.frm_per_pkt = 1;
+    attr->setting.vad = 1;
+    attr->setting.plc = 1;
+
+    return PJ_SUCCESS;
+}
+
+static pj_status_t alt_codec_enum_codecs(pjmedia_codec_factory *factory,
+					 unsigned *count,
+					 pjmedia_codec_info codecs[])
+{
+    unsigned i;
+
+    for (i=0; i<*count && i<PJ_ARRAY_SIZE(codec_list); ++i) {
+	struct alt_codec *ac = &codec_list[i];
+	pj_bzero(&codecs[i], sizeof(pjmedia_codec_info));
+	codecs[i].encoding_name = ac->encoding_name;
+	codecs[i].pt = ac->payload_type;
+	codecs[i].type = PJMEDIA_TYPE_AUDIO;
+	codecs[i].clock_rate = ac->clock_rate;
+	codecs[i].channel_cnt = ac->channel_cnt;
+    }
+
+    *count = i;
+
+    return PJ_SUCCESS;
+}
+
+static pj_status_t alt_codec_alloc_codec(pjmedia_codec_factory *factory,
+					 const pjmedia_codec_info *id,
+					 pjmedia_codec **p_codec)
+{
+    /* This will never get called since we won't be using this codec */
+    UNIMPLEMENTED(alt_codec_alloc_codec)
+    return PJ_ENOTSUP;
+}
+
+static pj_status_t alt_codec_dealloc_codec( pjmedia_codec_factory *factory,
+                                            pjmedia_codec *codec )
+{
+    /* This will never get called */
+    UNIMPLEMENTED(alt_codec_dealloc_codec)
+    return PJ_ENOTSUP;
+}
+
+static pj_status_t alt_codec_deinit(void)
+{
+    pjmedia_codec_mgr *codec_mgr;
+    codec_mgr = pjmedia_endpt_get_codec_mgr(pjsua_var.med_endpt);
+    return pjmedia_codec_mgr_unregister_factory(codec_mgr,
+                                                &alt_codec_factory.base);
+
+}
+
+static pjmedia_codec_factory_op alt_codec_factory_op =
+{
+    &alt_codec_test_alloc,
+    &alt_codec_default_attr,
+    &alt_codec_enum_codecs,
+    &alt_codec_alloc_codec,
+    &alt_codec_dealloc_codec,
+    &alt_codec_deinit
+};
+
+
+/*****************************************************************************
+ * API
+ */
+
+/* Initialize third party media library. */
+pj_status_t pjsua_aud_subsys_init()
+{
+    pjmedia_codec_mgr *codec_mgr;
+    pj_status_t status;
+
+    /* Register our "dummy" codecs */
+    alt_codec_factory.base.op = &alt_codec_factory_op;
+    codec_mgr = pjmedia_endpt_get_codec_mgr(pjsua_var.med_endpt);
+    status = pjmedia_codec_mgr_register_factory(codec_mgr,
+						&alt_codec_factory.base);
+    if (status != PJ_SUCCESS)
+	return status;
+
+    /* TODO: initialize your evil library here */
+    return PJ_SUCCESS;
+}
+
+/* Start (audio) media library. */
+pj_status_t pjsua_aud_subsys_start(void)
+{
+    /* TODO: */
+    return PJ_SUCCESS;
+}
+
+/* Cleanup and deinitialize third party media library. */
+pj_status_t pjsua_aud_subsys_destroy()
+{
+    /* TODO: */
+    return PJ_SUCCESS;
+}
+
+/* Our callback to receive incoming RTP packets */
+static void aud_rtp_cb(void *user_data, void *pkt, pj_ssize_t size)
+{
+    pjsua_call_media *call_med = (pjsua_call_media*) user_data;
+
+    /* TODO: Do something with the packet */
+    PJ_LOG(4,(THIS_FILE, "RX %d bytes audio RTP packet", (int)size));
+}
+
+/* Our callback to receive RTCP packets */
+static void aud_rtcp_cb(void *user_data, void *pkt, pj_ssize_t size)
+{
+    pjsua_call_media *call_med = (pjsua_call_media*) user_data;
+
+    /* TODO: Do something with the packet here */
+    PJ_LOG(4,(THIS_FILE, "RX %d bytes audio RTCP packet", (int)size));
+}
+
+/* A demo function to send dummy "RTP" packets periodically. You would not
+ * need to have this function in the real app!
+ */
+static void timer_to_send_aud_rtp(void *user_data)
+{
+    pjsua_call_media *call_med = (pjsua_call_media*) user_data;
+    const char *pkt = "Not RTP packet";
+
+    if (!call_med->call || !call_med->call->inv || !call_med->tp) {
+	/* Call has been disconnected. There is race condition here as
+	 * this cb may be called sometime after call has been disconnected */
+	return;
+    }
+
+    pjmedia_transport_send_rtp(call_med->tp, pkt, strlen(pkt));
+
+    pjsua_schedule_timer2(&timer_to_send_aud_rtp, call_med, 2000);
+}
+
+static void timer_to_send_aud_rtcp(void *user_data)
+{
+    pjsua_call_media *call_med = (pjsua_call_media*) user_data;
+    const char *pkt = "Not RTCP packet";
+
+    if (!call_med->call || !call_med->call->inv || !call_med->tp) {
+	/* Call has been disconnected. There is race condition here as
+	 * this cb may be called sometime after call has been disconnected */
+	return;
+    }
+
+    pjmedia_transport_send_rtcp(call_med->tp, pkt, strlen(pkt));
+
+    pjsua_schedule_timer2(&timer_to_send_aud_rtcp, call_med, 5000);
+}
+
+/* Stop the audio stream of a call. */
+void pjsua_aud_stop_stream(pjsua_call_media *call_med)
+{
+    /* Detach our RTP/RTCP callbacks from transport */
+    pjmedia_transport_detach(call_med->tp, call_med);
+
+    /* TODO: destroy your audio stream here */
+}
+
+/*
+ * This function is called whenever SDP negotiation has completed
+ * successfully. Here you'd want to start your audio stream
+ * based on the info in the SDPs.
+ */
+pj_status_t pjsua_aud_channel_update(pjsua_call_media *call_med,
+                                     pj_pool_t *tmp_pool,
+                                     pjmedia_stream_info *si,
+				     const pjmedia_sdp_session *local_sdp,
+				     const pjmedia_sdp_session *remote_sdp)
+{
+    pj_status_t status = PJ_SUCCESS;
+
+    PJ_LOG(4,(THIS_FILE,"Alt audio channel update.."));
+    pj_log_push_indent();
+
+    /* Check if no media is active */
+    if (si->dir != PJMEDIA_DIR_NONE) {
+	/* Attach our RTP and RTCP callbacks to the media transport */
+	status = pjmedia_transport_attach(call_med->tp, call_med,
+	                                  &si->rem_addr, &si->rem_rtcp,
+	                                  pj_sockaddr_get_len(&si->rem_addr),
+	                                  &aud_rtp_cb, &aud_rtcp_cb);
+
+	/* For a demonstration, let's use a timer to send "RTP" packet
+	 * periodically.
+	 */
+	pjsua_schedule_timer2(&timer_to_send_aud_rtp, call_med, 0);
+	pjsua_schedule_timer2(&timer_to_send_aud_rtcp, call_med, 2500);
+
+	/* TODO:
+	 *   - Create and start your media stream based on the parameters
+	 *     in si
+	 */
+    }
+
+on_return:
+    pj_log_pop_indent();
+    return status;
+}
+
+void pjsua_check_snd_dev_idle()
+{
+}
+
+/*****************************************************************************
+ *
+ * Call API which MAY need to be re-implemented if different backend is used.
+ */
+
+/* Check if call has an active media session. */
+PJ_DEF(pj_bool_t) pjsua_call_has_media(pjsua_call_id call_id)
+{
+    UNIMPLEMENTED(pjsua_call_has_media)
+    return PJ_TRUE;
+}
+
+
+/* Get the conference port identification associated with the call. */
+PJ_DEF(pjsua_conf_port_id) pjsua_call_get_conf_port(pjsua_call_id call_id)
+{
+    UNIMPLEMENTED(pjsua_call_get_conf_port)
+    return PJSUA_INVALID_ID;
+}
+
+/* Get media stream info for the specified media index. */
+PJ_DEF(pj_status_t) pjsua_call_get_stream_info( pjsua_call_id call_id,
+                                                unsigned med_idx,
+                                                pjsua_stream_info *psi)
+{
+    pj_bzero(psi, sizeof(*psi));
+    UNIMPLEMENTED(pjsua_call_get_stream_info)
+    return PJ_ENOTSUP;
+}
+
+/* Get media stream statistic for the specified media index.  */
+PJ_DEF(pj_status_t) pjsua_call_get_stream_stat( pjsua_call_id call_id,
+                                                unsigned med_idx,
+                                                pjsua_stream_stat *stat)
+{
+    pj_bzero(stat, sizeof(*stat));
+    UNIMPLEMENTED(pjsua_call_get_stream_stat)
+    return PJ_ENOTSUP;
+}
+
+/*
+ * Send DTMF digits to remote using RFC 2833 payload formats.
+ */
+PJ_DEF(pj_status_t) pjsua_call_dial_dtmf( pjsua_call_id call_id,
+					  const pj_str_t *digits)
+{
+    UNIMPLEMENTED(pjsua_call_dial_dtmf)
+    return PJ_ENOTSUP;
+}
+
+/*****************************************************************************
+ * Below are auxiliary API that we don't support (feel free to implement them
+ * with the other media stack)
+ */
+
+/* Get maximum number of conference ports. */
+PJ_DEF(unsigned) pjsua_conf_get_max_ports(void)
+{
+    UNIMPLEMENTED(pjsua_conf_get_max_ports)
+    return 0xFF;
+}
+
+/* Get current number of active ports in the bridge. */
+PJ_DEF(unsigned) pjsua_conf_get_active_ports(void)
+{
+    UNIMPLEMENTED(pjsua_conf_get_active_ports)
+    return 0;
+}
+
+/* Enumerate all conference ports. */
+PJ_DEF(pj_status_t) pjsua_enum_conf_ports(pjsua_conf_port_id id[],
+					  unsigned *count)
+{
+    *count = 0;
+    UNIMPLEMENTED(pjsua_enum_conf_ports)
+    return PJ_ENOTSUP;
+}
+
+/* Get information about the specified conference port */
+PJ_DEF(pj_status_t) pjsua_conf_get_port_info( pjsua_conf_port_id id,
+					      pjsua_conf_port_info *info)
+{
+    UNIMPLEMENTED(pjsua_conf_get_port_info)
+    return PJ_ENOTSUP;
+}
+
+/* Add arbitrary media port to PJSUA's conference bridge. */
+PJ_DEF(pj_status_t) pjsua_conf_add_port( pj_pool_t *pool,
+					 pjmedia_port *port,
+					 pjsua_conf_port_id *p_id)
+{
+    *p_id = PJSUA_INVALID_ID;
+    UNIMPLEMENTED(pjsua_conf_add_port)
+    /* We should return PJ_ENOTSUP here, but this API is needed by pjsua
+     * application or otherwise it will refuse to start.
+     */
+    return PJ_SUCCESS;
+}
+
+/* Remove arbitrary slot from the conference bridge. */
+PJ_DEF(pj_status_t) pjsua_conf_remove_port(pjsua_conf_port_id id)
+{
+    UNIMPLEMENTED(pjsua_conf_remove_port)
+    return PJ_ENOTSUP;
+}
+
+/* Establish unidirectional media flow from souce to sink. */
+PJ_DEF(pj_status_t) pjsua_conf_connect( pjsua_conf_port_id source,
+					pjsua_conf_port_id sink)
+{
+    UNIMPLEMENTED(pjsua_conf_connect)
+    return PJ_ENOTSUP;
+}
+
+/* Disconnect media flow from the source to destination port. */
+PJ_DEF(pj_status_t) pjsua_conf_disconnect( pjsua_conf_port_id source,
+					   pjsua_conf_port_id sink)
+{
+    UNIMPLEMENTED(pjsua_conf_disconnect)
+    return PJ_ENOTSUP;
+}
+
+/* Adjust the signal level to be transmitted from the bridge to the
+ * specified port by making it louder or quieter.
+ */
+PJ_DEF(pj_status_t) pjsua_conf_adjust_tx_level(pjsua_conf_port_id slot,
+					       float level)
+{
+    UNIMPLEMENTED(pjsua_conf_adjust_tx_level)
+    return PJ_ENOTSUP;
+}
+
+/* Adjust the signal level to be received from the specified port (to
+ * the bridge) by making it louder or quieter.
+ */
+PJ_DEF(pj_status_t) pjsua_conf_adjust_rx_level(pjsua_conf_port_id slot,
+					       float level)
+{
+    UNIMPLEMENTED(pjsua_conf_adjust_rx_level)
+    return PJ_ENOTSUP;
+}
+
+
+/* Get last signal level transmitted to or received from the specified port. */
+PJ_DEF(pj_status_t) pjsua_conf_get_signal_level(pjsua_conf_port_id slot,
+						unsigned *tx_level,
+						unsigned *rx_level)
+{
+    UNIMPLEMENTED(pjsua_conf_get_signal_level)
+    return PJ_ENOTSUP;
+}
+
+/* Create a file player, and automatically connect this player to
+ * the conference bridge.
+ */
+PJ_DEF(pj_status_t) pjsua_player_create( const pj_str_t *filename,
+					 unsigned options,
+					 pjsua_player_id *p_id)
+{
+    UNIMPLEMENTED(pjsua_player_create)
+    return PJ_ENOTSUP;
+}
+
+/* Create a file playlist media port, and automatically add the port
+ * to the conference bridge.
+ */
+PJ_DEF(pj_status_t) pjsua_playlist_create( const pj_str_t file_names[],
+					   unsigned file_count,
+					   const pj_str_t *label,
+					   unsigned options,
+					   pjsua_player_id *p_id)
+{
+    UNIMPLEMENTED(pjsua_playlist_create)
+    return PJ_ENOTSUP;
+}
+
+/* Get conference port ID associated with player. */
+PJ_DEF(pjsua_conf_port_id) pjsua_player_get_conf_port(pjsua_player_id id)
+{
+    UNIMPLEMENTED(pjsua_player_get_conf_port)
+    return -1;
+}
+
+/* Get the media port for the player. */
+PJ_DEF(pj_status_t) pjsua_player_get_port( pjsua_player_id id,
+					   pjmedia_port **p_port)
+{
+    UNIMPLEMENTED(pjsua_player_get_port)
+    return PJ_ENOTSUP;
+}
+
+/* Set playback position. */
+PJ_DEF(pj_status_t) pjsua_player_set_pos( pjsua_player_id id,
+					  pj_uint32_t samples)
+{
+    UNIMPLEMENTED(pjsua_player_set_pos)
+    return PJ_ENOTSUP;
+}
+
+/* Close the file, remove the player from the bridge, and free
+ * resources associated with the file player.
+ */
+PJ_DEF(pj_status_t) pjsua_player_destroy(pjsua_player_id id)
+{
+    UNIMPLEMENTED(pjsua_player_destroy)
+    return PJ_ENOTSUP;
+}
+
+/* Create a file recorder, and automatically connect this recorder to
+ * the conference bridge.
+ */
+PJ_DEF(pj_status_t) pjsua_recorder_create( const pj_str_t *filename,
+					   unsigned enc_type,
+					   void *enc_param,
+					   pj_ssize_t max_size,
+					   unsigned options,
+					   pjsua_recorder_id *p_id)
+{
+    UNIMPLEMENTED(pjsua_recorder_create)
+    return PJ_ENOTSUP;
+}
+
+
+/* Get conference port associated with recorder. */
+PJ_DEF(pjsua_conf_port_id) pjsua_recorder_get_conf_port(pjsua_recorder_id id)
+{
+    UNIMPLEMENTED(pjsua_recorder_get_conf_port)
+    return -1;
+}
+
+/* Get the media port for the recorder. */
+PJ_DEF(pj_status_t) pjsua_recorder_get_port( pjsua_recorder_id id,
+					     pjmedia_port **p_port)
+{
+    UNIMPLEMENTED(pjsua_recorder_get_port)
+    return PJ_ENOTSUP;
+}
+
+/* Destroy recorder (this will complete recording). */
+PJ_DEF(pj_status_t) pjsua_recorder_destroy(pjsua_recorder_id id)
+{
+    UNIMPLEMENTED(pjsua_recorder_destroy)
+    return PJ_ENOTSUP;
+}
+
+/* Enum sound devices. */
+PJ_DEF(pj_status_t) pjsua_enum_aud_devs( pjmedia_aud_dev_info info[],
+					 unsigned *count)
+{
+    UNIMPLEMENTED(pjsua_enum_aud_devs)
+    return PJ_ENOTSUP;
+}
+
+PJ_DEF(pj_status_t) pjsua_enum_snd_devs( pjmedia_snd_dev_info info[],
+					 unsigned *count)
+{
+    UNIMPLEMENTED(pjsua_enum_snd_devs)
+    return PJ_ENOTSUP;
+}
+
+/* Select or change sound device. */
+PJ_DEF(pj_status_t) pjsua_set_snd_dev( int capture_dev, int playback_dev)
+{
+    UNIMPLEMENTED(pjsua_set_snd_dev)
+    return PJ_SUCCESS;
+}
+
+/* Get currently active sound devices. */
+PJ_DEF(pj_status_t) pjsua_get_snd_dev(int *capture_dev, int *playback_dev)
+{
+    *capture_dev = *playback_dev = PJSUA_INVALID_ID;
+    UNIMPLEMENTED(pjsua_get_snd_dev)
+    return PJ_ENOTSUP;
+}
+
+/* Use null sound device. */
+PJ_DEF(pj_status_t) pjsua_set_null_snd_dev(void)
+{
+    UNIMPLEMENTED(pjsua_set_null_snd_dev)
+    return PJ_ENOTSUP;
+}
+
+/* Use no device! */
+PJ_DEF(pjmedia_port*) pjsua_set_no_snd_dev(void)
+{
+    UNIMPLEMENTED(pjsua_set_no_snd_dev)
+    return NULL;
+}
+
+/* Configure the AEC settings of the sound port. */
+PJ_DEF(pj_status_t) pjsua_set_ec(unsigned tail_ms, unsigned options)
+{
+    UNIMPLEMENTED(pjsua_set_ec)
+    return PJ_ENOTSUP;
+}
+
+/* Get current AEC tail length. */
+PJ_DEF(pj_status_t) pjsua_get_ec_tail(unsigned *p_tail_ms)
+{
+    UNIMPLEMENTED(pjsua_get_ec_tail)
+    return PJ_ENOTSUP;
+}
+
+/* Check whether the sound device is currently active. */
+PJ_DEF(pj_bool_t) pjsua_snd_is_active(void)
+{
+    UNIMPLEMENTED(pjsua_snd_is_active)
+    return PJ_FALSE;
+}
+
+/* Configure sound device setting to the sound device being used. */
+PJ_DEF(pj_status_t) pjsua_snd_set_setting( pjmedia_aud_dev_cap cap,
+					   const void *pval, pj_bool_t keep)
+{
+    UNIMPLEMENTED(pjsua_snd_set_setting)
+    return PJ_ENOTSUP;
+}
+
+/* Retrieve a sound device setting. */
+PJ_DEF(pj_status_t) pjsua_snd_get_setting(pjmedia_aud_dev_cap cap, void *pval)
+{
+    UNIMPLEMENTED(pjsua_snd_get_setting)
+    return PJ_ENOTSUP;
+}
diff --git a/jni/pjproject-android/.svn/pristine/de/de0a8395886d8eac33588abf0dddfeeb481068a5.svn-base b/jni/pjproject-android/.svn/pristine/de/de0a8395886d8eac33588abf0dddfeeb481068a5.svn-base
new file mode 100644
index 0000000..1a5fd56
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/de0a8395886d8eac33588abf0dddfeeb481068a5.svn-base
@@ -0,0 +1,11 @@
+# $Id$
+#
+from inc_cfg import *
+
+test_param = TestParam(
+		"Callee=optional (with duplicated offer) SRTP, caller=optional (with duplicated offer) SRTP",
+		[
+			InstanceParam("callee", "--null-audio --use-srtp=3 --srtp-secure=0 --max-calls=1"),
+			InstanceParam("caller", "--null-audio --use-srtp=3 --srtp-secure=0 --max-calls=1")
+		]
+		)
diff --git a/jni/pjproject-android/.svn/pristine/de/de2303d3a037277b4ff18d8cfd237bb23152bd9d.svn-base b/jni/pjproject-android/.svn/pristine/de/de2303d3a037277b4ff18d8cfd237bb23152bd9d.svn-base
new file mode 100644
index 0000000..5d0e566
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/de2303d3a037277b4ff18d8cfd237bb23152bd9d.svn-base
@@ -0,0 +1,658 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2008-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 <pjsip/sip_multipart.h>
+#include <pjsip/sip_parser.h>
+#include <pjlib-util/scanner.h>
+#include <pj/assert.h>
+#include <pj/ctype.h>
+#include <pj/errno.h>
+#include <pj/except.h>
+#include <pj/guid.h>
+#include <pj/log.h>
+#include <pj/pool.h>
+#include <pj/string.h>
+
+#define THIS_FILE		"sip_multipart.c"
+
+#define IS_SPACE(c)	((c)==' ' || (c)=='\t')
+
+#if 0
+#   define TRACE_(x)	PJ_LOG(4,x)
+#else
+#   define TRACE_(x)
+#endif
+
+extern pj_bool_t pjsip_use_compact_form;
+
+/* Type of "data" in multipart pjsip_msg_body */
+struct multipart_data
+{
+    pj_str_t	    	  boundary;
+    pjsip_multipart_part  part_head;
+};
+
+
+static int multipart_print_body(struct pjsip_msg_body *msg_body,
+			        char *buf, pj_size_t size)
+{
+    const struct multipart_data *m_data;
+    pj_str_t clen_hdr =  { "Content-Length: ", 16};
+    pjsip_multipart_part *part;
+    char *p = buf, *end = buf+size;
+
+#define SIZE_LEFT()	(end-p)
+
+    m_data = (const struct multipart_data*)msg_body->data;
+
+    PJ_ASSERT_RETURN(m_data && !pj_list_empty(&m_data->part_head), PJ_EINVAL);
+
+    part = m_data->part_head.next;
+    while (part != &m_data->part_head) {
+	enum { CLEN_SPACE = 5 };
+	char *clen_pos;
+	const pjsip_hdr *hdr;
+
+	clen_pos = NULL;
+
+	/* Print delimiter */
+	if (SIZE_LEFT() <= (m_data->boundary.slen+8) << 1)
+	    return -1;
+	*p++ = 13; *p++ = 10; *p++ = '-'; *p++ = '-';
+	pj_memcpy(p, m_data->boundary.ptr, m_data->boundary.slen);
+	p += m_data->boundary.slen;
+	*p++ = 13; *p++ = 10;
+
+	/* Print optional headers */
+	hdr = part->hdr.next;
+	while (hdr != &part->hdr) {
+	    int printed = pjsip_hdr_print_on((pjsip_hdr*)hdr, p,
+	                                     SIZE_LEFT()-2);
+	    if (printed < 0)
+		return -1;
+	    p += printed;
+	    *p++ = '\r';
+	    *p++ = '\n';
+	    hdr = hdr->next;
+	}
+
+	/* Automaticly adds Content-Type and Content-Length headers, only
+	 * if content_type is set in the message body.
+	 */
+	if (part->body && part->body->content_type.type.slen) {
+	    pj_str_t ctype_hdr = { "Content-Type: ", 14};
+	    const pjsip_media_type *media = &part->body->content_type;
+
+	    if (pjsip_use_compact_form) {
+		ctype_hdr.ptr = "c: ";
+		ctype_hdr.slen = 3;
+	    }
+
+	    /* Add Content-Type header. */
+	    if ( (end-p) < 24 + media->type.slen + media->subtype.slen) {
+		return -1;
+	    }
+	    pj_memcpy(p, ctype_hdr.ptr, ctype_hdr.slen);
+	    p += ctype_hdr.slen;
+	    p += pjsip_media_type_print(p, (unsigned)(end-p), media);
+	    *p++ = '\r';
+	    *p++ = '\n';
+
+	    /* Add Content-Length header. */
+	    if ((end-p) < clen_hdr.slen + 12 + 2) {
+		return -1;
+	    }
+	    pj_memcpy(p, clen_hdr.ptr, clen_hdr.slen);
+	    p += clen_hdr.slen;
+
+	    /* Print blanks after "Content-Length:", this is where we'll put
+	     * the content length value after we know the length of the
+	     * body.
+	     */
+	    pj_memset(p, ' ', CLEN_SPACE);
+	    clen_pos = p;
+	    p += CLEN_SPACE;
+	    *p++ = '\r';
+	    *p++ = '\n';
+	}
+
+	/* Empty newline */
+	*p++ = 13; *p++ = 10;
+
+	/* Print the body */
+	pj_assert(part->body != NULL);
+	if (part->body) {
+	    int printed = part->body->print_body(part->body, p, SIZE_LEFT());
+	    if (printed < 0)
+		return -1;
+	    p += printed;
+
+	    /* Now that we have the length of the body, print this to the
+	     * Content-Length header.
+	     */
+	    if (clen_pos) {
+		char tmp[16];
+		int len;
+
+		len = pj_utoa(printed, tmp);
+		if (len > CLEN_SPACE) len = CLEN_SPACE;
+		pj_memcpy(clen_pos+CLEN_SPACE-len, tmp, len);
+	    }
+	}
+
+	part = part->next;
+    }
+
+    /* Print closing delimiter */
+    if (SIZE_LEFT() < m_data->boundary.slen+8)
+	return -1;
+    *p++ = 13; *p++ = 10; *p++ = '-'; *p++ = '-';
+    pj_memcpy(p, m_data->boundary.ptr, m_data->boundary.slen);
+    p += m_data->boundary.slen;
+    *p++ = '-'; *p++ = '-'; *p++ = 13; *p++ = 10;
+
+#undef SIZE_LEFT
+
+    return (int)(p - buf);
+}
+
+static void* multipart_clone_data(pj_pool_t *pool, const void *data,
+				  unsigned len)
+{
+    const struct multipart_data *src;
+    struct multipart_data *dst;
+    const pjsip_multipart_part *src_part;
+
+    PJ_UNUSED_ARG(len);
+
+    src = (const struct multipart_data*) data;
+    dst = PJ_POOL_ALLOC_T(pool, struct multipart_data);
+
+    pj_strdup(pool, &dst->boundary, &src->boundary);
+
+    src_part = src->part_head.next;
+    while (src_part != &src->part_head) {
+	pjsip_multipart_part *dst_part;
+	const pjsip_hdr *src_hdr;
+
+	dst_part = pjsip_multipart_create_part(pool);
+
+	src_hdr = src_part->hdr.next;
+	while (src_hdr != &src_part->hdr) {
+	    pjsip_hdr *dst_hdr = (pjsip_hdr*)pjsip_hdr_clone(pool, src_hdr);
+	    pj_list_push_back(&dst_part->hdr, dst_hdr);
+	    src_hdr = src_hdr->next;
+	}
+
+	dst_part->body = pjsip_msg_body_clone(pool, src_part->body);
+
+	pj_list_push_back(&dst->part_head, dst_part);
+
+	src_part = src_part->next;
+    }
+
+    return (void*)dst;
+}
+
+/*
+ * Create an empty multipart body.
+ */
+PJ_DEF(pjsip_msg_body*) pjsip_multipart_create( pj_pool_t *pool,
+						const pjsip_media_type *ctype,
+						const pj_str_t *boundary)
+{
+    pjsip_msg_body *body;
+    pjsip_param *ctype_param;
+    struct multipart_data *mp_data;
+    pj_str_t STR_BOUNDARY = { "boundary", 8 };
+
+    PJ_ASSERT_RETURN(pool, NULL);
+
+    body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
+
+    /* content-type */
+    if (ctype && ctype->type.slen) {
+	pjsip_media_type_cp(pool, &body->content_type, ctype);
+    } else {
+	pj_str_t STR_MULTIPART = {"multipart", 9};
+	pj_str_t STR_MIXED = { "mixed", 5 };
+
+        pjsip_media_type_init(&body->content_type,
+                              &STR_MULTIPART, &STR_MIXED);
+    }
+
+    /* multipart data */
+    mp_data = PJ_POOL_ZALLOC_T(pool, struct multipart_data);
+    pj_list_init(&mp_data->part_head);
+    if (boundary) {
+	pj_strdup(pool, &mp_data->boundary, boundary);
+    } else {
+	pj_create_unique_string(pool, &mp_data->boundary);
+    }
+    body->data = mp_data;
+
+    /* Add ";boundary" parameter to content_type parameter. */
+    ctype_param = pjsip_param_find(&body->content_type.param, &STR_BOUNDARY);
+    if (!ctype_param) {
+	ctype_param = PJ_POOL_ALLOC_T(pool, pjsip_param);
+	ctype_param->name = STR_BOUNDARY;
+	pj_list_push_back(&body->content_type.param, ctype_param);
+    }
+    ctype_param->value = mp_data->boundary;
+
+    /* function pointers */
+    body->print_body = &multipart_print_body;
+    body->clone_data = &multipart_clone_data;
+
+    return body;
+}
+
+/*
+ * Create an empty multipart part.
+ */
+PJ_DEF(pjsip_multipart_part*) pjsip_multipart_create_part(pj_pool_t *pool)
+{
+    pjsip_multipart_part *mp;
+
+    mp = PJ_POOL_ZALLOC_T(pool, pjsip_multipart_part);
+    pj_list_init(&mp->hdr);
+
+    return mp;
+}
+
+
+/*
+ * Deep clone.
+ */
+PJ_DEF(pjsip_multipart_part*)
+pjsip_multipart_clone_part(pj_pool_t *pool,
+			   const pjsip_multipart_part *src)
+{
+    pjsip_multipart_part *dst;
+    const pjsip_hdr *hdr;
+
+    dst = pjsip_multipart_create_part(pool);
+
+    hdr = src->hdr.next;
+    while (hdr != &src->hdr) {
+	pj_list_push_back(&dst->hdr, pjsip_hdr_clone(pool, hdr));
+	hdr = hdr->next;
+    }
+
+    dst->body = pjsip_msg_body_clone(pool, src->body);
+
+    return dst;
+}
+
+
+/*
+ * Add a part into multipart bodies.
+ */
+PJ_DEF(pj_status_t) pjsip_multipart_add_part( pj_pool_t *pool,
+					      pjsip_msg_body *mp,
+					      pjsip_multipart_part *part)
+{
+    struct multipart_data *m_data;
+
+    /* All params must be specified */
+    PJ_ASSERT_RETURN(pool && mp && part, PJ_EINVAL);
+
+    /* mp must really point to an actual multipart msg body */
+    PJ_ASSERT_RETURN(mp->print_body==&multipart_print_body, PJ_EINVAL);
+
+    /* The multipart part must contain a valid message body */
+    PJ_ASSERT_RETURN(part->body && part->body->print_body, PJ_EINVAL);
+
+    m_data = (struct multipart_data*)mp->data;
+    pj_list_push_back(&m_data->part_head, part);
+
+    PJ_UNUSED_ARG(pool);
+
+    return PJ_SUCCESS;
+}
+
+/*
+ * Get the first part of multipart bodies.
+ */
+PJ_DEF(pjsip_multipart_part*)
+pjsip_multipart_get_first_part(const pjsip_msg_body *mp)
+{
+    struct multipart_data *m_data;
+
+    /* Must specify mandatory params */
+    PJ_ASSERT_RETURN(mp, NULL);
+
+    /* mp must really point to an actual multipart msg body */
+    PJ_ASSERT_RETURN(mp->print_body==&multipart_print_body, NULL);
+
+    m_data = (struct multipart_data*)mp->data;
+    if (pj_list_empty(&m_data->part_head))
+	return NULL;
+
+    return m_data->part_head.next;
+}
+
+/*
+ * Get the next part after the specified part.
+ */
+PJ_DEF(pjsip_multipart_part*)
+pjsip_multipart_get_next_part(const pjsip_msg_body *mp,
+			      pjsip_multipart_part *part)
+{
+    struct multipart_data *m_data;
+
+    /* Must specify mandatory params */
+    PJ_ASSERT_RETURN(mp && part, NULL);
+
+    /* mp must really point to an actual multipart msg body */
+    PJ_ASSERT_RETURN(mp->print_body==&multipart_print_body, NULL);
+
+    m_data = (struct multipart_data*)mp->data;
+
+    /* the part parameter must be really member of the list */
+    PJ_ASSERT_RETURN(pj_list_find_node(&m_data->part_head, part) != NULL,
+		     NULL);
+
+    if (part->next == &m_data->part_head)
+	return NULL;
+
+    return part->next;
+}
+
+/*
+ * Find a body inside multipart bodies which has the specified content type.
+ */
+PJ_DEF(pjsip_multipart_part*)
+pjsip_multipart_find_part( const pjsip_msg_body *mp,
+			   const pjsip_media_type *content_type,
+			   const pjsip_multipart_part *start)
+{
+    struct multipart_data *m_data;
+    pjsip_multipart_part *part;
+
+    /* Must specify mandatory params */
+    PJ_ASSERT_RETURN(mp && content_type, NULL);
+
+    /* mp must really point to an actual multipart msg body */
+    PJ_ASSERT_RETURN(mp->print_body==&multipart_print_body, NULL);
+
+    m_data = (struct multipart_data*)mp->data;
+
+    if (start)
+	part = start->next;
+    else
+	part = m_data->part_head.next;
+
+    while (part != &m_data->part_head) {
+	if (pjsip_media_type_cmp(&part->body->content_type,
+				 content_type, 0)==0)
+	{
+	    return part;
+	}
+	part = part->next;
+    }
+
+    return NULL;
+}
+
+/* Parse a multipart part. "pct" is parent content-type  */
+static pjsip_multipart_part *parse_multipart_part(pj_pool_t *pool,
+						  char *start,
+						  pj_size_t len,
+						  const pjsip_media_type *pct)
+{
+    pjsip_multipart_part *part = pjsip_multipart_create_part(pool);
+    char *p = start, *end = start+len, *end_hdr = NULL, *start_body = NULL;
+    pjsip_ctype_hdr *ctype_hdr = NULL;
+
+    TRACE_((THIS_FILE, "Parsing part: begin--\n%.*s\n--end",
+	    (int)len, start));
+
+    /* Find the end of header area, by looking at an empty line */
+    for (;;) {
+	while (p!=end && *p!='\n') ++p;
+	if (p==end) {
+	    start_body = end;
+	    break;
+	}
+	if ((p==start) || (p==start+1 && *(p-1)=='\r')) {
+	    /* Empty header section */
+	    end_hdr = start;
+	    start_body = ++p;
+	    break;
+	} else if (p==end-1) {
+	    /* Empty body section */
+	    end_hdr = end;
+	    start_body = ++p;
+	} else if ((p>=start+1 && *(p-1)=='\n') ||
+	           (p>=start+2 && *(p-1)=='\r' && *(p-2)=='\n'))
+	{
+	    /* Found it */
+	    end_hdr = (*(p-1)=='\r') ? (p-1) : p;
+	    start_body = ++p;
+	    break;
+	} else {
+	    ++p;
+	}
+    }
+
+    /* Parse the headers */
+    if (end_hdr-start > 0) {
+	pjsip_hdr *hdr;
+	pj_status_t status;
+
+	status = pjsip_parse_headers(pool, start, end_hdr-start, 
+				     &part->hdr, 0);
+	if (status != PJ_SUCCESS) {
+	    PJ_PERROR(2,(THIS_FILE, status, "Warning: error parsing multipart"
+					    " header"));
+	}
+
+	/* Find Content-Type header */
+	hdr = part->hdr.next;
+	while (hdr != &part->hdr) {
+	    TRACE_((THIS_FILE, "Header parsed: %.*s", (int)hdr->name.slen,
+		    hdr->name.ptr));
+	    if (hdr->type == PJSIP_H_CONTENT_TYPE) {
+		ctype_hdr = (pjsip_ctype_hdr*)hdr;
+	    }
+	    hdr = hdr->next;
+	}
+    }
+
+    /* Assign the body */
+    part->body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
+    if (ctype_hdr) {
+	pjsip_media_type_cp(pool, &part->body->content_type, &ctype_hdr->media);
+    } else if (pct && pj_stricmp2(&pct->subtype, "digest")==0) {
+	part->body->content_type.type = pj_str("message");
+	part->body->content_type.subtype = pj_str("rfc822");
+    } else {
+	part->body->content_type.type = pj_str("text");
+	part->body->content_type.subtype = pj_str("plain");
+    }
+
+    if (start_body < end) {
+	part->body->data = start_body;
+	part->body->len = (unsigned)(end - start_body);
+    } else {
+	part->body->data = (void*)"";
+	part->body->len = 0;
+    }
+    TRACE_((THIS_FILE, "Body parsed: \"%.*s\"", (int)part->body->len,
+	    part->body->data));
+    part->body->print_body = &pjsip_print_text_body;
+    part->body->clone_data = &pjsip_clone_text_data;
+
+    return part;
+}
+
+/* Public function to parse multipart message bodies into its parts */
+PJ_DEF(pjsip_msg_body*) pjsip_multipart_parse(pj_pool_t *pool,
+					      char *buf, pj_size_t len,
+					      const pjsip_media_type *ctype,
+					      unsigned options)
+{
+    pj_str_t boundary, delim;
+    char *curptr, *endptr;
+    const pjsip_param *ctype_param;
+    const pj_str_t STR_BOUNDARY = { "boundary", 8 };
+    pjsip_msg_body *body = NULL;
+
+    PJ_ASSERT_RETURN(pool && buf && len && ctype && !options, NULL);
+
+    TRACE_((THIS_FILE, "Started parsing multipart body"));
+
+    /* Get the boundary value in the ctype */
+    boundary.ptr = NULL;
+    boundary.slen = 0;
+    ctype_param = pjsip_param_find(&ctype->param, &STR_BOUNDARY);
+    if (ctype_param) {
+	boundary = ctype_param->value;
+	if (boundary.slen>2 && *boundary.ptr=='"') {
+	    /* Remove quote */
+	    boundary.ptr++;
+	    boundary.slen -= 2;
+	}
+	TRACE_((THIS_FILE, "Boundary is specified: '%.*s'", (int)boundary.slen,
+		boundary.ptr));
+    }
+
+    if (!boundary.slen) {
+	/* Boundary not found or not specified. Try to be clever, get
+	 * the boundary from the body.
+	 */
+	char *p=buf, *end=buf+len;
+
+	PJ_LOG(4,(THIS_FILE, "Warning: boundary parameter not found or "
+			     "not specified when parsing multipart body"));
+
+	/* Find the first "--". This "--" must be right after a CRLF, unless
+	 * it really appears at the start of the buffer.
+	 */
+	for (;;) {
+	    while (p!=end && *p!='-') ++p;
+	    if (p!=end && *(p+1)=='-' &&
+		((p>buf && *(p-1)=='\n') || (p==buf)))
+	    {
+		p+=2;
+		break;
+	    } else {
+		++p;
+	    }
+	}
+
+	if (p==end) {
+	    /* Unable to determine boundary. Maybe this is not a multipart
+	     * message?
+	     */
+	    PJ_LOG(4,(THIS_FILE, "Error: multipart boundary not specified and"
+				 " unable to calculate from the body"));
+	    return NULL;
+	}
+
+	boundary.ptr = p;
+	while (p!=end && !pj_isspace(*p)) ++p;
+	boundary.slen = p - boundary.ptr;
+
+	TRACE_((THIS_FILE, "Boundary is calculated: '%.*s'",
+		(int)boundary.slen, boundary.ptr));
+    }
+
+    /* Build the delimiter:
+     *   delimiter = "--" boundary
+     */
+    delim.slen = boundary.slen+2;
+    delim.ptr = (char*)pj_pool_alloc(pool, (int)delim.slen);
+    delim.ptr[0] = '-';
+    delim.ptr[1] = '-';
+    pj_memcpy(delim.ptr+2, boundary.ptr, boundary.slen);
+
+    /* Start parsing the body, skip until the first delimiter. */
+    curptr = buf;
+    endptr = buf + len;
+    {
+	pj_str_t body;
+
+	body.ptr = buf; body.slen = len;
+	curptr = pj_strstr(&body, &delim);
+	if (!curptr)
+	    return NULL;
+    }
+
+    body = pjsip_multipart_create(pool, ctype, &boundary);
+
+    for (;;) {
+	char *start_body, *end_body;
+	pjsip_multipart_part *part;
+
+	/* Eat the boundary */
+	curptr += delim.slen;
+	if (*curptr=='-' && curptr<endptr-1 && *(curptr+1)=='-') {
+	    /* Found the closing delimiter */
+	    curptr += 2;
+	    break;
+	}
+	/* Optional whitespace after delimiter */
+	while (curptr!=endptr && IS_SPACE(*curptr)) ++curptr;
+	/* Mandatory CRLF */
+	if (*curptr=='\r') ++curptr;
+	if (*curptr!='\n') {
+	    /* Expecting a newline here */
+	    return NULL;
+	}
+	++curptr;
+
+	/* We now in the start of the body */
+	start_body = curptr;
+
+	/* Find the next delimiter */
+	{
+	    pj_str_t subbody;
+
+	    subbody.ptr = curptr; subbody.slen = endptr - curptr;
+	    curptr = pj_strstr(&subbody, &delim);
+	    if (!curptr) {
+		/* We're really expecting end delimiter to be found. */
+		return NULL;
+	    }
+	}
+
+	end_body = curptr;
+
+	/* The newline preceeding the delimiter is conceptually part of
+	 * the delimiter, so trim it from the body.
+	 */
+	if (*(end_body-1) == '\n')
+	    --end_body;
+	if (*(end_body-1) == '\r')
+	    --end_body;
+
+	/* Now that we have determined the part's boundary, parse it
+	 * to get the header and body part of the part.
+	 */
+	part = parse_multipart_part(pool, start_body, end_body - start_body,
+				    ctype);
+	if (part) {
+	    pjsip_multipart_add_part(pool, body, part);
+	}
+    }
+
+    return body;
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/de/de2d5e42e5eeef75c04b2e45bada75f491163ff3.svn-base b/jni/pjproject-android/.svn/pristine/de/de2d5e42e5eeef75c04b2e45bada75f491163ff3.svn-base
new file mode 100644
index 0000000..be19e73
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/de2d5e42e5eeef75c04b2e45bada75f491163ff3.svn-base
@@ -0,0 +1,45 @@
+#include <pj/types.h>
+
+/* Check if we need to use the fixed point version */
+#if !defined(PJ_HAS_FLOATING_POINT) || PJ_HAS_FLOATING_POINT==0
+#   define FIXED_POINT
+#   define USE_KISS_FFT
+#else 
+#   define FLOATING_POINT
+#   define USE_SMALLFT
+#endif
+
+#define EXPORT
+
+#if (defined(PJ_WIN32) && PJ_WIN32!=0) || \
+    (defined(PJ_WIN64) && PJ_WIN64!=0) || \
+    (defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE != 0) 
+#   include "../../speex/win32/config.h"
+#else
+#define inline __inline
+#define restrict
+#endif
+
+#ifdef _MSC_VER
+#   pragma warning(disable: 4100)   // unreferenced formal parameter
+#   pragma warning(disable: 4101)   // unreferenced local variable
+#   pragma warning(disable: 4244)   // conversion from 'double ' to 'float '
+#   pragma warning(disable: 4305)   // truncation from 'const double ' to 'float '
+#   pragma warning(disable: 4018)   // signed/unsigned mismatch
+//#   pragma warning(disable: 4701)   // local variable used without initialized
+#endif
+
+#include <pj/log.h>
+
+/*
+ * Override miscellaneous Speex functions.
+ */
+#define OVERRIDE_SPEEX_ERROR
+#define speex_error(str) PJ_LOG(4,("speex", "error: %s", str))
+
+#define OVERRIDE_SPEEX_WARNING
+#define speex_warning(str) PJ_LOG(5,("speex", "warning: %s", str))
+
+#define OVERRIDE_SPEEX_WARNING_INT
+#define speex_warning_int(str,val)  PJ_LOG(5,("speex", "warning: %s: %d", str, val))
+
diff --git a/jni/pjproject-android/.svn/pristine/de/de2f5509c9c64d8511f0dc9ea6b8026b4cf84481.svn-base b/jni/pjproject-android/.svn/pristine/de/de2f5509c9c64d8511f0dc9ea6b8026b4cf84481.svn-base
new file mode 100644
index 0000000..28f79dd
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/de2f5509c9c64d8511f0dc9ea6b8026b4cf84481.svn-base
@@ -0,0 +1 @@
+#include "../../../portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c"
diff --git a/jni/pjproject-android/.svn/pristine/de/de3fb127fb960c5e382cf7a601753fa42a59702b.svn-base b/jni/pjproject-android/.svn/pristine/de/de3fb127fb960c5e382cf7a601753fa42a59702b.svn-base
new file mode 100644
index 0000000..6dbffdf
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/de3fb127fb960c5e382cf7a601753fa42a59702b.svn-base
@@ -0,0 +1,326 @@
+EXPORTS
+	PJ_FD_CLR                                @ 1 NONAME
+	PJ_FD_COUNT                              @ 2 NONAME
+	PJ_FD_ISSET                              @ 3 NONAME
+	PJ_FD_SET                                @ 4 NONAME
+	PJ_FD_ZERO                               @ 5 NONAME
+	PJ_GUID_STRING_LENGTH                    @ 6 NONAME
+	PJ_NO_MEMORY_EXCEPTION                   @ 7 NONAME
+	PJ_VERSION                               @ 8 NONAME
+	pj_AF_INET                               @ 9 NONAME
+	pj_AF_INET6                              @ 10 NONAME
+	pj_AF_IRDA                               @ 11 NONAME
+	pj_AF_PACKET                             @ 12 NONAME
+	pj_AF_UNIX                               @ 13 NONAME
+	pj_AF_UNSPEC                             @ 14 NONAME
+	pj_GUID_STRING_LENGTH                    @ 15 NONAME
+	pj_IPTOS_LOWDELAY                        @ 16 NONAME
+	pj_IPTOS_MINCOST                         @ 17 NONAME
+	pj_IPTOS_RELIABILITY                     @ 18 NONAME
+	pj_IPTOS_THROUGHPUT                      @ 19 NONAME
+	pj_IP_TOS                                @ 20 NONAME
+	pj_MSG_DONTROUTE                         @ 21 NONAME
+	pj_MSG_OOB                               @ 22 NONAME
+	pj_MSG_PEEK                              @ 23 NONAME
+	pj_NO_MEMORY_EXCEPTION                   @ 24 NONAME
+	pj_SOCK_DGRAM                            @ 25 NONAME
+	pj_SOCK_RAW                              @ 26 NONAME
+	pj_SOCK_RDM                              @ 27 NONAME
+	pj_SOCK_STREAM                           @ 28 NONAME
+	pj_SOL_IP                                @ 29 NONAME
+	pj_SOL_IPV6                              @ 30 NONAME
+	pj_SOL_SOCKET                            @ 31 NONAME
+	pj_SOL_TCP                               @ 32 NONAME
+	pj_SOL_UDP                               @ 33 NONAME
+	pj_SO_RCVBUF                             @ 34 NONAME
+	pj_SO_SNDBUF                             @ 35 NONAME
+	pj_SO_TYPE                               @ 36 NONAME
+	pj_ansi_to_unicode                       @ 37 NONAME
+	pj_array_erase                           @ 38 NONAME
+	pj_array_find                            @ 39 NONAME
+	pj_array_insert                          @ 40 NONAME
+	pj_atexit                                @ 41 NONAME
+	pj_atomic_add                            @ 42 NONAME
+	pj_atomic_add_and_get                    @ 43 NONAME
+	pj_atomic_create                         @ 44 NONAME
+	pj_atomic_dec                            @ 45 NONAME
+	pj_atomic_dec_and_get                    @ 46 NONAME
+	pj_atomic_destroy                        @ 47 NONAME
+	pj_atomic_get                            @ 48 NONAME
+	pj_atomic_inc                            @ 49 NONAME
+	pj_atomic_inc_and_get                    @ 50 NONAME
+	pj_atomic_set                            @ 51 NONAME
+	pj_caching_pool_destroy                  @ 52 NONAME
+	pj_caching_pool_init                     @ 53 NONAME
+	pj_create_random_string                  @ 54 NONAME
+	pj_create_unique_string                  @ 55 NONAME
+	pj_dump_config                           @ 56 NONAME
+	pj_elapsed_cycle                         @ 57 NONAME
+	pj_elapsed_msec                          @ 58 NONAME
+	pj_elapsed_nanosec                       @ 59 NONAME
+	pj_elapsed_time                          @ 60 NONAME
+	pj_elapsed_usec                          @ 61 NONAME
+	pj_enter_critical_section                @ 62 NONAME
+	pj_enum_ip_interface                     @ 63 NONAME
+	pj_enum_ip_route                         @ 64 NONAME
+	pj_exception_id_alloc                    @ 65 NONAME
+	pj_exception_id_free                     @ 66 NONAME
+	pj_exception_id_name                     @ 67 NONAME
+	pj_fifobuf_alloc                         @ 68 NONAME
+	pj_fifobuf_free                          @ 69 NONAME
+	pj_fifobuf_init                          @ 70 NONAME
+	pj_fifobuf_max_size                      @ 71 NONAME
+	pj_fifobuf_unalloc                       @ 72 NONAME
+	pj_file_close                            @ 73 NONAME
+	pj_file_delete                           @ 74 NONAME
+	pj_file_exists                           @ 75 NONAME
+	pj_file_flush                            @ 76 NONAME
+	pj_file_getpos                           @ 77 NONAME
+	pj_file_getstat                          @ 78 NONAME
+	pj_file_move                             @ 79 NONAME
+	pj_file_open                             @ 80 NONAME
+	pj_file_read                             @ 81 NONAME
+	pj_file_setpos                           @ 82 NONAME
+	pj_file_size                             @ 83 NONAME
+	pj_file_write                            @ 84 NONAME
+	pj_generate_unique_string                @ 85 NONAME
+	pj_get_netos_error                       @ 86 NONAME
+	pj_get_os_error                          @ 87 NONAME
+	pj_get_timestamp                         @ 88 NONAME
+	pj_get_timestamp_freq                    @ 89 NONAME
+	pj_get_version                           @ 90 NONAME
+	pj_getaddrinfo                           @ 91 NONAME
+	pj_getdefaultipinterface                 @ 92 NONAME
+	pj_gethostaddr                           @ 93 NONAME
+	pj_gethostbyname                         @ 94 NONAME
+	pj_gethostip                             @ 95 NONAME
+	pj_gethostname                           @ 96 NONAME
+	pj_getpid                                @ 97 NONAME
+	pj_gettimeofday                          @ 98 NONAME
+	pj_hash_calc                             @ 99 NONAME
+	pj_hash_calc_tolower                     @ 100 NONAME
+	pj_hash_count                            @ 101 NONAME
+	pj_hash_create                           @ 102 NONAME
+	pj_hash_first                            @ 103 NONAME
+	pj_hash_get                              @ 104 NONAME
+	pj_hash_next                             @ 105 NONAME
+	pj_hash_set                              @ 106 NONAME
+	pj_hash_set_np                           @ 107 NONAME
+	pj_hash_this                             @ 108 NONAME
+	pj_htonl                                 @ 109 NONAME
+	pj_htons                                 @ 110 NONAME
+	pj_inet_addr                             @ 111 NONAME
+	pj_inet_addr2                            @ 112 NONAME
+	pj_inet_aton                             @ 113 NONAME
+	pj_inet_ntoa                             @ 114 NONAME
+	pj_inet_ntop                             @ 115 NONAME
+	pj_inet_ntop2                            @ 116 NONAME
+	pj_inet_pton                             @ 117 NONAME
+	pj_init                                  @ 118 NONAME
+	pj_ioqueue_accept                        @ 119 NONAME
+	pj_ioqueue_connect                       @ 120 NONAME
+	pj_ioqueue_create                        @ 121 NONAME
+	pj_ioqueue_destroy                       @ 122 NONAME
+	pj_ioqueue_get_user_data                 @ 123 NONAME
+	pj_ioqueue_is_pending                    @ 124 NONAME
+	pj_ioqueue_name                          @ 125 NONAME
+	pj_ioqueue_op_key_init                   @ 126 NONAME
+	pj_ioqueue_poll                          @ 127 NONAME
+	pj_ioqueue_post_completion               @ 128 NONAME
+	pj_ioqueue_recv                          @ 129 NONAME
+	pj_ioqueue_recvfrom                      @ 130 NONAME
+	pj_ioqueue_register_sock                 @ 131 NONAME
+	pj_ioqueue_register_sock2                @ 132 NONAME
+	pj_ioqueue_send                          @ 133 NONAME
+	pj_ioqueue_sendto                        @ 134 NONAME
+	pj_ioqueue_set_lock                      @ 135 NONAME
+	pj_ioqueue_set_user_data                 @ 136 NONAME
+	pj_ioqueue_unregister                    @ 137 NONAME
+	pj_leave_critical_section                @ 138 NONAME
+	pj_list_erase                            @ 139 NONAME
+	pj_list_find_node                        @ 140 NONAME
+	pj_list_insert_after                     @ 141 NONAME
+	pj_list_insert_before                    @ 142 NONAME
+	pj_list_insert_nodes_after               @ 143 NONAME
+	pj_list_insert_nodes_before              @ 144 NONAME
+	pj_list_merge_first                      @ 145 NONAME
+	pj_list_merge_last                       @ 146 NONAME
+	pj_list_search                           @ 147 NONAME
+	pj_list_size                             @ 148 NONAME
+	pj_lock_acquire                          @ 149 NONAME
+	pj_lock_create_null_mutex                @ 150 NONAME
+	pj_lock_create_recursive_mutex           @ 151 NONAME
+	pj_lock_create_semaphore                 @ 152 NONAME
+	pj_lock_create_simple_mutex              @ 153 NONAME
+	pj_lock_destroy                          @ 154 NONAME
+	pj_lock_release                          @ 155 NONAME
+	pj_lock_tryacquire                       @ 156 NONAME
+	pj_log                                   @ 157 NONAME
+	pj_log_1                                 @ 158 NONAME
+	pj_log_2                                 @ 159 NONAME
+	pj_log_3                                 @ 160 NONAME
+	pj_log_4                                 @ 161 NONAME
+	pj_log_5                                 @ 162 NONAME
+	pj_log_get_decor                         @ 163 NONAME
+	pj_log_get_level                         @ 164 NONAME
+	pj_log_get_log_func                      @ 165 NONAME
+	pj_log_set_decor                         @ 166 NONAME
+	pj_log_set_level                         @ 167 NONAME
+	pj_log_set_log_func                      @ 168 NONAME
+	pj_log_write                             @ 169 NONAME
+	pj_mutex_create                          @ 170 NONAME
+	pj_mutex_create_recursive                @ 171 NONAME
+	pj_mutex_create_simple                   @ 172 NONAME
+	pj_mutex_destroy                         @ 173 NONAME
+	pj_mutex_lock                            @ 174 NONAME
+	pj_mutex_trylock                         @ 175 NONAME
+	pj_mutex_unlock                          @ 176 NONAME
+	pj_ntohl                                 @ 177 NONAME
+	pj_ntohs                                 @ 178 NONAME
+	pj_pool_alloc                            @ 179 NONAME
+	pj_pool_alloc_from_block                 @ 180 NONAME
+	pj_pool_allocate_find                    @ 181 NONAME
+	pj_pool_calloc                           @ 182 NONAME
+	pj_pool_create                           @ 183 NONAME
+	pj_pool_create_int                       @ 184 NONAME
+	pj_pool_create_on_buf                    @ 185 NONAME
+	pj_pool_destroy_int                      @ 186 NONAME
+	pj_pool_factory_default_policy           @ 187 NONAME
+	pj_pool_factory_get_default_policy       @ 188 NONAME
+	pj_pool_get_capacity                     @ 189 NONAME
+	pj_pool_get_used_size                    @ 190 NONAME
+	pj_pool_getobjname                       @ 191 NONAME
+	pj_pool_init_int                         @ 192 NONAME
+	pj_pool_release                          @ 193 NONAME
+	pj_pool_reset                            @ 194 NONAME
+	pj_rand                                  @ 195 NONAME
+	pj_rbtree_erase                          @ 196 NONAME
+	pj_rbtree_find                           @ 197 NONAME
+	pj_rbtree_first                          @ 198 NONAME
+	pj_rbtree_init                           @ 199 NONAME
+	pj_rbtree_insert                         @ 200 NONAME
+	pj_rbtree_last                           @ 201 NONAME
+	pj_rbtree_max_height                     @ 202 NONAME
+	pj_rbtree_min_height                     @ 203 NONAME
+	pj_rbtree_next                           @ 204 NONAME
+	pj_rbtree_prev                           @ 205 NONAME
+	pj_register_strerror                     @ 206 NONAME
+	pj_rwmutex_create                        @ 207 NONAME
+	pj_rwmutex_destroy                       @ 208 NONAME
+	pj_rwmutex_lock_read                     @ 209 NONAME
+	pj_rwmutex_lock_write                    @ 210 NONAME
+	pj_rwmutex_unlock_read                   @ 211 NONAME
+	pj_rwmutex_unlock_write                  @ 212 NONAME
+	pj_sem_create                            @ 213 NONAME
+	pj_sem_destroy                           @ 214 NONAME
+	pj_sem_post                              @ 215 NONAME
+	pj_sem_trywait                           @ 216 NONAME
+	pj_sem_wait                              @ 217 NONAME
+	pj_set_netos_error                       @ 218 NONAME
+	pj_set_os_error                          @ 219 NONAME
+	pj_shutdown                              @ 220 NONAME
+	pj_sock_accept                           @ 221 NONAME
+	pj_sock_bind                             @ 222 NONAME
+	pj_sock_bind_in                          @ 223 NONAME
+	pj_sock_close                            @ 224 NONAME
+	pj_sock_connect                          @ 225 NONAME
+	pj_sock_getpeername                      @ 226 NONAME
+	pj_sock_getsockname                      @ 227 NONAME
+	pj_sock_getsockopt                       @ 228 NONAME
+	pj_sock_listen                           @ 229 NONAME
+	pj_sock_recv                             @ 230 NONAME
+	pj_sock_recvfrom                         @ 231 NONAME
+	pj_sock_select                           @ 232 NONAME
+	pj_sock_send                             @ 233 NONAME
+	pj_sock_sendto                           @ 234 NONAME
+	pj_sock_setsockopt                       @ 235 NONAME
+	pj_sock_shutdown                         @ 236 NONAME
+	pj_sock_socket                           @ 237 NONAME
+	pj_sockaddr_cmp                          @ 238 NONAME
+	pj_sockaddr_copy_addr                    @ 239 NONAME
+	pj_sockaddr_get_addr                     @ 240 NONAME
+	pj_sockaddr_get_addr_len                 @ 241 NONAME
+	pj_sockaddr_get_len                      @ 242 NONAME
+	pj_sockaddr_get_port                     @ 243 NONAME
+	pj_sockaddr_has_addr                     @ 244 NONAME
+	pj_sockaddr_in_get_addr                  @ 245 NONAME
+	pj_sockaddr_in_get_port                  @ 246 NONAME
+	pj_sockaddr_in_init                      @ 247 NONAME
+	pj_sockaddr_in_set_addr                  @ 248 NONAME
+	pj_sockaddr_in_set_port                  @ 249 NONAME
+	pj_sockaddr_in_set_str_addr              @ 250 NONAME
+	pj_sockaddr_init                         @ 251 NONAME
+	pj_sockaddr_print                        @ 252 NONAME
+	pj_sockaddr_set_port                     @ 253 NONAME
+	pj_sockaddr_set_str_addr                 @ 254 NONAME
+	pj_srand                                 @ 255 NONAME
+	pj_str                                   @ 256 NONAME
+	pj_strassign                             @ 257 NONAME
+	pj_strcat                                @ 258 NONAME
+	pj_strcat2                               @ 259 NONAME
+	pj_strcmp                                @ 260 NONAME
+	pj_strcmp2                               @ 261 NONAME
+	pj_strcpy                                @ 262 NONAME
+	pj_strcpy2                               @ 263 NONAME
+	pj_strdup                                @ 264 NONAME
+	pj_strdup2                               @ 265 NONAME
+	pj_strdup2_with_null                     @ 266 NONAME
+	pj_strdup3                               @ 267 NONAME
+	pj_strdup_with_null                      @ 268 NONAME
+	pj_strerror                              @ 269 NONAME
+	pj_stricmp                               @ 270 NONAME
+	pj_stricmp2                              @ 271 NONAME
+	pj_strltrim                              @ 272 NONAME
+	pj_strncmp                               @ 273 NONAME
+	pj_strncmp2                              @ 274 NONAME
+	pj_strncpy                               @ 275 NONAME
+	pj_strncpy_with_null                     @ 276 NONAME
+	pj_strnicmp                              @ 277 NONAME
+	pj_strnicmp2                             @ 278 NONAME
+	pj_strrtrim                              @ 279 NONAME
+	pj_strtoul                               @ 280 NONAME
+	pj_strtoul2                              @ 281 NONAME
+	pj_strtrim                               @ 282 NONAME
+	pj_symbianos_poll                        @ 283 NONAME
+	pj_symbianos_set_params                  @ 284 NONAME
+	pj_thread_check_stack                    @ 285 NONAME
+	pj_thread_create                         @ 286 NONAME
+	pj_thread_destroy                        @ 287 NONAME
+	pj_thread_get_name                       @ 288 NONAME
+	pj_thread_get_os_handle                  @ 289 NONAME
+	pj_thread_get_stack_info                 @ 290 NONAME
+	pj_thread_get_stack_max_usage            @ 291 NONAME
+	pj_thread_is_registered                  @ 292 NONAME
+	pj_thread_join                           @ 293 NONAME
+	pj_thread_local_alloc                    @ 294 NONAME
+	pj_thread_local_free                     @ 295 NONAME
+	pj_thread_local_get                      @ 296 NONAME
+	pj_thread_local_set                      @ 297 NONAME
+	pj_thread_register                       @ 298 NONAME
+	pj_thread_resume                         @ 299 NONAME
+	pj_thread_sleep                          @ 300 NONAME
+	pj_thread_this                           @ 301 NONAME
+	pj_time_decode                           @ 302 NONAME
+	pj_time_encode                           @ 303 NONAME
+	pj_time_gmt_to_local                     @ 304 NONAME
+	pj_time_local_to_gmt                     @ 305 NONAME
+	pj_time_val_normalize                    @ 306 NONAME
+	pj_timer_entry_init                      @ 307 NONAME
+	pj_timer_heap_cancel                     @ 308 NONAME
+	pj_timer_heap_cancel_if_active           @ 309 NONAME
+	pj_timer_heap_count                      @ 310 NONAME
+	pj_timer_heap_create                     @ 311 NONAME
+	pj_timer_heap_destroy                    @ 312 NONAME
+	pj_timer_heap_earliest_time              @ 313 NONAME
+	pj_timer_heap_mem_size                   @ 314 NONAME
+	pj_timer_heap_poll                       @ 315 NONAME
+	pj_timer_heap_schedule                   @ 316 NONAME
+	pj_timer_heap_schedule_w_grp_lock        @ 317 NONAME
+	pj_timer_heap_set_lock                   @ 318 NONAME
+	pj_timer_heap_set_max_timed_out_per_poll @ 319 NONAME
+	pj_unicode_to_ansi                       @ 320 NONAME
+	pj_utoa                                  @ 321 NONAME
+	pj_utoa_pad                              @ 322 NONAME
+	platform_strerror                        @ 323 NONAME
+	snprintf                                 @ 324 NONAME
+	vsnprintf                                @ 325 NONAME
\ No newline at end of file
diff --git a/jni/pjproject-android/.svn/pristine/de/de4493cdd886c54c46d9b9457c604830318df637.svn-base b/jni/pjproject-android/.svn/pristine/de/de4493cdd886c54c46d9b9457c604830318df637.svn-base
new file mode 100644
index 0000000..9970cc7
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/de4493cdd886c54c46d9b9457c604830318df637.svn-base
@@ -0,0 +1,111 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 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/stream_common.h>
+#include <pj/log.h>
+
+#define THIS_FILE	"stream_common.c"
+
+/*
+ * Parse fmtp for specified format/payload type.
+ */
+PJ_DEF(pj_status_t) pjmedia_stream_info_parse_fmtp( pj_pool_t *pool,
+						    const pjmedia_sdp_media *m,
+						    unsigned pt,
+						    pjmedia_codec_fmtp *fmtp)
+{
+    const pjmedia_sdp_attr *attr;
+    pjmedia_sdp_fmtp sdp_fmtp;
+    char *p, *p_end, fmt_buf[8];
+    pj_str_t fmt;
+    pj_status_t status;
+
+    pj_assert(m && fmtp);
+
+    pj_bzero(fmtp, sizeof(pjmedia_codec_fmtp));
+
+    /* Get "fmtp" attribute for the format */
+    pj_ansi_sprintf(fmt_buf, "%d", pt);
+    fmt = pj_str(fmt_buf);
+    attr = pjmedia_sdp_media_find_attr2(m, "fmtp", &fmt);
+    if (attr == NULL)
+	return PJ_SUCCESS;
+
+    /* Parse "fmtp" attribute */
+    status = pjmedia_sdp_attr_get_fmtp(attr, &sdp_fmtp);
+    if (status != PJ_SUCCESS)
+	return status;
+
+    /* Prepare parsing */
+    p = sdp_fmtp.fmt_param.ptr;
+    p_end = p + sdp_fmtp.fmt_param.slen;
+
+    /* Parse */
+    while (p < p_end) {
+	char *token, *start, *end;
+
+	if (fmtp->cnt >= PJMEDIA_CODEC_MAX_FMTP_CNT) {
+	    PJ_LOG(4,(THIS_FILE,
+		      "Warning: fmtp parameter count exceeds "
+		      "PJMEDIA_CODEC_MAX_FMTP_CNT"));
+	    return PJ_SUCCESS;
+	}
+
+	/* Skip whitespaces */
+	while (p < p_end && (*p == ' ' || *p == '\t')) ++p;
+	if (p == p_end)
+	    break;
+
+	/* Get token */
+	start = p;
+	while (p < p_end && *p != ';' && *p != '=') ++p;
+	end = p - 1;
+
+	/* Right trim */
+	while (end >= start && (*end == ' '  || *end == '\t' || 
+				*end == '\r' || *end == '\n' ))
+	    --end;
+
+	/* Forward a char after trimming */
+	++end;
+
+	/* Store token */
+	if (end > start) {
+	    if (pool) {
+		token = (char*)pj_pool_alloc(pool, end - start);
+		pj_ansi_strncpy(token, start, end - start);
+	    } else {
+		token = start;
+	    }
+	    if (*p == '=')
+		/* Got param name */
+		pj_strset(&fmtp->param[fmtp->cnt].name, token, end - start);
+	    else
+		/* Got param value */
+		pj_strset(&fmtp->param[fmtp->cnt++].val, token, end - start);
+	} else if (*p != '=') {
+	    ++fmtp->cnt;
+	}
+
+	/* Next */
+	++p;
+    }
+
+    return PJ_SUCCESS;
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/de/de783a746db054f8155bf38a2311c40a86cbd9b3.svn-base b/jni/pjproject-android/.svn/pristine/de/de783a746db054f8155bf38a2311c40a86cbd9b3.svn-base
new file mode 100644
index 0000000..2849f71
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/de783a746db054f8155bf38a2311c40a86cbd9b3.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:0 AES_CM_128_HMAC_SHA1_80 inline:
+"""
+
+args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0"
+include = []
+exclude = []
+
+sendto_cfg = sip.SendtoCfg( "caller send crypto attr without key, callee must not accept the call", 
+			    pjsua_args=args, sdp=sdp, resp_code=406, 
+			    resp_inc=include, resp_exc=exclude)
diff --git a/jni/pjproject-android/.svn/pristine/de/de83ca9afb9f1163a812444bcedefe4ad2e169a4.svn-base b/jni/pjproject-android/.svn/pristine/de/de83ca9afb9f1163a812444bcedefe4ad2e169a4.svn-base
new file mode 100644
index 0000000..6bba3fe
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/de83ca9afb9f1163a812444bcedefe4ad2e169a4.svn-base
@@ -0,0 +1,179 @@
+/* $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 
+ */
+
+
+/**
+ * \page page_pjmedia_samples_level_c Samples: Reading from WAV File
+ *
+ * This is a very simple example to use the @ref PJMEDIA_FILE_PLAY, to
+ * directly read the samples from the file.
+ *
+ * This file is pjsip-apps/src/samples/level.c
+ *
+ * \includelineno level.c
+ */
+
+
+static const char *desc = 
+ " FILE:								    \n"
+ "  level.c								    \n"
+ "									    \n"
+ " PURPOSE:								    \n"
+ "  Read PCM WAV file and display the audio level the first 100 frames.     \n"
+ "  Each frame is assumed to have 160 samples.				    \n"
+ "									    \n"
+ " USAGE:								    \n"
+ "  level file.wav							    \n"
+ "									    \n"
+ "  The WAV file SHOULD have a 16bit mono samples.			    ";
+
+#include <pjmedia.h>
+#include <pjlib.h>
+
+#include <stdio.h>
+
+/* For logging purpose. */
+#define THIS_FILE   "level.c"
+
+
+/* Util to display the error message for the specified error code  */
+static int app_perror( const char *sender, const char *title, 
+		       pj_status_t status)
+{
+    char errmsg[PJ_ERR_MSG_SIZE];
+
+    PJ_UNUSED_ARG(sender);
+
+    pj_strerror(status, errmsg, sizeof(errmsg));
+
+    printf("%s: %s [code=%d]\n", title, errmsg, status);
+    return 1;
+}
+
+
+/*
+ * main()
+ */
+int main(int argc, char *argv[])
+{
+    enum { NSAMPLES = 640, COUNT=100 };
+    pj_caching_pool cp;
+    pjmedia_endpt *med_endpt;
+    pj_pool_t *pool;
+    pjmedia_port *file_port;
+    int i;
+    pj_status_t status;
+
+
+    /* Verify cmd line arguments. */
+    if (argc != 2) {
+	puts("");
+	puts(desc);
+	return 1;
+    }
+
+    /* Must init PJLIB first: */
+    status = pj_init();
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+    /* Must create a pool factory before we can allocate any memory. */
+    pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
+
+    /* 
+     * Initialize media endpoint.
+     * This will implicitly initialize PJMEDIA too.
+     */
+    status = pjmedia_endpt_create(&cp.factory, NULL, 1, &med_endpt);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+    /* Create memory pool for our file player */
+    pool = pj_pool_create( &cp.factory,	    /* pool factory	    */
+			   "wav",	    /* pool name.	    */
+			   4000,	    /* init size	    */
+			   4000,	    /* increment size	    */
+			   NULL		    /* callback on error    */
+			   );
+
+    /* Create file media port from the WAV file */
+    status = pjmedia_wav_player_port_create(  pool,	/* memory pool	    */
+					      argv[1],	/* file to play	    */
+					      0,	/* use default ptime*/
+					      0,	/* flags	    */
+					      0,	/* default buffer   */
+					      &file_port/* returned port    */
+					      );
+    if (status != PJ_SUCCESS) {
+	app_perror(THIS_FILE, "Unable to use WAV file", status);
+	return 1;
+    }
+
+    if (PJMEDIA_PIA_SPF(&file_port->info) > NSAMPLES) {
+	app_perror(THIS_FILE, "WAV clock rate is too big", PJ_EINVAL);
+	return 1;
+    }
+
+    puts("Time\tPCMU\tLinear");
+    puts("------------------------");
+
+    for (i=0; i<COUNT; ++i) {
+	pj_int16_t framebuf[NSAMPLES];
+	pjmedia_frame frm;
+	pj_int32_t level32;
+	unsigned ms;
+	int level;
+
+	frm.buf = framebuf;
+	frm.size = sizeof(framebuf);
+	
+	pjmedia_port_get_frame(file_port, &frm);
+
+	level32 = pjmedia_calc_avg_signal(framebuf, 
+					  PJMEDIA_PIA_SPF(&file_port->info));
+	level = pjmedia_linear2ulaw(level32) ^ 0xFF;
+
+	ms = i * 1000 * PJMEDIA_PIA_SPF(&file_port->info) /
+		PJMEDIA_PIA_SRATE(&file_port->info);
+	printf("%03d.%03d\t%7d\t%7d\n", 
+	        ms/1000, ms%1000, level, level32);
+    }
+    puts("");
+    
+
+    /* Destroy file port */
+    status = pjmedia_port_destroy( file_port );
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+    /* Release application pool */
+    pj_pool_release( pool );
+
+    /* Destroy media endpoint. */
+    pjmedia_endpt_destroy( med_endpt );
+
+    /* Destroy pool factory */
+    pj_caching_pool_destroy( &cp );
+
+    /* Shutdown PJLIB */
+    pj_shutdown();
+
+
+    /* Done. */
+    return 0;
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/de/de95884d3298b8a45223b62e25c759b89b3cf764.svn-base b/jni/pjproject-android/.svn/pristine/de/de95884d3298b8a45223b62e25c759b89b3cf764.svn-base
new file mode 100644
index 0000000..aa04f04
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/de95884d3298b8a45223b62e25c759b89b3cf764.svn-base
@@ -0,0 +1,1534 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-06-17'
+
+# This file 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, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep -q __ELF__
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+		os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:Bitrig:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	exitcode=$?
+	trap '' 0
+	exit $exitcode ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+	echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+	echo m68k-milan-mint${UNAME_RELEASE}
+	exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+	echo m68k-hades-mint${UNAME_RELEASE}
+	exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+	echo m68k-unknown-mint${UNAME_RELEASE}
+	exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+	# DG/UX returns AViiON for all architectures
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[4567])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+		    case "${sc_cpu_version}" in
+		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      532)                      # CPU_PA_RISC2_0
+			case "${sc_kernel_bits}" in
+			  32) HP_ARCH="hppa2.0n" ;;
+			  64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+			esac ;;
+		    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^		//' << EOF >$dummy.c
+
+		#define _HPUX_SOURCE
+		#include <stdlib.h>
+		#include <unistd.h>
+
+		int main ()
+		{
+		#if defined(_SC_KERNEL_BITS)
+		    long bits = sysconf(_SC_KERNEL_BITS);
+		#endif
+		    long cpu  = sysconf (_SC_CPU_VERSION);
+
+		    switch (cpu)
+			{
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+			case CPU_PA_RISC2_0:
+		#if defined(_SC_KERNEL_BITS)
+			    switch (bits)
+				{
+				case 64: puts ("hppa2.0w"); break;
+				case 32: puts ("hppa2.0n"); break;
+				default: puts ("hppa2.0"); break;
+				} break;
+		#else  /* !defined(_SC_KERNEL_BITS) */
+			    puts ("hppa2.0"); break;
+		#endif
+			default: puts ("hppa1.0"); break;
+			}
+		    exit (0);
+		}
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep -q __LP64__
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+	exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+	exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+	exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+	exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    5000:UNIX_System_V:4.*:*)
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
+    i*:windows32*:*)
+	# uname -m includes "-pc" on this system.
+	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:*)
+	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    authenticamd | genuineintel | EM64T)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+	esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    arm*:Linux:*:*)
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	else
+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+		| grep -q __ARM_PCS_VFP
+	    then
+		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	    else
+		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+	    fi
+	fi
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo ${UNAME_MACHINE}-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo ${UNAME_MACHINE}-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	LIBC=gnu
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=${UNAME_MACHINE}el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=${UNAME_MACHINE}
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    padre:Linux:*:*)
+	echo sparc-unknown-linux-gnu
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    tile*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    xtensa*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+	# Unixware is an offshoot of SVR4, but it has its own version
+	# number series starting with 2...
+	# I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+	# Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
+	# the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configury will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
+	exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+			# says <Richard.M.Bartel@ccMail.Census.GOV>
+	echo i586-unisys-sysv4
+	exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+		echo mips-nec-sysv${UNAME_RELEASE}
+	else
+		echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+	exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
+	echo i586-pc-haiku
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+	echo neo-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSE-*:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+	echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+	"4"
+#else
+	""
+#endif
+	); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/jni/pjproject-android/.svn/pristine/de/dec6b39d88e75b7ba276752811e3be43804192a0.svn-base b/jni/pjproject-android/.svn/pristine/de/dec6b39d88e75b7ba276752811e3be43804192a0.svn-base
new file mode 100644
index 0000000..e465762
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/dec6b39d88e75b7ba276752811e3be43804192a0.svn-base
@@ -0,0 +1,105 @@
+.\"
+.\" 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.
+.\"
+.PU
+.TH GSM 3 
+.SH NAME
+gsm_create, gsm_destroy, gsm_encode, gsm_decode \(em GSM\ 06.10 lossy sound compression
+.SH SYNOPSIS
+.PP
+#include "gsm.h"
+.PP
+gsm gsm_create();
+.PP
+void gsm_encode(handle, src, dst)
+.br
+gsm handle;
+.br
+gsm_signal src[160];
+.br
+gsm_frame dst;
+.PP
+int gsm_decode(handle, src, dst)
+.br
+gsm handle;
+.br
+gsm_frame src;
+.br
+gsm_signal dst[160];
+.PP
+void gsm_destroy(handle)
+.br
+gsm handle;
+.br
+.SH "DESCRIPTION"
+Gsm is an implementation of the final draft GSM 06.10
+standard for full-rate speech transcoding.
+.PP
+gsm_create() initializes a gsm pass and returns a 'gsm' object
+which can be used as a handle in subsequent calls to gsm_decode(),
+gsm_encode() or gsm_destroy().
+.PP
+gsm_encode() encodes an array of 160 13-bit samples (given as
+gsm_signal's, signed integral values of at least 16 bits) into
+a gsm_frame of 33 bytes.
+(gsm_frame is a type defined as an array of 33 gsm_bytes in gsm.h.)
+.PP
+gsm_decode() decodes a gsm_frame into an array of 160 13-bit samples
+(given as gsm_signals), which sound rather like what you handed to
+gsm_encode() on the other side of the wire.
+.PP
+gsm_destroy() finishes a gsm pass and frees all storage associated
+with it.
+.SS "Sample format"
+The following scaling is assumed for input to the algorithm:
+.br
+.nf
+   0  1                             11 12
+   S..v..v..v..v..v..v..v..v..v..v..v..v..*..*..*
+.nf
+.br
+Only the top 13 bits are used as a signed input value.
+The output of gsm_decode() has the three lower bits set to zero.
+.\" .SH OPTIONS
+.SH "RETURN VALUE"
+gsm_create() returns an opaque handle object of type gsm, or 0 on error.
+gsm_decode() returns -1 if the passed frame is invalid, else 0.
+.SH EXAMPLE
+.nf
+#include "gsm.h"
+
+gsm handle;
+gsm_frame buf;
+gsm_signal sample[160];
+int cc, soundfd;
+
+play() {	/* read compressed data from standard input, write to soundfd */
+
+	if (!(handle = gsm_create())) error...
+	while (cc = read(0, (char *)buf, sizeof buf)) {
+		if (cc != sizeof buf) error...
+		if (gsm_decode(handle, buf, sample) < 0) error... 
+		if (write(soundfd, sample, sizeof sample) != sizeof sample)
+			error...
+	}
+	gsm_destroy(handle);
+}
+
+record() {	/* read from soundfd, write compressed to standard output */
+
+	if (!(handle = gsm_create())) error...
+	while (cc = read(soundfd, sample, sizeof sample)) {
+		if (cc != sizeof sample) error...
+		gsm_encode(handle, sample, buf);
+		if (write(1, (char *)buf, sizeof buf) != sizeof sample) 
+			error...
+	}
+	gsm_destroy(handle);
+}
+.nf
+.SH BUGS
+Please direct bug reports to jutta@cs.tu-berlin.de and cabo@cs.tu-berlin.de.
+.SH "SEE ALSO"
+toast(1), gsm_print(3), gsm_explode(3), gsm_option(3)
diff --git a/jni/pjproject-android/.svn/pristine/de/dece59763221644c8305fb00f5abac62162d691c.svn-base b/jni/pjproject-android/.svn/pristine/de/dece59763221644c8305fb00f5abac62162d691c.svn-base
new file mode 100644
index 0000000..e35a4b9
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/dece59763221644c8305fb00f5abac62162d691c.svn-base
@@ -0,0 +1,36 @@
+/* $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 
+ */
+#ifndef __PJ_COMPAT_M_ALPHA_H__
+#define __PJ_COMPAT_M_ALPHA_H__
+
+/**
+ * @file m_alpha.h
+ * @brief Describes Alpha processor family specifics.
+ */
+
+#define PJ_M_NAME		"alpha"
+
+#define PJ_HAS_PENTIUM		0
+#define PJ_IS_LITTLE_ENDIAN	1
+#define PJ_IS_BIG_ENDIAN	0
+
+
+#endif	/* __PJ_COMPAT_M_ALPHA_H__ */
+
diff --git a/jni/pjproject-android/.svn/pristine/de/def4bc64b70efcd76187feaaf067a692f89eaf3a.svn-base b/jni/pjproject-android/.svn/pristine/de/def4bc64b70efcd76187feaaf067a692f89eaf3a.svn-base
new file mode 100644
index 0000000..9b150a9
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/def4bc64b70efcd76187feaaf067a692f89eaf3a.svn-base
@@ -0,0 +1,2 @@
+EXPORTS
+	init_pjsua
diff --git a/jni/pjproject-android/.svn/pristine/de/def564ded42c00d46117ca9abddd472b03896e35.svn-base b/jni/pjproject-android/.svn/pristine/de/def564ded42c00d46117ca9abddd472b03896e35.svn-base
new file mode 100644
index 0000000..ee357b3
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/de/def564ded42c00d46117ca9abddd472b03896e35.svn-base
@@ -0,0 +1,1176 @@
+/* $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 
+ */
+
+
+/**
+ * \page page_pjmedia_samples_streamutil_c Samples: Remote Streaming
+ *
+ * This example mainly demonstrates how to stream media file to remote
+ * peer using RTP.
+ *
+ * This file is pjsip-apps/src/samples/streamutil.c
+ *
+ * \includelineno streamutil.c
+ */
+
+#include <pjlib.h>
+#include <pjlib-util.h>
+#include <pjmedia.h>
+#include <pjmedia-codec.h>
+#include <pjmedia/transport_srtp.h>
+
+#include <stdlib.h>	/* atoi() */
+#include <stdio.h>
+
+#include "util.h"
+
+
+static const char *desc = 
+ " streamutil								\n"
+ "									\n"
+ " PURPOSE:								\n"
+ "  Demonstrate how to use pjmedia stream component to transmit/receive \n"
+ "  RTP packets to/from sound device.		    			\n"
+ "\n"
+ "\n"
+ " USAGE:								\n"
+ "  streamutil [options]                                                \n"
+ "\n"
+ "\n"
+ " Options:\n"
+ "  --codec=CODEC         Set the codec name.                           \n"
+ "  --local-port=PORT     Set local RTP port (default=4000)		\n"
+ "  --remote=IP:PORT      Set the remote peer. If this option is set,	\n"
+ "                        the program will transmit RTP audio to the	\n"
+ "                        specified address. (default: recv only)	\n"
+ "  --play-file=WAV       Send audio from the WAV file instead of from	\n"
+ "                        the sound device.				\n"
+ "  --record-file=WAV     Record incoming audio to WAV file instead of	\n"
+ "                        playing it to sound device.			\n"
+ "  --send-recv           Set stream direction to bidirectional.        \n"
+ "  --send-only           Set stream direction to send only		\n"
+ "  --recv-only           Set stream direction to recv only (default)   \n"
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+ "  --use-srtp[=NAME]     Enable SRTP with crypto suite NAME            \n"
+ "                        e.g: AES_CM_128_HMAC_SHA1_80 (default),       \n"
+ "                             AES_CM_128_HMAC_SHA1_32                  \n"
+ "                        Use this option along with the TX & RX keys,  \n"
+ "                        formated of 60 hex digits (e.g: E148DA..)      \n"
+ "  --srtp-tx-key         SRTP key for transmiting                      \n"
+ "  --srtp-rx-key         SRTP key for receiving                        \n"
+#endif
+
+ "\n"
+;
+
+
+
+
+#define THIS_FILE	"stream.c"
+
+
+
+/* Prototype */
+static void print_stream_stat(pjmedia_stream *stream, 
+			      const pjmedia_codec_param *codec_param);
+
+/* Prototype for LIBSRTP utility in file datatypes.c */
+int hex_string_to_octet_string(char *raw, char *hex, int len);
+
+/* 
+ * Register all codecs. 
+ */
+static pj_status_t init_codecs(pjmedia_endpt *med_endpt)
+{
+    return pjmedia_codec_register_audio_codecs(med_endpt, NULL);
+}
+
+
+/* 
+ * Create stream based on the codec, dir, remote address, etc. 
+ */
+static pj_status_t create_stream( pj_pool_t *pool,
+				  pjmedia_endpt *med_endpt,
+				  const pjmedia_codec_info *codec_info,
+				  pjmedia_dir dir,
+				  pj_uint16_t local_port,
+				  const pj_sockaddr_in *rem_addr,
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+				  pj_bool_t use_srtp,
+				  const pj_str_t *crypto_suite,
+				  const pj_str_t *srtp_tx_key,
+				  const pj_str_t *srtp_rx_key,
+#endif
+				  pjmedia_stream **p_stream )
+{
+    pjmedia_stream_info info;
+    pjmedia_transport *transport = NULL;
+    pj_status_t status;
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+    pjmedia_transport *srtp_tp = NULL;
+#endif
+
+
+    /* Reset stream info. */
+    pj_bzero(&info, sizeof(info));
+
+
+    /* Initialize stream info formats */
+    info.type = PJMEDIA_TYPE_AUDIO;
+    info.dir = dir;
+    pj_memcpy(&info.fmt, codec_info, sizeof(pjmedia_codec_info));
+    info.tx_pt = codec_info->pt;
+    info.ssrc = pj_rand();
+    
+#if PJMEDIA_HAS_RTCP_XR && PJMEDIA_STREAM_ENABLE_XR
+    /* Set default RTCP XR enabled/disabled */
+    info.rtcp_xr_enabled = PJ_TRUE;
+#endif
+
+    /* Copy remote address */
+    pj_memcpy(&info.rem_addr, rem_addr, sizeof(pj_sockaddr_in));
+
+    /* If remote address is not set, set to an arbitrary address
+     * (otherwise stream will assert).
+     */
+    if (info.rem_addr.addr.sa_family == 0) {
+	const pj_str_t addr = pj_str("127.0.0.1");
+	pj_sockaddr_in_init(&info.rem_addr.ipv4, &addr, 0);
+    }
+
+    /* Create media transport */
+    status = pjmedia_transport_udp_create(med_endpt, NULL, local_port,
+					  0, &transport);
+    if (status != PJ_SUCCESS)
+	return status;
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+    /* Check if SRTP enabled */
+    if (use_srtp) {
+	pjmedia_srtp_crypto tx_plc, rx_plc;
+
+	status = pjmedia_transport_srtp_create(med_endpt, transport, 
+					       NULL, &srtp_tp);
+	if (status != PJ_SUCCESS)
+	    return status;
+
+	pj_bzero(&tx_plc, sizeof(pjmedia_srtp_crypto));
+	pj_bzero(&rx_plc, sizeof(pjmedia_srtp_crypto));
+
+	tx_plc.key = *srtp_tx_key;
+	tx_plc.name = *crypto_suite;
+	rx_plc.key = *srtp_rx_key;
+	rx_plc.name = *crypto_suite;
+	
+	status = pjmedia_transport_srtp_start(srtp_tp, &tx_plc, &rx_plc);
+	if (status != PJ_SUCCESS)
+	    return status;
+
+	transport = srtp_tp;
+    }
+#endif
+
+    /* Now that the stream info is initialized, we can create the 
+     * stream.
+     */
+
+    status = pjmedia_stream_create( med_endpt, pool, &info, 
+				    transport, 
+				    NULL, p_stream);
+
+    if (status != PJ_SUCCESS) {
+	app_perror(THIS_FILE, "Error creating stream", status);
+	pjmedia_transport_close(transport);
+	return status;
+    }
+
+
+    return PJ_SUCCESS;
+}
+
+
+/*
+ * usage()
+ */
+static void usage()
+{
+    puts(desc);
+}
+
+/*
+ * main()
+ */
+int main(int argc, char *argv[])
+{
+    pj_caching_pool cp;
+    pjmedia_endpt *med_endpt;
+    pj_pool_t *pool;
+    pjmedia_port *rec_file_port = NULL, *play_file_port = NULL;
+    pjmedia_master_port *master_port = NULL;
+    pjmedia_snd_port *snd_port = NULL;
+    pjmedia_stream *stream = NULL;
+    pjmedia_port *stream_port;
+    char tmp[10];
+    pj_status_t status; 
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+    /* SRTP variables */
+    pj_bool_t use_srtp = PJ_FALSE;
+    char tmp_tx_key[64];
+    char tmp_rx_key[64];
+    pj_str_t  srtp_tx_key = {NULL, 0};
+    pj_str_t  srtp_rx_key = {NULL, 0};
+    pj_str_t  srtp_crypto_suite = {NULL, 0};
+    int	tmp_key_len;
+#endif
+
+    /* Default values */
+    const pjmedia_codec_info *codec_info;
+    pjmedia_codec_param codec_param;
+    pjmedia_dir dir = PJMEDIA_DIR_DECODING;
+    pj_sockaddr_in remote_addr;
+    pj_uint16_t local_port = 4000;
+    char *codec_id = NULL;
+    char *rec_file = NULL;
+    char *play_file = NULL;
+
+    enum {
+	OPT_CODEC	= 'c',
+	OPT_LOCAL_PORT	= 'p',
+	OPT_REMOTE	= 'r',
+	OPT_PLAY_FILE	= 'w',
+	OPT_RECORD_FILE	= 'R',
+	OPT_SEND_RECV	= 'b',
+	OPT_SEND_ONLY	= 's',
+	OPT_RECV_ONLY	= 'i',
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+	OPT_USE_SRTP	= 'S',
+#endif
+	OPT_SRTP_TX_KEY	= 'x',
+	OPT_SRTP_RX_KEY	= 'y',
+	OPT_HELP	= 'h',
+    };
+
+    struct pj_getopt_option long_options[] = {
+	{ "codec",	    1, 0, OPT_CODEC },
+	{ "local-port",	    1, 0, OPT_LOCAL_PORT },
+	{ "remote",	    1, 0, OPT_REMOTE },
+	{ "play-file",	    1, 0, OPT_PLAY_FILE },
+	{ "record-file",    1, 0, OPT_RECORD_FILE },
+	{ "send-recv",      0, 0, OPT_SEND_RECV },
+	{ "send-only",      0, 0, OPT_SEND_ONLY },
+	{ "recv-only",      0, 0, OPT_RECV_ONLY },
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+	{ "use-srtp",	    2, 0, OPT_USE_SRTP },
+	{ "srtp-tx-key",    1, 0, OPT_SRTP_TX_KEY },
+	{ "srtp-rx-key",    1, 0, OPT_SRTP_RX_KEY },
+#endif
+	{ "help",	    0, 0, OPT_HELP },
+	{ NULL, 0, 0, 0 },
+    };
+
+    int c;
+    int option_index;
+
+
+    pj_bzero(&remote_addr, sizeof(remote_addr));
+
+
+    /* init PJLIB : */
+    status = pj_init();
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+
+    /* Parse arguments */
+    pj_optind = 0;
+    while((c=pj_getopt_long(argc,argv, "h", long_options, &option_index))!=-1) {
+
+	switch (c) {
+	case OPT_CODEC:
+	    codec_id = pj_optarg;
+	    break;
+
+	case OPT_LOCAL_PORT:
+	    local_port = (pj_uint16_t) atoi(pj_optarg);
+	    if (local_port < 1) {
+		printf("Error: invalid local port %s\n", pj_optarg);
+		return 1;
+	    }
+	    break;
+
+	case OPT_REMOTE:
+	    {
+		pj_str_t ip = pj_str(strtok(pj_optarg, ":"));
+		pj_uint16_t port = (pj_uint16_t) atoi(strtok(NULL, ":"));
+
+		status = pj_sockaddr_in_init(&remote_addr, &ip, port);
+		if (status != PJ_SUCCESS) {
+		    app_perror(THIS_FILE, "Invalid remote address", status);
+		    return 1;
+		}
+	    }
+	    break;
+
+	case OPT_PLAY_FILE:
+	    play_file = pj_optarg;
+	    break;
+
+	case OPT_RECORD_FILE:
+	    rec_file = pj_optarg;
+	    break;
+
+	case OPT_SEND_RECV:
+	    dir = PJMEDIA_DIR_ENCODING_DECODING;
+	    break;
+
+	case OPT_SEND_ONLY:
+	    dir = PJMEDIA_DIR_ENCODING;
+	    break;
+
+	case OPT_RECV_ONLY:
+	    dir = PJMEDIA_DIR_DECODING;
+	    break;
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+	case OPT_USE_SRTP:
+	    use_srtp = PJ_TRUE;
+	    if (pj_optarg) {
+		pj_strset(&srtp_crypto_suite, pj_optarg, strlen(pj_optarg));
+	    } else {
+		srtp_crypto_suite = pj_str("AES_CM_128_HMAC_SHA1_80");
+	    }
+	    break;
+
+	case OPT_SRTP_TX_KEY:
+	    tmp_key_len = hex_string_to_octet_string(tmp_tx_key, pj_optarg, 
+						     (int)strlen(pj_optarg));
+	    pj_strset(&srtp_tx_key, tmp_tx_key, tmp_key_len/2);
+	    break;
+
+	case OPT_SRTP_RX_KEY:
+	    tmp_key_len = hex_string_to_octet_string(tmp_rx_key, pj_optarg, 
+						     (int)strlen(pj_optarg));
+	    pj_strset(&srtp_rx_key, tmp_rx_key, tmp_key_len/2);
+	    break;
+#endif
+
+	case OPT_HELP:
+	    usage();
+	    return 1;
+
+	default:
+	    printf("Invalid options %s\n", argv[pj_optind]);
+	    return 1;
+	}
+
+    }
+
+
+    /* Verify arguments. */
+    if (dir & PJMEDIA_DIR_ENCODING) {
+	if (remote_addr.sin_addr.s_addr == 0) {
+	    printf("Error: remote address must be set\n");
+	    return 1;
+	}
+    }
+
+    if (play_file != NULL && dir != PJMEDIA_DIR_ENCODING) {
+	printf("Direction is set to --send-only because of --play-file\n");
+	dir = PJMEDIA_DIR_ENCODING;
+    }
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+    /* SRTP validation */
+    if (use_srtp) {
+	if (!srtp_tx_key.slen || !srtp_rx_key.slen)
+	{
+	    printf("Error: Key for each SRTP stream direction must be set\n");
+	    return 1;
+	}
+    }
+#endif
+
+    /* Must create a pool factory before we can allocate any memory. */
+    pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
+
+    /* 
+     * Initialize media endpoint.
+     * This will implicitly initialize PJMEDIA too.
+     */
+    status = pjmedia_endpt_create(&cp.factory, NULL, 1, &med_endpt);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+    /* Create memory pool for application purpose */
+    pool = pj_pool_create( &cp.factory,	    /* pool factory	    */
+			   "app",	    /* pool name.	    */
+			   4000,	    /* init size	    */
+			   4000,	    /* increment size	    */
+			   NULL		    /* callback on error    */
+			   );
+
+
+    /* Register all supported codecs */
+    status = init_codecs(med_endpt);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+
+    /* Find which codec to use. */
+    if (codec_id) {
+	unsigned count = 1;
+	pj_str_t str_codec_id = pj_str(codec_id);
+	pjmedia_codec_mgr *codec_mgr = pjmedia_endpt_get_codec_mgr(med_endpt);
+	status = pjmedia_codec_mgr_find_codecs_by_id( codec_mgr,
+						      &str_codec_id, &count,
+						      &codec_info, NULL);
+	if (status != PJ_SUCCESS) {
+	    printf("Error: unable to find codec %s\n", codec_id);
+	    return 1;
+	}
+    } else {
+	/* Default to pcmu */
+	pjmedia_codec_mgr_get_codec_info( pjmedia_endpt_get_codec_mgr(med_endpt),
+					  0, &codec_info);
+    }
+
+    /* Create stream based on program arguments */
+    status = create_stream(pool, med_endpt, codec_info, dir, local_port, 
+			   &remote_addr, 
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+			   use_srtp, &srtp_crypto_suite, 
+			   &srtp_tx_key, &srtp_rx_key,
+#endif
+			   &stream);
+    if (status != PJ_SUCCESS)
+	goto on_exit;
+
+    /* Get codec default param for info */
+    status = pjmedia_codec_mgr_get_default_param(
+				    pjmedia_endpt_get_codec_mgr(med_endpt), 
+				    codec_info, 
+				    &codec_param);
+    /* Should be ok, as create_stream() above succeeded */
+    pj_assert(status == PJ_SUCCESS);
+
+    /* Get the port interface of the stream */
+    status = pjmedia_stream_get_port( stream, &stream_port);
+    PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+
+    if (play_file) {
+	unsigned wav_ptime;
+
+	wav_ptime = PJMEDIA_PIA_PTIME(&stream_port->info);
+	status = pjmedia_wav_player_port_create(pool, play_file, wav_ptime,
+						0, -1, &play_file_port);
+	if (status != PJ_SUCCESS) {
+	    app_perror(THIS_FILE, "Unable to use file", status);
+	    goto on_exit;
+	}
+
+	status = pjmedia_master_port_create(pool, play_file_port, stream_port,
+					    0, &master_port);
+	if (status != PJ_SUCCESS) {
+	    app_perror(THIS_FILE, "Unable to create master port", status);
+	    goto on_exit;
+	}
+
+	status = pjmedia_master_port_start(master_port);
+	if (status != PJ_SUCCESS) {
+	    app_perror(THIS_FILE, "Error starting master port", status);
+	    goto on_exit;
+	}
+
+	printf("Playing from WAV file %s..\n", play_file);
+
+    } else if (rec_file) {
+
+	status = pjmedia_wav_writer_port_create(pool, rec_file,
+					        PJMEDIA_PIA_SRATE(&stream_port->info),
+					        PJMEDIA_PIA_CCNT(&stream_port->info),
+					        PJMEDIA_PIA_SPF(&stream_port->info),
+					        PJMEDIA_PIA_BITS(&stream_port->info),
+						0, 0, &rec_file_port);
+	if (status != PJ_SUCCESS) {
+	    app_perror(THIS_FILE, "Unable to use file", status);
+	    goto on_exit;
+	}
+
+	status = pjmedia_master_port_create(pool, stream_port, rec_file_port, 
+					    0, &master_port);
+	if (status != PJ_SUCCESS) {
+	    app_perror(THIS_FILE, "Unable to create master port", status);
+	    goto on_exit;
+	}
+
+	status = pjmedia_master_port_start(master_port);
+	if (status != PJ_SUCCESS) {
+	    app_perror(THIS_FILE, "Error starting master port", status);
+	    goto on_exit;
+	}
+
+	printf("Recording to WAV file %s..\n", rec_file);
+	
+    } else {
+
+	/* Create sound device port. */
+	if (dir == PJMEDIA_DIR_ENCODING_DECODING)
+	    status = pjmedia_snd_port_create(pool, -1, -1, 
+					PJMEDIA_PIA_SRATE(&stream_port->info),
+					PJMEDIA_PIA_CCNT(&stream_port->info),
+					PJMEDIA_PIA_SPF(&stream_port->info),
+					PJMEDIA_PIA_BITS(&stream_port->info),
+					0, &snd_port);
+	else if (dir == PJMEDIA_DIR_ENCODING)
+	    status = pjmedia_snd_port_create_rec(pool, -1, 
+					PJMEDIA_PIA_SRATE(&stream_port->info),
+					PJMEDIA_PIA_CCNT(&stream_port->info),
+					PJMEDIA_PIA_SPF(&stream_port->info),
+					PJMEDIA_PIA_BITS(&stream_port->info),
+					0, &snd_port);
+	else
+	    status = pjmedia_snd_port_create_player(pool, -1, 
+					PJMEDIA_PIA_SRATE(&stream_port->info),
+					PJMEDIA_PIA_CCNT(&stream_port->info),
+					PJMEDIA_PIA_SPF(&stream_port->info),
+					PJMEDIA_PIA_BITS(&stream_port->info),
+					0, &snd_port);
+
+
+	if (status != PJ_SUCCESS) {
+	    app_perror(THIS_FILE, "Unable to create sound port", status);
+	    goto on_exit;
+	}
+
+	/* Connect sound port to stream */
+	status = pjmedia_snd_port_connect( snd_port, stream_port );
+	PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+    }
+
+    /* Start streaming */
+    pjmedia_stream_start(stream);
+
+
+    /* Done */
+
+    if (dir == PJMEDIA_DIR_DECODING)
+	printf("Stream is active, dir is recv-only, local port is %d\n",
+	       local_port);
+    else if (dir == PJMEDIA_DIR_ENCODING)
+	printf("Stream is active, dir is send-only, sending to %s:%d\n",
+	       pj_inet_ntoa(remote_addr.sin_addr),
+	       pj_ntohs(remote_addr.sin_port));
+    else
+	printf("Stream is active, send/recv, local port is %d, "
+	       "sending to %s:%d\n",
+	       local_port,
+	       pj_inet_ntoa(remote_addr.sin_addr),
+	       pj_ntohs(remote_addr.sin_port));
+
+
+    for (;;) {
+
+	puts("");
+	puts("Commands:");
+	puts("  s     Display media statistics");
+	puts("  q     Quit");
+	puts("");
+
+	printf("Command: "); fflush(stdout);
+
+	if (fgets(tmp, sizeof(tmp), stdin) == NULL) {
+	    puts("EOF while reading stdin, will quit now..");
+	    break;
+	}
+
+	if (tmp[0] == 's')
+	    print_stream_stat(stream, &codec_param);
+	else if (tmp[0] == 'q')
+	    break;
+
+    }
+
+
+
+    /* Start deinitialization: */
+on_exit:
+
+    /* Destroy sound device */
+    if (snd_port) {
+	pjmedia_snd_port_destroy( snd_port );
+	PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+    }
+
+    /* If there is master port, then we just need to destroy master port
+     * (it will recursively destroy upstream and downstream ports, which
+     * in this case are file_port and stream_port).
+     */
+    if (master_port) {
+	pjmedia_master_port_destroy(master_port, PJ_TRUE);
+	play_file_port = NULL;
+	stream = NULL;
+    }
+
+    /* Destroy stream */
+    if (stream) {
+	pjmedia_transport *tp;
+
+	tp = pjmedia_stream_get_transport(stream);
+	pjmedia_stream_destroy(stream);
+	
+	pjmedia_transport_close(tp);
+    }
+
+    /* Destroy file ports */
+    if (play_file_port)
+	pjmedia_port_destroy( play_file_port );
+    if (rec_file_port)
+	pjmedia_port_destroy( rec_file_port );
+
+
+    /* Release application pool */
+    pj_pool_release( pool );
+
+    /* Destroy media endpoint. */
+    pjmedia_endpt_destroy( med_endpt );
+
+    /* Destroy pool factory */
+    pj_caching_pool_destroy( &cp );
+
+    /* Shutdown PJLIB */
+    pj_shutdown();
+
+
+    return (status == PJ_SUCCESS) ? 0 : 1;
+}
+
+
+
+
+static const char *good_number(char *buf, pj_int32_t val)
+{
+    if (val < 1000) {
+	pj_ansi_sprintf(buf, "%d", val);
+    } else if (val < 1000000) {
+	pj_ansi_sprintf(buf, "%d.%dK", 
+			val / 1000,
+			(val % 1000) / 100);
+    } else {
+	pj_ansi_sprintf(buf, "%d.%02dM", 
+			val / 1000000,
+			(val % 1000000) / 10000);
+    }
+
+    return buf;
+}
+
+
+#define SAMPLES_TO_USEC(usec, samples, clock_rate) \
+    do { \
+	if (samples <= 4294) \
+	    usec = samples * 1000000 / clock_rate; \
+	else { \
+	    usec = samples * 1000 / clock_rate; \
+	    usec *= 1000; \
+	} \
+    } while(0)
+
+#define PRINT_VOIP_MTC_VAL(s, v) \
+    if (v == 127) \
+	sprintf(s, "(na)"); \
+    else \
+	sprintf(s, "%d", v)
+
+
+/*
+ * Print stream statistics
+ */
+static void print_stream_stat(pjmedia_stream *stream,
+			      const pjmedia_codec_param *codec_param)
+{
+    char duration[80], last_update[80];
+    char bps[16], ipbps[16], packets[16], bytes[16], ipbytes[16];
+    pjmedia_port *port;
+    pjmedia_rtcp_stat stat;
+    pj_time_val now;
+
+
+    pj_gettimeofday(&now);
+    pjmedia_stream_get_stat(stream, &stat);
+    pjmedia_stream_get_port(stream, &port);
+
+    puts("Stream statistics:");
+
+    /* Print duration */
+    PJ_TIME_VAL_SUB(now, stat.start);
+    sprintf(duration, " Duration: %02ld:%02ld:%02ld.%03ld",
+	    now.sec / 3600,
+	    (now.sec % 3600) / 60,
+	    (now.sec % 60),
+	    now.msec);
+
+
+    printf(" Info: audio %dHz, %dms/frame, %sB/s (%sB/s +IP hdr)\n",
+	PJMEDIA_PIA_SRATE(&port->info),
+	PJMEDIA_PIA_PTIME(&port->info),
+	good_number(bps, (codec_param->info.avg_bps+7)/8),
+	good_number(ipbps, ((codec_param->info.avg_bps+7)/8) + 
+			   (40 * 1000 /
+			    codec_param->setting.frm_per_pkt /
+			    codec_param->info.frm_ptime)));
+
+    if (stat.rx.update_cnt == 0)
+	strcpy(last_update, "never");
+    else {
+	pj_gettimeofday(&now);
+	PJ_TIME_VAL_SUB(now, stat.rx.update);
+	sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago",
+		now.sec / 3600,
+		(now.sec % 3600) / 60,
+		now.sec % 60,
+		now.msec);
+    }
+
+    printf(" RX stat last update: %s\n"
+	   "    total %s packets %sB received (%sB +IP hdr)%s\n"
+	   "    pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n"
+	   "          (msec)    min     avg     max     last    dev\n"
+	   "    loss period: %7.3f %7.3f %7.3f %7.3f %7.3f%s\n"
+	   "    jitter     : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n",
+	   last_update,
+	   good_number(packets, stat.rx.pkt),
+	   good_number(bytes, stat.rx.bytes),
+	   good_number(ipbytes, stat.rx.bytes + stat.rx.pkt * 32),
+	   "",
+	   stat.rx.loss,
+	   stat.rx.loss * 100.0 / (stat.rx.pkt + stat.rx.loss),
+	   stat.rx.dup, 
+	   stat.rx.dup * 100.0 / (stat.rx.pkt + stat.rx.loss),
+	   stat.rx.reorder, 
+	   stat.rx.reorder * 100.0 / (stat.rx.pkt + stat.rx.loss),
+	   "",
+	   stat.rx.loss_period.min / 1000.0, 
+	   stat.rx.loss_period.mean / 1000.0, 
+	   stat.rx.loss_period.max / 1000.0,
+	   stat.rx.loss_period.last / 1000.0,
+	   pj_math_stat_get_stddev(&stat.rx.loss_period) / 1000.0,
+	   "",
+	   stat.rx.jitter.min / 1000.0,
+	   stat.rx.jitter.mean / 1000.0,
+	   stat.rx.jitter.max / 1000.0,
+	   stat.rx.jitter.last / 1000.0,
+	   pj_math_stat_get_stddev(&stat.rx.jitter) / 1000.0,
+	   ""
+	   );
+
+
+    if (stat.tx.update_cnt == 0)
+	strcpy(last_update, "never");
+    else {
+	pj_gettimeofday(&now);
+	PJ_TIME_VAL_SUB(now, stat.tx.update);
+	sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago",
+		now.sec / 3600,
+		(now.sec % 3600) / 60,
+		now.sec % 60,
+		now.msec);
+    }
+
+    printf(" TX stat last update: %s\n"
+	   "    total %s packets %sB sent (%sB +IP hdr)%s\n"
+	   "    pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n"
+	   "          (msec)    min     avg     max     last    dev\n"
+	   "    loss period: %7.3f %7.3f %7.3f %7.3f %7.3f%s\n"
+	   "    jitter     : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n",
+	   last_update,
+	   good_number(packets, stat.tx.pkt),
+	   good_number(bytes, stat.tx.bytes),
+	   good_number(ipbytes, stat.tx.bytes + stat.tx.pkt * 32),
+	   "",
+	   stat.tx.loss,
+	   stat.tx.loss * 100.0 / (stat.tx.pkt + stat.tx.loss),
+	   stat.tx.dup, 
+	   stat.tx.dup * 100.0 / (stat.tx.pkt + stat.tx.loss),
+	   stat.tx.reorder, 
+	   stat.tx.reorder * 100.0 / (stat.tx.pkt + stat.tx.loss),
+	   "",
+	   stat.tx.loss_period.min / 1000.0, 
+	   stat.tx.loss_period.mean / 1000.0, 
+	   stat.tx.loss_period.max / 1000.0,
+	   stat.tx.loss_period.last / 1000.0,
+	   pj_math_stat_get_stddev(&stat.tx.loss_period) / 1000.0,
+	   "",
+	   stat.tx.jitter.min / 1000.0,
+	   stat.tx.jitter.mean / 1000.0,
+	   stat.tx.jitter.max / 1000.0,
+	   stat.tx.jitter.last / 1000.0,
+	   pj_math_stat_get_stddev(&stat.tx.jitter) / 1000.0,
+	   ""
+	   );
+
+
+    printf(" RTT delay     : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n", 
+	   stat.rtt.min / 1000.0,
+	   stat.rtt.mean / 1000.0,
+	   stat.rtt.max / 1000.0,
+	   stat.rtt.last / 1000.0,
+	   pj_math_stat_get_stddev(&stat.rtt) / 1000.0,
+	   ""
+	   );
+
+#if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
+    /* RTCP XR Reports */
+    do {
+	char loss[16], dup[16];
+	char jitter[80];
+	char toh[80];
+	char plc[16], jba[16], jbr[16];
+	char signal_lvl[16], noise_lvl[16], rerl[16];
+	char r_factor[16], ext_r_factor[16], mos_lq[16], mos_cq[16];
+	pjmedia_rtcp_xr_stat xr_stat;
+
+	if (pjmedia_stream_get_stat_xr(stream, &xr_stat) != PJ_SUCCESS)
+	    break;
+
+	puts("\nExtended reports:");
+
+	/* Statistics Summary */
+	puts(" Statistics Summary");
+
+	if (xr_stat.rx.stat_sum.l)
+	    sprintf(loss, "%d", xr_stat.rx.stat_sum.lost);
+	else
+	    sprintf(loss, "(na)");
+
+	if (xr_stat.rx.stat_sum.d)
+	    sprintf(dup, "%d", xr_stat.rx.stat_sum.dup);
+	else
+	    sprintf(dup, "(na)");
+
+	if (xr_stat.rx.stat_sum.j) {
+	    unsigned jmin, jmax, jmean, jdev;
+
+	    SAMPLES_TO_USEC(jmin, xr_stat.rx.stat_sum.jitter.min, 
+			    port->info.fmt.det.aud.clock_rate);
+	    SAMPLES_TO_USEC(jmax, xr_stat.rx.stat_sum.jitter.max, 
+			    port->info.fmt.det.aud.clock_rate);
+	    SAMPLES_TO_USEC(jmean, xr_stat.rx.stat_sum.jitter.mean, 
+			    port->info.fmt.det.aud.clock_rate);
+	    SAMPLES_TO_USEC(jdev, 
+			   pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.jitter),
+			   port->info.fmt.det.aud.clock_rate);
+	    sprintf(jitter, "%7.3f %7.3f %7.3f %7.3f", 
+		    jmin/1000.0, jmean/1000.0, jmax/1000.0, jdev/1000.0);
+	} else
+	    sprintf(jitter, "(report not available)");
+
+	if (xr_stat.rx.stat_sum.t) {
+	    sprintf(toh, "%11d %11d %11d %11d", 
+		    xr_stat.rx.stat_sum.toh.min,
+		    xr_stat.rx.stat_sum.toh.mean,
+		    xr_stat.rx.stat_sum.toh.max,
+		    pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.toh));
+	} else
+	    sprintf(toh, "(report not available)");
+
+	if (xr_stat.rx.stat_sum.update.sec == 0)
+	    strcpy(last_update, "never");
+	else {
+	    pj_gettimeofday(&now);
+	    PJ_TIME_VAL_SUB(now, xr_stat.rx.stat_sum.update);
+	    sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago",
+		    now.sec / 3600,
+		    (now.sec % 3600) / 60,
+		    now.sec % 60,
+		    now.msec);
+	}
+
+	printf(" RX last update: %s\n"
+	       "    begin seq=%d, end seq=%d%s\n"
+	       "    pkt loss=%s, dup=%s%s\n"
+	       "          (msec)    min     avg     max     dev\n"
+	       "    jitter     : %s\n"
+	       "    toh        : %s\n",
+	       last_update,
+	       xr_stat.rx.stat_sum.begin_seq, xr_stat.rx.stat_sum.end_seq,
+	       "",
+	       loss, dup,
+	       "",
+	       jitter,
+	       toh
+	       );
+
+	if (xr_stat.tx.stat_sum.l)
+	    sprintf(loss, "%d", xr_stat.tx.stat_sum.lost);
+	else
+	    sprintf(loss, "(na)");
+
+	if (xr_stat.tx.stat_sum.d)
+	    sprintf(dup, "%d", xr_stat.tx.stat_sum.dup);
+	else
+	    sprintf(dup, "(na)");
+
+	if (xr_stat.tx.stat_sum.j) {
+	    unsigned jmin, jmax, jmean, jdev;
+
+	    SAMPLES_TO_USEC(jmin, xr_stat.tx.stat_sum.jitter.min, 
+			    port->info.fmt.det.aud.clock_rate);
+	    SAMPLES_TO_USEC(jmax, xr_stat.tx.stat_sum.jitter.max, 
+			    port->info.fmt.det.aud.clock_rate);
+	    SAMPLES_TO_USEC(jmean, xr_stat.tx.stat_sum.jitter.mean, 
+			    port->info.fmt.det.aud.clock_rate);
+	    SAMPLES_TO_USEC(jdev, 
+			   pj_math_stat_get_stddev(&xr_stat.tx.stat_sum.jitter),
+			   port->info.fmt.det.aud.clock_rate);
+	    sprintf(jitter, "%7.3f %7.3f %7.3f %7.3f", 
+		    jmin/1000.0, jmean/1000.0, jmax/1000.0, jdev/1000.0);
+	} else
+	    sprintf(jitter, "(report not available)");
+
+	if (xr_stat.tx.stat_sum.t) {
+	    sprintf(toh, "%11d %11d %11d %11d", 
+		    xr_stat.tx.stat_sum.toh.min,
+		    xr_stat.tx.stat_sum.toh.mean,
+		    xr_stat.tx.stat_sum.toh.max,
+		    pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.toh));
+	} else
+	    sprintf(toh,    "(report not available)");
+
+	if (xr_stat.tx.stat_sum.update.sec == 0)
+	    strcpy(last_update, "never");
+	else {
+	    pj_gettimeofday(&now);
+	    PJ_TIME_VAL_SUB(now, xr_stat.tx.stat_sum.update);
+	    sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago",
+		    now.sec / 3600,
+		    (now.sec % 3600) / 60,
+		    now.sec % 60,
+		    now.msec);
+	}
+
+	printf(" TX last update: %s\n"
+	       "    begin seq=%d, end seq=%d%s\n"
+	       "    pkt loss=%s, dup=%s%s\n"
+	       "          (msec)    min     avg     max     dev\n"
+	       "    jitter     : %s\n"
+	       "    toh        : %s\n",
+	       last_update,
+	       xr_stat.tx.stat_sum.begin_seq, xr_stat.tx.stat_sum.end_seq,
+	       "",
+	       loss, dup,
+	       "",
+	       jitter,
+	       toh
+	       );
+
+	/* VoIP Metrics */
+	puts(" VoIP Metrics");
+
+	PRINT_VOIP_MTC_VAL(signal_lvl, xr_stat.rx.voip_mtc.signal_lvl);
+	PRINT_VOIP_MTC_VAL(noise_lvl, xr_stat.rx.voip_mtc.noise_lvl);
+	PRINT_VOIP_MTC_VAL(rerl, xr_stat.rx.voip_mtc.rerl);
+	PRINT_VOIP_MTC_VAL(r_factor, xr_stat.rx.voip_mtc.r_factor);
+	PRINT_VOIP_MTC_VAL(ext_r_factor, xr_stat.rx.voip_mtc.ext_r_factor);
+	PRINT_VOIP_MTC_VAL(mos_lq, xr_stat.rx.voip_mtc.mos_lq);
+	PRINT_VOIP_MTC_VAL(mos_cq, xr_stat.rx.voip_mtc.mos_cq);
+
+	switch ((xr_stat.rx.voip_mtc.rx_config>>6) & 3) {
+	    case PJMEDIA_RTCP_XR_PLC_DIS:
+		sprintf(plc, "DISABLED");
+		break;
+	    case PJMEDIA_RTCP_XR_PLC_ENH:
+		sprintf(plc, "ENHANCED");
+		break;
+	    case PJMEDIA_RTCP_XR_PLC_STD:
+		sprintf(plc, "STANDARD");
+		break;
+	    case PJMEDIA_RTCP_XR_PLC_UNK:
+	    default:
+		sprintf(plc, "UNKNOWN");
+		break;
+	}
+
+	switch ((xr_stat.rx.voip_mtc.rx_config>>4) & 3) {
+	    case PJMEDIA_RTCP_XR_JB_FIXED:
+		sprintf(jba, "FIXED");
+		break;
+	    case PJMEDIA_RTCP_XR_JB_ADAPTIVE:
+		sprintf(jba, "ADAPTIVE");
+		break;
+	    default:
+		sprintf(jba, "UNKNOWN");
+		break;
+	}
+
+	sprintf(jbr, "%d", xr_stat.rx.voip_mtc.rx_config & 0x0F);
+
+	if (xr_stat.rx.voip_mtc.update.sec == 0)
+	    strcpy(last_update, "never");
+	else {
+	    pj_gettimeofday(&now);
+	    PJ_TIME_VAL_SUB(now, xr_stat.rx.voip_mtc.update);
+	    sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago",
+		    now.sec / 3600,
+		    (now.sec % 3600) / 60,
+		    now.sec % 60,
+		    now.msec);
+	}
+
+	printf(" RX last update: %s\n"
+	       "    packets    : loss rate=%d (%.2f%%), discard rate=%d (%.2f%%)\n"
+	       "    burst      : density=%d (%.2f%%), duration=%d%s\n"
+	       "    gap        : density=%d (%.2f%%), duration=%d%s\n"
+	       "    delay      : round trip=%d%s, end system=%d%s\n"
+	       "    level      : signal=%s%s, noise=%s%s, RERL=%s%s\n"
+	       "    quality    : R factor=%s, ext R factor=%s\n"
+	       "                 MOS LQ=%s, MOS CQ=%s\n"
+	       "    config     : PLC=%s, JB=%s, JB rate=%s, Gmin=%d\n"
+	       "    JB delay   : cur=%d%s, max=%d%s, abs max=%d%s\n",
+	       last_update,
+	       /* pakcets */
+	       xr_stat.rx.voip_mtc.loss_rate, xr_stat.rx.voip_mtc.loss_rate*100.0/256,
+	       xr_stat.rx.voip_mtc.discard_rate, xr_stat.rx.voip_mtc.discard_rate*100.0/256,
+	       /* burst */
+	       xr_stat.rx.voip_mtc.burst_den, xr_stat.rx.voip_mtc.burst_den*100.0/256,
+	       xr_stat.rx.voip_mtc.burst_dur, "ms",
+	       /* gap */
+	       xr_stat.rx.voip_mtc.gap_den, xr_stat.rx.voip_mtc.gap_den*100.0/256,
+	       xr_stat.rx.voip_mtc.gap_dur, "ms",
+	       /* delay */
+	       xr_stat.rx.voip_mtc.rnd_trip_delay, "ms",
+	       xr_stat.rx.voip_mtc.end_sys_delay, "ms",
+	       /* level */
+	       signal_lvl, "dB",
+	       noise_lvl, "dB",
+	       rerl, "",
+	       /* quality */
+	       r_factor, ext_r_factor, mos_lq, mos_cq,
+	       /* config */
+	       plc, jba, jbr, xr_stat.rx.voip_mtc.gmin,
+	       /* JB delay */
+	       xr_stat.rx.voip_mtc.jb_nom, "ms",
+	       xr_stat.rx.voip_mtc.jb_max, "ms",
+	       xr_stat.rx.voip_mtc.jb_abs_max, "ms"
+	       );
+
+	PRINT_VOIP_MTC_VAL(signal_lvl, xr_stat.tx.voip_mtc.signal_lvl);
+	PRINT_VOIP_MTC_VAL(noise_lvl, xr_stat.tx.voip_mtc.noise_lvl);
+	PRINT_VOIP_MTC_VAL(rerl, xr_stat.tx.voip_mtc.rerl);
+	PRINT_VOIP_MTC_VAL(r_factor, xr_stat.tx.voip_mtc.r_factor);
+	PRINT_VOIP_MTC_VAL(ext_r_factor, xr_stat.tx.voip_mtc.ext_r_factor);
+	PRINT_VOIP_MTC_VAL(mos_lq, xr_stat.tx.voip_mtc.mos_lq);
+	PRINT_VOIP_MTC_VAL(mos_cq, xr_stat.tx.voip_mtc.mos_cq);
+
+	switch ((xr_stat.tx.voip_mtc.rx_config>>6) & 3) {
+	    case PJMEDIA_RTCP_XR_PLC_DIS:
+		sprintf(plc, "DISABLED");
+		break;
+	    case PJMEDIA_RTCP_XR_PLC_ENH:
+		sprintf(plc, "ENHANCED");
+		break;
+	    case PJMEDIA_RTCP_XR_PLC_STD:
+		sprintf(plc, "STANDARD");
+		break;
+	    case PJMEDIA_RTCP_XR_PLC_UNK:
+	    default:
+		sprintf(plc, "unknown");
+		break;
+	}
+
+	switch ((xr_stat.tx.voip_mtc.rx_config>>4) & 3) {
+	    case PJMEDIA_RTCP_XR_JB_FIXED:
+		sprintf(jba, "FIXED");
+		break;
+	    case PJMEDIA_RTCP_XR_JB_ADAPTIVE:
+		sprintf(jba, "ADAPTIVE");
+		break;
+	    default:
+		sprintf(jba, "unknown");
+		break;
+	}
+
+	sprintf(jbr, "%d", xr_stat.tx.voip_mtc.rx_config & 0x0F);
+
+	if (xr_stat.tx.voip_mtc.update.sec == 0)
+	    strcpy(last_update, "never");
+	else {
+	    pj_gettimeofday(&now);
+	    PJ_TIME_VAL_SUB(now, xr_stat.tx.voip_mtc.update);
+	    sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago",
+		    now.sec / 3600,
+		    (now.sec % 3600) / 60,
+		    now.sec % 60,
+		    now.msec);
+	}
+
+	printf(" TX last update: %s\n"
+	       "    packets    : loss rate=%d (%.2f%%), discard rate=%d (%.2f%%)\n"
+	       "    burst      : density=%d (%.2f%%), duration=%d%s\n"
+	       "    gap        : density=%d (%.2f%%), duration=%d%s\n"
+	       "    delay      : round trip=%d%s, end system=%d%s\n"
+	       "    level      : signal=%s%s, noise=%s%s, RERL=%s%s\n"
+	       "    quality    : R factor=%s, ext R factor=%s\n"
+	       "                 MOS LQ=%s, MOS CQ=%s\n"
+	       "    config     : PLC=%s, JB=%s, JB rate=%s, Gmin=%d\n"
+	       "    JB delay   : cur=%d%s, max=%d%s, abs max=%d%s\n",
+	       last_update,
+	       /* pakcets */
+	       xr_stat.tx.voip_mtc.loss_rate, xr_stat.tx.voip_mtc.loss_rate*100.0/256,
+	       xr_stat.tx.voip_mtc.discard_rate, xr_stat.tx.voip_mtc.discard_rate*100.0/256,
+	       /* burst */
+	       xr_stat.tx.voip_mtc.burst_den, xr_stat.tx.voip_mtc.burst_den*100.0/256,
+	       xr_stat.tx.voip_mtc.burst_dur, "ms",
+	       /* gap */
+	       xr_stat.tx.voip_mtc.gap_den, xr_stat.tx.voip_mtc.gap_den*100.0/256,
+	       xr_stat.tx.voip_mtc.gap_dur, "ms",
+	       /* delay */
+	       xr_stat.tx.voip_mtc.rnd_trip_delay, "ms",
+	       xr_stat.tx.voip_mtc.end_sys_delay, "ms",
+	       /* level */
+	       signal_lvl, "dB",
+	       noise_lvl, "dB",
+	       rerl, "",
+	       /* quality */
+	       r_factor, ext_r_factor, mos_lq, mos_cq,
+	       /* config */
+	       plc, jba, jbr, xr_stat.tx.voip_mtc.gmin,
+	       /* JB delay */
+	       xr_stat.tx.voip_mtc.jb_nom, "ms",
+	       xr_stat.tx.voip_mtc.jb_max, "ms",
+	       xr_stat.tx.voip_mtc.jb_abs_max, "ms"
+	       );
+
+
+	/* RTT delay (by receiver side) */
+	printf("          (msec)    min     avg     max     last    dev\n");
+	printf(" RTT delay     : %7.3f %7.3f %7.3f %7.3f %7.3f%s\n", 
+	       xr_stat.rtt.min / 1000.0,
+	       xr_stat.rtt.mean / 1000.0,
+	       xr_stat.rtt.max / 1000.0,
+	       xr_stat.rtt.last / 1000.0,
+	       pj_math_stat_get_stddev(&xr_stat.rtt) / 1000.0,
+	       ""
+	       );
+    } while (0);
+#endif /* PJMEDIA_HAS_RTCP_XR */
+
+}
+