[asterisk-commits] file: branch file/gulp_transfer r387658 - /team/file/gulp_transfer/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun May 5 08:56:29 CDT 2013


Author: file
Date: Sun May  5 08:56:26 2013
New Revision: 387658

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387658
Log:
Some slight clean up.

Modified:
    team/file/gulp_transfer/res/res_sip_refer.c

Modified: team/file/gulp_transfer/res/res_sip_refer.c
URL: http://svnview.digium.com/svn/asterisk/team/file/gulp_transfer/res/res_sip_refer.c?view=diff&rev=387658&r1=387657&r2=387658
==============================================================================
--- team/file/gulp_transfer/res/res_sip_refer.c (original)
+++ team/file/gulp_transfer/res/res_sip_refer.c Sun May  5 08:56:26 2013
@@ -331,7 +331,7 @@
 	char exten[AST_MAX_EXTENSION];
 	RAII_VAR(struct refer_progress *, progress, NULL, ao2_cleanup);
 	struct refer_blind refer;
-	enum ast_transfer_result res;
+	int response = 0;
 
 	/* If no explicit transfer context has been provided use their configured context */
 	if (ast_strlen_zero(context)) {
@@ -356,11 +356,25 @@
 
 	refer.progress = progress;
 	refer.rdata = rdata;
-	res = ast_bridge_transfer_blind(session->channel, exten, context, refer_blind_callback, &refer);
+
+	switch (ast_bridge_transfer_blind(session->channel, exten, context, refer_blind_callback, &refer)) {
+		case AST_BRIDGE_TRANSFER_INVALID:
+			response = 503;
+			break;
+		case AST_BRIDGE_TRANSFER_NOT_PERMITTED:
+			response = 403;
+			break;
+		case AST_BRIDGE_TRANSFER_FAIL:
+			response = 500;
+			break;
+		case AST_BRIDGE_TRANSFER_SUCCESS:
+			session->defer_terminate = 1;
+			response = 200;
+			break;
+	}
 
 	if (!progress) {
 		/* The transferer has requested no subscription, so send a final response immediately */
-		int response = (res != AST_BRIDGE_TRANSFER_SUCCESS ? 603 : 200);
 		pjsip_tx_data *tdata;
 		const pj_str_t str_refer_sub = { "Refer-Sub", 9 };
 		const pj_str_t str_false = { "false", 5 };
@@ -375,17 +389,15 @@
 		pjsip_msg_add_hdr(tdata->msg, hdr);
 
 		pjsip_dlg_send_response(session->inv_session->dlg, pjsip_rdata_get_tsx(rdata), tdata);
-	} else if (res != AST_BRIDGE_TRANSFER_SUCCESS) {
+	} else if (response != 200) {
 		/* Since this failed we can send a final NOTIFY now and terminate the subscription */
-		struct refer_progress_notification *notification = refer_progress_notification_alloc(progress, 603, PJSIP_EVSUB_STATE_TERMINATED);
+		struct refer_progress_notification *notification = refer_progress_notification_alloc(progress, response, PJSIP_EVSUB_STATE_TERMINATED);
 
 		if (notification) {
 			/* The refer_progress_notify function will call ao2_cleanup on this for us */
 			refer_progress_notify(notification);
 		}
 	}
-
-	session->defer_terminate = 1;
 
 	return 0;
 }




More information about the asterisk-commits mailing list