summaryrefslogtreecommitdiff
path: root/pjsip/src/test-pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-01-10 13:31:40 +0000
committerBenny Prijono <bennylp@teluu.com>2006-01-10 13:31:40 +0000
commit4dc1b31807de4da871158d4af5d0a8e752e47111 (patch)
treec0f4461767fe1d55cb542d3e89fc243c2255abd5 /pjsip/src/test-pjsip
parent8757a26cbbabd54c5662bf9b492214fe937dc93a (diff)
Renamed pjsip_url to pjsip_sip_uri
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@119 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/test-pjsip')
-rw-r--r--pjsip/src/test-pjsip/msg_test.c4
-rw-r--r--pjsip/src/test-pjsip/tsx_uas_test.c725
-rw-r--r--pjsip/src/test-pjsip/txdata_test.c208
-rw-r--r--pjsip/src/test-pjsip/uri_test.c36
4 files changed, 888 insertions, 85 deletions
diff --git a/pjsip/src/test-pjsip/msg_test.c b/pjsip/src/test-pjsip/msg_test.c
index f49f1256..8fe879a3 100644
--- a/pjsip/src/test-pjsip/msg_test.c
+++ b/pjsip/src/test-pjsip/msg_test.c
@@ -332,7 +332,7 @@ static pjsip_msg *create_msg0(pj_pool_t *pool)
pjsip_msg *msg;
pjsip_name_addr *name_addr;
- pjsip_url *url;
+ pjsip_sip_uri *url;
pjsip_fromto_hdr *fromto;
pjsip_cid_hdr *cid;
pjsip_clen_hdr *clen;
@@ -537,7 +537,7 @@ static pjsip_msg *create_msg1(pj_pool_t *pool)
pjsip_via_hdr *via;
pjsip_route_hdr *route;
pjsip_name_addr *name_addr;
- pjsip_url *url;
+ pjsip_sip_uri *url;
pjsip_max_forwards_hdr *max_fwd;
pjsip_to_hdr *to;
pjsip_from_hdr *from;
diff --git a/pjsip/src/test-pjsip/tsx_uas_test.c b/pjsip/src/test-pjsip/tsx_uas_test.c
index fc587825..bed6fd08 100644
--- a/pjsip/src/test-pjsip/tsx_uas_test.c
+++ b/pjsip/src/test-pjsip/tsx_uas_test.c
@@ -45,24 +45,31 @@
**
** TEST4_BRANCH_ID
** Transaction retransmits last response (if any) without notifying
- ** transaction user upon receiving request retransmissions on:
- ** a. TRYING state.
- ** a. PROCEEDING state.
- ** b. COMPLETED state.
+ ** transaction user upon receiving request retransmissions on TRYING
+ ** state
**
** TEST5_BRANCH_ID
- ** INVITE transaction MUST retransmit final response. (Note: PJSIP also
- ** retransmit 2xx final response until it's terminated by user).
+ ** As above, in PROCEEDING state.
**
** TEST6_BRANCH_ID
- ** INVITE transaction MUST cease retransmission of final response when
- * ACK is received. (Note: PJSIP also retransmit 2xx final response
- * until it's terminated by user).
+ ** As above, in COMPLETED state, with first sending provisional response.
**
** TEST7_BRANCH_ID
- ** Test where INVITE UAS transaction never receives ACK
+ ** INVITE transaction MUST retransmit non-2xx final response.
**
** TEST8_BRANCH_ID
+ ** As above, for INVITE's 2xx final response (this is PJSIP specific).
+ **
+ ** TEST9_BRANCH_ID
+ ** INVITE transaction MUST cease retransmission of final response when
+ ** ACK is received. (Note: PJSIP also retransmit 2xx final response
+ ** until it's terminated by user).
+ ** Transaction also MUST terminate in T4 seconds.
+ **
+ ** TEST10_BRANCH_ID
+ ** Test where INVITE UAS transaction never receives ACK
+ **
+ ** TEST11_BRANCH_ID
** When UAS failed to deliver the response with the selected transport,
** it should try contacting the client with other transport or begin
** RFC 3263 server resolution procedure.
@@ -72,7 +79,7 @@
** upon receiving request retransmission).
** c. COMPLETED state.
**
- ** TEST9_BRANCH_ID
+ ** TEST12_BRANCH_ID
** Variant of previous test, where transaction fails to deliver the
** response using any kind of transports. Transaction should report
** transport error to its transaction user.
@@ -86,12 +93,37 @@ static char *TEST4_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test4";
static char *TEST5_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test5";
static char *TEST6_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test6";
static char *TEST7_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test7";
+static char *TEST8_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test8";
+static char *TEST9_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test9";
+static char *TEST10_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test10";
+static char *TEST11_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test11";
+static char *TEST12_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test12";
#define TEST1_STATUS_CODE 200
#define TEST2_STATUS_CODE 301
#define TEST3_PROVISIONAL_CODE PJSIP_SC_QUEUED
#define TEST3_STATUS_CODE 202
+#define TEST4_STATUS_CODE 200
+#define TEST4_REQUEST_COUNT 2
+#define TEST5_PROVISIONAL_CODE 100
+#define TEST5_STATUS_CODE 200
+#define TEST5_REQUEST_COUNT 2
+#define TEST5_RESPONSE_COUNT 2
+#define TEST6_PROVISIONAL_CODE 100
+#define TEST6_STATUS_CODE 200 /* Must be final */
+#define TEST6_REQUEST_COUNT 2
+#define TEST6_RESPONSE_COUNT 3
+#define TEST7_STATUS_CODE 301
+#define TEST8_STATUS_CODE 302
+
+
+#define TEST4_TITLE "test4: absorbing request retransmission"
+#define TEST5_TITLE "test5: retransmit last response in PROCEEDING state"
+#define TEST6_TITLE "test6: retransmit last response in COMPLETED state"
+
+#define TEST_TIMEOUT_ERROR -30
+#define MAX_ALLOWED_DIFF 150
static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e);
static pj_bool_t on_rx_message(pjsip_rx_data *rdata);
@@ -161,6 +193,7 @@ struct response
pjsip_tx_data *tdata;
};
+/* Timer callback to send response. */
static void send_response_timer( pj_timer_heap_t *timer_heap,
struct pj_timer_entry *entry)
{
@@ -183,6 +216,31 @@ static void send_response_timer( pj_timer_heap_t *timer_heap,
}
}
+/* Utility to send response. */
+static void send_response( pjsip_rx_data *rdata,
+ pjsip_transaction *tsx,
+ int status_code )
+{
+ pj_status_t status;
+ pjsip_tx_data *tdata;
+
+ status = pjsip_endpt_create_response( endpt, rdata, status_code, NULL,
+ &tdata);
+ if (status != PJ_SUCCESS) {
+ app_perror(" error: unable to create response", status);
+ test_complete = -196;
+ return;
+ }
+
+ status = pjsip_tsx_send_msg(tsx, tdata);
+ if (status != PJ_SUCCESS) {
+ app_perror(" error: unable to send response", status);
+ pjsip_tx_data_dec_ref(tdata);
+ test_complete = -197;
+ return;
+ }
+}
+
/* 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,
@@ -222,6 +280,49 @@ static void schedule_send_response( pjsip_rx_data *rdata,
}
}
+
+/* Find and terminate tsx with the specified key. */
+static void terminate_our_tsx(int status_code)
+{
+ pjsip_transaction *tsx;
+
+ tsx = pjsip_tsx_layer_find_tsx(&tsx_key, PJ_TRUE);
+ if (!tsx) {
+ PJ_LOG(3,(THIS_FILE," error: timer unable to find transaction"));
+ return;
+ }
+
+ pjsip_tsx_terminate(tsx, status_code);
+ pj_mutex_unlock(tsx->mutex);
+}
+
+/* Timer callback to terminate transaction. */
+static void terminate_tsx_timer( pj_timer_heap_t *timer_heap,
+ struct pj_timer_entry *entry)
+{
+ terminate_our_tsx(entry->id);
+}
+
+
+/* Schedule timer to terminate transaction. */
+static void schedule_terminate_tsx( pjsip_transaction *tsx,
+ int status_code,
+ int msec_delay )
+{
+ pj_time_val delay;
+
+ delay.sec = 0;
+ delay.msec = msec_delay;
+ pj_time_val_normalize(&delay);
+
+ pj_assert(pj_strcmp(&tsx->transaction_key, &tsx_key)==0);
+ timer.user_data = NULL;
+ timer.id = status_code;
+ timer.cb = &terminate_tsx_timer;
+ pjsip_endpt_schedule_timer(endpt, &timer, &delay);
+}
+
+
/*
* This is the handler to receive state changed notification from the
* transaction. It is used to verify that the transaction behaves according
@@ -331,6 +432,148 @@ static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e)
}
+ } else
+ if (pj_strcmp2(&tsx->branch, TEST4_BRANCH_ID)==0) {
+ /*
+ * TEST4_BRANCH_ID tests receiving retransmissions in TRYING state.
+ */
+ if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
+
+ /* Check that status code is status_code. */
+ if (tsx->status_code != TEST4_STATUS_CODE) {
+ PJ_LOG(3,(THIS_FILE, " error: incorrect status code"));
+ test_complete = -120;
+ }
+
+ /* Previous state. */
+ if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_TRYING) {
+ PJ_LOG(3,(THIS_FILE, " error: incorrect prev_state"));
+ test_complete = -121;
+ }
+
+ } else if (tsx->state != PJSIP_TSX_STATE_DESTROYED)
+ {
+ PJ_LOG(3,(THIS_FILE, " error: unexpected state"));
+ test_complete = -122;
+
+ }
+
+
+ } else
+ if (pj_strcmp2(&tsx->branch, TEST5_BRANCH_ID)==0) {
+ /*
+ * TEST5_BRANCH_ID tests receiving retransmissions in PROCEEDING state
+ */
+ if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
+
+ /* Check that status code is status_code. */
+ if (tsx->status_code != TEST5_STATUS_CODE) {
+ PJ_LOG(3,(THIS_FILE, " error: incorrect status code"));
+ test_complete = -130;
+ }
+
+ /* Previous state. */
+ if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_PROCEEDING) {
+ PJ_LOG(3,(THIS_FILE, " error: incorrect prev_state"));
+ test_complete = -131;
+ }
+
+ } else if (tsx->state == PJSIP_TSX_STATE_PROCEEDING) {
+
+ /* Check status code. */
+ if (tsx->status_code != TEST5_PROVISIONAL_CODE) {
+ PJ_LOG(3,(THIS_FILE, " error: incorrect status code"));
+ test_complete = -132;
+ }
+
+ } else if (tsx->state != PJSIP_TSX_STATE_DESTROYED) {
+ PJ_LOG(3,(THIS_FILE, " error: unexpected state"));
+ test_complete = -133;
+
+ }
+
+ } else
+ if (pj_strcmp2(&tsx->branch, TEST6_BRANCH_ID)==0) {
+ /*
+ * TEST6_BRANCH_ID tests receiving retransmissions in COMPLETED state
+ */
+ if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
+
+ /* Check that status code is status_code. */
+ if (tsx->status_code != TEST6_STATUS_CODE) {
+ PJ_LOG(3,(THIS_FILE, " error: incorrect status code"));
+ test_complete = -140;
+ }
+
+ /* Previous state. */
+ if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) {
+ PJ_LOG(3,(THIS_FILE, " error: incorrect prev_state"));
+ test_complete = -141;
+ }
+
+ } else if (tsx->state != PJSIP_TSX_STATE_PROCEEDING &&
+ tsx->state != PJSIP_TSX_STATE_COMPLETED &&
+ tsx->state != PJSIP_TSX_STATE_DESTROYED)
+ {
+ PJ_LOG(3,(THIS_FILE, " error: unexpected state"));
+ test_complete = -142;
+
+ }
+
+
+ } else
+ if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID)==0 ||
+ pj_strcmp2(&tsx->branch, TEST8_BRANCH_ID)==0)
+ {
+ /*
+ * TEST7_BRANCH_ID and TEST8_BRANCH_ID test retransmission of
+ * INVITE final response
+ */
+ int code;
+
+ if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID) == 0)
+ code = TEST7_STATUS_CODE;
+ else
+ code = TEST8_STATUS_CODE;
+
+ if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
+
+ if (test_complete == 0)
+ test_complete = 1;
+
+ /* Check status code. */
+ if (tsx->status_code != PJSIP_SC_TSX_TIMEOUT) {
+ PJ_LOG(3,(THIS_FILE, " error: incorrect status code"));
+ test_complete = -150;
+ }
+
+ /* Previous state. */
+ if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) {
+ PJ_LOG(3,(THIS_FILE, " error: incorrect prev_state"));
+ test_complete = -151;
+ }
+
+ } else if (tsx->state == PJSIP_TSX_STATE_COMPLETED) {
+
+ /* Check that status code is status_code. */
+ if (tsx->status_code != code) {
+ PJ_LOG(3,(THIS_FILE, " error: incorrect status code"));
+ test_complete = -152;
+ }
+
+ /* Previous state. */
+ if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_TRYING) {
+ PJ_LOG(3,(THIS_FILE, " error: incorrect prev_state"));
+ test_complete = -153;
+ }
+
+ } else if (tsx->state != PJSIP_TSX_STATE_DESTROYED) {
+
+ PJ_LOG(3,(THIS_FILE, " error: unexpected state"));
+ test_complete = -154;
+
+ }
+
}
}
@@ -344,6 +587,8 @@ static void save_key(pjsip_transaction *tsx)
pj_strcpy(&tsx_key, &key);
}
+#define DIFF(a,b) ((a<b) ? (b-a) : (a-b))
+
/*
* Message receiver handler.
*/
@@ -371,7 +616,6 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata)
* response.
*/
pjsip_transaction *tsx;
- pjsip_tx_data *tdata;
status = pjsip_tsx_create_uas(&tsx_user, rdata, &tsx);
if (status != PJ_SUCCESS) {
@@ -381,22 +625,7 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata)
}
save_key(tsx);
-
- status = pjsip_endpt_create_response(endpt, rdata,
- status_code, NULL,
- &tdata);
- if (status != PJ_SUCCESS) {
- app_perror(" error: unable to create response", status);
- test_complete = -111;
- return PJ_TRUE;
- }
-
- status = pjsip_tsx_send_msg(tsx, tdata);
- if (status != PJ_SUCCESS) {
- app_perror(" error: unable to send response", status);
- test_complete = -112;
- return PJ_TRUE;
- }
+ send_response(rdata, tsx, status_code);
} else {
/* Verify the response received. */
@@ -427,7 +656,6 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata)
* response, then schedule timer to send final response.
*/
pjsip_transaction *tsx;
- pjsip_tx_data *tdata;
status = pjsip_tsx_create_uas(&tsx_user, rdata, &tsx);
if (status != PJ_SUCCESS) {
@@ -438,22 +666,7 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata)
save_key(tsx);
- status = pjsip_endpt_create_response(endpt, rdata,
- TEST3_PROVISIONAL_CODE, NULL,
- &tdata);
- if (status != PJ_SUCCESS) {
- app_perror(" error: unable to create response", status);
- test_complete = -121;
- return PJ_TRUE;
- }
-
- status = pjsip_tsx_send_msg(tsx, tdata);
- if (status != PJ_SUCCESS) {
- app_perror(" error: unable to send response", status);
- test_complete = -122;
- return PJ_TRUE;
- }
-
+ send_response(rdata, tsx, TEST3_PROVISIONAL_CODE);
schedule_send_response(rdata, &tsx->transaction_key,
TEST3_STATUS_CODE, 2000);
@@ -482,6 +695,255 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata)
}
return PJ_TRUE;
+ } else if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0 ||
+ pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0 ||
+ pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0)
+ {
+
+ /* TEST4_BRANCH_ID: absorbs retransmissions in TRYING state. */
+ /* TEST5_BRANCH_ID: retransmit last response in PROCEEDING state. */
+ /* TEST6_BRANCH_ID: retransmit last response in COMPLETED state. */
+
+ if (msg->type == PJSIP_REQUEST_MSG) {
+ /* On received response, create UAS. */
+ pjsip_transaction *tsx;
+
+ status = pjsip_tsx_create_uas(&tsx_user, rdata, &tsx);
+ if (status != PJ_SUCCESS) {
+ app_perror(" error: unable to create transaction", status);
+ test_complete = -130;
+ return PJ_TRUE;
+ }
+
+ save_key(tsx);
+
+ if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0) {
+
+ } else if (pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0) {
+ send_response(rdata, tsx, TEST5_PROVISIONAL_CODE);
+
+ } else if (pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0) {
+ send_response(rdata, tsx, TEST6_PROVISIONAL_CODE);
+ send_response(rdata, tsx, TEST6_STATUS_CODE);
+ }
+
+ } else {
+ /* Verify the response received. */
+
+ ++recv_count;
+
+ if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0) {
+ PJ_LOG(3,(THIS_FILE, " error: not expecting response!"));
+ test_complete = -132;
+
+ } else if (pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0) {
+
+ if (rdata->msg_info.msg->line.status.code!=TEST5_PROVISIONAL_CODE) {
+ PJ_LOG(3,(THIS_FILE, " error: incorrect status code!"));
+ test_complete = -133;
+
+ }
+ if (recv_count > TEST5_RESPONSE_COUNT) {
+ PJ_LOG(3,(THIS_FILE, " error: not expecting response!"));
+ test_complete = -134;
+ }
+
+ } else if (pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0) {
+
+ int code = rdata->msg_info.msg->line.status.code;
+
+ switch (recv_count) {
+ case 1:
+ if (code != TEST6_PROVISIONAL_CODE) {
+ PJ_LOG(3,(THIS_FILE, " error: invalid code!"));
+ test_complete = -135;
+ }
+ break;
+ case 2:
+ case 3:
+ if (code != TEST6_STATUS_CODE) {
+ PJ_LOG(3,(THIS_FILE, " error: invalid code!"));
+ test_complete = -136;
+ }
+ break;
+ default:
+ PJ_LOG(3,(THIS_FILE, " error: not expecting response"));
+ test_complete = -137;
+ break;
+ }
+ }
+ }
+ return PJ_TRUE;
+
+
+ } else if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0 ||
+ pj_strcmp2(&branch_param, TEST8_BRANCH_ID) == 0)
+ {
+
+ /*
+ * TEST7_BRANCH_ID and TEST8_BRANCH_ID test the retransmission
+ * of INVITE final response
+ */
+ if (msg->type == PJSIP_REQUEST_MSG) {
+
+ /* On received response, create UAS. */
+ pjsip_transaction *tsx;
+
+ status = pjsip_tsx_create_uas(&tsx_user, rdata, &tsx);
+ if (status != PJ_SUCCESS) {
+ app_perror(" error: unable to create transaction", status);
+ test_complete = -140;
+ return PJ_TRUE;
+ }
+
+ save_key(tsx);
+
+ if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0) {
+
+ send_response(rdata, tsx, TEST7_STATUS_CODE);
+
+ } else {
+
+ send_response(rdata, tsx, TEST8_STATUS_CODE);
+
+ }
+
+ } else {
+ int code;
+
+ ++recv_count;
+
+ if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0)
+ code = TEST7_STATUS_CODE;
+ else
+ code = TEST8_STATUS_CODE;
+
+ if (recv_count==1) {
+
+ if (rdata->msg_info.msg->line.status.code != code) {
+ PJ_LOG(3,(THIS_FILE," error: invalid status code"));
+ test_complete = -141;
+ }
+
+ recv_last = rdata->pkt_info.timestamp;
+
+ } else {
+
+ pj_time_val now;
+ unsigned msec, msec_expected;
+
+ now = rdata->pkt_info.timestamp;
+
+ PJ_TIME_VAL_SUB(now, recv_last);
+
+ msec = now.sec*1000 + now.msec;
+ msec_expected = (1 << (recv_count-2)) * PJSIP_T1_TIMEOUT;
+ if (msec_expected > PJSIP_T2_TIMEOUT)
+ msec_expected = PJSIP_T2_TIMEOUT;
+
+ if (DIFF(msec, msec_expected) > MAX_ALLOWED_DIFF) {
+ PJ_LOG(3,(THIS_FILE,
+ " error: incorrect retransmission "
+ "time (%d ms expected, %d ms received",
+ msec_expected, msec));
+ test_complete = -142;
+ }
+
+ if (recv_count > 11) {
+ PJ_LOG(3,(THIS_FILE," error: too many responses (%d)",
+ recv_count));
+ test_complete = -143;
+ }
+
+ recv_last = rdata->pkt_info.timestamp;
+ }
+
+ }
+ return PJ_TRUE;
+
+ } else if (pj_strcmp2(&branch_param, TEST9_BRANCH_ID)) {
+
+ /*
+ * TEST9_BRANCH_ID tests that the retransmission of INVITE final
+ * response should cease when ACK is received. Transaction also MUST
+ * terminate in T4 seconds.
+ */
+ if (msg->type == PJSIP_REQUEST_MSG) {
+
+ /* On received response, create UAS. */
+ pjsip_transaction *tsx;
+
+ status = pjsip_tsx_create_uas(&tsx_user, rdata, &tsx);
+ if (status != PJ_SUCCESS) {
+ app_perror(" error: unable to create transaction", status);
+ test_complete = -140;
+ return PJ_TRUE;
+ }
+
+ save_key(tsx);
+
+ if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0) {
+
+ send_response(rdata, tsx, TEST7_STATUS_CODE);
+
+ } else {
+
+ send_response(rdata, tsx, TEST8_STATUS_CODE);
+
+ }
+
+ } else {
+ int code;
+
+ ++recv_count;
+
+ if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0)
+ code = TEST7_STATUS_CODE;
+ else
+ code = TEST8_STATUS_CODE;
+
+ if (recv_count==1) {
+
+ if (rdata->msg_info.msg->line.status.code != code) {
+ PJ_LOG(3,(THIS_FILE," error: invalid status code"));
+ test_complete = -141;
+ }
+
+ recv_last = rdata->pkt_info.timestamp;
+
+ } else {
+
+ pj_time_val now;
+ unsigned msec, msec_expected;
+
+ now = rdata->pkt_info.timestamp;
+
+ PJ_TIME_VAL_SUB(now, recv_last);
+
+ msec = now.sec*1000 + now.msec;
+ msec_expected = (1 << (recv_count-2)) * PJSIP_T1_TIMEOUT;
+ if (msec_expected > PJSIP_T2_TIMEOUT)
+ msec_expected = PJSIP_T2_TIMEOUT;
+
+ if (DIFF(msec, msec_expected) > MAX_ALLOWED_DIFF) {
+ PJ_LOG(3,(THIS_FILE,
+ " error: incorrect retransmission "
+ "time (%d ms expected, %d ms received",
+ msec_expected, msec));
+ test_complete = -142;
+ }
+
+ if (recv_count > 11) {
+ PJ_LOG(3,(THIS_FILE," error: too many responses (%d)",
+ recv_count));
+ test_complete = -143;
+ }
+
+ recv_last = rdata->pkt_info.timestamp;
+ }
+
+ }
+ return PJ_TRUE;
}
return PJ_FALSE;
@@ -492,12 +954,15 @@ static pj_bool_t on_rx_message(pjsip_rx_data *rdata)
*/
static int perform_test( char *target_uri, char *from_uri,
char *branch_param, int test_time,
- const pjsip_method *method )
+ const pjsip_method *method,
+ int request_cnt, int request_interval_msec,
+ int expecting_timeout)
{
pjsip_tx_data *tdata;
pj_str_t target, from;
pjsip_via_hdr *via;
- pj_time_val timeout;
+ pj_time_val timeout, next_send;
+ int sent_cnt;
pj_status_t status;
PJ_LOG(3,(THIS_FILE,
@@ -526,17 +991,10 @@ static int perform_test( char *target_uri, char *from_uri,
via = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
via->branch_param = pj_str(branch_param);
- /* Add additional reference to tdata to prevent transaction from
- * deleting it.
- */
- pjsip_tx_data_add_ref(tdata);
-
- /* Send the first message. */
- status = pjsip_endpt_send_request_stateless(endpt, tdata, NULL, NULL);
- if (status != PJ_SUCCESS) {
- app_perror(" Error: unable to send request", status);
- return -20;
- }
+ /* Schedule first send. */
+ sent_cnt = 0;
+ pj_gettimeofday(&next_send);
+ pj_time_val_normalize(&next_send);
/* Set test completion time. */
pj_gettimeofday(&timeout);
@@ -549,10 +1007,35 @@ static int perform_test( char *target_uri, char *from_uri,
pjsip_endpt_handle_events(endpt, &poll_delay);
pj_gettimeofday(&now);
+
+ if (sent_cnt < request_cnt && PJ_TIME_VAL_GTE(now, next_send)) {
+ /* Add additional reference to tdata to prevent transaction from
+ * deleting it.
+ */
+ pjsip_tx_data_add_ref(tdata);
+
+ /* (Re)Send the request. */
+ status = pjsip_endpt_send_request_stateless(endpt, tdata, 0, 0);
+ if (status != PJ_SUCCESS) {
+ app_perror(" Error: unable to send request", status);
+ pjsip_tx_data_dec_ref(tdata);
+ return -20;
+ }
+
+ /* Schedule next send, if any. */
+ sent_cnt++;
+ if (sent_cnt < request_cnt) {
+ pj_gettimeofday(&next_send);
+ next_send.msec += request_interval_msec;
+ pj_time_val_normalize(&next_send);
+ }
+ }
+
if (now.sec > timeout.sec) {
- PJ_LOG(3,(THIS_FILE, " Error: test has timed out"));
+ if (!expecting_timeout)
+ PJ_LOG(3,(THIS_FILE, " Error: test has timed out"));
pjsip_tx_data_dec_ref(tdata);
- return -30;
+ return TEST_TIMEOUT_ERROR;
}
}
@@ -612,7 +1095,7 @@ static int tsx_basic_final_response_test(void)
"sip:129.0.0.1;transport=loop-dgram",
TEST1_BRANCH_ID,
33, /* Test duration must be greater than 32 secs */
- &pjsip_options_method);
+ &pjsip_options_method, 1, 0, 0);
if (status != 0)
return status;
@@ -622,7 +1105,7 @@ static int tsx_basic_final_response_test(void)
"sip:129.0.0.1;transport=loop-dgram",
TEST2_BRANCH_ID,
33, /* Test duration must be greater than 32 secs */
- &pjsip_options_method);
+ &pjsip_options_method, 1, 0, 0);
if (status != 0)
return status;
@@ -646,13 +1129,92 @@ static int tsx_basic_provisional_response_test(void)
"sip:129.0.0.1;transport=loop-dgram",
TEST3_BRANCH_ID,
35,
- &pjsip_options_method);
+ &pjsip_options_method, 1, 0, 0);
+
return status;
}
/*****************************************************************************
**
+ ** TEST4_BRANCH_ID: Absorbs retransmissions in TRYING state
+ ** TEST5_BRANCH_ID: Absorbs retransmissions in PROCEEDING state
+ ** TEST6_BRANCH_ID: Absorbs retransmissions in COMPLETED state
+ **
+ *****************************************************************************
+ */
+static int tsx_retransmit_last_response_test(const char *title,
+ char *branch_id,
+ int request_cnt,
+ int status_code)
+{
+ int status;
+
+ PJ_LOG(3,(THIS_FILE," %s", title));
+
+ status = perform_test("sip:129.0.0.1;transport=loop-dgram",
+ "sip:129.0.0.1;transport=loop-dgram",
+ branch_id,
+ 5,
+ &pjsip_options_method,
+ request_cnt, 1000, 1);
+ if (status && status != TEST_TIMEOUT_ERROR)
+ return status;
+ if (!status) {
+ PJ_LOG(3,(THIS_FILE, " error: expecting timeout"));
+ return -31;
+ }
+
+ terminate_our_tsx(status_code);
+ flush_events(100);
+
+ if (test_complete != 1)
+ return test_complete;
+
+ flush_events(100);
+ return 0;
+}
+
+/*****************************************************************************
+ **
+ ** TEST7_BRANCH_ID: INVITE non-2xx final response retransmission test
+ ** TEST8_BRANCH_ID: INVITE 2xx final response retransmission test
+ **
+ *****************************************************************************
+ */
+static int tsx_final_response_retransmission_test(void)
+{
+ int status;
+
+ PJ_LOG(3,(THIS_FILE,
+ " test7: INVITE non-2xx final response retransmission"));
+
+ status = perform_test("sip:129.0.0.1;transport=loop-dgram",
+ "sip:129.0.0.1;transport=loop-dgram",
+ TEST7_BRANCH_ID,
+ 33, /* Test duration must be greater than 32 secs */
+ &pjsip_invite_method, 1, 0, 0);
+ if (status != 0)
+ return status;
+
+ PJ_LOG(3,(THIS_FILE,
+ " test8: INVITE 2xx final response retransmission"));
+
+ status = perform_test("sip:129.0.0.1;transport=loop-dgram",
+ "sip:129.0.0.1;transport=loop-dgram",
+ TEST8_BRANCH_ID,
+ 33, /* Test duration must be greater than 32 secs */
+ &pjsip_invite_method, 1, 0, 0);
+ if (status != 0)
+ return status;
+
+ return 0;
+}
+
+
+
+/*****************************************************************************
+ **
** UAS Transaction Test.
**
*****************************************************************************
@@ -689,7 +1251,6 @@ int tsx_uas_test(void)
status = tsx_basic_final_response_test();
if (status != 0)
return status;
-#endif
/* TEST3_BRANCH_ID: with provisional response
*/
@@ -697,6 +1258,42 @@ int tsx_uas_test(void)
if (status != 0)
return status;
+ /* TEST4_BRANCH_ID: absorbs retransmissions in TRYING state
+ */
+ status = tsx_retransmit_last_response_test(TEST4_TITLE,
+ TEST4_BRANCH_ID,
+ TEST4_REQUEST_COUNT,
+ TEST4_STATUS_CODE);
+ if (status != 0)
+ return status;
+
+ /* TEST5_BRANCH_ID: retransmit last response in PROCEEDING state
+ */
+ status = tsx_retransmit_last_response_test(TEST5_TITLE,
+ TEST5_BRANCH_ID,
+ TEST5_REQUEST_COUNT,
+ TEST5_STATUS_CODE);
+ if (status != 0)
+ return status;
+
+ /* TEST6_BRANCH_ID: retransmit last response in PROCEEDING state
+ */
+ status = tsx_retransmit_last_response_test(TEST6_TITLE,
+ TEST6_BRANCH_ID,
+ TEST6_REQUEST_COUNT,
+ TEST6_STATUS_CODE);
+ if (status != 0)
+ return status;
+
+ /* TEST7_BRANCH_ID: INVITE non-2xx final response retransmission test
+ * TEST8_BRANCH_ID: INVITE 2xx final response retransmission test
+ */
+
+ status = tsx_final_response_retransmission_test();
+ if (status != 0)
+ return status;
+
+#endif
pjsip_transport_dec_ref(loop);
return 0;
diff --git a/pjsip/src/test-pjsip/txdata_test.c b/pjsip/src/test-pjsip/txdata_test.c
index b740c6fe..def46b5a 100644
--- a/pjsip/src/test-pjsip/txdata_test.c
+++ b/pjsip/src/test-pjsip/txdata_test.c
@@ -29,13 +29,15 @@
/*
* This tests various core message creation functions.
*/
-int txdata_test(void)
+static int core_txdata_test(void)
{
pj_status_t status;
pj_str_t target, from, to, contact, body;
pjsip_rx_data dummy_rdata;
pjsip_tx_data *invite, *invite2, *cancel, *response, *ack;
+ PJ_LOG(3,(THIS_FILE, " core transmit data test"));
+
/* Create INVITE request. */
target = pj_str("tel:+1");
from = pj_str("tel:+0");
@@ -321,3 +323,207 @@ int txdata_test(void)
return 0;
}
+/* This tests the request creating functions against the following
+ * requirements:
+ * - header params in URI creates header in the request.
+ * - method and headers params are correctly shown or hidden in
+ * request URI, From, To, and Contact header.
+ */
+static int txdata_test_uri_params(void)
+{
+ char msgbuf[512];
+ pj_str_t target = pj_str("sip:alice@wonderland:5061;x-param=param%201"
+ "?X-Hdr-1=Header%201"
+ "&X-Empty-Hdr=");
+ pj_str_t pname = pj_str("x-param");
+ pj_str_t hname = pj_str("X-Hdr-1");
+ pj_str_t hemptyname = pj_str("X-Empty-Hdr");
+ pjsip_from_hdr *from_hdr;
+ pjsip_to_hdr *to_hdr;
+ pjsip_contact_hdr *contact_hdr;
+ pjsip_generic_string_hdr *hdr;
+ pjsip_tx_data *tdata;
+ pjsip_sip_uri *uri;
+ pjsip_param *param;
+ pjsip_msg *msg;
+ int len;
+ pj_status_t status;
+
+ PJ_LOG(3,(THIS_FILE, " header param in URI to create request"));
+
+ /* Create request with header param in target URI. */
+ status = pjsip_endpt_create_request(endpt, &pjsip_invite_method, &target,
+ &target, &target, &target, NULL, -1,
+ NULL, &tdata);
+ if (status != 0) {
+ app_perror(" error: Unable to create request", status);
+ return -200;
+ }
+
+ /* Print and parse the request.
+ * We'll check that header params are not present in
+ */
+ len = pjsip_msg_print(tdata->msg, msgbuf, sizeof(msgbuf));
+ if (len < 1) {
+ PJ_LOG(3,(THIS_FILE, " error: printing message"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -250;
+ }
+ msgbuf[len] = '\0';
+
+ PJ_LOG(5,(THIS_FILE, "%d bytes request created:--begin-msg--\n"
+ "%s\n"
+ "--end-msg--", len, msgbuf));
+
+ /* Now parse the message. */
+ msg = pjsip_parse_msg( tdata->pool, msgbuf, len, NULL);
+ if (msg == NULL) {
+ app_perror(" error: parsing message message", status);
+ pjsip_tx_data_dec_ref(tdata);
+ return -250;
+ }
+
+ /* Check the existence of port, other_param, and header param.
+ * Port is now allowed in To and From header.
+ */
+ /* Port in request URI. */
+ uri = (pjsip_sip_uri*) pjsip_uri_get_uri(msg->line.req.uri);
+ if (uri->port != 5061) {
+ PJ_LOG(3,(THIS_FILE, " error: port not present in request URI"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -260;
+ }
+ /* other_param in request_uri */
+ param = pjsip_param_find(&uri->other_param, &pname);
+ if (param == NULL || pj_strcmp2(&param->value, "param 1") != 0) {
+ PJ_LOG(3,(THIS_FILE, " error: x-param not present in request URI"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -261;
+ }
+ /* header param in request uri. */
+ if (!pj_list_empty(&uri->header_param)) {
+ PJ_LOG(3,(THIS_FILE, " error: hparam in request URI"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -262;
+ }
+
+ /* Port in From header. */
+ from_hdr = (pjsip_from_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_FROM, NULL);
+ uri = (pjsip_sip_uri*) pjsip_uri_get_uri(from_hdr->uri);
+ if (uri->port != 0) {
+ PJ_LOG(3,(THIS_FILE, " error: port most not exist in From header"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -270;
+ }
+ /* other_param in From header */
+ param = pjsip_param_find(&uri->other_param, &pname);
+ if (param == NULL || pj_strcmp2(&param->value, "param 1") != 0) {
+ PJ_LOG(3,(THIS_FILE, " error: x-param not present in From header"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -271;
+ }
+ /* header param in From header. */
+ if (!pj_list_empty(&uri->header_param)) {
+ PJ_LOG(3,(THIS_FILE, " error: hparam in From header"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -272;
+ }
+
+
+ /* Port in To header. */
+ to_hdr = (pjsip_to_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_TO, NULL);
+ uri = (pjsip_sip_uri*) pjsip_uri_get_uri(to_hdr->uri);
+ if (uri->port != 0) {
+ PJ_LOG(3,(THIS_FILE, " error: port most not exist in To header"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -280;
+ }
+ /* other_param in To header */
+ param = pjsip_param_find(&uri->other_param, &pname);
+ if (param == NULL || pj_strcmp2(&param->value, "param 1") != 0) {
+ PJ_LOG(3,(THIS_FILE, " error: x-param not present in To header"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -281;
+ }
+ /* header param in From header. */
+ if (!pj_list_empty(&uri->header_param)) {
+ PJ_LOG(3,(THIS_FILE, " error: hparam in To header"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -282;
+ }
+
+
+
+ /* Port in Contact header. */
+ contact_hdr = (pjsip_contact_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_CONTACT, NULL);
+ uri = (pjsip_sip_uri*) pjsip_uri_get_uri(contact_hdr->uri);
+ if (uri->port != 5061) {
+ PJ_LOG(3,(THIS_FILE, " error: port not present in Contact header"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -290;
+ }
+ /* other_param in Contact header */
+ param = pjsip_param_find(&uri->other_param, &pname);
+ if (param == NULL || pj_strcmp2(&param->value, "param 1") != 0) {
+ PJ_LOG(3,(THIS_FILE, " error: x-param not present in Contact header"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -291;
+ }
+ /* header param in Contact header. */
+ if (pj_list_empty(&uri->header_param)) {
+ PJ_LOG(3,(THIS_FILE, " error: hparam is missing in Contact header"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -292;
+ }
+ /* Check for X-Hdr-1 */
+ param = pjsip_param_find(&uri->header_param, &hname);
+ if (param == NULL || pj_strcmp2(&param->value, "Header 1")!=0) {
+ PJ_LOG(3,(THIS_FILE, " error: hparam is missing in Contact header"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -293;
+ }
+ /* Check for X-Empty-Hdr */
+ param = pjsip_param_find(&uri->header_param, &hemptyname);
+ if (param == NULL || pj_strcmp2(&param->value, "")!=0) {
+ PJ_LOG(3,(THIS_FILE, " error: hparam is missing in Contact header"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -294;
+ }
+
+
+ /* Check that headers are present in the request. */
+ hdr = (pjsip_generic_string_hdr*)
+ pjsip_msg_find_hdr_by_name(msg, &hname, NULL);
+ if (hdr == NULL || pj_strcmp2(&hdr->hvalue, "Header 1")!=0) {
+ PJ_LOG(3,(THIS_FILE, " error: header X-Hdr-1 not created"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -300;
+ }
+
+ hdr = (pjsip_generic_string_hdr*)
+ pjsip_msg_find_hdr_by_name(msg, &hemptyname, NULL);
+ if (hdr == NULL || pj_strcmp2(&param->value, "")!=0) {
+ PJ_LOG(3,(THIS_FILE, " error: header X-Empty-Hdr not created"));
+ pjsip_tx_data_dec_ref(tdata);
+ return -330;
+ }
+
+ pjsip_tx_data_dec_ref(tdata);
+ return 0;
+}
+
+int txdata_test(void)
+{
+ int status;
+
+ status = core_txdata_test();
+ if (status != 0)
+ return status;
+
+
+ status = txdata_test_uri_params();
+ if (status != 0)
+ return status;
+
+ return 0;
+}
diff --git a/pjsip/src/test-pjsip/uri_test.c b/pjsip/src/test-pjsip/uri_test.c
index 46edd66a..28bdedd9 100644
--- a/pjsip/src/test-pjsip/uri_test.c
+++ b/pjsip/src/test-pjsip/uri_test.c
@@ -317,7 +317,7 @@ struct uri_test
static pjsip_uri *create_uri0(pj_pool_t *pool)
{
/* "sip:localhost" */
- pjsip_url *url = pjsip_url_create(pool, 0);
+ pjsip_sip_uri *url = pjsip_url_create(pool, 0);
pj_strdup2(pool, &url->host, "localhost");
return (pjsip_uri*)url;
@@ -326,7 +326,7 @@ static pjsip_uri *create_uri0(pj_pool_t *pool)
static pjsip_uri *create_uri1(pj_pool_t *pool)
{
/* "sip:user@localhost" */
- pjsip_url *url = pjsip_url_create(pool, 0);
+ pjsip_sip_uri *url = pjsip_url_create(pool, 0);
pj_strdup2( pool, &url->user, "user");
pj_strdup2( pool, &url->host, "localhost");
@@ -337,7 +337,7 @@ static pjsip_uri *create_uri1(pj_pool_t *pool)
static pjsip_uri *create_uri2(pj_pool_t *pool)
{
/* "sip:user:password@localhost:5060" */
- pjsip_url *url = pjsip_url_create(pool, 0);
+ pjsip_sip_uri *url = pjsip_url_create(pool, 0);
pj_strdup2( pool, &url->user, "user");
pj_strdup2( pool, &url->passwd, "password");
@@ -350,7 +350,7 @@ static pjsip_uri *create_uri2(pj_pool_t *pool)
static pjsip_uri *create_uri3(pj_pool_t *pool)
{
/* Like: "sip:localhost:5060", but without the port. */
- pjsip_url *url = pjsip_url_create(pool, 0);
+ pjsip_sip_uri *url = pjsip_url_create(pool, 0);
pj_strdup2(pool, &url->host, "localhost");
return (pjsip_uri*)url;
@@ -359,7 +359,7 @@ static pjsip_uri *create_uri3(pj_pool_t *pool)
static pjsip_uri *create_uri4(pj_pool_t *pool)
{
/* "sip:localhost;transport=tcp;user=ip;ttl=255;lr;maddr=127.0.0.1;method=ACK" */
- pjsip_url *url = pjsip_url_create(pool, 0);
+ pjsip_sip_uri *url = pjsip_url_create(pool, 0);
pj_strdup2(pool, &url->host, "localhost");
pj_strdup2(pool, &url->transport_param, "tcp");
@@ -386,7 +386,7 @@ static pjsip_uri *create_uri5(pj_pool_t *pool)
/* "sip:localhost;pickup=hurry;user=phone;message=I%20am%20sorry"
"?Subject=Hello%20There&Server=SIP%20Server"
*/
- pjsip_url *url = pjsip_url_create(pool, 0);
+ pjsip_sip_uri *url = pjsip_url_create(pool, 0);
pj_strdup2(pool, &url->host, "localhost");
pj_strdup2(pool, &url->user_param, "phone");
@@ -405,7 +405,7 @@ static pjsip_uri *create_uri5(pj_pool_t *pool)
static pjsip_uri *create_uri6(pj_pool_t *pool)
{
/* "sips:localhost" */
- pjsip_url *url = pjsip_url_create(pool, 1);
+ pjsip_sip_uri *url = pjsip_url_create(pool, 1);
pj_strdup2(pool, &url->host, "localhost");
return (pjsip_uri*)url;
@@ -415,7 +415,7 @@ static pjsip_uri *create_uri7(pj_pool_t *pool)
{
/* "<sip:localhost>" */
pjsip_name_addr *name_addr = pjsip_name_addr_create(pool);
- pjsip_url *url;
+ pjsip_sip_uri *url;
url = pjsip_url_create(pool, 0);
name_addr->uri = (pjsip_uri*) url;
@@ -428,7 +428,7 @@ static pjsip_uri *create_uri8(pj_pool_t *pool)
{
/* " Power Administrator <sips:localhost>" */
pjsip_name_addr *name_addr = pjsip_name_addr_create(pool);
- pjsip_url *url;
+ pjsip_sip_uri *url;
url = pjsip_url_create(pool, 1);
name_addr->uri = (pjsip_uri*) url;
@@ -442,7 +442,7 @@ static pjsip_uri *create_uri9(pj_pool_t *pool)
{
/* " \"User\" <sip:user@localhost:5071>" */
pjsip_name_addr *name_addr = pjsip_name_addr_create(pool);
- pjsip_url *url;
+ pjsip_sip_uri *url;
url = pjsip_url_create(pool, 0);
name_addr->uri = (pjsip_uri*) url;
@@ -458,7 +458,7 @@ static pjsip_uri *create_uri10(pj_pool_t *pool)
{
/* " \"Strange User\\\"\\\\\\\"\" <sip:localhost>" */
pjsip_name_addr *name_addr = pjsip_name_addr_create(pool);
- pjsip_url *url;
+ pjsip_sip_uri *url;
url = pjsip_url_create(pool, 0);
name_addr->uri = (pjsip_uri*) url;
@@ -472,7 +472,7 @@ static pjsip_uri *create_uri11(pj_pool_t *pool)
{
/* " \"Rogue User\\\" <sip:localhost>" */
pjsip_name_addr *name_addr = pjsip_name_addr_create(pool);
- pjsip_url *url;
+ pjsip_sip_uri *url;
url = pjsip_url_create(pool, 0);
name_addr->uri = (pjsip_uri*) url;
@@ -486,7 +486,7 @@ static pjsip_uri *create_uri12(pj_pool_t *pool)
{
/* "Strange User\" <sip:localhost>" */
pjsip_name_addr *name_addr = pjsip_name_addr_create(pool);
- pjsip_url *url;
+ pjsip_sip_uri *url;
url = pjsip_url_create(pool, 0);
name_addr->uri = (pjsip_uri*) url;
@@ -499,7 +499,7 @@ static pjsip_uri *create_uri12(pj_pool_t *pool)
static pjsip_uri *create_uri13(pj_pool_t *pool)
{
/* "sip:localhost;pvalue=\"hello world\"" */
- pjsip_url *url;
+ pjsip_sip_uri *url;
url = pjsip_url_create(pool, 0);
pj_strdup2(pool, &url->host, "localhost");
//pj_strdup2(pool, &url->other_param, ";pvalue=\"hello world\"");
@@ -511,7 +511,7 @@ static pjsip_uri *create_uri14(pj_pool_t *pool)
{
/* "This is -. !% *_+`'~ me <sip:a19A&=+$,;?/%2c:%40a&Zz=+$,@my_proxy09.my-domain.com:9801>" */
pjsip_name_addr *name_addr = pjsip_name_addr_create(pool);
- pjsip_url *url;
+ pjsip_sip_uri *url;
url = pjsip_url_create(pool, 0);
name_addr->uri = (pjsip_uri*) url;
@@ -527,7 +527,7 @@ static pjsip_uri *create_uri14(pj_pool_t *pool)
static pjsip_uri *create_uri15(pj_pool_t *pool)
{
/* "sip:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.com" */
- pjsip_url *url;
+ pjsip_sip_uri *url;
url = pjsip_url_create(pool, 0);
pj_strdup2(pool, &url->host, ALPHANUM "-_.com");
return (pjsip_uri*)url;
@@ -536,7 +536,7 @@ static pjsip_uri *create_uri15(pj_pool_t *pool)
static pjsip_uri *create_uri16(pj_pool_t *pool)
{
/* "sip:" USER_CHAR ":" PASS_CHAR "@host" */
- pjsip_url *url;
+ pjsip_sip_uri *url;
url = pjsip_url_create(pool, 0);
pj_strdup2(pool, &url->user, USER_CHAR);
pj_strdup2(pool, &url->passwd, PASS_CHAR);
@@ -547,7 +547,7 @@ static pjsip_uri *create_uri16(pj_pool_t *pool)
static pjsip_uri *create_uri17(pj_pool_t *pool)
{
/* "sip:host;user=ip;" PARAM_CHAR "%21=" PARAM_CHAR "%21;lr;other=1;transport=sctp;other2" */
- pjsip_url *url;
+ pjsip_sip_uri *url;
url = pjsip_url_create(pool, 0);
pj_strdup2(pool, &url->host, "host");
pj_strdup2(pool, &url->user_param, "ip");