Re #1881: Fixed compile warnings on VS2015 about declaration hides previous declaration.
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@5170 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
710aa0cc27
commit
88358fd268
|
@ -115,7 +115,7 @@ static int server_thread(void *p)
|
|||
if (srv->action == ACTION_IGNORE) {
|
||||
continue;
|
||||
} else if (srv->action == ACTION_REPLY) {
|
||||
pj_size_t send_size = 0;
|
||||
pj_size_t send_len = 0;
|
||||
unsigned ctr = 0;
|
||||
pj_ansi_sprintf(pkt, "HTTP/1.0 200 OK\r\n");
|
||||
if (srv->send_content_length) {
|
||||
|
@ -130,11 +130,11 @@ static int server_thread(void *p)
|
|||
pj_sock_close(newsock);
|
||||
continue;
|
||||
}
|
||||
while (send_size < srv->data_size) {
|
||||
pkt_len = srv->data_size - send_size;
|
||||
while (send_len < srv->data_size) {
|
||||
pkt_len = srv->data_size - send_len;
|
||||
if (pkt_len > (signed)srv->buf_size)
|
||||
pkt_len = srv->buf_size;
|
||||
send_size += pkt_len;
|
||||
send_len += pkt_len;
|
||||
pj_create_random_string(pkt, pkt_len);
|
||||
pj_ansi_sprintf(pkt, "\nPacket: %d", ++ctr);
|
||||
pkt[pj_ansi_strlen(pkt)] = '\n';
|
||||
|
@ -418,12 +418,12 @@ int http_client_test1()
|
|||
return -43;
|
||||
|
||||
{
|
||||
pj_sockaddr_in addr;
|
||||
int addr_len = sizeof(addr);
|
||||
sstatus = pj_sock_getsockname(g_server.sock, &addr, &addr_len);
|
||||
pj_sockaddr_in addr2;
|
||||
int addr_len = sizeof(addr2);
|
||||
sstatus = pj_sock_getsockname(g_server.sock, &addr2, &addr_len);
|
||||
if (sstatus != PJ_SUCCESS)
|
||||
return -44;
|
||||
g_server.port = pj_sockaddr_in_get_port(&addr);
|
||||
g_server.port = pj_sockaddr_in_get_port(&addr2);
|
||||
pj_ansi_snprintf(urlbuf, sizeof(urlbuf),
|
||||
"http://127.0.0.1:%d/about-us/",
|
||||
g_server.port);
|
||||
|
@ -530,12 +530,12 @@ int http_client_test2()
|
|||
return -43;
|
||||
|
||||
{
|
||||
pj_sockaddr_in addr;
|
||||
int addr_len = sizeof(addr);
|
||||
sstatus = pj_sock_getsockname(g_server.sock, &addr, &addr_len);
|
||||
pj_sockaddr_in addr2;
|
||||
int addr_len = sizeof(addr2);
|
||||
sstatus = pj_sock_getsockname(g_server.sock, &addr2, &addr_len);
|
||||
if (sstatus != PJ_SUCCESS)
|
||||
return -44;
|
||||
g_server.port = pj_sockaddr_in_get_port(&addr);
|
||||
g_server.port = pj_sockaddr_in_get_port(&addr2);
|
||||
pj_ansi_snprintf(urlbuf, sizeof(urlbuf),
|
||||
"http://127.0.0.1:%d",
|
||||
g_server.port);
|
||||
|
@ -659,12 +659,12 @@ int http_client_test_put1()
|
|||
return -43;
|
||||
|
||||
{
|
||||
pj_sockaddr_in addr;
|
||||
int addr_len = sizeof(addr);
|
||||
sstatus = pj_sock_getsockname(g_server.sock, &addr, &addr_len);
|
||||
pj_sockaddr_in addr2;
|
||||
int addr_len = sizeof(addr2);
|
||||
sstatus = pj_sock_getsockname(g_server.sock, &addr2, &addr_len);
|
||||
if (sstatus != PJ_SUCCESS)
|
||||
return -44;
|
||||
g_server.port = pj_sockaddr_in_get_port(&addr);
|
||||
g_server.port = pj_sockaddr_in_get_port(&addr2);
|
||||
pj_ansi_snprintf(urlbuf, sizeof(urlbuf),
|
||||
"http://127.0.0.1:%d/test/test.txt",
|
||||
g_server.port);
|
||||
|
@ -762,12 +762,12 @@ int http_client_test_put2()
|
|||
return -43;
|
||||
|
||||
{
|
||||
pj_sockaddr_in addr;
|
||||
int addr_len = sizeof(addr);
|
||||
sstatus = pj_sock_getsockname(g_server.sock, &addr, &addr_len);
|
||||
pj_sockaddr_in addr2;
|
||||
int addr_len = sizeof(addr2);
|
||||
sstatus = pj_sock_getsockname(g_server.sock, &addr2, &addr_len);
|
||||
if (sstatus != PJ_SUCCESS)
|
||||
return -44;
|
||||
g_server.port = pj_sockaddr_in_get_port(&addr);
|
||||
g_server.port = pj_sockaddr_in_get_port(&addr2);
|
||||
pj_ansi_snprintf(urlbuf, sizeof(urlbuf),
|
||||
"http://127.0.0.1:%d/test/test2.txt",
|
||||
g_server.port);
|
||||
|
@ -857,12 +857,12 @@ int http_client_test_delete()
|
|||
return -43;
|
||||
|
||||
{
|
||||
pj_sockaddr_in addr;
|
||||
int addr_len = sizeof(addr);
|
||||
sstatus = pj_sock_getsockname(g_server.sock, &addr, &addr_len);
|
||||
pj_sockaddr_in addr2;
|
||||
int addr_len = sizeof(addr2);
|
||||
sstatus = pj_sock_getsockname(g_server.sock, &addr2, &addr_len);
|
||||
if (sstatus != PJ_SUCCESS)
|
||||
return -44;
|
||||
g_server.port = pj_sockaddr_in_get_port(&addr);
|
||||
g_server.port = pj_sockaddr_in_get_port(&addr2);
|
||||
pj_ansi_snprintf(urlbuf, sizeof(urlbuf),
|
||||
"http://127.0.0.1:%d/test/test2.txt",
|
||||
g_server.port);
|
||||
|
|
|
@ -36,6 +36,10 @@
|
|||
(defined(PJ_WIN64) && PJ_WIN64!=0) || \
|
||||
(defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0)
|
||||
|
||||
/* Undefine EADDRINUSE first, we want it equal to WSAEADDRINUSE,
|
||||
* while WinSDK 10 defines it to another value.
|
||||
*/
|
||||
#undef EADDRINUSE
|
||||
#define EADDRINUSE WSAEADDRINUSE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1633,7 +1633,6 @@ PJ_DEF(void) pj_dns_resolver_dump(pj_dns_resolver *resolver,
|
|||
|
||||
PJ_LOG(3,(resolver->name.ptr, " Name servers:"));
|
||||
for (i=0; i<resolver->ns_count; ++i) {
|
||||
const char *state_names[] = { "probing", "active", "bad"};
|
||||
struct nameserver *ns = &resolver->ns[i];
|
||||
|
||||
PJ_LOG(3,(resolver->name.ptr,
|
||||
|
|
|
@ -616,25 +616,25 @@ static void dns_callback(void *user_data,
|
|||
srv_rec.count = 0;
|
||||
for (i=0; i<query_job->srv_cnt; ++i) {
|
||||
unsigned j;
|
||||
struct srv_target *srv = &query_job->srv[i];
|
||||
struct srv_target *srv2 = &query_job->srv[i];
|
||||
|
||||
srv_rec.entry[srv_rec.count].priority = srv->priority;
|
||||
srv_rec.entry[srv_rec.count].weight = srv->weight;
|
||||
srv_rec.entry[srv_rec.count].port = (pj_uint16_t)srv->port ;
|
||||
srv_rec.entry[srv_rec.count].priority = srv2->priority;
|
||||
srv_rec.entry[srv_rec.count].weight = srv2->weight;
|
||||
srv_rec.entry[srv_rec.count].port = (pj_uint16_t)srv2->port ;
|
||||
|
||||
srv_rec.entry[srv_rec.count].server.name = srv->target_name;
|
||||
srv_rec.entry[srv_rec.count].server.alias = srv->cname;
|
||||
srv_rec.entry[srv_rec.count].server.name = srv2->target_name;
|
||||
srv_rec.entry[srv_rec.count].server.alias = srv2->cname;
|
||||
srv_rec.entry[srv_rec.count].server.addr_count = 0;
|
||||
|
||||
pj_assert(srv->addr_cnt <= PJ_DNS_MAX_IP_IN_A_REC);
|
||||
pj_assert(srv2->addr_cnt <= PJ_DNS_MAX_IP_IN_A_REC);
|
||||
|
||||
for (j=0; j<srv->addr_cnt; ++j) {
|
||||
for (j=0; j<srv2->addr_cnt; ++j) {
|
||||
srv_rec.entry[srv_rec.count].server.addr[j].s_addr =
|
||||
srv->addr[j].s_addr;
|
||||
srv2->addr[j].s_addr;
|
||||
++srv_rec.entry[srv_rec.count].server.addr_count;
|
||||
}
|
||||
|
||||
if (srv->addr_cnt > 0) {
|
||||
if (srv2->addr_cnt > 0) {
|
||||
++srv_rec.count;
|
||||
if (srv_rec.count == PJ_DNS_SRV_MAX_ADDR)
|
||||
break;
|
||||
|
|
|
@ -49,8 +49,8 @@ PJ_DEF(pj_status_t) pjstun_create_bind_req( pj_pool_t *pool,
|
|||
return PJ_SUCCESS;
|
||||
}
|
||||
|
||||
PJ_DEF(pj_status_t) pjstun_parse_msg( void *buf, pj_size_t len,
|
||||
pjstun_msg *msg)
|
||||
PJ_DEF(pj_status_t) pjstun_parse_msg( void *buf, pj_size_t buf_len,
|
||||
pjstun_msg *msg)
|
||||
{
|
||||
pj_uint16_t msg_type, msg_len;
|
||||
char *p_attr;
|
||||
|
@ -74,9 +74,9 @@ PJ_DEF(pj_status_t) pjstun_parse_msg( void *buf, pj_size_t len,
|
|||
}
|
||||
|
||||
msg_len = pj_ntohs(msg->hdr->length);
|
||||
if (msg_len != len - sizeof(pjstun_msg_hdr)) {
|
||||
if (msg_len != buf_len - sizeof(pjstun_msg_hdr)) {
|
||||
PJ_LOG(4,(THIS_FILE, "Error: invalid msg_len %d (expecting %d)",
|
||||
msg_len, len - sizeof(pjstun_msg_hdr)));
|
||||
msg_len, buf_len - sizeof(pjstun_msg_hdr)));
|
||||
return PJLIB_UTIL_ESTUNINMSGLEN;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,11 +98,11 @@ static int pjlib_error(pj_status_t code, char *buf, pj_size_t size)
|
|||
|
||||
for (i=0; i<sizeof(err_str)/sizeof(err_str[0]); ++i) {
|
||||
if (err_str[i].code == code) {
|
||||
pj_size_t len = strlen(err_str[i].msg);
|
||||
if (len >= size) len = size-1;
|
||||
pj_memcpy(buf, err_str[i].msg, len);
|
||||
buf[len] = '\0';
|
||||
return (int)len;
|
||||
pj_size_t len2 = pj_ansi_strlen(err_str[i].msg);
|
||||
if (len2 >= size) len2 = size-1;
|
||||
pj_memcpy(buf, err_str[i].msg, len2);
|
||||
buf[len2] = '\0';
|
||||
return (int)len2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -90,8 +90,8 @@ PJ_DEF(void) pj_caching_pool_destroy( pj_caching_pool *cp )
|
|||
|
||||
/* Delete all pool in free list */
|
||||
for (i=0; i < PJ_CACHING_POOL_ARRAY_SIZE; ++i) {
|
||||
pj_pool_t *pool = (pj_pool_t*) cp->free_list[i].next;
|
||||
pj_pool_t *next;
|
||||
pool = (pj_pool_t*) cp->free_list[i].next;
|
||||
for (; pool != (void*)&cp->free_list[i]; pool = next) {
|
||||
next = pool->next;
|
||||
pj_list_erase(pool);
|
||||
|
|
|
@ -84,9 +84,9 @@ static void on_read_complete(pj_ioqueue_key_t *key,
|
|||
return;
|
||||
|
||||
if (bytes_read < 0) {
|
||||
pj_status_t rc = (pj_status_t)-bytes_read;
|
||||
char errmsg[PJ_ERR_MSG_SIZE];
|
||||
|
||||
rc = (pj_status_t)-bytes_read;
|
||||
if (rc != last_error) {
|
||||
//last_error = rc;
|
||||
pj_strerror(rc, errmsg, sizeof(errmsg));
|
||||
|
|
|
@ -263,21 +263,21 @@ static int compliance_test(pj_bool_t allow_concur)
|
|||
|
||||
// Poll if pending.
|
||||
while (send_pending || recv_pending) {
|
||||
int rc;
|
||||
int ret;
|
||||
pj_time_val timeout = { 5, 0 };
|
||||
|
||||
TRACE_("poll...");
|
||||
#ifdef PJ_SYMBIAN
|
||||
rc = pj_symbianos_poll(-1, PJ_TIME_VAL_MSEC(timeout));
|
||||
ret = pj_symbianos_poll(-1, PJ_TIME_VAL_MSEC(timeout));
|
||||
#else
|
||||
rc = pj_ioqueue_poll(ioque, &timeout);
|
||||
ret = pj_ioqueue_poll(ioque, &timeout);
|
||||
#endif
|
||||
|
||||
if (rc == 0) {
|
||||
if (ret == 0) {
|
||||
PJ_LOG(1,(THIS_FILE, "...ERROR: timed out..."));
|
||||
status=-45; goto on_error;
|
||||
} else if (rc < 0) {
|
||||
app_perror("...ERROR in ioqueue_poll()", -rc);
|
||||
} else if (ret < 0) {
|
||||
app_perror("...ERROR in ioqueue_poll()", -ret);
|
||||
status=-50; goto on_error;
|
||||
}
|
||||
|
||||
|
|
|
@ -190,20 +190,20 @@ static int drain_test(pj_size_t size, pj_size_t increment)
|
|||
|
||||
/* Drain the pool until there's nothing left. */
|
||||
while (freesize > 0) {
|
||||
int size;
|
||||
int size2;
|
||||
|
||||
if (freesize > 255)
|
||||
size = ((pj_rand() & 0x000000FF) + PJ_POOL_ALIGNMENT) &
|
||||
size2 = ((pj_rand() & 0x000000FF) + PJ_POOL_ALIGNMENT) &
|
||||
~(PJ_POOL_ALIGNMENT - 1);
|
||||
else
|
||||
size = (int)freesize;
|
||||
size2 = (int)freesize;
|
||||
|
||||
p = pj_pool_alloc(pool, size);
|
||||
p = pj_pool_alloc(pool, size2);
|
||||
if (!p) {
|
||||
status=-20; goto on_error;
|
||||
}
|
||||
|
||||
freesize -= size;
|
||||
freesize -= size2;
|
||||
}
|
||||
|
||||
/* Check that capacity is zero. */
|
||||
|
|
|
@ -47,14 +47,14 @@ static int pool_test_pool()
|
|||
return -1;
|
||||
|
||||
for (i=0; i<COUNT; ++i) {
|
||||
char *p;
|
||||
if ( (p=(char*)pj_pool_alloc(pool, sizes[i])) == NULL) {
|
||||
char *ptr;
|
||||
if ( (ptr=(char*)pj_pool_alloc(pool, sizes[i])) == NULL) {
|
||||
PJ_LOG(3,(THIS_FILE," error: pool failed to allocate %d bytes",
|
||||
sizes[i]));
|
||||
pj_pool_release(pool);
|
||||
return -1;
|
||||
}
|
||||
*p = '\0';
|
||||
*ptr = '\0';
|
||||
}
|
||||
|
||||
pj_pool_release(pool);
|
||||
|
|
|
@ -58,7 +58,8 @@ static int test_timer_heap(void)
|
|||
pj_pool_t *pool;
|
||||
pj_timer_heap_t *timer;
|
||||
pj_time_val delay;
|
||||
pj_status_t rc; int err=0;
|
||||
pj_status_t status;
|
||||
int err=0;
|
||||
pj_size_t size;
|
||||
unsigned count;
|
||||
|
||||
|
@ -77,9 +78,9 @@ static int test_timer_heap(void)
|
|||
for (i=0; i<MAX_COUNT; ++i) {
|
||||
entry[i].cb = &timer_callback;
|
||||
}
|
||||
rc = pj_timer_heap_create(pool, MAX_COUNT, &timer);
|
||||
if (rc != PJ_SUCCESS) {
|
||||
app_perror("...error: unable to create timer heap", rc);
|
||||
status = pj_timer_heap_create(pool, MAX_COUNT, &timer);
|
||||
if (status != PJ_SUCCESS) {
|
||||
app_perror("...error: unable to create timer heap", status);
|
||||
return -30;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ struct op_key
|
|||
int addrlen;
|
||||
};
|
||||
|
||||
static void on_read_complete(pj_ioqueue_key_t *key,
|
||||
static void on_read_complete(pj_ioqueue_key_t *ioq_key,
|
||||
pj_ioqueue_op_key_t *op_key,
|
||||
pj_ssize_t bytes_received)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ static void on_read_complete(pj_ioqueue_key_t *key,
|
|||
pj_memcpy(send_rec->buffer, recv_rec->buffer, bytes_received);
|
||||
pj_memcpy(&send_rec->addr, &recv_rec->addr, recv_rec->addrlen);
|
||||
send_rec->addrlen = recv_rec->addrlen;
|
||||
rc = pj_ioqueue_sendto(key, &send_rec->op_key_,
|
||||
rc = pj_ioqueue_sendto(ioq_key, &send_rec->op_key_,
|
||||
send_rec->buffer, &sent, 0,
|
||||
&send_rec->addr, send_rec->addrlen);
|
||||
send_rec->is_pending = (rc==PJ_EPENDING);
|
||||
|
@ -75,7 +75,7 @@ static void on_read_complete(pj_ioqueue_key_t *key,
|
|||
|
||||
if (!send_rec->is_pending) {
|
||||
bytes_received = recv_rec->size;
|
||||
rc = pj_ioqueue_recvfrom(key, &recv_rec->op_key_,
|
||||
rc = pj_ioqueue_recvfrom(ioq_key, &recv_rec->op_key_,
|
||||
recv_rec->buffer, &bytes_received, 0,
|
||||
&recv_rec->addr, &recv_rec->addrlen);
|
||||
recv_rec->is_pending = (rc==PJ_EPENDING);
|
||||
|
@ -99,7 +99,7 @@ static void on_read_complete(pj_ioqueue_key_t *key,
|
|||
}
|
||||
}
|
||||
|
||||
static void on_write_complete(pj_ioqueue_key_t *key,
|
||||
static void on_write_complete(pj_ioqueue_key_t *ioq_key,
|
||||
pj_ioqueue_op_key_t *op_key,
|
||||
pj_ssize_t bytes_sent)
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ static void on_write_complete(pj_ioqueue_key_t *key,
|
|||
}
|
||||
|
||||
send_rec->is_pending = 0;
|
||||
on_read_complete(key, &send_rec->peer->op_key_, 0);
|
||||
on_read_complete(ioq_key, &send_rec->peer->op_key_, 0);
|
||||
}
|
||||
|
||||
static int worker_thread(void *arg)
|
||||
|
|
|
@ -484,7 +484,7 @@ PJ_DEF(pj_status_t) pjmedia_endpt_create_audio_sdp(pjmedia_endpt *endpt,
|
|||
if (codec_param.setting.dec_fmtp.cnt > 0) {
|
||||
enum { MAX_FMTP_STR_LEN = 160 };
|
||||
char buf[MAX_FMTP_STR_LEN];
|
||||
unsigned buf_len = 0, i;
|
||||
unsigned buf_len = 0, ii;
|
||||
pjmedia_codec_fmtp *dec_fmtp = &codec_param.setting.dec_fmtp;
|
||||
|
||||
/* Print codec PT */
|
||||
|
@ -493,36 +493,36 @@ PJ_DEF(pj_status_t) pjmedia_endpt_create_audio_sdp(pjmedia_endpt *endpt,
|
|||
"%d",
|
||||
codec_info->pt);
|
||||
|
||||
for (i = 0; i < dec_fmtp->cnt; ++i) {
|
||||
for (ii = 0; ii < dec_fmtp->cnt; ++ii) {
|
||||
pj_size_t test_len = 2;
|
||||
|
||||
/* Check if buf still available */
|
||||
test_len = dec_fmtp->param[i].val.slen +
|
||||
dec_fmtp->param[i].name.slen + 2;
|
||||
test_len = dec_fmtp->param[ii].val.slen +
|
||||
dec_fmtp->param[ii].name.slen + 2;
|
||||
if (test_len + buf_len >= MAX_FMTP_STR_LEN)
|
||||
return PJ_ETOOBIG;
|
||||
|
||||
/* Print delimiter */
|
||||
buf_len += pj_ansi_snprintf(&buf[buf_len],
|
||||
MAX_FMTP_STR_LEN - buf_len,
|
||||
(i == 0?" ":";"));
|
||||
(ii == 0?" ":";"));
|
||||
|
||||
/* Print an fmtp param */
|
||||
if (dec_fmtp->param[i].name.slen)
|
||||
if (dec_fmtp->param[ii].name.slen)
|
||||
buf_len += pj_ansi_snprintf(
|
||||
&buf[buf_len],
|
||||
MAX_FMTP_STR_LEN - buf_len,
|
||||
"%.*s=%.*s",
|
||||
(int)dec_fmtp->param[i].name.slen,
|
||||
dec_fmtp->param[i].name.ptr,
|
||||
(int)dec_fmtp->param[i].val.slen,
|
||||
dec_fmtp->param[i].val.ptr);
|
||||
(int)dec_fmtp->param[ii].name.slen,
|
||||
dec_fmtp->param[ii].name.ptr,
|
||||
(int)dec_fmtp->param[ii].val.slen,
|
||||
dec_fmtp->param[ii].val.ptr);
|
||||
else
|
||||
buf_len += pj_ansi_snprintf(&buf[buf_len],
|
||||
MAX_FMTP_STR_LEN - buf_len,
|
||||
"%.*s",
|
||||
(int)dec_fmtp->param[i].val.slen,
|
||||
dec_fmtp->param[i].val.ptr);
|
||||
(int)dec_fmtp->param[ii].val.slen,
|
||||
dec_fmtp->param[ii].val.ptr);
|
||||
}
|
||||
|
||||
attr = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_attr);
|
||||
|
|
|
@ -1176,18 +1176,18 @@ static pj_status_t match_offer(pj_pool_t *pool,
|
|||
{
|
||||
/* Match! */
|
||||
if (is_codec) {
|
||||
pjmedia_sdp_media *o, *a;
|
||||
pjmedia_sdp_media *o_med, *a_med;
|
||||
unsigned o_fmt_idx, a_fmt_idx;
|
||||
|
||||
o = (pjmedia_sdp_media*)offer;
|
||||
a = (pjmedia_sdp_media*)preanswer;
|
||||
o_med = (pjmedia_sdp_media*)offer;
|
||||
a_med = (pjmedia_sdp_media*)preanswer;
|
||||
o_fmt_idx = prefer_remote_codec_order? i:j;
|
||||
a_fmt_idx = prefer_remote_codec_order? j:i;
|
||||
|
||||
/* Call custom format matching callbacks */
|
||||
if (custom_fmt_match(pool, &or_.enc_name,
|
||||
o, o_fmt_idx,
|
||||
a, a_fmt_idx,
|
||||
o_med, o_fmt_idx,
|
||||
a_med, a_fmt_idx,
|
||||
ALLOW_MODIFY_ANSWER) !=
|
||||
PJ_SUCCESS)
|
||||
{
|
||||
|
|
|
@ -665,16 +665,16 @@ static pj_status_t tonegen_get_frame(pjmedia_port *port,
|
|||
{
|
||||
/* Fade in */
|
||||
short *samp = (dst - cnt);
|
||||
short *end;
|
||||
short *samp_end;
|
||||
|
||||
if (cnt > tonegen->fade_in_len)
|
||||
cnt = tonegen->fade_in_len;
|
||||
end = samp + cnt;
|
||||
samp_end = samp + cnt;
|
||||
if (cnt) {
|
||||
const unsigned step = 0xFFFF / cnt;
|
||||
unsigned scale = 0;
|
||||
|
||||
for (; samp < end; ++samp) {
|
||||
for (; samp < samp_end; ++samp) {
|
||||
(*samp) = (short)(((*samp) * scale) >> 16);
|
||||
scale += step;
|
||||
}
|
||||
|
|
|
@ -580,15 +580,13 @@ static pj_status_t file_get_frame(pjmedia_port *this_port,
|
|||
{
|
||||
struct file_reader_port *fport = (struct file_reader_port*)this_port;
|
||||
pj_size_t frame_size;
|
||||
pj_status_t status;
|
||||
pj_status_t status = PJ_SUCCESS;
|
||||
|
||||
pj_assert(fport->base.info.signature == SIGNATURE);
|
||||
pj_assert(frame->size <= fport->bufsize);
|
||||
|
||||
/* EOF is set and readpos already passed the eofpos */
|
||||
if (fport->eof && fport->readpos >= fport->eofpos) {
|
||||
pj_status_t status = PJ_SUCCESS;
|
||||
|
||||
PJ_LOG(5,(THIS_FILE, "File port %.*s EOF",
|
||||
(int)fport->base.info.name.slen,
|
||||
fport->base.info.name.ptr));
|
||||
|
|
|
@ -159,14 +159,14 @@ static int codec_test_encode(pjmedia_codec_mgr *mgr,
|
|||
|
||||
pos = 0;
|
||||
for (;;) {
|
||||
pj_size_t count;
|
||||
pj_size_t count2;
|
||||
|
||||
count = fread(in_frame.buf, encoded_frame_len, 1, fref);
|
||||
if (count != 1)
|
||||
count2 = fread(in_frame.buf, encoded_frame_len, 1, fref);
|
||||
if (count2 != 1)
|
||||
break;
|
||||
|
||||
count = fread(out_frame.buf, encoded_frame_len, 1, output);
|
||||
if (count != 1)
|
||||
count2 = fread(out_frame.buf, encoded_frame_len, 1, output);
|
||||
if (count2 != 1)
|
||||
break;
|
||||
|
||||
if (memcmp(in_frame.buf, out_frame.buf, encoded_frame_len)) {
|
||||
|
@ -380,7 +380,7 @@ static int codec_test_decode(pjmedia_codec_mgr *mgr,
|
|||
for (;;) {
|
||||
pjmedia_frame in_frame[2];
|
||||
pj_timestamp ts;
|
||||
unsigned count;
|
||||
unsigned count2;
|
||||
pj_bool_t has_frame;
|
||||
|
||||
if (is_itu_format) {
|
||||
|
@ -401,15 +401,15 @@ static int codec_test_decode(pjmedia_codec_mgr *mgr,
|
|||
}
|
||||
|
||||
if (has_frame) {
|
||||
count = 2;
|
||||
count2 = 2;
|
||||
if (pjmedia_codec_parse(codec, pkt, encoded_len, &ts,
|
||||
&count, in_frame) != PJ_SUCCESS)
|
||||
&count2, in_frame) != PJ_SUCCESS)
|
||||
{
|
||||
rc = -100;
|
||||
goto on_return;
|
||||
}
|
||||
|
||||
if (count != 1) {
|
||||
if (count2 != 1) {
|
||||
rc = -110;
|
||||
goto on_return;
|
||||
}
|
||||
|
@ -459,14 +459,14 @@ static int codec_test_decode(pjmedia_codec_mgr *mgr,
|
|||
|
||||
pos = 0;
|
||||
for (;;) {
|
||||
pj_size_t count;
|
||||
pj_size_t count2;
|
||||
|
||||
count = fread(pkt, samples_per_frame*2, 1, fref);
|
||||
if (count != 1)
|
||||
count2 = fread(pkt, samples_per_frame*2, 1, fref);
|
||||
if (count2 != 1)
|
||||
break;
|
||||
|
||||
count = fread(out_frame.buf, samples_per_frame*2, 1, output);
|
||||
if (count != 1)
|
||||
count2 = fread(out_frame.buf, samples_per_frame*2, 1, output);
|
||||
if (count2 != 1)
|
||||
break;
|
||||
|
||||
if (memcmp(pkt, out_frame.buf, samples_per_frame*2)) {
|
||||
|
|
|
@ -2490,7 +2490,7 @@ int mips_test(void)
|
|||
#endif
|
||||
};
|
||||
|
||||
unsigned i, c, k[3] = {K8, K16, K32}, clock_rates[3] = {8000, 16000, 32000};
|
||||
unsigned i, c, clks[3] = {K8, K16, K32}, clock_rates[3] = {8000, 16000, 32000};
|
||||
|
||||
PJ_LOG(3,(THIS_FILE, "MIPS test, with CPU=%dMhz, %6.1f MIPS", CPU_MHZ, CPU_IPS / 1000000));
|
||||
PJ_LOG(3,(THIS_FILE, "Clock Item Time CPU MIPS"));
|
||||
|
@ -2509,7 +2509,7 @@ int mips_test(void)
|
|||
float cpu_pct, mips_val;
|
||||
unsigned j, clock_rate = clock_rates[c];
|
||||
|
||||
if ((e->valid_clock_rate & k[c]) == 0)
|
||||
if ((e->valid_clock_rate & clks[c]) == 0)
|
||||
continue;
|
||||
|
||||
/* Run test */
|
||||
|
|
|
@ -424,7 +424,7 @@ static pj_bool_t turn_on_data_recvfrom(pj_activesock_t *asock,
|
|||
//pj_str_t ip_addr;
|
||||
pj_stun_username_attr *uname;
|
||||
pj_activesock_cb alloc_sock_cb;
|
||||
turn_allocation *alloc;
|
||||
///turn_allocation *alloc;
|
||||
|
||||
/* Must be Allocate request */
|
||||
if (req->hdr.type != PJ_STUN_ALLOCATE_REQUEST) {
|
||||
|
|
|
@ -692,7 +692,7 @@ static int fingerprint_test_vector()
|
|||
if (v->options & USE_MESSAGE_INTEGRITY) {
|
||||
if (PJ_STUN_IS_REQUEST(msg->hdr.type)) {
|
||||
pj_stun_auth_cred cred;
|
||||
pj_status_t status;
|
||||
pj_status_t status2;
|
||||
|
||||
pj_bzero(&cred, sizeof(cred));
|
||||
cred.type = PJ_STUN_AUTH_CRED_STATIC;
|
||||
|
@ -701,11 +701,11 @@ static int fingerprint_test_vector()
|
|||
cred.data.static_cred.data = pj_str(v->password);
|
||||
cred.data.static_cred.nonce = pj_str(v->nonce);
|
||||
|
||||
status = pj_stun_authenticate_request(buf, (unsigned)len, msg,
|
||||
status2 = pj_stun_authenticate_request(buf, (unsigned)len, msg,
|
||||
&cred, pool, NULL, NULL);
|
||||
if (status != PJ_SUCCESS) {
|
||||
if (status2 != PJ_SUCCESS) {
|
||||
char errmsg[PJ_ERR_MSG_SIZE];
|
||||
pj_strerror(status, errmsg, sizeof(errmsg));
|
||||
pj_strerror(status2, errmsg, sizeof(errmsg));
|
||||
PJ_LOG(1,(THIS_FILE,
|
||||
" Request authentication failed: %s",
|
||||
errmsg));
|
||||
|
@ -714,12 +714,12 @@ static int fingerprint_test_vector()
|
|||
}
|
||||
|
||||
} else if (PJ_STUN_IS_RESPONSE(msg->hdr.type)) {
|
||||
pj_status_t status;
|
||||
status = pj_stun_authenticate_response(buf, (unsigned)len,
|
||||
pj_status_t status2;
|
||||
status2 = pj_stun_authenticate_response(buf, (unsigned)len,
|
||||
msg, &key);
|
||||
if (status != PJ_SUCCESS) {
|
||||
if (status2 != PJ_SUCCESS) {
|
||||
char errmsg[PJ_ERR_MSG_SIZE];
|
||||
pj_strerror(status, errmsg, sizeof(errmsg));
|
||||
pj_strerror(status2, errmsg, sizeof(errmsg));
|
||||
PJ_LOG(1,(THIS_FILE,
|
||||
" Response authentication failed: %s",
|
||||
errmsg));
|
||||
|
|
|
@ -1600,8 +1600,8 @@ PJ_DEF(pj_status_t) pj_ice_sess_create_check_list(
|
|||
pj_ice_sess *ice,
|
||||
const pj_str_t *rem_ufrag,
|
||||
const pj_str_t *rem_passwd,
|
||||
unsigned rcand_cnt,
|
||||
const pj_ice_sess_cand rcand[])
|
||||
unsigned rem_cand_cnt,
|
||||
const pj_ice_sess_cand rem_cand[])
|
||||
{
|
||||
pj_ice_sess_checklist *clist;
|
||||
char buf[128];
|
||||
|
@ -1611,9 +1611,9 @@ PJ_DEF(pj_status_t) pj_ice_sess_create_check_list(
|
|||
unsigned highest_comp = 0;
|
||||
pj_status_t status;
|
||||
|
||||
PJ_ASSERT_RETURN(ice && rem_ufrag && rem_passwd && rcand_cnt && rcand,
|
||||
PJ_EINVAL);
|
||||
PJ_ASSERT_RETURN(rcand_cnt + ice->rcand_cnt <= PJ_ICE_MAX_CAND,
|
||||
PJ_ASSERT_RETURN(ice && rem_ufrag && rem_passwd && rem_cand_cnt &&
|
||||
rem_cand, PJ_EINVAL);
|
||||
PJ_ASSERT_RETURN(rem_cand_cnt + ice->rcand_cnt <= PJ_ICE_MAX_CAND,
|
||||
PJ_ETOOMANY);
|
||||
|
||||
pj_grp_lock_acquire(ice->grp_lock);
|
||||
|
@ -1638,19 +1638,19 @@ PJ_DEF(pj_status_t) pj_ice_sess_create_check_list(
|
|||
|
||||
/* Save remote candidates */
|
||||
ice->rcand_cnt = 0;
|
||||
for (i=0; i<rcand_cnt; ++i) {
|
||||
for (i=0; i<rem_cand_cnt; ++i) {
|
||||
pj_ice_sess_cand *cn = &ice->rcand[ice->rcand_cnt];
|
||||
|
||||
/* Ignore candidate which has no matching component ID */
|
||||
if (rcand[i].comp_id==0 || rcand[i].comp_id > ice->comp_cnt) {
|
||||
if (rem_cand[i].comp_id==0 || rem_cand[i].comp_id > ice->comp_cnt) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rcand[i].comp_id > highest_comp)
|
||||
highest_comp = rcand[i].comp_id;
|
||||
if (rem_cand[i].comp_id > highest_comp)
|
||||
highest_comp = rem_cand[i].comp_id;
|
||||
|
||||
pj_memcpy(cn, &rcand[i], sizeof(pj_ice_sess_cand));
|
||||
pj_strdup(ice->pool, &cn->foundation, &rcand[i].foundation);
|
||||
pj_memcpy(cn, &rem_cand[i], sizeof(pj_ice_sess_cand));
|
||||
pj_strdup(ice->pool, &cn->foundation, &rem_cand[i].foundation);
|
||||
ice->rcand_cnt++;
|
||||
}
|
||||
|
||||
|
|
|
@ -1291,7 +1291,6 @@ static void on_allocate_success(pj_turn_session *sess,
|
|||
const pj_stun_xor_relayed_addr_attr *raddr_attr;
|
||||
const pj_stun_sockaddr_attr *mapped_attr;
|
||||
pj_str_t s;
|
||||
pj_time_val timeout;
|
||||
|
||||
/* Must have LIFETIME attribute */
|
||||
lf_attr = (const pj_stun_lifetime_attr*)
|
||||
|
@ -1396,6 +1395,7 @@ static void on_allocate_success(pj_turn_session *sess,
|
|||
|
||||
/* Start keep-alive timer once allocation succeeds */
|
||||
if (sess->state < PJ_TURN_STATE_DEALLOCATING) {
|
||||
pj_time_val timeout;
|
||||
timeout.sec = sess->ka_interval;
|
||||
timeout.msec = 0;
|
||||
|
||||
|
@ -1771,14 +1771,14 @@ static struct ch_t *lookup_ch_by_addr(pj_turn_session *sess,
|
|||
ch->expiry.sec += PJ_TURN_PERM_TIMEOUT - sess->ka_interval - 1;
|
||||
|
||||
if (bind_channel) {
|
||||
pj_uint32_t hval = 0;
|
||||
pj_uint32_t hval2 = 0;
|
||||
/* Register by channel number */
|
||||
pj_assert(ch->num != PJ_TURN_INVALID_CHANNEL && ch->bound);
|
||||
|
||||
if (pj_hash_get(sess->ch_table, &ch->num,
|
||||
sizeof(ch->num), &hval)==0) {
|
||||
sizeof(ch->num), &hval2)==0) {
|
||||
pj_hash_set(sess->pool, sess->ch_table, &ch->num,
|
||||
sizeof(ch->num), hval, ch);
|
||||
sizeof(ch->num), hval2, ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ static void call_timeout_callback(pj_timer_heap_t *timer_heap,
|
|||
struct pj_timer_entry *entry)
|
||||
{
|
||||
pjsua_call_id call_id = entry->id;
|
||||
pjsua_msg_data msg_data;
|
||||
pjsua_msg_data msg_data_;
|
||||
pjsip_generic_string_hdr warn;
|
||||
pj_str_t hname = pj_str("Warning");
|
||||
pj_str_t hvalue = pj_str("399 pjsua \"Call duration exceeded\"");
|
||||
|
@ -151,16 +151,16 @@ static void call_timeout_callback(pj_timer_heap_t *timer_heap,
|
|||
}
|
||||
|
||||
/* Add warning header */
|
||||
pjsua_msg_data_init(&msg_data);
|
||||
pjsua_msg_data_init(&msg_data_);
|
||||
pjsip_generic_string_hdr_init2(&warn, &hname, &hvalue);
|
||||
pj_list_push_back(&msg_data.hdr_list, &warn);
|
||||
pj_list_push_back(&msg_data_.hdr_list, &warn);
|
||||
|
||||
/* Call duration has been exceeded; disconnect the call */
|
||||
PJ_LOG(3,(THIS_FILE, "Duration (%d seconds) has been exceeded "
|
||||
"for call %d, disconnecting the call",
|
||||
app_config.duration, call_id));
|
||||
entry->id = PJSUA_INVALID_ID;
|
||||
pjsua_call_hangup(call_id, 200, NULL, &msg_data);
|
||||
pjsua_call_hangup(call_id, 200, NULL, &msg_data_);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -293,13 +293,13 @@ static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
|
|||
ring_start(call_id);
|
||||
|
||||
if (app_config.auto_answer > 0) {
|
||||
pjsua_call_setting call_opt;
|
||||
pjsua_call_setting opt;
|
||||
|
||||
pjsua_call_setting_default(&call_opt);
|
||||
call_opt.aud_cnt = app_config.aud_cnt;
|
||||
call_opt.vid_cnt = app_config.vid.vid_cnt;
|
||||
pjsua_call_setting_default(&opt);
|
||||
opt.aud_cnt = app_config.aud_cnt;
|
||||
opt.vid_cnt = app_config.vid.vid_cnt;
|
||||
|
||||
pjsua_call_answer2(call_id, &call_opt, app_config.auto_answer, NULL,
|
||||
pjsua_call_answer2(call_id, &opt, app_config.auto_answer, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -667,7 +667,7 @@ static void on_incoming_subscribe(pjsua_acc_id acc_id,
|
|||
pjsip_rx_data *rdata,
|
||||
pjsip_status_code *code,
|
||||
pj_str_t *reason,
|
||||
pjsua_msg_data *msg_data)
|
||||
pjsua_msg_data *msg_data_)
|
||||
{
|
||||
/* Just accept the request (the default behavior) */
|
||||
PJ_UNUSED_ARG(acc_id);
|
||||
|
@ -677,7 +677,7 @@ static void on_incoming_subscribe(pjsua_acc_id acc_id,
|
|||
PJ_UNUSED_ARG(rdata);
|
||||
PJ_UNUSED_ARG(code);
|
||||
PJ_UNUSED_ARG(reason);
|
||||
PJ_UNUSED_ARG(msg_data);
|
||||
PJ_UNUSED_ARG(msg_data_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1412,26 +1412,26 @@ static pj_status_t app_init()
|
|||
pjmedia_port *tport;
|
||||
char name[80];
|
||||
pj_str_t label;
|
||||
pj_status_t status;
|
||||
pj_status_t status2;
|
||||
|
||||
pj_ansi_snprintf(name, sizeof(name), "tone-%d,%d",
|
||||
app_config.tones[i].freq1,
|
||||
app_config.tones[i].freq2);
|
||||
label = pj_str(name);
|
||||
status = pjmedia_tonegen_create2(app_config.pool, &label,
|
||||
8000, 1, 160, 16,
|
||||
PJMEDIA_TONEGEN_LOOP, &tport);
|
||||
if (status != PJ_SUCCESS) {
|
||||
status2 = pjmedia_tonegen_create2(app_config.pool, &label,
|
||||
8000, 1, 160, 16,
|
||||
PJMEDIA_TONEGEN_LOOP, &tport);
|
||||
if (status2 != PJ_SUCCESS) {
|
||||
pjsua_perror(THIS_FILE, "Unable to create tone generator", status);
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
status = pjsua_conf_add_port(app_config.pool, tport,
|
||||
status2 = pjsua_conf_add_port(app_config.pool, tport,
|
||||
&app_config.tone_slots[i]);
|
||||
pj_assert(status == PJ_SUCCESS);
|
||||
pj_assert(status2 == PJ_SUCCESS);
|
||||
|
||||
status = pjmedia_tonegen_play(tport, 1, &app_config.tones[i], 0);
|
||||
pj_assert(status == PJ_SUCCESS);
|
||||
status2 = pjmedia_tonegen_play(tport, 1, &app_config.tones[i], 0);
|
||||
pj_assert(status2 == PJ_SUCCESS);
|
||||
}
|
||||
|
||||
/* Optionally create recorder file, if any. */
|
||||
|
@ -1448,7 +1448,7 @@ static pj_status_t app_init()
|
|||
|
||||
/* Create ringback tones */
|
||||
if (app_config.no_tones == PJ_FALSE) {
|
||||
unsigned i, samples_per_frame;
|
||||
unsigned samples_per_frame;
|
||||
pjmedia_tone_desc tone[RING_CNT+RINGBACK_CNT];
|
||||
pj_str_t name;
|
||||
|
||||
|
|
|
@ -1748,9 +1748,9 @@ static pj_status_t cmd_transfer_call(pj_cli_cmd_val *cval)
|
|||
pjsua_call_xfer( current_call, &binfo.uri, &msg_data);
|
||||
}
|
||||
} else if (result.uri_result) {
|
||||
pj_str_t tmp;
|
||||
tmp = pj_str(result.uri_result);
|
||||
pjsua_call_xfer( current_call, &tmp, &msg_data);
|
||||
pj_str_t tmp2;
|
||||
tmp2 = pj_str(result.uri_result);
|
||||
pjsua_call_xfer( current_call, &tmp2, &msg_data);
|
||||
}
|
||||
}
|
||||
return PJ_SUCCESS;
|
||||
|
@ -1768,7 +1768,7 @@ static pj_status_t cmd_transfer_replace_call(pj_cli_cmd_val *cval)
|
|||
pj_str_t STR_REFER_SUB = { "Refer-Sub", 9 };
|
||||
pj_str_t STR_FALSE = { "false", 5 };
|
||||
pjsua_call_id ids[PJSUA_MAX_CALLS];
|
||||
pjsua_msg_data msg_data;
|
||||
pjsua_msg_data msg_data_;
|
||||
char buf[8] = {0};
|
||||
pj_str_t tmp = pj_str(buf);
|
||||
unsigned count;
|
||||
|
@ -1822,17 +1822,17 @@ static pj_status_t cmd_transfer_replace_call(pj_cli_cmd_val *cval)
|
|||
return PJ_SUCCESS;
|
||||
}
|
||||
|
||||
pjsua_msg_data_init(&msg_data);
|
||||
pjsua_msg_data_init(&msg_data_);
|
||||
if (app_config.no_refersub) {
|
||||
/* Add Refer-Sub: false in outgoing REFER request */
|
||||
pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB,
|
||||
&STR_FALSE);
|
||||
pj_list_push_back(&msg_data.hdr_list, &refer_sub);
|
||||
pj_list_push_back(&msg_data_.hdr_list, &refer_sub);
|
||||
}
|
||||
|
||||
pjsua_call_xfer_replaces(call, dst_call,
|
||||
PJSUA_XFER_NO_REQUIRE_REPLACES,
|
||||
&msg_data);
|
||||
&msg_data_);
|
||||
}
|
||||
return PJ_SUCCESS;
|
||||
}
|
||||
|
@ -2661,7 +2661,7 @@ static pj_status_t cmd_restart_handler(pj_cli_cmd_val *cval)
|
|||
return PJ_SUCCESS;
|
||||
}
|
||||
|
||||
static pj_status_t add_call_command(pj_cli_t *cli)
|
||||
static pj_status_t add_call_command(pj_cli_t *c)
|
||||
{
|
||||
char* call_command =
|
||||
"<CMD name='call' id='100' desc='Call related commands'>"
|
||||
|
@ -2733,12 +2733,12 @@ static pj_status_t add_call_command(pj_cli_t *cli)
|
|||
"</CMD>";
|
||||
|
||||
pj_str_t xml = pj_str(call_command);
|
||||
return pj_cli_add_cmd_from_xml(cli, NULL,
|
||||
return pj_cli_add_cmd_from_xml(c, NULL,
|
||||
&xml, cmd_call_handler,
|
||||
NULL, get_choice_value);
|
||||
}
|
||||
|
||||
static pj_status_t add_presence_command(pj_cli_t *cli)
|
||||
static pj_status_t add_presence_command(pj_cli_t *c)
|
||||
{
|
||||
char* presence_command =
|
||||
"<CMD name='im' id='200' desc='IM and Presence Commands'>"
|
||||
|
@ -2789,12 +2789,12 @@ static pj_status_t add_presence_command(pj_cli_t *cli)
|
|||
|
||||
pj_str_t xml = pj_str(presence_command);
|
||||
|
||||
return pj_cli_add_cmd_from_xml(cli, NULL,
|
||||
return pj_cli_add_cmd_from_xml(c, NULL,
|
||||
&xml, cmd_presence_handler,
|
||||
NULL, get_choice_value);
|
||||
}
|
||||
|
||||
static pj_status_t add_account_command(pj_cli_t *cli)
|
||||
static pj_status_t add_account_command(pj_cli_t *c)
|
||||
{
|
||||
char* account_command =
|
||||
"<CMD name='acc' id='300' desc='Account commands'>"
|
||||
|
@ -2834,12 +2834,12 @@ static pj_status_t add_account_command(pj_cli_t *cli)
|
|||
"</CMD>";
|
||||
|
||||
pj_str_t xml = pj_str(account_command);
|
||||
return pj_cli_add_cmd_from_xml(cli, NULL,
|
||||
return pj_cli_add_cmd_from_xml(c, NULL,
|
||||
&xml, cmd_account_handler,
|
||||
NULL, get_choice_value);
|
||||
}
|
||||
|
||||
static pj_status_t add_media_command(pj_cli_t *cli)
|
||||
static pj_status_t add_media_command(pj_cli_t *c)
|
||||
{
|
||||
char* media_command =
|
||||
"<CMD name='audio' id='400' desc='Conference and Media commands'>"
|
||||
|
@ -2869,12 +2869,12 @@ static pj_status_t add_media_command(pj_cli_t *cli)
|
|||
"</CMD>";
|
||||
|
||||
pj_str_t xml = pj_str(media_command);
|
||||
return pj_cli_add_cmd_from_xml(cli, NULL,
|
||||
return pj_cli_add_cmd_from_xml(c, NULL,
|
||||
&xml, cmd_media_handler,
|
||||
NULL, get_choice_value);
|
||||
}
|
||||
|
||||
static pj_status_t add_config_command(pj_cli_t *cli)
|
||||
static pj_status_t add_config_command(pj_cli_t *c)
|
||||
{
|
||||
char* config_command =
|
||||
"<CMD name='stat' id='500' desc='Status and config commands'>"
|
||||
|
@ -2890,7 +2890,7 @@ static pj_status_t add_config_command(pj_cli_t *cli)
|
|||
"</CMD>";
|
||||
|
||||
pj_str_t xml = pj_str(config_command);
|
||||
return pj_cli_add_cmd_from_xml(cli, NULL,
|
||||
return pj_cli_add_cmd_from_xml(c, NULL,
|
||||
&xml, cmd_config_handler,
|
||||
NULL, get_choice_value);
|
||||
}
|
||||
|
@ -3041,7 +3041,7 @@ static pj_status_t add_video_command(pj_cli_t *cli)
|
|||
}
|
||||
#endif
|
||||
|
||||
static pj_status_t add_other_command(pj_cli_t *cli)
|
||||
static pj_status_t add_other_command(pj_cli_t *c)
|
||||
{
|
||||
char* sleep_command =
|
||||
"<CMD name='sleep' id='700' desc='Suspend keyboard input'>"
|
||||
|
@ -3068,63 +3068,63 @@ static pj_status_t add_other_command(pj_cli_t *cli)
|
|||
pj_str_t shutdown_xml = pj_str(shutdown_command);
|
||||
pj_str_t restart_xml = pj_str(restart_command);
|
||||
|
||||
status = pj_cli_add_cmd_from_xml(cli, NULL,
|
||||
status = pj_cli_add_cmd_from_xml(c, NULL,
|
||||
&sleep_xml, cmd_sleep_handler,
|
||||
NULL, NULL);
|
||||
if (status != PJ_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = pj_cli_add_cmd_from_xml(cli, NULL,
|
||||
status = pj_cli_add_cmd_from_xml(c, NULL,
|
||||
&network_xml, cmd_network_handler,
|
||||
NULL, NULL);
|
||||
if (status != PJ_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = pj_cli_add_cmd_from_xml(cli, NULL,
|
||||
status = pj_cli_add_cmd_from_xml(c, NULL,
|
||||
&shutdown_xml, cmd_quit_handler,
|
||||
NULL, NULL);
|
||||
|
||||
if (status != PJ_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = pj_cli_add_cmd_from_xml(cli, NULL,
|
||||
status = pj_cli_add_cmd_from_xml(c, NULL,
|
||||
&restart_xml, cmd_restart_handler,
|
||||
NULL, NULL);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
pj_status_t cli_setup_command(pj_cli_t *cli)
|
||||
pj_status_t cli_setup_command(pj_cli_t *c)
|
||||
{
|
||||
pj_status_t status;
|
||||
|
||||
status = add_call_command(cli);
|
||||
status = add_call_command(c);
|
||||
if (status != PJ_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = add_presence_command(cli);
|
||||
status = add_presence_command(c);
|
||||
if (status != PJ_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = add_account_command(cli);
|
||||
status = add_account_command(c);
|
||||
if (status != PJ_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = add_media_command(cli);
|
||||
status = add_media_command(c);
|
||||
if (status != PJ_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = add_config_command(cli);
|
||||
status = add_config_command(c);
|
||||
if (status != PJ_SUCCESS)
|
||||
return status;
|
||||
|
||||
#if PJSUA_HAS_VIDEO
|
||||
status = add_video_command(cli);
|
||||
status = add_video_command(c);
|
||||
if (status != PJ_SUCCESS)
|
||||
return status;
|
||||
#endif
|
||||
|
||||
status = add_other_command(cli);
|
||||
status = add_other_command(c);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -606,7 +606,7 @@ on_error:
|
|||
static void ui_make_new_call()
|
||||
{
|
||||
char buf[128];
|
||||
pjsua_msg_data msg_data;
|
||||
pjsua_msg_data msg_data_;
|
||||
input_result result;
|
||||
pj_str_t tmp;
|
||||
|
||||
|
@ -631,10 +631,10 @@ static void ui_make_new_call()
|
|||
tmp.slen = 0;
|
||||
}
|
||||
|
||||
pjsua_msg_data_init(&msg_data);
|
||||
TEST_MULTIPART(&msg_data);
|
||||
pjsua_msg_data_init(&msg_data_);
|
||||
TEST_MULTIPART(&msg_data_);
|
||||
pjsua_call_make_call(current_acc, &tmp, &call_opt, NULL,
|
||||
&msg_data, ¤t_call);
|
||||
&msg_data_, ¤t_call);
|
||||
}
|
||||
|
||||
static void ui_make_multi_call()
|
||||
|
@ -757,7 +757,7 @@ static void ui_answer_call()
|
|||
{
|
||||
pjsua_call_info call_info;
|
||||
char buf[128];
|
||||
pjsua_msg_data msg_data;
|
||||
pjsua_msg_data msg_data_;
|
||||
|
||||
if (current_call != -1) {
|
||||
pjsua_call_get_info(current_call, &call_info);
|
||||
|
@ -789,7 +789,7 @@ static void ui_answer_call()
|
|||
if (st_code < 100)
|
||||
return;
|
||||
|
||||
pjsua_msg_data_init(&msg_data);
|
||||
pjsua_msg_data_init(&msg_data_);
|
||||
|
||||
if (st_code/100 == 3) {
|
||||
if (!simple_input("Enter URL to be put in Contact",
|
||||
|
@ -798,7 +798,7 @@ static void ui_answer_call()
|
|||
hvalue = pj_str(contact);
|
||||
pjsip_generic_string_hdr_init2(&hcontact, &hname, &hvalue);
|
||||
|
||||
pj_list_push_back(&msg_data.hdr_list, &hcontact);
|
||||
pj_list_push_back(&msg_data_.hdr_list, &hcontact);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -812,7 +812,7 @@ static void ui_answer_call()
|
|||
return;
|
||||
}
|
||||
|
||||
pjsua_call_answer2(current_call, &call_opt, st_code, NULL, &msg_data);
|
||||
pjsua_call_answer2(current_call, &call_opt, st_code, NULL, &msg_data_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1079,7 +1079,7 @@ static void ui_call_transfer(pj_bool_t no_refersub)
|
|||
pj_str_t STR_FALSE = { "false", 5 };
|
||||
pjsua_call_info ci;
|
||||
input_result result;
|
||||
pjsua_msg_data msg_data;
|
||||
pjsua_msg_data msg_data_;
|
||||
|
||||
pjsua_call_get_info(current_call, &ci);
|
||||
printf("Transferring current call [%d] %.*s\n", current_call,
|
||||
|
@ -1094,12 +1094,12 @@ static void ui_call_transfer(pj_bool_t no_refersub)
|
|||
return;
|
||||
}
|
||||
|
||||
pjsua_msg_data_init(&msg_data);
|
||||
pjsua_msg_data_init(&msg_data_);
|
||||
if (no_refersub) {
|
||||
/* Add Refer-Sub: false in outgoing REFER request */
|
||||
pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB,
|
||||
&STR_FALSE);
|
||||
pj_list_push_back(&msg_data.hdr_list, &refer_sub);
|
||||
pj_list_push_back(&msg_data_.hdr_list, &refer_sub);
|
||||
}
|
||||
if (result.nb_result != PJSUA_APP_NO_NB) {
|
||||
if (result.nb_result == -1 || result.nb_result == 0) {
|
||||
|
@ -1107,13 +1107,13 @@ static void ui_call_transfer(pj_bool_t no_refersub)
|
|||
} else {
|
||||
pjsua_buddy_info binfo;
|
||||
pjsua_buddy_get_info(result.nb_result-1, &binfo);
|
||||
pjsua_call_xfer( current_call, &binfo.uri, &msg_data);
|
||||
pjsua_call_xfer( current_call, &binfo.uri, &msg_data_);
|
||||
}
|
||||
|
||||
} else if (result.uri_result) {
|
||||
pj_str_t tmp;
|
||||
tmp = pj_str(result.uri_result);
|
||||
pjsua_call_xfer( current_call, &tmp, &msg_data);
|
||||
pjsua_call_xfer( current_call, &tmp, &msg_data_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1130,7 +1130,7 @@ static void ui_call_transfer_replaces(pj_bool_t no_refersub)
|
|||
pj_str_t STR_FALSE = { "false", 5 };
|
||||
pjsua_call_id ids[PJSUA_MAX_CALLS];
|
||||
pjsua_call_info ci;
|
||||
pjsua_msg_data msg_data;
|
||||
pjsua_msg_data msg_data_;
|
||||
char buf[128];
|
||||
unsigned i, count;
|
||||
|
||||
|
@ -1189,17 +1189,17 @@ static void ui_call_transfer_replaces(pj_bool_t no_refersub)
|
|||
return;
|
||||
}
|
||||
|
||||
pjsua_msg_data_init(&msg_data);
|
||||
pjsua_msg_data_init(&msg_data_);
|
||||
if (no_refersub) {
|
||||
/* Add Refer-Sub: false in outgoing REFER request */
|
||||
pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB,
|
||||
&STR_FALSE);
|
||||
pj_list_push_back(&msg_data.hdr_list, &refer_sub);
|
||||
pj_list_push_back(&msg_data_.hdr_list, &refer_sub);
|
||||
}
|
||||
|
||||
pjsua_call_xfer_replaces(call, dst_call,
|
||||
PJSUA_XFER_NO_REQUIRE_REPLACES,
|
||||
&msg_data);
|
||||
&msg_data_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1262,19 +1262,19 @@ static void ui_send_dtmf_info()
|
|||
digits = pj_str(buf);
|
||||
for (i=0; i<digits.slen; ++i) {
|
||||
char body[80];
|
||||
pjsua_msg_data msg_data;
|
||||
pjsua_msg_data msg_data_;
|
||||
|
||||
pjsua_msg_data_init(&msg_data);
|
||||
msg_data.content_type = pj_str("application/dtmf-relay");
|
||||
msg_data_.content_type = pj_str("application/dtmf-relay");
|
||||
|
||||
pj_ansi_snprintf(body, sizeof(body),
|
||||
"Signal=%c\r\n"
|
||||
"Duration=160",
|
||||
buf[i]);
|
||||
msg_data.msg_body = pj_str(body);
|
||||
msg_data_.msg_body = pj_str(body);
|
||||
|
||||
status = pjsua_call_send_request(current_call, &SIP_INFO,
|
||||
&msg_data);
|
||||
&msg_data_);
|
||||
if (status != PJ_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ on_return:
|
|||
/*
|
||||
* Simple implementation of app_main() for console targets
|
||||
*/
|
||||
pj_status_t app_main(pj_cli_t *cli)
|
||||
pj_status_t app_main(pj_cli_t *c)
|
||||
{
|
||||
pj_status_t status;
|
||||
pj_cli_sess *sess;
|
||||
|
@ -231,7 +231,7 @@ pj_status_t app_main(pj_cli_t *cli)
|
|||
/*
|
||||
* Create the console front end
|
||||
*/
|
||||
status = pj_cli_console_create(cli, &console_cfg, &sess, NULL);
|
||||
status = pj_cli_console_create(c, &console_cfg, &sess, NULL);
|
||||
if (status != PJ_SUCCESS)
|
||||
return status;
|
||||
|
||||
|
@ -242,7 +242,6 @@ pj_status_t app_main(pj_cli_t *cli)
|
|||
*/
|
||||
for (;;) {
|
||||
char cmdline[PJ_CLI_MAX_CMDBUF];
|
||||
pj_status_t status;
|
||||
|
||||
status = pj_cli_console_process(sess, &cmdline[0], sizeof(cmdline));
|
||||
if (status != PJ_SUCCESS)
|
||||
|
|
|
@ -43,11 +43,11 @@ static FILE *f = NULL;
|
|||
//#define VERBOSE
|
||||
#define THIS_FILE "http_demo"
|
||||
|
||||
static void on_response(pj_http_req *http_req, const pj_http_resp *resp)
|
||||
static void on_response(pj_http_req *req, const pj_http_resp *resp)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
PJ_UNUSED_ARG(http_req);
|
||||
PJ_UNUSED_ARG(req);
|
||||
PJ_LOG(3,(THIS_FILE, "%.*s %d %.*s", (int)resp->version.slen, resp->version.ptr,
|
||||
resp->status_code,
|
||||
(int)resp->reason.slen, resp->reason.ptr));
|
||||
|
@ -65,9 +65,9 @@ static void on_response(pj_http_req *http_req, const pj_http_resp *resp)
|
|||
}
|
||||
}
|
||||
|
||||
static void on_send_data(pj_http_req *http_req, void **data, pj_size_t *size)
|
||||
static void on_send_data(pj_http_req *req, void **data, pj_size_t *size)
|
||||
{
|
||||
PJ_UNUSED_ARG(http_req);
|
||||
PJ_UNUSED_ARG(req);
|
||||
PJ_UNUSED_ARG(size);
|
||||
PJ_UNUSED_ARG(data);
|
||||
}
|
||||
|
|
|
@ -195,14 +195,14 @@ int main(int argc, char *argv[])
|
|||
processed = 0;
|
||||
while (processed < longest + clock_rate * APPEND * 2 / 1000) {
|
||||
pj_int16_t framebuf[PTIME * 48000 / 1000];
|
||||
pjmedia_port *cp = pjmedia_conf_get_master_port(conf);
|
||||
pjmedia_port *mp = pjmedia_conf_get_master_port(conf);
|
||||
pjmedia_frame frame;
|
||||
|
||||
frame.buf = framebuf;
|
||||
frame.size = PJMEDIA_PIA_SPF(&cp->info) * 2;
|
||||
frame.size = PJMEDIA_PIA_SPF(&mp->info) * 2;
|
||||
pj_assert(frame.size <= sizeof(framebuf));
|
||||
|
||||
CHECK( pjmedia_port_get_frame(cp, &frame) );
|
||||
CHECK( pjmedia_port_get_frame(mp, &frame) );
|
||||
|
||||
if (frame.type != PJMEDIA_FRAME_TYPE_AUDIO) {
|
||||
pj_bzero(frame.buf, frame.size);
|
||||
|
|
|
@ -371,8 +371,6 @@ static void pcap2wav(const pj_str_t *codec,
|
|||
/* Decode and write to WAV file */
|
||||
samples_cnt = 0;
|
||||
for (i=0; i<frame_cnt; ++i) {
|
||||
pjmedia_frame pcm_frame;
|
||||
|
||||
pcm_frame.buf = pcm;
|
||||
pcm_frame.size = samples_per_frame * 2;
|
||||
|
||||
|
|
|
@ -967,12 +967,12 @@ static void call_on_media_update( pjsip_inv_session *inv,
|
|||
{
|
||||
if (status != PJ_SUCCESS) {
|
||||
pjsip_tx_data *tdata;
|
||||
pj_status_t status;
|
||||
pj_status_t status2;
|
||||
|
||||
status = pjsip_inv_end_session(inv, PJSIP_SC_UNSUPPORTED_MEDIA_TYPE,
|
||||
status2 = pjsip_inv_end_session(inv, PJSIP_SC_UNSUPPORTED_MEDIA_TYPE,
|
||||
NULL, &tdata);
|
||||
if (status == PJ_SUCCESS && tdata)
|
||||
status = pjsip_inv_send_msg(inv, tdata);
|
||||
if (status2 == PJ_SUCCESS && tdata)
|
||||
status2 = pjsip_inv_send_msg(inv, tdata);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1059,7 +1059,6 @@ static pj_status_t create_sdp( pj_pool_t *pool,
|
|||
|
||||
{
|
||||
pjmedia_sdp_rtpmap rtpmap;
|
||||
pjmedia_sdp_attr *attr;
|
||||
char ptstr[10];
|
||||
|
||||
sprintf(ptstr, "%d", app.audio_codec.pt);
|
||||
|
@ -2125,8 +2124,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* If URL is specified, then make call immediately */
|
||||
if (app.uri_to_call.slen) {
|
||||
unsigned i;
|
||||
|
||||
PJ_LOG(3,(THIS_FILE, "Making %d calls to %s..", app.max_calls,
|
||||
app.uri_to_call.ptr));
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ static pj_bool_t proxy_on_rx_request( pjsip_rx_data *rdata )
|
|||
} else {
|
||||
/* This is CANCEL request */
|
||||
pjsip_transaction *invite_uas;
|
||||
struct uas_data *uas_data;
|
||||
struct uas_data *uas_data2;
|
||||
pj_str_t key;
|
||||
|
||||
/* Find the UAS INVITE transaction */
|
||||
|
@ -269,17 +269,17 @@ static pj_bool_t proxy_on_rx_request( pjsip_rx_data *rdata )
|
|||
* The UAS INVITE transaction will get final response when
|
||||
* we receive final response from the UAC INVITE transaction.
|
||||
*/
|
||||
uas_data = (struct uas_data*) invite_uas->mod_data[mod_tu.id];
|
||||
if (uas_data->uac_tsx && uas_data->uac_tsx->status_code < 200) {
|
||||
uas_data2 = (struct uas_data*) invite_uas->mod_data[mod_tu.id];
|
||||
if (uas_data2->uac_tsx && uas_data2->uac_tsx->status_code < 200) {
|
||||
pjsip_tx_data *cancel;
|
||||
|
||||
pj_grp_lock_acquire(uas_data->uac_tsx->grp_lock);
|
||||
pj_grp_lock_acquire(uas_data2->uac_tsx->grp_lock);
|
||||
|
||||
pjsip_endpt_create_cancel(global.endpt, uas_data->uac_tsx->last_tx,
|
||||
pjsip_endpt_create_cancel(global.endpt, uas_data2->uac_tsx->last_tx,
|
||||
&cancel);
|
||||
pjsip_endpt_send_request(global.endpt, cancel, -1, NULL, NULL);
|
||||
|
||||
pj_grp_lock_release(uas_data->uac_tsx->grp_lock);
|
||||
pj_grp_lock_release(uas_data2->uac_tsx->grp_lock);
|
||||
}
|
||||
|
||||
/* Unlock UAS tsx because it is locked in find_tsx() */
|
||||
|
|
|
@ -434,14 +434,14 @@ static pj_status_t create_request(pjsip_publishc *pubc,
|
|||
|
||||
/* Add user headers */
|
||||
if (!pj_list_empty(&pubc->usr_hdr)) {
|
||||
const pjsip_hdr *hdr;
|
||||
const pjsip_hdr *uhdr;
|
||||
|
||||
hdr = pubc->usr_hdr.next;
|
||||
while (hdr != &pubc->usr_hdr) {
|
||||
uhdr = pubc->usr_hdr.next;
|
||||
while (uhdr != &pubc->usr_hdr) {
|
||||
pjsip_hdr *new_hdr = (pjsip_hdr*)
|
||||
pjsip_hdr_shallow_clone(tdata->pool, hdr);
|
||||
pjsip_hdr_shallow_clone(tdata->pool, uhdr);
|
||||
pjsip_msg_add_hdr(tdata->msg, new_hdr);
|
||||
hdr = hdr->next;
|
||||
uhdr = uhdr->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -242,25 +242,25 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uac( pjsip_user_agent *ua,
|
|||
pjsip_sip_uri *sip_uri = (pjsip_sip_uri *)
|
||||
pjsip_uri_get_uri(dlg->remote.info->uri);
|
||||
if (!pj_list_empty(&sip_uri->header_param)) {
|
||||
pj_str_t tmp;
|
||||
pj_str_t tmp2;
|
||||
|
||||
/* Remove all header param */
|
||||
pj_list_init(&sip_uri->header_param);
|
||||
|
||||
/* Print URI */
|
||||
tmp.ptr = (char*) pj_pool_alloc(dlg->pool,
|
||||
tmp2.ptr = (char*) pj_pool_alloc(dlg->pool,
|
||||
dlg->remote.info_str.slen);
|
||||
tmp.slen = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR,
|
||||
sip_uri, tmp.ptr,
|
||||
tmp2.slen = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR,
|
||||
sip_uri, tmp2.ptr,
|
||||
dlg->remote.info_str.slen);
|
||||
|
||||
if (tmp.slen < 1) {
|
||||
if (tmp2.slen < 1) {
|
||||
status = PJSIP_EURITOOLONG;
|
||||
goto on_error;
|
||||
}
|
||||
|
||||
/* Assign remote.info_str */
|
||||
dlg->remote.info_str = tmp;
|
||||
dlg->remote.info_str = tmp2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -391,12 +391,12 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua,
|
|||
* MUST be a SIPS URI.
|
||||
*/
|
||||
if (contact) {
|
||||
pj_str_t tmp;
|
||||
pj_str_t tmp2;
|
||||
|
||||
pj_strdup_with_null(dlg->pool, &tmp, contact);
|
||||
pj_strdup_with_null(dlg->pool, &tmp2, contact);
|
||||
dlg->local.contact = (pjsip_contact_hdr*)
|
||||
pjsip_parse_hdr(dlg->pool, &HCONTACT, tmp.ptr,
|
||||
tmp.slen, NULL);
|
||||
pjsip_parse_hdr(dlg->pool, &HCONTACT, tmp2.ptr,
|
||||
tmp2.slen, NULL);
|
||||
if (!dlg->local.contact) {
|
||||
status = PJSIP_EINVALIDURI;
|
||||
goto on_error;
|
||||
|
|
|
@ -592,10 +592,10 @@ PJ_DEF(pjsip_msg_body*) pjsip_multipart_parse(pj_pool_t *pool,
|
|||
curptr = buf;
|
||||
endptr = buf + len;
|
||||
{
|
||||
pj_str_t body;
|
||||
pj_str_t strbody;
|
||||
|
||||
body.ptr = buf; body.slen = len;
|
||||
curptr = pj_strstr(&body, &delim);
|
||||
strbody.ptr = buf; strbody.slen = len;
|
||||
curptr = pj_strstr(&strbody, &delim);
|
||||
if (!curptr)
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -674,7 +674,7 @@ static pjsip_parse_hdr_func* find_handler(const pj_str_t *hname)
|
|||
pj_uint32_t hash;
|
||||
char hname_copy[PJSIP_MAX_HNAME_LEN];
|
||||
pj_str_t tmp;
|
||||
pjsip_parse_hdr_func *handler;
|
||||
pjsip_parse_hdr_func *func;
|
||||
|
||||
if (hname->slen >= PJSIP_MAX_HNAME_LEN) {
|
||||
/* Guaranteed not to be able to find handler. */
|
||||
|
@ -683,9 +683,9 @@ static pjsip_parse_hdr_func* find_handler(const pj_str_t *hname)
|
|||
|
||||
/* First, common case, try to find handler with exact name */
|
||||
hash = pj_hash_calc(0, hname->ptr, (unsigned)hname->slen);
|
||||
handler = find_handler_imp(hash, hname);
|
||||
if (handler)
|
||||
return handler;
|
||||
func = find_handler_imp(hash, hname);
|
||||
if (func)
|
||||
return func;
|
||||
|
||||
|
||||
/* If not found, try converting the header name to lowercase and
|
||||
|
@ -980,7 +980,7 @@ retry_parse:
|
|||
parse_headers:
|
||||
/* Parse headers. */
|
||||
do {
|
||||
pjsip_parse_hdr_func * handler;
|
||||
pjsip_parse_hdr_func * func;
|
||||
pjsip_hdr *hdr = NULL;
|
||||
|
||||
/* Init hname just in case parsing fails.
|
||||
|
@ -995,14 +995,14 @@ parse_headers:
|
|||
}
|
||||
|
||||
/* Find handler. */
|
||||
handler = find_handler(&hname);
|
||||
func = find_handler(&hname);
|
||||
|
||||
/* Call the handler if found.
|
||||
* If no handler is found, then treat the header as generic
|
||||
* hname/hvalue pair.
|
||||
*/
|
||||
if (handler) {
|
||||
hdr = (*handler)(ctx);
|
||||
if (func) {
|
||||
hdr = (*func)(ctx);
|
||||
|
||||
/* Note:
|
||||
* hdr MAY BE NULL, if parsing does not yield a new header
|
||||
|
@ -2262,9 +2262,9 @@ PJ_DEF(void*) pjsip_parse_hdr( pj_pool_t *pool, const pj_str_t *hname,
|
|||
context.rdata = NULL;
|
||||
|
||||
PJ_TRY {
|
||||
pjsip_parse_hdr_func *handler = find_handler(hname);
|
||||
if (handler) {
|
||||
hdr = (*handler)(&context);
|
||||
pjsip_parse_hdr_func *func = find_handler(hname);
|
||||
if (func) {
|
||||
hdr = (*func)(&context);
|
||||
} else {
|
||||
hdr = parse_hdr_generic_string(&context);
|
||||
hdr->type = PJSIP_H_OTHER;
|
||||
|
@ -2310,7 +2310,7 @@ retry_parse:
|
|||
{
|
||||
/* Parse headers. */
|
||||
do {
|
||||
pjsip_parse_hdr_func * handler;
|
||||
pjsip_parse_hdr_func * func;
|
||||
pjsip_hdr *hdr = NULL;
|
||||
|
||||
/* Init hname just in case parsing fails.
|
||||
|
@ -2325,14 +2325,14 @@ retry_parse:
|
|||
}
|
||||
|
||||
/* Find handler. */
|
||||
handler = find_handler(&hname);
|
||||
func = find_handler(&hname);
|
||||
|
||||
/* Call the handler if found.
|
||||
* If no handler is found, then treat the header as generic
|
||||
* hname/hvalue pair.
|
||||
*/
|
||||
if (handler) {
|
||||
hdr = (*handler)(&ctx);
|
||||
if (func) {
|
||||
hdr = (*func)(&ctx);
|
||||
} else {
|
||||
hdr = parse_hdr_generic_string(&ctx);
|
||||
hdr->name = hdr->sname = hname;
|
||||
|
|
|
@ -399,7 +399,6 @@ static void* tel_uri_parse( pj_scanner *scanner, pj_pool_t *pool,
|
|||
/* Get all parameters. */
|
||||
if (parse_params && *scanner->curptr==';') {
|
||||
pj_str_t pname, pvalue;
|
||||
const pjsip_parser_const_t *pc = pjsip_parser_const();
|
||||
|
||||
do {
|
||||
/* Eat the ';' separator. */
|
||||
|
|
|
@ -1183,7 +1183,8 @@ static pj_bool_t on_accept_complete(pj_activesock_t *asock,
|
|||
}
|
||||
/* Start keep-alive timer */
|
||||
if (pjsip_cfg()->tcp.keep_alive_interval) {
|
||||
pj_time_val delay = {pjsip_cfg()->tcp.keep_alive_interval, 0};
|
||||
pj_time_val delay = { 0 };
|
||||
delay.sec = pjsip_cfg()->tcp.keep_alive_interval;
|
||||
pjsip_endpt_schedule_timer(listener->endpt,
|
||||
&tcp->ka_timer,
|
||||
&delay);
|
||||
|
@ -1542,7 +1543,8 @@ static pj_bool_t on_connect_complete(pj_activesock_t *asock,
|
|||
|
||||
/* Start keep-alive timer */
|
||||
if (pjsip_cfg()->tcp.keep_alive_interval) {
|
||||
pj_time_val delay = { pjsip_cfg()->tcp.keep_alive_interval, 0 };
|
||||
pj_time_val delay = { 0 };
|
||||
delay.sec = pjsip_cfg()->tcp.keep_alive_interval;
|
||||
pjsip_endpt_schedule_timer(tcp->base.endpt, &tcp->ka_timer,
|
||||
&delay);
|
||||
tcp->ka_timer.id = PJ_TRUE;
|
||||
|
|
|
@ -2536,7 +2536,6 @@ PJ_DEF(pj_status_t) pjsua_acc_set_registration( pjsua_acc_id acc_id,
|
|||
&tdata);
|
||||
|
||||
if (0 && status == PJ_SUCCESS && pjsua_var.acc[acc_id].cred_cnt) {
|
||||
pjsua_acc *acc = &pjsua_var.acc[acc_id];
|
||||
pjsip_authorization_hdr *h;
|
||||
char *uri;
|
||||
int d;
|
||||
|
|
|
@ -4510,12 +4510,12 @@ static void on_call_transferred( pjsip_inv_session *inv,
|
|||
/*
|
||||
* Always answer with 2xx.
|
||||
*/
|
||||
pjsip_tx_data *tdata;
|
||||
pjsip_tx_data *tdata2;
|
||||
const pj_str_t str_false = { "false", 5};
|
||||
pjsip_hdr *hdr;
|
||||
|
||||
status = pjsip_dlg_create_response(inv->dlg, rdata, code, NULL,
|
||||
&tdata);
|
||||
&tdata2);
|
||||
if (status != PJ_SUCCESS) {
|
||||
pjsua_perror(THIS_FILE, "Unable to create 2xx response to REFER",
|
||||
status);
|
||||
|
@ -4524,14 +4524,14 @@ static void on_call_transferred( pjsip_inv_session *inv,
|
|||
|
||||
/* Add Refer-Sub header */
|
||||
hdr = (pjsip_hdr*)
|
||||
pjsip_generic_string_hdr_create(tdata->pool, &str_refer_sub,
|
||||
pjsip_generic_string_hdr_create(tdata2->pool, &str_refer_sub,
|
||||
&str_false);
|
||||
pjsip_msg_add_hdr(tdata->msg, hdr);
|
||||
pjsip_msg_add_hdr(tdata2->msg, hdr);
|
||||
|
||||
|
||||
/* Send answer */
|
||||
status = pjsip_dlg_send_response(inv->dlg, pjsip_rdata_get_tsx(rdata),
|
||||
tdata);
|
||||
tdata2);
|
||||
if (status != PJ_SUCCESS) {
|
||||
pjsua_perror(THIS_FILE, "Unable to create 2xx response to REFER",
|
||||
status);
|
||||
|
|
|
@ -906,7 +906,7 @@ PJ_DEF(pj_status_t) pjsua_init( const pjsua_config *ua_cfg,
|
|||
*/
|
||||
if (ua_cfg->nameserver_count) {
|
||||
#if PJSIP_HAS_RESOLVER
|
||||
unsigned i;
|
||||
unsigned ii;
|
||||
|
||||
/* Create DNS resolver */
|
||||
status = pjsip_endpt_create_resolver(pjsua_var.endpt,
|
||||
|
@ -933,10 +933,10 @@ PJ_DEF(pj_status_t) pjsua_init( const pjsua_config *ua_cfg,
|
|||
}
|
||||
|
||||
/* Print nameservers */
|
||||
for (i=0; i<ua_cfg->nameserver_count; ++i) {
|
||||
for (ii=0; ii<ua_cfg->nameserver_count; ++ii) {
|
||||
PJ_LOG(4,(THIS_FILE, "Nameserver %.*s added",
|
||||
(int)ua_cfg->nameserver[i].slen,
|
||||
ua_cfg->nameserver[i].ptr));
|
||||
(int)ua_cfg->nameserver[ii].slen,
|
||||
ua_cfg->nameserver[ii].ptr));
|
||||
}
|
||||
#else
|
||||
PJ_LOG(2,(THIS_FILE,
|
||||
|
@ -1099,14 +1099,14 @@ PJ_DEF(pj_status_t) pjsua_init( const pjsua_config *ua_cfg,
|
|||
|
||||
/* Start worker thread if needed. */
|
||||
if (pjsua_var.ua_cfg.thread_cnt) {
|
||||
unsigned i;
|
||||
unsigned ii;
|
||||
|
||||
if (pjsua_var.ua_cfg.thread_cnt > PJ_ARRAY_SIZE(pjsua_var.thread))
|
||||
pjsua_var.ua_cfg.thread_cnt = PJ_ARRAY_SIZE(pjsua_var.thread);
|
||||
|
||||
for (i=0; i<pjsua_var.ua_cfg.thread_cnt; ++i) {
|
||||
for (ii=0; ii<pjsua_var.ua_cfg.thread_cnt; ++ii) {
|
||||
status = pj_thread_create(pjsua_var.pool, "pjsua", &worker_thread,
|
||||
NULL, 0, 0, &pjsua_var.thread[i]);
|
||||
NULL, 0, 0, &pjsua_var.thread[ii]);
|
||||
if (status != PJ_SUCCESS)
|
||||
goto on_error;
|
||||
}
|
||||
|
|
|
@ -371,10 +371,6 @@ static void dump_media_session(const char *indent,
|
|||
|
||||
/* Get and ICE SRTP status */
|
||||
if (call_med->tp) {
|
||||
pjmedia_transport_info tp_info;
|
||||
|
||||
pjmedia_transport_info_init(&tp_info);
|
||||
pjmedia_transport_get_info(call_med->tp, &tp_info);
|
||||
if (tp_info.specific_info_cnt > 0) {
|
||||
unsigned j;
|
||||
for (j = 0; j < tp_info.specific_info_cnt; ++j) {
|
||||
|
|
|
@ -439,12 +439,12 @@ static pj_status_t create_rtp_rtcp_sock(pjsua_call_media *call_med,
|
|||
|
||||
} else {
|
||||
if (acc->cfg.allow_sdp_nat_rewrite && acc->reg_mapped_addr.slen) {
|
||||
pj_status_t status;
|
||||
pj_status_t status2;
|
||||
|
||||
/* Take the address from mapped addr as seen by registrar */
|
||||
status = pj_sockaddr_set_str_addr(af, &bound_addr,
|
||||
&acc->reg_mapped_addr);
|
||||
if (status != PJ_SUCCESS) {
|
||||
status2 = pj_sockaddr_set_str_addr(af, &bound_addr,
|
||||
&acc->reg_mapped_addr);
|
||||
if (status2 != PJ_SUCCESS) {
|
||||
/* just leave bound_addr with whatever it was
|
||||
pj_bzero(pj_sockaddr_get_addr(&bound_addr),
|
||||
pj_sockaddr_get_addr_len(&bound_addr));
|
||||
|
|
|
@ -152,9 +152,9 @@ public:
|
|||
};
|
||||
|
||||
|
||||
void CallAudioMedia::setPortId(int id)
|
||||
void CallAudioMedia::setPortId(int pid)
|
||||
{
|
||||
this->id = id;
|
||||
this->id = pid;
|
||||
}
|
||||
|
||||
CallOpParam::CallOpParam(bool useDefaultCallSetting)
|
||||
|
|
|
@ -1511,7 +1511,7 @@ void VidCodecParam::fromPj(const pjmedia_vid_codec_param ¶m)
|
|||
{
|
||||
dir = param.dir;
|
||||
packing = param.packing;
|
||||
ignoreFmtp = param.ignore_fmtp;
|
||||
ignoreFmtp = param.ignore_fmtp != PJ_FALSE;
|
||||
encMtu = param.enc_mtu;
|
||||
encFmt.fromPj(param.enc_fmt);
|
||||
decFmt.fromPj(param.dec_fmt);
|
||||
|
|
|
@ -304,24 +304,24 @@ void TransportConfig::writeObject(ContainerNode &node) const throw(Error)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TransportInfo::fromPj(const pjsua_transport_info &info)
|
||||
void TransportInfo::fromPj(const pjsua_transport_info &tinfo)
|
||||
{
|
||||
this->id = info.id;
|
||||
this->type = info.type;
|
||||
this->typeName = pj2Str(info.type_name);
|
||||
this->info = pj2Str(info.info);
|
||||
this->flags = info.flag;
|
||||
this->id = tinfo.id;
|
||||
this->type = tinfo.type;
|
||||
this->typeName = pj2Str(tinfo.type_name);
|
||||
this->info = pj2Str(tinfo.info);
|
||||
this->flags = tinfo.flag;
|
||||
|
||||
char straddr[PJ_INET6_ADDRSTRLEN+10];
|
||||
pj_sockaddr_print(&info.local_addr, straddr, sizeof(straddr), 3);
|
||||
pj_sockaddr_print(&tinfo.local_addr, straddr, sizeof(straddr), 3);
|
||||
this->localAddress = straddr;
|
||||
|
||||
pj_ansi_snprintf(straddr, sizeof(straddr), "%.*s:%d",
|
||||
(int)info.local_name.host.slen,
|
||||
info.local_name.host.ptr,
|
||||
info.local_name.port);
|
||||
(int)tinfo.local_name.host.slen,
|
||||
tinfo.local_name.host.ptr,
|
||||
tinfo.local_name.port);
|
||||
this->localName = straddr;
|
||||
this->usageCount = info.usage_count;
|
||||
this->usageCount = tinfo.usage_count;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -173,25 +173,25 @@ static void add_dns_entries(pj_dns_resolver *resv)
|
|||
* Sample of invalid SRV records: _sip._udp.sip01.example.com.
|
||||
*/
|
||||
for (i=0; i<PJ_ARRAY_SIZE(ans); ++i) {
|
||||
pj_dns_parsed_query q;
|
||||
pj_dns_parsed_query q2;
|
||||
char buf[128];
|
||||
char *services[] = { "_sip._udp.", "_sip._tcp.", "_sips._tcp."};
|
||||
unsigned j;
|
||||
|
||||
for (j=0; j<PJ_ARRAY_SIZE(services); ++j) {
|
||||
q.dnsclass = PJ_DNS_CLASS_IN;
|
||||
q.type = PJ_DNS_TYPE_SRV;
|
||||
q2.dnsclass = PJ_DNS_CLASS_IN;
|
||||
q2.type = PJ_DNS_TYPE_SRV;
|
||||
|
||||
q.name.ptr = buf;
|
||||
q2.name.ptr = buf;
|
||||
pj_bzero(buf, sizeof(buf));
|
||||
pj_strcpy2(&q.name, services[j]);
|
||||
pj_strcat(&q.name, &ans[i].rdata.srv.target);
|
||||
pj_strcpy2(&q2.name, services[j]);
|
||||
pj_strcat(&q2.name, &ans[i].rdata.srv.target);
|
||||
|
||||
pj_bzero(&pkt, sizeof(pkt));
|
||||
pkt.hdr.qdcount = 1;
|
||||
pkt.hdr.flags = PJ_DNS_SET_QR(1) |
|
||||
PJ_DNS_SET_RCODE(PJ_DNS_RCODE_NXDOMAIN);
|
||||
pkt.q = &q;
|
||||
pkt.q = &q2;
|
||||
|
||||
pj_dns_resolver_add_entry( resv, &pkt, PJ_FALSE);
|
||||
}
|
||||
|
@ -406,10 +406,10 @@ static int round_robin_test(pj_pool_t *pool)
|
|||
pjsip_endpt_resolve(endpt, pool, &dest, &result, &cb);
|
||||
|
||||
while (result.status == 0x12345678) {
|
||||
int i = 0;
|
||||
int ii = 0;
|
||||
pj_time_val timeout = { 1, 0 };
|
||||
pjsip_endpt_handle_events(endpt, &timeout);
|
||||
if (i == 1)
|
||||
if (ii == 1)
|
||||
pj_dns_resolver_dump(pjsip_endpt_get_resolver(endpt), PJ_TRUE);
|
||||
}
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ static void send_response( pjsip_rx_data *rdata,
|
|||
|
||||
/* Schedule timer to send response for the specified UAS transaction */
|
||||
static void schedule_send_response( pjsip_rx_data *rdata,
|
||||
const pj_str_t *tsx_key,
|
||||
const pj_str_t *tsx_key_,
|
||||
int status_code,
|
||||
int msec_delay )
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ static void schedule_send_response( pjsip_rx_data *rdata,
|
|||
}
|
||||
|
||||
r = PJ_POOL_ALLOC_T(tdata->pool, struct response);
|
||||
pj_strdup(tdata->pool, &r->tsx_key, tsx_key);
|
||||
pj_strdup(tdata->pool, &r->tsx_key, tsx_key_);
|
||||
r->tdata = tdata;
|
||||
|
||||
delay.sec = 0;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
# 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: 4456) // declaration of '[var]' hides previous local declaration
|
||||
//# pragma warning(disable: 4701) // local variable used without initialized
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue