Index: /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 2370)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 2371)
@@ -2394,12 +2394,11 @@
  * Redirection handler.
  */
-static void call_on_redirected(pjsua_call_id call_id, const pjsip_uri *target,
-			       pjsip_redirect_op *cmd, const pjsip_event *e)
-{
-    *cmd = app_config.redir_op;
-
+static pjsip_redirect_op call_on_redirected(pjsua_call_id call_id, 
+					    const pjsip_uri *target,
+					    const pjsip_event *e)
+{
     PJ_UNUSED_ARG(e);
 
-    if (*cmd == PJSIP_REDIRECT_PENDING) {
+    if (app_config.redir_op == PJSIP_REDIRECT_PENDING) {
 	char uristr[PJSIP_MAX_URL_SIZE];
 	int len;
@@ -2416,4 +2415,6 @@
 		  call_id, len, uristr));
     }
+
+    return app_config.redir_op;
 }
 
Index: /pjproject/trunk/pjsip/include/pjsip-ua/sip_inv.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip-ua/sip_inv.h	(revision 2370)
+++ /pjproject/trunk/pjsip/include/pjsip-ua/sip_inv.h	(revision 2371)
@@ -231,10 +231,17 @@
      * @param inv	The invite session.
      * @param target	The current target to be tried.
-     * @param cmd	Action to be performed for the target. Set this
+     * @param e		The event that caused this callback to be called.
+     *			This could be the receipt of 3xx response, or
+     *			4xx/5xx response received for the INVITE sent to
+     *			subsequent targets, or NULL if this callback is
+     *			called from within #pjsip_inv_process_redirect()
+     *			context.
+     *
+     * @return		Action to be performed for the target. Set this
      *			parameter to one of the value below:
      *			- PJSIP_REDIRECT_ACCEPT: immediately accept the
-     *			  redirection (default value). When set, the
+     *			  redirection to this target. When set, the
      *			  session will immediately resend INVITE request
-     *			  to the target.
+     *			  to the target after this callback returns.
      *			- PJSIP_REDIRECT_REJECT: immediately reject this
      *			  target. The session will continue retrying with
@@ -252,13 +259,8 @@
      *			  to either accept or reject the redirection upon
      *			  getting user decision.
-     * @param e		The event that caused this callback to be called.
-     *			This could be the receipt of 3xx response, or
-     *			4xx/5xx response received for the INVITE sent to
-     *			subsequent targets, or NULL if this callback is
-     *			called from within #pjsip_inv_process_redirect()
-     *			context.
-     */
-    void (*on_redirected)(pjsip_inv_session *inv, const pjsip_uri *target,
-			  pjsip_redirect_op *cmd, const pjsip_event *e);
+     */
+    pjsip_redirect_op (*on_redirected)(pjsip_inv_session *inv, 
+				       const pjsip_uri *target,
+				       const pjsip_event *e);
 
 } pjsip_inv_callback;
Index: /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 2370)
+++ /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 2371)
@@ -1080,5 +1080,12 @@
      * @param call_id	The call ID.
      * @param target	The current target to be tried.
-     * @param cmd	Action to be performed for the target. Set this
+     * @param e		The event that caused this callback to be called.
+     *			This could be the receipt of 3xx response, or
+     *			4xx/5xx response received for the INVITE sent to
+     *			subsequent targets, or NULL if this callback is
+     *			called from within #pjsua_call_process_redirect()
+     *			context.
+     *
+     * @return		Action to be performed for the target. Set this
      *			parameter to one of the value below:
      *			- PJSIP_REDIRECT_ACCEPT: immediately accept the
@@ -1101,13 +1108,8 @@
      *			  to either accept or reject the redirection upon
      *			  getting user decision.
-     * @param e		The event that caused this callback to be called.
-     *			This could be the receipt of 3xx response, or
-     *			4xx/5xx response received for the INVITE sent to
-     *			subsequent targets, or NULL if this callback is
-     *			called from within #pjsua_call_process_redirect()
-     *			context.
-     */
-    void (*on_call_redirected)(pjsua_call_id call_id, const pjsip_uri *target,
-			       pjsip_redirect_op *cmd, const pjsip_event *e);
+     */
+    pjsip_redirect_op (*on_call_redirected)(pjsua_call_id call_id, 
+					    const pjsip_uri *target,
+					    const pjsip_event *e);
 
 } pjsua_callback;
Index: /pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c	(revision 2370)
+++ /pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c	(revision 2371)
@@ -1938,5 +1938,5 @@
 				 const pj_str_t *reason, pjsip_event *e)
 {
-    pjsip_redirect_op op = PJSIP_REDIRECT_ACCEPT;
+    pjsip_redirect_op op;
     pjsip_target *target;
 
@@ -1981,5 +1981,5 @@
     pjsip_target_set_set_current(&inv->dlg->target_set, target);
 
-    (*mod_inv.cb.on_redirected)(inv, target->uri, &op, e);
+    op = (*mod_inv.cb.on_redirected)(inv, target->uri, e);
 
 
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 2370)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 2371)
@@ -69,8 +69,7 @@
  * Redirection handler.
  */
-static void pjsua_call_on_redirected(pjsip_inv_session *inv, 
-				     const pjsip_uri *target,
-				     pjsip_redirect_op *cmd, 
-				     const pjsip_event *e);
+static pjsip_redirect_op pjsua_call_on_redirected(pjsip_inv_session *inv,
+						  const pjsip_uri *target,
+						  const pjsip_event *e);
 
 
@@ -3815,15 +3814,16 @@
 
 /* Redirection handler */
-static void pjsua_call_on_redirected(pjsip_inv_session *inv, 
-				     const pjsip_uri *target,
-				     pjsip_redirect_op *cmd, 
-				     const pjsip_event *e)
+static pjsip_redirect_op pjsua_call_on_redirected(pjsip_inv_session *inv,
+						  const pjsip_uri *target,
+						  const pjsip_event *e)
 {
     pjsua_call *call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id];
+    pjsip_redirect_op op;
 
     PJSUA_LOCK();
 
     if (pjsua_var.ua_cfg.cb.on_call_redirected) {
-	(*pjsua_var.ua_cfg.cb.on_call_redirected)(call->index, target, cmd, e);
+	op = (*pjsua_var.ua_cfg.cb.on_call_redirected)(call->index, 
+							 target, e);
     } else {
 	PJ_LOG(4,(THIS_FILE, "Unhandled redirection for call %d "
@@ -3831,8 +3831,10 @@
 		  "call.",
 		  call->index));
-	*cmd = PJSIP_REDIRECT_STOP;
+	op = PJSIP_REDIRECT_STOP;
     }
 
     PJSUA_UNLOCK();
-}
-
+
+    return op;
+}
+
