diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2010-09-28 04:57:01 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2010-09-28 04:57:01 +0000 |
commit | 956dfe0b552043fbd5ce2181219feeb59b7f459f (patch) | |
tree | 5e1237f70a1be156eac335802ab5784376a4fe75 | |
parent | c850d430469b470fc4b2d029fcb4f34d90cbb0f9 (diff) |
Close #1138:
- Added new pjsua registration status callback on_reg_state2(), it includes the whole info from the lower layer registration callback pjsip_regc_cb().
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3322 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 22 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 12 |
2 files changed, 32 insertions, 2 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 44f73451..3aa03b93 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -411,6 +411,16 @@ typedef struct pjsua_mwi_info /** + * Structure to be passed on registration callback. + */ +typedef struct pjsua_reg_info +{ + struct pjsip_regc_cbparam *cbparam; /**< Parameters returned by + registration callback. */ +} pjsua_reg_info; + + +/** * This structure describes application callback to receive various event * notification from PJSUA-API. All of these callbacks are OPTIONAL, * although definitely application would want to implement some of @@ -582,11 +592,21 @@ typedef struct pjsua_callback * Application may then query the account info to get the * registration details. * - * @param acc_id Account ID. + * @param acc_id The account ID. */ void (*on_reg_state)(pjsua_acc_id acc_id); /** + * Notify application when registration status has changed. + * Application may inspect the registration info to get the + * registration status details. + * + * @param acc_id The account ID. + * @param info The registration info. + */ + void (*on_reg_state2)(pjsua_acc_id acc_id, pjsua_reg_info *info); + + /** * Notification when incoming SUBSCRIBE request is received. Application * may use this callback to authorize the incoming subscribe request * (e.g. ask user permission if the request should be granted). diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index 0163ed5b..abb61b15 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -1513,9 +1513,19 @@ static void regc_cb(struct pjsip_regc_cbparam *param) schedule_reregistration(acc); } - if (pjsua_var.ua_cfg.cb.on_reg_state) + /* Call the registration status callback */ + + if (pjsua_var.ua_cfg.cb.on_reg_state) { (*pjsua_var.ua_cfg.cb.on_reg_state)(acc->index); + } + + if (pjsua_var.ua_cfg.cb.on_reg_state2) { + pjsua_reg_info reg_info; + reg_info.cbparam = param; + (*pjsua_var.ua_cfg.cb.on_reg_state2)(acc->index, ®_info); + } + PJSUA_UNLOCK(); } |