summaryrefslogtreecommitdiff
path: root/pjsip/include
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2016-02-05 04:29:17 +0000
committerNanang Izzuddin <nanang@teluu.com>2016-02-05 04:29:17 +0000
commit3985dd57937870f3d47a4ddd68b477a42ffddec1 (patch)
tree7cfd8a02592a91bbae1f72e1792bac0954a0e1db /pjsip/include
parent09977f8551064c5972ea5d23605bfd4adb886189 (diff)
Fixed #1902:
- Crash when endpoint has multiple worker threads and SIP TCP transport is disconnected during incoming call handling. - Deprecated pjsip_dlg_create_uas(), replaced by pjsip_dlg_create_uas_and_inc_lock(). - Serialized transaction state notifications (of 'terminated' and 'destroyed') in case of transport error. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5241 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include')
-rw-r--r--pjsip/include/pjsip-ua/sip_replaces.h2
-rw-r--r--pjsip/include/pjsip/sip_dialog.h59
2 files changed, 58 insertions, 3 deletions
diff --git a/pjsip/include/pjsip-ua/sip_replaces.h b/pjsip/include/pjsip-ua/sip_replaces.h
index aff44498..4544b7ac 100644
--- a/pjsip/include/pjsip-ua/sip_replaces.h
+++ b/pjsip/include/pjsip-ua/sip_replaces.h
@@ -138,7 +138,7 @@
// Create UAS Invite session as usual.
//
- status = pjsip_dlg_create_uas(.., rdata, .., &dlg);
+ status = pjsip_dlg_create_uas_and_inc_lock(.., rdata, .., &dlg);
..
status = pjsip_inv_create_uas(dlg, .., &inv);
diff --git a/pjsip/include/pjsip/sip_dialog.h b/pjsip/include/pjsip/sip_dialog.h
index 9f37c32f..7f68476c 100644
--- a/pjsip/include/pjsip/sip_dialog.h
+++ b/pjsip/include/pjsip/sip_dialog.h
@@ -61,6 +61,15 @@
PJ_BEGIN_DECL
+/* Deprecated API pjsip_dlg_create_uas() due to a fatal bug of possible
+ * premature dialog destroy. Application should not change this setting,
+ * unless it uses single worker thread.
+ * See also https://trac.pjsip.org/repos/ticket/1902.
+ */
+#ifndef DEPRECATED_FOR_TICKET_1902
+# define DEPRECATED_FOR_TICKET_1902 1
+#endif
+
/**
* This structure is used to describe dialog's participants, which in this
* case is local party (i.e. us) and remote party.
@@ -240,6 +249,7 @@ PJ_DECL(pj_status_t) pjsip_dlg_create_uac( pjsip_user_agent *ua,
pjsip_dialog **p_dlg);
+#if !DEPRECATED_FOR_TICKET_1902
/**
* Initialize UAS dialog from the information found in the incoming request
* that creates a dialog (such as INVITE, REFER, or SUBSCRIBE), and set the
@@ -279,6 +289,50 @@ PJ_DECL(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua,
pjsip_rx_data *rdata,
const pj_str_t *contact,
pjsip_dialog **p_dlg);
+#endif
+
+
+/**
+ * Initialize UAS dialog from the information found in the incoming request
+ * that creates a dialog (such as INVITE, REFER, or SUBSCRIBE), and set the
+ * local Contact to contact. If contact is not specified, the local contact
+ * is initialized from the URI in the To header in the request.
+ *
+ * This function will also create UAS transaction for the incoming request,
+ * and associate the transaction to the rdata. Application can query the
+ * transaction used to handle this request by calling #pjsip_rdata_get_tsx()
+ * after this function returns.
+ *
+ * Note that initially, the session count in the dialog will be initialized
+ * to 1 (one), and the dialog is locked. Application needs to explicitly call
+ * #pjsip_dlg_dec_lock() to release the lock and decrease the session count.
+ *
+ *
+ * @param ua The user agent module instance.
+ * @param rdata The incoming request that creates the dialog,
+ * such as INVITE, SUBSCRIBE, or REFER.
+ * @param contact Optional dialog local Contact to be put as Contact
+ * header value, hence the format must follow
+ * RFC 3261 Section 20.10:
+ * When the header field value contains a display
+ * name, the URI including all URI parameters is
+ * enclosed in "<" and ">". If no "<" and ">" are
+ * present, all parameters after the URI are header
+ * parameters, not URI parameters. The display name
+ * can be tokens, or a quoted string, if a larger
+ * character set is desired.
+ * If this argument is NULL, the local contact will be
+ * initialized from the value of To header in the
+ * request.
+ * @param p_dlg Pointer to receive the dialog.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t)
+pjsip_dlg_create_uas_and_inc_lock( pjsip_user_agent *ua,
+ pjsip_rx_data *rdata,
+ const pj_str_t *contact,
+ pjsip_dialog **p_dlg);
/**
@@ -361,8 +415,9 @@ PJ_DECL(pj_status_t) pjsip_dlg_terminate( pjsip_dialog *dlg );
* for UAC dialog, before any request is sent. After dialog has been
* established, the route set can not be changed.
*
- * For UAS dialog,the route set will be initialized in pjsip_dlg_create_uas()
- * from the Record-Route headers in the incoming request.
+ * For UAS dialog, the route set will be initialized in
+ * pjsip_dlg_create_uas_and_inc_lock() from the Record-Route headers in
+ * the incoming request.
*
* The route_set argument is standard list of Route headers (i.e. with
* sentinel).