[asterisk-commits] dvossel: branch dvossel/call_forward_api_trunk r198564 - in /team/dvossel/cal...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 1 11:07:57 CDT 2009


Author: dvossel
Date: Mon Jun  1 11:07:54 2009
New Revision: 198564

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=198564
Log:
created new call forward api

Modified:
    team/dvossel/call_forward_api_trunk/include/asterisk/channel.h
    team/dvossel/call_forward_api_trunk/main/channel.c
    team/dvossel/call_forward_api_trunk/main/features.c

Modified: team/dvossel/call_forward_api_trunk/include/asterisk/channel.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/dvossel/call_forward_api_trunk/include/asterisk/channel.h?view=diff&rev=198564&r1=198563&r2=198564
==============================================================================
--- team/dvossel/call_forward_api_trunk/include/asterisk/channel.h (original)
+++ team/dvossel/call_forward_api_trunk/include/asterisk/channel.h Mon Jun  1 11:07:54 2009
@@ -1081,6 +1081,17 @@
 	int timeout, int *reason, const char *cid_num, const char *cid_name, struct outgoing_helper *oh);
 
 /*!
+ * \brief Forwards a call to a new channel specified by the original channel's call_forward str.  If possible, the new forwarded channel is created and returned while the original one is terminated.
+ * \param orig original channel requesting the call forward
+ * \param timeout maximum amount of time to wait for setup of new forward channel
+ * \param format requested channel format
+ * \param oh Outgoing helper used with original channel
+ * \param outstate reason why unsuccessful (if uncuccessful)
+ * \return Returns the forwarded call's ast_channel on success or NULL on failure
+ */
+struct ast_channel *ast_call_forward(struct ast_channel *orig, int *timeout, int format, struct outgoing_helper *oh, int *outstate);
+
+/*!
  * \brief Register a channel technology (a new channel driver)
  * Called by a channel module to register the kind of channels it supports.
  * \param tech Structure defining channel technology or "type"

Modified: team/dvossel/call_forward_api_trunk/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/dvossel/call_forward_api_trunk/main/channel.c?view=diff&rev=198564&r1=198563&r2=198564
==============================================================================
--- team/dvossel/call_forward_api_trunk/main/channel.c (original)
+++ team/dvossel/call_forward_api_trunk/main/channel.c Mon Jun  1 11:07:54 2009
@@ -3944,7 +3944,7 @@
 	}
 }
 
-static struct ast_channel *do_forward(struct ast_channel *orig, int *timeout, int format, struct outgoing_helper *oh, int *outstate)
+struct ast_channel *ast_call_forward(struct ast_channel *orig, int *timeout, int format, struct outgoing_helper *oh, int *outstate)
 {
 	char tmpchan[256];
 	struct ast_channel *new = NULL;
@@ -4058,7 +4058,7 @@
 			if (timeout > -1)
 				timeout = res;
 			if (!ast_strlen_zero(chan->call_forward)) {
-				if (!(chan = do_forward(chan, &timeout, format, oh, outstate))) {
+				if (!(chan = ast_call_forward(chan, &timeout, format, oh, outstate))) {
 					return NULL;
 				}
 				continue;

Modified: team/dvossel/call_forward_api_trunk/main/features.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/dvossel/call_forward_api_trunk/main/features.c?view=diff&rev=198564&r1=198563&r2=198564
==============================================================================
--- team/dvossel/call_forward_api_trunk/main/features.c (original)
+++ team/dvossel/call_forward_api_trunk/main/features.c Mon Jun  1 11:07:54 2009
@@ -2343,6 +2343,12 @@
 			continue;
 
 		if (chan && (chan == active_channel)){
+			if (!ast_strlen_zero(chan->call_forward)) {
+				if (!(chan = ast_call_forward(chan, &to, format, NULL, outstate))) {
+					return NULL;
+				}
+				continue;
+			}
 			f = ast_read(chan);
 			if (f == NULL) { /*doh! where'd he go?*/
 				state = AST_CONTROL_HANGUP;




More information about the asterisk-commits mailing list