summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsua-lib
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-09-30 16:50:27 +0000
committerBenny Prijono <bennylp@teluu.com>2007-09-30 16:50:27 +0000
commit5d3a328ea04cec823e59e3847f4a469184e35e43 (patch)
treee8aba103ac9914cfa217c97209ed57f104df7361 /pjsip/src/pjsua-lib
parent96f10a3a4be5a266b18cb8993eef0ba54eb29ea5 (diff)
Ticket #385: Support for reliable provisional response (100rel, PRACK)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1463 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c32
-rw-r--r--pjsip/src/pjsua-lib/pjsua_core.c6
2 files changed, 25 insertions, 13 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index c5d27342..22a11053 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -220,9 +220,6 @@ PJ_DEF(pj_status_t) pjsua_call_make_call( pjsua_acc_id acc_id,
PJ_ASSERT_RETURN(acc_id>=0 || acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc),
PJ_EINVAL);
- /* Options must be zero for now */
- PJ_ASSERT_RETURN(options == 0, PJ_EINVAL);
-
/* Check arguments */
PJ_ASSERT_RETURN(dest_uri, PJ_EINVAL);
@@ -322,8 +319,13 @@ PJ_DEF(pj_status_t) pjsua_call_make_call( pjsua_acc_id acc_id,
}
/* Create the INVITE session: */
+#if PJSIP_HAS_100REL
+ options |= PJSIP_INV_SUPPORT_100REL;
+#endif
+ if (acc->cfg.require_100rel)
+ options |= PJSIP_INV_REQUIRE_100REL;
- status = pjsip_inv_create_uac( dlg, offer, 0, &inv);
+ status = pjsip_inv_create_uac( dlg, offer, options, &inv);
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Invite session creation failed", status);
goto on_error;
@@ -557,8 +559,20 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
return PJ_TRUE;
}
+ /*
+ * Get which account is most likely to be associated with this incoming
+ * call. We need the account to find which contact URI to put for
+ * the call.
+ */
+ acc_id = call->acc_id = pjsua_acc_find_for_incoming(rdata);
/* Verify that we can handle the request. */
+#if PJSIP_HAS_100REL
+ options |= PJSIP_INV_SUPPORT_100REL;
+#endif
+ if (pjsua_var.acc[acc_id].cfg.require_100rel)
+ options |= PJSIP_INV_REQUIRE_100REL;
+
status = pjsip_inv_verify_request(rdata, &options, answer, NULL,
pjsua_var.endpt, &response);
if (status != PJ_SUCCESS) {
@@ -566,7 +580,6 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
/*
* No we can't handle the incoming INVITE request.
*/
-
if (response) {
pjsip_response_addr res_addr;
@@ -587,13 +600,6 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
}
- /*
- * Get which account is most likely to be associated with this incoming
- * call. We need the account to find which contact URI to put for
- * the call.
- */
- acc_id = call->acc_id = pjsua_acc_find_for_incoming(rdata);
-
/* Get suitable Contact header */
status = pjsua_acc_create_uas_contact(rdata->tp_info.pool, &contact,
acc_id, rdata);
@@ -625,7 +631,7 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
}
/* Create invite session: */
- status = pjsip_inv_create_uas( dlg, rdata, answer, 0, &inv);
+ status = pjsip_inv_create_uas( dlg, rdata, answer, options, &inv);
if (status != PJ_SUCCESS) {
pjsip_hdr hdr_list;
pjsip_warning_hdr *w;
diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c
index 3b512666..8c2b3b56 100644
--- a/pjsip/src/pjsua-lib/pjsua_core.c
+++ b/pjsip/src/pjsua-lib/pjsua_core.c
@@ -141,6 +141,7 @@ PJ_DEF(void) pjsua_acc_config_default(pjsua_acc_config *cfg)
cfg->reg_timeout = PJSUA_REG_INTERVAL;
cfg->transport_id = PJSUA_INVALID_ID;
cfg->auto_update_nat = PJ_TRUE;
+ cfg->require_100rel = pjsua_var.ua_cfg.require_100rel;
}
PJ_DEF(void) pjsua_buddy_config_default(pjsua_buddy_config *cfg)
@@ -648,6 +649,11 @@ PJ_DEF(pj_status_t) pjsua_init( const pjsua_config *ua_cfg,
status = pjsip_replaces_init_module( pjsua_var.endpt );
PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
+#if PJSIP_HAS_100REL
+ /* Initialize 100rel support */
+ status = pjsip_100rel_init_module(pjsua_var.endpt);
+ PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
+#endif
/* Initialize and register PJSUA application module. */
{