summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2013-02-27 10:16:08 +0000
committerLiong Sauw Ming <ming@teluu.com>2013-02-27 10:16:08 +0000
commite0b9872e5b72532014d4f2fd8116662cc92fdf64 (patch)
treebe3ac789db5892454d95b218849b56ebdcf24520
parent1703f7d9893e43ae31e81cb9de5b26420e2f6857 (diff)
Re #1559: Backported to 1.x, except r4312,r4330
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@4387 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjlib-util/build/Makefile2
-rw-r--r--pjlib/build/Makefile2
-rw-r--r--pjlib/src/pj/sock_bsd.c5
-rw-r--r--pjlib/src/pjlib-test/activesock.c1
-rw-r--r--pjlib/src/pjlib-test/ioq_tcp.c12
-rw-r--r--pjlib/src/pjlib-test/ioq_udp.c5
-rw-r--r--pjmedia/build/Makefile4
-rw-r--r--pjmedia/src/pjmedia-audiodev/alsa_dev.c2
-rw-r--r--pjmedia/src/pjmedia/g711.c5
-rw-r--r--pjmedia/src/pjmedia/rtcp.c3
-rw-r--r--pjmedia/src/pjmedia/rtp.c2
-rw-r--r--pjmedia/src/pjmedia/transport_srtp.c52
-rw-r--r--pjnath/build/Makefile2
-rw-r--r--pjsip-apps/src/python/setup.py5
-rw-r--r--pjsip-apps/src/samples/icedemo.c1
-rw-r--r--pjsip/build/Makefile2
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h13
-rw-r--r--pjsip/src/pjsip/sip_parser.c9
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c15
19 files changed, 102 insertions, 40 deletions
diff --git a/pjlib-util/build/Makefile b/pjlib-util/build/Makefile
index fba93bb3..d2ad65a8 100644
--- a/pjlib-util/build/Makefile
+++ b/pjlib-util/build/Makefile
@@ -74,7 +74,7 @@ distclean: realclean
pjlib-util:
$(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $(PJLIB_UTIL_LIB)
-pjlib-util-test:
+pjlib-util-test: pjlib-util
$(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $(UTIL_TEST_EXE)
.PHONY: ../lib/pjlib-util.ko
diff --git a/pjlib/build/Makefile b/pjlib/build/Makefile
index 91836445..a36f5f44 100644
--- a/pjlib/build/Makefile
+++ b/pjlib/build/Makefile
@@ -87,7 +87,7 @@ pjlib: ../include/pj/config_site.h
../include/pj/config_site.h:
touch ../include/pj/config_site.h
-pjlib-test:
+pjlib-test: pjlib
$(MAKE) -f $(RULES_MAK) APP=TEST app=pjlib-test $(TEST_EXE)
.PHONY: ../lib/pjlib.ko
diff --git a/pjlib/src/pj/sock_bsd.c b/pjlib/src/pj/sock_bsd.c
index 9bd0356f..358b9aef 100644
--- a/pjlib/src/pj/sock_bsd.c
+++ b/pjlib/src/pj/sock_bsd.c
@@ -718,7 +718,6 @@ PJ_DEF(pj_status_t) pj_sock_recvfrom(pj_sock_t sock,
{
PJ_CHECK_STACK();
PJ_ASSERT_RETURN(buf && len, PJ_EINVAL);
- PJ_ASSERT_RETURN(from && fromlen, (*len=-1, PJ_EINVAL));
*len = recvfrom(sock, (char*)buf, *len, flags,
(struct sockaddr*)from, (socklen_t*)fromlen);
@@ -726,7 +725,9 @@ PJ_DEF(pj_status_t) pj_sock_recvfrom(pj_sock_t sock,
if (*len < 0)
return PJ_RETURN_OS_ERROR(pj_get_native_netos_error());
else {
- PJ_SOCKADDR_RESET_LEN(from);
+ if (from) {
+ PJ_SOCKADDR_RESET_LEN(from);
+ }
return PJ_SUCCESS;
}
}
diff --git a/pjlib/src/pjlib-test/activesock.c b/pjlib/src/pjlib-test/activesock.c
index 6fc61355..41fa5190 100644
--- a/pjlib/src/pjlib-test/activesock.c
+++ b/pjlib/src/pjlib-test/activesock.c
@@ -213,6 +213,7 @@ static int udp_ping_pong_test(void)
for (i=0; i<10 && last_rx1 == srv1->rx_cnt && last_rx2 == srv2->rx_cnt; ++i) {
pj_time_val delay = {0, 10};
#ifdef PJ_SYMBIAN
+ PJ_UNUSED_ARG(delay);
pj_symbianos_poll(-1, 100);
#else
pj_ioqueue_poll(ioqueue, &delay);
diff --git a/pjlib/src/pjlib-test/ioq_tcp.c b/pjlib/src/pjlib-test/ioq_tcp.c
index afb3c0c3..4d70e3cd 100644
--- a/pjlib/src/pjlib-test/ioq_tcp.c
+++ b/pjlib/src/pjlib-test/ioq_tcp.c
@@ -363,7 +363,7 @@ static int compliance_test_0(pj_bool_t allow_concur)
#ifdef PJ_SYMBIAN
callback_call_count = 0;
- pj_symbianos_poll(-1, 1000);
+ pj_symbianos_poll(-1, PJ_TIME_VAL_MSEC(timeout));
status = callback_call_count;
#else
status = pj_ioqueue_poll(ioque, &timeout);
@@ -412,7 +412,7 @@ static int compliance_test_0(pj_bool_t allow_concur)
if (pending_op == 0) {
pj_time_val timeout = {1, 0};
#ifdef PJ_SYMBIAN
- status = pj_symbianos_poll(-1, 1000);
+ status = pj_symbianos_poll(-1, PJ_TIME_VAL_MSEC(timeout));
#else
status = pj_ioqueue_poll(ioque, &timeout);
#endif
@@ -542,7 +542,7 @@ static int compliance_test_1(pj_bool_t allow_concur)
#ifdef PJ_SYMBIAN
callback_call_count = 0;
- pj_symbianos_poll(-1, 1000);
+ pj_symbianos_poll(-1, PJ_TIME_VAL_MSEC(timeout));
status = callback_call_count;
#else
status = pj_ioqueue_poll(ioque, &timeout);
@@ -576,7 +576,7 @@ static int compliance_test_1(pj_bool_t allow_concur)
if (pending_op == 0) {
pj_time_val timeout = {1, 0};
#ifdef PJ_SYMBIAN
- status = pj_symbianos_poll(-1, 1000);
+ status = pj_symbianos_poll(-1, PJ_TIME_VAL_MSEC(timeout));
#else
status = pj_ioqueue_poll(ioque, &timeout);
#endif
@@ -771,7 +771,7 @@ static int compliance_test_2(pj_bool_t allow_concur)
pj_time_val timeout = {1, 0};
#ifdef PJ_SYMBIAN
- status = pj_symbianos_poll(-1, 1000);
+ status = pj_symbianos_poll(-1, PJ_TIME_VAL_MSEC(timeout));
#else
status = pj_ioqueue_poll(ioque, &timeout);
#endif
@@ -797,7 +797,7 @@ static int compliance_test_2(pj_bool_t allow_concur)
if (pending_op == 0) {
pj_time_val timeout = {1, 0};
#ifdef PJ_SYMBIAN
- status = pj_symbianos_poll(-1, 1000);
+ status = pj_symbianos_poll(-1, PJ_TIME_VAL_MSEC(timeout));
#else
status = pj_ioqueue_poll(ioque, &timeout);
#endif
diff --git a/pjlib/src/pjlib-test/ioq_udp.c b/pjlib/src/pjlib-test/ioq_udp.c
index 81ae73d9..66c856c9 100644
--- a/pjlib/src/pjlib-test/ioq_udp.c
+++ b/pjlib/src/pjlib-test/ioq_udp.c
@@ -267,7 +267,7 @@ static int compliance_test(pj_bool_t allow_concur)
TRACE_("poll...");
#ifdef PJ_SYMBIAN
- rc = pj_symbianos_poll(-1, 5000);
+ rc = pj_symbianos_poll(-1, PJ_TIME_VAL_MSEC(timeout));
#else
rc = pj_ioqueue_poll(ioque, &timeout);
#endif
@@ -783,7 +783,7 @@ static int bench_test(pj_bool_t allow_concur, int bufsize,
do {
pj_time_val timeout = { 1, 0 };
#ifdef PJ_SYMBIAN
- rc = pj_symbianos_poll(-1, 1000);
+ rc = pj_symbianos_poll(-1, PJ_TIME_VAL_MSEC(timeout));
#else
rc = pj_ioqueue_poll(ioque, &timeout);
#endif
@@ -812,6 +812,7 @@ static int bench_test(pj_bool_t allow_concur, int bufsize,
do {
pj_time_val timeout = { 0, 10 };
#ifdef PJ_SYMBIAN
+ PJ_UNUSED_ARG(timeout);
rc = pj_symbianos_poll(-1, 100);
#else
rc = pj_ioqueue_poll(ioque, &timeout);
diff --git a/pjmedia/build/Makefile b/pjmedia/build/Makefile
index 59d007fb..5ee3edaf 100644
--- a/pjmedia/build/Makefile
+++ b/pjmedia/build/Makefile
@@ -150,7 +150,9 @@ pjmedia-audiodev:
pjsdp:
$(MAKE) -f $(RULES_MAK) APP=PJSDP app=pjsdp $(PJSDP_LIB)
-pjmedia-test: $(PJMEDIA_LIB)
+$(PJMEDIA_LIB): pjmedia
+
+pjmedia-test: $(PJMEDIA_LIB) pjmedia
$(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $(PJMEDIA_TEST_EXE)
.PHONY: ../lib/pjmedia.ko
diff --git a/pjmedia/src/pjmedia-audiodev/alsa_dev.c b/pjmedia/src/pjmedia-audiodev/alsa_dev.c
index 5bcdedf0..efda3190 100644
--- a/pjmedia/src/pjmedia-audiodev/alsa_dev.c
+++ b/pjmedia/src/pjmedia-audiodev/alsa_dev.c
@@ -232,7 +232,7 @@ static pj_status_t add_dev (struct alsa_factory *af, const char *dev_name)
pj_bzero(adi, sizeof(*adi));
/* Set device name */
- strcpy(adi->name, dev_name);
+ strncpy(adi->name, dev_name, sizeof(adi->name));
/* Check the number of playback channels */
adi->output_count = (pb_result>=0) ? 1 : 0;
diff --git a/pjmedia/src/pjmedia/g711.c b/pjmedia/src/pjmedia/g711.c
index 33f6eac6..c7bd26bc 100644
--- a/pjmedia/src/pjmedia/g711.c
+++ b/pjmedia/src/pjmedia/g711.c
@@ -330,7 +330,8 @@ static pj_status_t g711_alloc_codec( pjmedia_codec_factory *factory,
#if !PLC_DISABLED
/* Create PLC, always with 10ms ptime */
- status = pjmedia_plc_create(g711_factory.pool, 8000, 80,
+ status = pjmedia_plc_create(g711_factory.pool, 8000,
+ SAMPLES_PER_FRAME,
0, &codec_priv->plc);
if (status != PJ_SUCCESS) {
pj_mutex_unlock(g711_factory.mutex);
@@ -340,7 +341,7 @@ static pj_status_t g711_alloc_codec( pjmedia_codec_factory *factory,
/* Create VAD */
status = pjmedia_silence_det_create(g711_factory.pool,
- 8000, 80,
+ 8000, SAMPLES_PER_FRAME,
&codec_priv->vad);
if (status != PJ_SUCCESS) {
pj_mutex_unlock(g711_factory.mutex);
diff --git a/pjmedia/src/pjmedia/rtcp.c b/pjmedia/src/pjmedia/rtcp.c
index 52274155..f45b8a60 100644
--- a/pjmedia/src/pjmedia/rtcp.c
+++ b/pjmedia/src/pjmedia/rtcp.c
@@ -752,7 +752,8 @@ static void parse_rtcp_bye(pjmedia_rtcp_session *sess,
/* Check and get BYE reason */
if (size > 8) {
- reason.slen = *((pj_uint8_t*)pkt+8);
+ reason.slen = PJ_MIN(sizeof(sess->stat.peer_sdes_buf_),
+ *((pj_uint8_t*)pkt+8));
pj_memcpy(sess->stat.peer_sdes_buf_, ((pj_uint8_t*)pkt+9),
reason.slen);
reason.ptr = sess->stat.peer_sdes_buf_;
diff --git a/pjmedia/src/pjmedia/rtp.c b/pjmedia/src/pjmedia/rtp.c
index 62c0d656..5a19c37e 100644
--- a/pjmedia/src/pjmedia/rtp.c
+++ b/pjmedia/src/pjmedia/rtp.c
@@ -118,8 +118,6 @@ PJ_DEF(pj_status_t) pjmedia_rtp_encode_rtp( pjmedia_rtp_session *ses,
int payload_len, int ts_len,
const void **rtphdr, int *hdrlen )
{
- PJ_UNUSED_ARG(payload_len);
-
/* Update timestamp */
ses->out_hdr.ts = pj_htonl(pj_ntohl(ses->out_hdr.ts)+ts_len);
diff --git a/pjmedia/src/pjmedia/transport_srtp.c b/pjmedia/src/pjmedia/transport_srtp.c
index 76bd1518..1a5df765 100644
--- a/pjmedia/src/pjmedia/transport_srtp.c
+++ b/pjmedia/src/pjmedia/transport_srtp.c
@@ -37,7 +37,7 @@
/* Maximum size of packet */
#define MAX_RTP_BUFFER_LEN 1500
#define MAX_RTCP_BUFFER_LEN 1500
-#define MAX_KEY_LEN 32
+#define MAX_KEY_LEN 128
/* Initial value of probation counter. When probation counter > 0,
* it means SRTP is in probation state, and it may restart when
@@ -611,19 +611,47 @@ PJ_DEF(pj_status_t) pjmedia_transport_srtp_start(
/* Declare SRTP session initialized */
srtp->session_inited = PJ_TRUE;
- PJ_LOG(5, (srtp->pool->obj_name, "TX: %s key=%s", srtp->tx_policy.name.ptr,
- octet_string_hex_string(tx->key.ptr, tx->key.slen)));
- if (srtp->tx_policy.flags) {
- PJ_LOG(5,(srtp->pool->obj_name,"TX: disable%s%s", (cr_tx_idx?"":" enc"),
- (au_tx_idx?"":" auth")));
- }
+ /* Logging stuffs */
+#if PJ_LOG_MAX_LEVEL >= 5
+ {
+ char b64[PJ_BASE256_TO_BASE64_LEN(MAX_KEY_LEN)];
+ int b64_len;
- PJ_LOG(5, (srtp->pool->obj_name, "RX: %s key=%s", srtp->rx_policy.name.ptr,
- octet_string_hex_string(rx->key.ptr, rx->key.slen)));
- if (srtp->rx_policy.flags) {
- PJ_LOG(5,(srtp->pool->obj_name,"RX: disable%s%s", (cr_rx_idx?"":" enc"),
- (au_rx_idx?"":" auth")));
+ /* TX crypto and key */
+ b64_len = sizeof(b64);
+ status = pj_base64_encode((pj_uint8_t*)tx->key.ptr, tx->key.slen,
+ b64, &b64_len);
+ if (status != PJ_SUCCESS)
+ b64_len = pj_ansi_sprintf(b64, "--key too long--");
+ else
+ b64[b64_len] = '\0';
+
+ PJ_LOG(5, (srtp->pool->obj_name, "TX: %s key=%s",
+ srtp->tx_policy.name.ptr, b64));
+ if (srtp->tx_policy.flags) {
+ PJ_LOG(5,(srtp->pool->obj_name, "TX: disable%s%s",
+ (cr_tx_idx?"":" enc"),
+ (au_tx_idx?"":" auth")));
+ }
+
+ /* RX crypto and key */
+ b64_len = sizeof(b64);
+ status = pj_base64_encode((pj_uint8_t*)rx->key.ptr, rx->key.slen,
+ b64, &b64_len);
+ if (status != PJ_SUCCESS)
+ b64_len = pj_ansi_sprintf(b64, "--key too long--");
+ else
+ b64[b64_len] = '\0';
+
+ PJ_LOG(5, (srtp->pool->obj_name, "RX: %s key=%s",
+ srtp->rx_policy.name.ptr, b64));
+ if (srtp->rx_policy.flags) {
+ PJ_LOG(5,(srtp->pool->obj_name,"RX: disable%s%s",
+ (cr_rx_idx?"":" enc"),
+ (au_rx_idx?"":" auth")));
+ }
}
+#endif
on_return:
pj_lock_release(srtp->mutex);
diff --git a/pjnath/build/Makefile b/pjnath/build/Makefile
index 573d9579..66017c79 100644
--- a/pjnath/build/Makefile
+++ b/pjnath/build/Makefile
@@ -97,6 +97,8 @@ distclean: realclean
pjnath:
$(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $(PJNATH_LIB)
+$$(PJNATH_LIB): pjnath
+
pjnath-test: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB)
$(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $(PJNATH_TEST_EXE)
diff --git a/pjsip-apps/src/python/setup.py b/pjsip-apps/src/python/setup.py
index 6e3618d5..69a98594 100644
--- a/pjsip-apps/src/python/setup.py
+++ b/pjsip-apps/src/python/setup.py
@@ -87,8 +87,9 @@ f.close()
if platform.system() == 'Darwin':
extra_link_args = ["-framework", "CoreFoundation",
"-framework", "AudioToolbox"]
- # OS X Lion support
- if platform.mac_ver()[0].startswith("10.7"):
+ version = platform.mac_ver()[0].split(".")
+ # OS X Lion (10.7.x) or above support
+ if version[0] == '10' and int(version[1]) >= 7:
extra_link_args += ["-framework", "AudioUnit"]
else:
extra_link_args = []
diff --git a/pjsip-apps/src/samples/icedemo.c b/pjsip-apps/src/samples/icedemo.c
index 79bdb5fa..943befb2 100644
--- a/pjsip-apps/src/samples/icedemo.c
+++ b/pjsip-apps/src/samples/icedemo.c
@@ -614,6 +614,7 @@ static int encode_session(char buffer[], unsigned maxlen)
}
/* Enumerate all candidates for this component */
+ cand_cnt = PJ_ARRAY_SIZE(cand);
status = pj_ice_strans_enum_cands(icedemo.icest, comp+1,
&cand_cnt, cand);
if (status != PJ_SUCCESS)
diff --git a/pjsip/build/Makefile b/pjsip/build/Makefile
index 4e55b239..a14432c9 100644
--- a/pjsip/build/Makefile
+++ b/pjsip/build/Makefile
@@ -137,7 +137,7 @@ pjsip-simple:
pjsua-lib:
$(MAKE) -f $(RULES_MAK) APP=PJSUA_LIB app=pjsua-lib $(PJSUA_LIB_LIB)
-pjsip-test:
+pjsip-test: pjsip
$(MAKE) -f $(RULES_MAK) APP=TEST app=pjsip-test $(TEST_EXE)
.PHONY: ../lib/pjsip.ko
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 417301e5..7b66d5c3 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -653,9 +653,10 @@ typedef struct pjsua_callback
* callback.
* - it may delay the processing of the request, for example to request
* user permission whether to accept or reject the request. In this
- * case, the application MUST set the \a code argument to 202, and
- * later calls #pjsua_pres_notify() to accept or reject the
- * subscription request.
+ * case, the application MUST set the \a code argument to 202, then
+ * IMMEDIATELY calls #pjsua_pres_notify() with state
+ * PJSIP_EVSUB_STATE_PENDING and later calls #pjsua_pres_notify()
+ * again to accept or reject the subscription request.
*
* Any \a code other than 200 and 202 will be treated as 200.
*
@@ -2240,7 +2241,8 @@ typedef struct pjsua_acc_config
/**
* The full SIP URL for the account. The value can take name address or
- * URL format, and will look something like "sip:account@serviceprovider".
+ * URL format, and will look something like "sip:account@serviceprovider"
+ * or "\"Display Name\" <sip:account@provider>".
*
* This field is mandatory.
*/
@@ -3524,7 +3526,8 @@ PJ_DECL(pj_status_t) pjsua_call_update(pjsua_call_id call_id,
* of the call transfer request.
*
* @param call_id The call id to be transfered.
- * @param dest Address of new target to be contacted.
+ * @param dest URI of new target to be contacted. The URI may be
+ * in name address or addr-spec format.
* @param msg_data Optional message components to be sent with
* the request.
*
diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c
index ccdf5d35..56ce484c 100644
--- a/pjsip/src/pjsip/sip_parser.c
+++ b/pjsip/src/pjsip/sip_parser.c
@@ -1522,8 +1522,15 @@ static pjsip_name_addr *int_parse_name_addr( pj_scanner *scanner,
/* Get the SIP-URL */
has_bracket = (*scanner->curptr == '<');
- if (has_bracket)
+ if (has_bracket) {
pj_scan_get_char(scanner);
+ } else if (name_addr->display.slen) {
+ /* Must have bracket now (2012-10-26).
+ * Allowing (invalid) name-addr to pass URI verification will
+ * cause us to send invalid URI to the wire.
+ */
+ PJ_THROW( PJSIP_SYN_ERR_EXCEPTION);
+ }
name_addr->uri = int_parse_uri( scanner, pool, PJ_TRUE );
if (has_bracket) {
if (pj_scan_get_char(scanner) != '>')
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index 434bbee4..0d700bd7 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -34,6 +34,17 @@
*/
#define LOCK_CODEC_MAX_RETRY 5
+
+/*
+ * The INFO method.
+ */
+const pjsip_method pjsip_info_method =
+{
+ PJSIP_OTHER_METHOD,
+ { "INFO", 4 }
+};
+
+
/* This callback receives notification from invite session when the
* session state has changed.
*/
@@ -175,6 +186,10 @@ pj_status_t pjsua_call_subsys_init(const pjsua_config *cfg)
pjsip_endpt_add_capability(pjsua_var.endpt, NULL, PJSIP_H_SUPPORTED,
NULL, 1, &str_norefersub);
+ /* Add "INFO" in Allow header, for DTMF and video key frame request. */
+ pjsip_endpt_add_capability(pjsua_var.endpt, NULL, PJSIP_H_ALLOW,
+ NULL, 1, &pjsip_info_method.name);
+
return status;
}