summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-08-09 13:53:59 +0000
committerBenny Prijono <bennylp@teluu.com>2006-08-09 13:53:59 +0000
commite8b11d39cd89a716e3580db2b0dc4fca2412cd22 (patch)
tree7dc79e5d0b0049904dcd5d954376c6e8fe8d431d
parent5b11a53fd76ef35ac96bf86ed973f53dc342f52c (diff)
Fixed run-time bug with simple_ua and pjsip-perf sample.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@668 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip-apps/src/samples/pjsip-perf.c4
-rw-r--r--pjsip-apps/src/samples/simpleua.c42
2 files changed, 21 insertions, 25 deletions
diff --git a/pjsip-apps/src/samples/pjsip-perf.c b/pjsip-apps/src/samples/pjsip-perf.c
index 791c1c8e..5ec44af7 100644
--- a/pjsip-apps/src/samples/pjsip-perf.c
+++ b/pjsip-apps/src/samples/pjsip-perf.c
@@ -396,6 +396,8 @@ static void answer_timer_cb(pj_timer_heap_t *h, pj_timer_entry *entry)
struct call *call = entry->user_data;
pj_bool_t has_initial = PJ_TRUE;
+ PJ_UNUSED_ARG(h);
+
entry->id = 0;
send_response(call->inv, NULL, 200, &has_initial);
}
@@ -532,7 +534,7 @@ static pj_bool_t mod_call_on_rx_request(pjsip_rx_data *rdata)
} else {
/* Send the 200 response immediately . */
- status = pjsip_inv_send_msg(call->inv, tdata);
+ status = send_response(call->inv, rdata, 200, &has_initial);
PJ_ASSERT_ON_FAIL(status == PJ_SUCCESS, return PJ_TRUE);
}
diff --git a/pjsip-apps/src/samples/simpleua.c b/pjsip-apps/src/samples/simpleua.c
index 1f682a6d..d7b65086 100644
--- a/pjsip-apps/src/samples/simpleua.c
+++ b/pjsip-apps/src/samples/simpleua.c
@@ -256,39 +256,33 @@ int main(int argc, char *argv[])
status = pjmedia_codec_g711_init(g_med_endpt);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
/*
- * Initialize RTP socket info for the media.
- * The RTP socket is hard-codec to port 4000.
+ * Create media transport used to send/receive RTP/RTCP socket.
+ * One media transport is needed for each call. Application may
+ * opt to re-use the same media transport for subsequent calls.
*/
- status = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, &g_med_skinfo.rtp_sock);
- PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
-
- pj_sockaddr_in_init( &g_med_skinfo.rtp_addr_name,
- pjsip_endpt_name(g_endpt), 4000);
-
- status = pj_sock_bind(g_med_skinfo.rtp_sock, &g_med_skinfo.rtp_addr_name,
- sizeof(pj_sockaddr_in));
+ status = pjmedia_transport_udp_create(g_med_endpt, NULL, 4000, 0,
+ &g_med_transport);
if (status != PJ_SUCCESS) {
- app_perror( THIS_FILE,
- "Unable to bind RTP socket",
- status);
+ app_perror(THIS_FILE, "Unable to create media transport", status);
return 1;
}
+ /*
+ * Get socket info (address, port) of the media transport. We will
+ * need this info to create SDP (i.e. the address and port info in
+ * the SDP).
+ */
+ {
+ pjmedia_transport_udp_info udp_info;
- /* For simplicity, ignore RTCP socket. */
- g_med_skinfo.rtcp_sock = PJ_INVALID_SOCKET;
- g_med_skinfo.rtcp_addr_name = g_med_skinfo.rtp_addr_name;
-
-
- /* Create media transport */
- status = pjmedia_transport_udp_attach(g_med_endpt, NULL, &g_med_skinfo,
- 0, &g_med_transport);
- if (status != PJ_SUCCESS) {
- app_perror(THIS_FILE, "Unable to create media transport", status);
- return 1;
+ pjmedia_transport_udp_get_info(g_med_transport, &udp_info);
+ pj_memcpy(&g_med_skinfo, &udp_info.skinfo,
+ sizeof(pjmedia_sock_info));
}
+
/*
* If URL is specified, then make call immediately.
*/