summaryrefslogtreecommitdiff
path: root/pjsip/include
diff options
context:
space:
mode:
Diffstat (limited to 'pjsip/include')
-rw-r--r--pjsip/include/pjsip/sip_msg.h13
-rw-r--r--pjsip/include/pjsip/sip_util.h50
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h19
3 files changed, 70 insertions, 12 deletions
diff --git a/pjsip/include/pjsip/sip_msg.h b/pjsip/include/pjsip/sip_msg.h
index 6c7b0201..7a303521 100644
--- a/pjsip/include/pjsip/sip_msg.h
+++ b/pjsip/include/pjsip/sip_msg.h
@@ -710,6 +710,19 @@ struct pjsip_msg
*/
PJ_DECL(pjsip_msg*) pjsip_msg_create( pj_pool_t *pool, pjsip_msg_type_e type);
+
+/**
+ * Perform a deep clone of a SIP message.
+ *
+ * @param pool The pool for creating the new message.
+ * @param msg The message to be duplicated.
+ *
+ * @return New message, which is duplicated from the original
+ * message.
+ */
+PJ_DECL(pjsip_msg*) pjsip_msg_clone( pj_pool_t *pool, const pjsip_msg *msg);
+
+
/**
* Find a header in the message by the header type.
*
diff --git a/pjsip/include/pjsip/sip_util.h b/pjsip/include/pjsip/sip_util.h
index 4d19d306..62fb847c 100644
--- a/pjsip/include/pjsip/sip_util.h
+++ b/pjsip/include/pjsip/sip_util.h
@@ -472,27 +472,49 @@ PJ_DECL(pj_status_t) pjsip_endpt_send_request( pjsip_endpoint *endpt,
void (*cb)(void*,pjsip_event*));
/**
+ * @}
+ */
+
+/**
+ * @defgroup PJSIP_PROXY_CORE Core Proxy Layer
+ * @ingroup PJSIP
+ * @brief Core proxy operations
+ * @{
+ */
+
+/**
* Create new request message to be forwarded upstream to new destination URI
* in uri. The new request is a full/deep clone of the request received in
* rdata, unless if other copy mechanism is specified in the options.
* The branch parameter, if not NULL, will be used as the branch-param in
* the Via header. If it is NULL, then a unique branch parameter will be used.
*
+ * Note: this function DOES NOT perform Route information preprocessing as
+ * described in RFC 3261 Section 16.4. Application must take care of
+ * removing/updating the Route headers according of the rules as
+ * described in that section.
+ *
* @param endpt The endpoint instance.
* @param rdata The incoming request message.
* @param uri The URI where the request will be forwarded to.
- * @param branch Optional branch parameter.
+ * @param branch Optional branch parameter. Application may specify its
+ * own branch, for example if it wishes to perform loop
+ * detection. If the branch parameter is not specified,
+ * this function will generate its own by calling
+ * #pjsip_calculate_branch_id() function.
* @param options Optional option flags when duplicating the message.
* @param tdata The result.
*
* @return PJ_SUCCESS on success.
*/
-PJ_DECL(pj_status_t) pjsip_endpt_create_request_fwd( pjsip_endpoint *endpt,
- pjsip_rx_data *rdata,
- const pjsip_uri *uri,
- const pj_str_t *branch,
- unsigned options,
- pjsip_tx_data **tdata);
+PJ_DECL(pj_status_t) pjsip_endpt_create_request_fwd(pjsip_endpoint *endpt,
+ pjsip_rx_data *rdata,
+ const pjsip_uri *uri,
+ const pj_str_t *branch,
+ unsigned options,
+ pjsip_tx_data **tdata);
+
+
/**
* Create new response message to be forwarded downstream by the proxy from
@@ -515,13 +537,17 @@ PJ_DECL(pj_status_t) pjsip_endpt_create_response_fwd( pjsip_endpoint *endpt,
pjsip_tx_data **tdata);
+
/**
* Create a globally unique branch parameter based on the information in
- * the incoming request message. This function guarantees that subsequent
- * retransmissions of the same request will generate the same branch id.
- * This function can also be used in the loop detection process.
- * If the same request arrives back in the proxy with the same URL, it will
- * calculate into the same branch id.
+ * the incoming request message, for the purpose of creating a new request
+ * for forwarding. This is the default implementation used by
+ * #pjsip_endpt_create_request_fwd() function if the branch parameter is
+ * not specified.
+ *
+ * The default implementation here will just create an MD5 hash of the
+ * top-most Via.
+ *
* Note that the returned string was allocated from rdata's pool.
*
* @param rdata The incoming request message.
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index fee08d33..b6ba7d53 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -2201,6 +2201,25 @@ PJ_DECL(pjsua_acc_id) pjsua_acc_find_for_incoming(pjsip_rx_data *rdata);
/**
+ * Create arbitrary requests using the account. Application should only use
+ * this function to create auxiliary requests outside dialog, such as
+ * OPTIONS, and use the call or presence API to create dialog related
+ * requests.
+ *
+ * @param acc_id The account ID.
+ * @param method The SIP method of the request.
+ * @param target Target URI.
+ * @param p_tdata Pointer to receive the request.
+ *
+ * @return PJ_SUCCESS or the error code.
+ */
+PJ_DECL(pj_status_t) pjsua_acc_create_request(pjsua_acc_id acc_id,
+ const pjsip_method *method,
+ const pj_str_t *target,
+ pjsip_tx_data **p_tdata);
+
+
+/**
* Create a suitable URI to be put as Contact based on the specified
* target URI for the specified account.
*