summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-10-04 06:17:58 +0000
committerBenny Prijono <bennylp@teluu.com>2007-10-04 06:17:58 +0000
commit3e7fd859b0c02776768f4ef1649a06929918fbe3 (patch)
tree99ba7c1dd303c14d13e5df827b938ddd9cdaddad /pjsip
parent1223bb18330914b87f16734b7cb576d34e6b011f (diff)
Ticket #389: Added new commands in pjsua to change codec priorities and send UPDATE
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1471 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h13
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c64
2 files changed, 77 insertions, 0 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 4422b0ea..b727528b 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -2765,6 +2765,19 @@ PJ_DECL(pj_status_t) pjsua_call_reinvite(pjsua_call_id call_id,
pj_bool_t unhold,
const pjsua_msg_data *msg_data);
+/**
+ * Send UPDATE request.
+ *
+ * @param call_id Call identification.
+ * @param options Must be zero for now.
+ * @param msg_data Optional message components to be sent with
+ * the request.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsua_call_update(pjsua_call_id call_id,
+ unsigned options,
+ const pjsua_msg_data *msg_data);
/**
* Initiate call transfer to the specified address. This function will send
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index ac5db1dd..e737c25b 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -1282,6 +1282,70 @@ PJ_DEF(pj_status_t) pjsua_call_reinvite( pjsua_call_id call_id,
/*
+ * Send UPDATE request.
+ */
+PJ_DEF(pj_status_t) pjsua_call_update( pjsua_call_id call_id,
+ unsigned options,
+ const pjsua_msg_data *msg_data)
+{
+ pjmedia_sdp_session *sdp;
+ pjsip_tx_data *tdata;
+ pjsua_call *call;
+ pjsip_dialog *dlg;
+ pj_status_t status;
+
+ PJ_UNUSED_ARG(options);
+
+ PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls,
+ PJ_EINVAL);
+
+ status = acquire_call("pjsua_call_update()", call_id, &call, &dlg);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ /* Init media channel */
+ status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Error initializing media channel", status);
+ pjsip_dlg_dec_lock(dlg);
+ return PJSIP_ESESSIONSTATE;
+ }
+
+ /* Create SDP */
+ status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, &sdp);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Unable to get SDP from media endpoint",
+ status);
+ pjsip_dlg_dec_lock(dlg);
+ return status;
+ }
+
+ /* Create re-INVITE with new offer */
+ status = pjsip_inv_update(call->inv, NULL, sdp, &tdata);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Unable to create UPDATE request", status);
+ pjsip_dlg_dec_lock(dlg);
+ return status;
+ }
+
+ /* Add additional headers etc */
+ pjsua_process_msg_data( tdata, msg_data);
+
+ /* Send the request */
+ status = pjsip_inv_send_msg( call->inv, tdata);
+ if (status != PJ_SUCCESS) {
+ pjsua_perror(THIS_FILE, "Unable to send UPDAT Erequest", status);
+ pjsip_dlg_dec_lock(dlg);
+ return status;
+ }
+
+ pjsip_dlg_dec_lock(dlg);
+
+ return PJ_SUCCESS;
+}
+
+
+/*
* Initiate call transfer to the specified address.
*/
PJ_DEF(pj_status_t) pjsua_call_xfer( pjsua_call_id call_id,