[asterisk-commits] mmichelson: branch 10-digiumphones r367162 - in /branches/10-digiumphones: ch...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 21 14:16:43 CDT 2012


Author: mmichelson
Date: Mon May 21 14:16:37 2012
New Revision: 367162

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=367162
Log:
Add "send to voicemail" Digium phone functionality to Asterisk.

This change accommodates two methods by which calls can be directed to
a user's voicemail.

* Incoming calls can be redirected to any user's voicemail.
* Established calls can be blind transferred to any user's voicemail.

Digium phones indicate the desire to direct a call to voicemail by using
a Diversion header with a reason parameter of "send_to_vm". 

This patch adds the "send_to_vm" reason as a valid redirecting reason. In
addition, chan_sip.c has been modified to update redirecting information
on the transferred channel by reading a Diversion header on a REFER request.

(closes issue AST-871)
Reported by Malcolm Davenport

Review: https://reviewboard.asterisk.org/r/1925


Modified:
    branches/10-digiumphones/channels/chan_sip.c
    branches/10-digiumphones/include/asterisk/callerid.h
    branches/10-digiumphones/main/callerid.c

Modified: branches/10-digiumphones/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/channels/chan_sip.c?view=diff&rev=367162&r1=367161&r2=367162
==============================================================================
--- branches/10-digiumphones/channels/chan_sip.c (original)
+++ branches/10-digiumphones/channels/chan_sip.c Mon May 21 14:16:37 2012
@@ -684,7 +684,8 @@
 	{ AST_REDIRECTING_REASON_FOLLOW_ME, "follow-me" },
 	{ AST_REDIRECTING_REASON_OUT_OF_ORDER, "out-of-service" },
 	{ AST_REDIRECTING_REASON_AWAY, "away" },
-	{ AST_REDIRECTING_REASON_CALL_FWD_DTE, "unknown"}
+	{ AST_REDIRECTING_REASON_CALL_FWD_DTE, "unknown"},
+	{ AST_REDIRECTING_REASON_SEND_TO_VM, "send_to_vm"},
 };
 
 
@@ -15764,7 +15765,7 @@
 			}
 			/* Remove enclosing double-quotes */
 			if (*reason_param == '"')
-				ast_strip_quoted(reason_param, "\"", "\"");
+				reason_param = ast_strip_quoted(reason_param, "\"", "\"");
 			if (!ast_strlen_zero(reason_param)) {
 				sip_set_redirstr(p, reason_param);
 				if (p->owner) {
@@ -24139,6 +24140,8 @@
 	int localtransfer = 0;
 	int attendedtransfer = 0;
 	int res = 0;
+	struct ast_party_redirecting redirecting;
+	struct ast_set_party_redirecting update_redirecting;
 
 	if (req->debug) {
 		ast_verbose("Call %s got a SIP call transfer from %s: (REFER)!\n",
@@ -24442,6 +24445,16 @@
 		goto handle_refer_cleanup;
 	}
 	ast_set_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER);	/* Delay hangup */
+
+	/* When a call is transferred to voicemail from a Digium phone, there may be
+	 * a Diversion header present in the REFER with an appropriate reason parameter
+	 * set. We need to update the redirecting information appropriately.
+	 */
+	ast_party_redirecting_init(&redirecting);
+	memset(&update_redirecting, 0, sizeof(update_redirecting));
+	change_redirecting_information(p, req, &redirecting, &update_redirecting, FALSE);
+	ast_channel_update_redirecting(current.chan2, &redirecting, &update_redirecting);
+	ast_party_redirecting_free(&redirecting);
 
 	/* Do not hold the pvt lock during the indicate and async_goto. Those functions
 	 * lock channels which will invalidate locking order if the pvt lock is held.*/

Modified: branches/10-digiumphones/include/asterisk/callerid.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/include/asterisk/callerid.h?view=diff&rev=367162&r1=367161&r2=367162
==============================================================================
--- branches/10-digiumphones/include/asterisk/callerid.h (original)
+++ branches/10-digiumphones/include/asterisk/callerid.h Mon May 21 14:16:37 2012
@@ -400,6 +400,7 @@
 	AST_REDIRECTING_REASON_OUT_OF_ORDER,
 	AST_REDIRECTING_REASON_AWAY,
 	AST_REDIRECTING_REASON_CALL_FWD_DTE,           /* This is something defined in Q.931, and no I don't know what it means */
+	AST_REDIRECTING_REASON_SEND_TO_VM,
 };
 
 /*!

Modified: branches/10-digiumphones/main/callerid.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/main/callerid.c?view=diff&rev=367162&r1=367161&r2=367162
==============================================================================
--- branches/10-digiumphones/main/callerid.c (original)
+++ branches/10-digiumphones/main/callerid.c Mon May 21 14:16:37 2012
@@ -1203,6 +1203,7 @@
 	{ AST_REDIRECTING_REASON_OUT_OF_ORDER,   "out_of_order", "Called DTE Out-Of-Order" },
 	{ AST_REDIRECTING_REASON_AWAY,           "away",         "Callee is Away" },
 	{ AST_REDIRECTING_REASON_CALL_FWD_DTE,   "cf_dte",       "Call Forwarding By The Called DTE" },
+	{ AST_REDIRECTING_REASON_SEND_TO_VM,     "send_to_vm",   "Call is being redirected to user's voicemail"},
 /* *INDENT-ON* */
 };
 




More information about the asterisk-commits mailing list