summaryrefslogtreecommitdiff
path: root/pjsip/include
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-10-12 07:44:14 +0000
committerBenny Prijono <bennylp@teluu.com>2009-10-12 07:44:14 +0000
commit8f0431d203dd8b5adddb17ea56f0321374b86b29 (patch)
treee7dfbcada2039c2dbc6163cb23261a64836d7236 /pjsip/include
parentcc9e61e2abaf2cb5e225a2263ad2b0c6d4f803d2 (diff)
Ticket #411: Cannot update account presence's status while previous PUBLISH is in progress (thanks Olivier Beytrison for the report)
- enable request queueing. If PUBLISH is to be sent while another one is still in progress, queue the request and send it later when the ongoing request completes - this behavior is controlled by new pjsip_publishc_opt structure to control session's options - default behavior is to queue the request git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2940 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include')
-rw-r--r--pjsip/include/pjsip-simple/publish.h47
-rw-r--r--pjsip/include/pjsip/sip_config.h14
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h5
3 files changed, 62 insertions, 4 deletions
diff --git a/pjsip/include/pjsip-simple/publish.h b/pjsip/include/pjsip-simple/publish.h
index 3c7c7d55..a05eb6bc 100644
--- a/pjsip/include/pjsip-simple/publish.h
+++ b/pjsip/include/pjsip-simple/publish.h
@@ -65,6 +65,25 @@ extern const pjsip_method pjsip_publish_method;
typedef struct pjsip_publishc pjsip_publishc;
+/**
+ * Client publication options. Application should initialize this structure
+ * with its default values by calling #pjsip_publishc_opt_default()
+ */
+typedef struct pjsip_publishc_opt
+{
+ /**
+ * Specify whether the client publication session should queue the
+ * PUBLISH request should there be another PUBLISH transaction still
+ * pending. If this is set to false, the client will return error
+ * on the PUBLISH request if there is another PUBLISH transaction still
+ * in progress.
+ *
+ * Default: PJSIP_PUBLISHC_QUEUE_REQUEST
+ */
+ pj_bool_t queue_request;
+
+} pjsip_publishc_opt;
+
/** Structure to hold parameters when calling application's callback.
* The application's callback is called when the client publication process
@@ -89,6 +108,14 @@ typedef void pjsip_publishc_cb(struct pjsip_publishc_cbparam *param);
/**
+ * Initialize client publication session option with default values.
+ *
+ * @param opt The option.
+ */
+PJ_DECL(void) pjsip_publishc_opt_default(pjsip_publishc_opt *opt);
+
+
+/**
* Initialize client publication module.
*
* @param endpt SIP endpoint.
@@ -98,12 +125,11 @@ typedef void pjsip_publishc_cb(struct pjsip_publishc_cbparam *param);
PJ_DECL(pj_status_t) pjsip_publishc_init_module(pjsip_endpoint *endpt);
-
/**
* Create client publication structure.
*
* @param endpt Endpoint, used to allocate pool from.
- * @param options Option flags.
+ * @param opt Options, or NULL to specify default options.
* @param token Opaque data to be associated with the client publication.
* @param cb Pointer to callback function to receive publication status.
* @param p_pubc Pointer to receive client publication structure.
@@ -111,7 +137,7 @@ PJ_DECL(pj_status_t) pjsip_publishc_init_module(pjsip_endpoint *endpt);
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsip_publishc_create( pjsip_endpoint *endpt,
- unsigned options,
+ const pjsip_publishc_opt *opt,
void *token,
pjsip_publishc_cb *cb,
pjsip_publishc **p_pubc);
@@ -269,10 +295,23 @@ PJ_DECL(pj_status_t) pjsip_publishc_update_expires(pjsip_publishc *pubc,
* and application will be notified via the callback when the process
* completes.
*
+ * If the session has another PUBLISH request outstanding, the behavior
+ * depends on whether request queueing is enabled in the session (this was
+ * set by setting \a queue_request field of #pjsip_publishc_opt to true
+ * when calling #pjsip_publishc_create(). Default is true). If request
+ * queueing is enabled, the request will be queued and the function will
+ * return PJ_EPENDING. One the outstanding request is complete, the queued
+ * request will be sent automatically. If request queueing is disabled, the
+ * function will reject the request and return PJ_EBUSY.
+ *
* @param pubc The client publication structure.
* @param tdata Transmit data.
*
- * @return PJ_SUCCESS on success.
+ * @return - PJ_SUCCESS on success, or
+ * - PJ_EPENDING if request is queued, or
+ * - PJ_EBUSY if request is rejected because another PUBLISH
+ * request is in progress, or
+ * - other status code to indicate the error.
*/
PJ_DECL(pj_status_t) pjsip_publishc_send(pjsip_publishc *pubc,
pjsip_tx_data *tdata);
diff --git a/pjsip/include/pjsip/sip_config.h b/pjsip/include/pjsip/sip_config.h
index af38c040..5bbe420f 100644
--- a/pjsip/include/pjsip/sip_config.h
+++ b/pjsip/include/pjsip/sip_config.h
@@ -896,6 +896,20 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
#endif
+/**
+ * Specify whether the client publication session should queue the
+ * PUBLISH request should there be another PUBLISH transaction still
+ * pending. If this is set to false, the client will return error
+ * on the PUBLISH request if there is another PUBLISH transaction still
+ * in progress.
+ *
+ * Default: 1 (yes)
+ */
+#ifndef PJSIP_PUBLISHC_QUEUE_REQUEST
+# define PJSIP_PUBLISHC_QUEUE_REQUEST 1
+#endif
+
+
PJ_END_DECL
/**
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index cd86a524..bb6558db 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -1797,6 +1797,11 @@ typedef struct pjsua_acc_config
pj_bool_t publish_enabled;
/**
+ * Event publication options.
+ */
+ pjsip_publishc_opt publish_opt;
+
+ /**
* Authentication preference.
*/
pjsip_auth_clt_pref auth_pref;