Idefisk
Tools
Tutorials
Reviews
VoIP Providers
Archives
AsteriskGuru Archives
Mailing List Archives
FAQ
Search
Memberlist
Usergroups
Register
Profile
Log in to check your private messages
Log in
[svn-commits] dvossel: branch dvossel/call_forward_api_trunk
AsteriskGuru Archives Forum Index
->
Asterisk-CVS
View previous topic
::
View next topic
Author
Message
svn-commits at lists.digi
Guest
Posted: Thu May 28, 2009 8:55 pm
Post subject: [svn-commits] dvossel: branch dvossel/call_forward_api_trunk
Author: dvossel
Date: Thu May 28 16:52:26 2009
New Revision: 197826
URL:
http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=197826
Log:
call_forward api branch creation
Added:
team/dvossel/call_forward_api_trunk/
- copied from r197825, trunk/
_______________________________________________
--Bandwidth and Colocation Provided by
http://www.api-digital.com--
svn-commits mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/svn-commits
Back to top
svn-commits at lists.digi
Guest
Posted: Thu May 28, 2009 8:58 pm
Post subject: [svn-commits] dvossel: branch dvossel/call_forward_api_trunk
Author: dvossel
Date: Thu May 28 16:54:02 2009
New Revision: 197827
URL:
http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=197827
Log:
svnmerge and automerge init
Modified:
team/dvossel/call_forward_api_trunk/ (props changed)
Propchange: team/dvossel/call_forward_api_trunk/
------------------------------------------------------------------------------
automerge = *
Propchange: team/dvossel/call_forward_api_trunk/
------------------------------------------------------------------------------
automerge-email =
dvossel@digium.com
Propchange: team/dvossel/call_forward_api_trunk/
------------------------------------------------------------------------------
svnmerge-integrated = /trunk:1-197825
_______________________________________________
--Bandwidth and Colocation Provided by
http://www.api-digital.com--
svn-commits mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/svn-commits
Back to top
svn-commits at lists.digi
Guest
Posted: Fri May 29, 2009 7:01 pm
Post subject: [svn-commits] dvossel: branch dvossel/call_forward_api_trunk
Author: dvossel
Date: Fri May 29 14:58:40 2009
New Revision: 198145
URL:
http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=198145
Log:
initial call forward support for ast_request_and_dial()
Modified:
team/dvossel/call_forward_api_trunk/main/channel.c
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=198145&r1=198144&r2=198145
==============================================================================
--- team/dvossel/call_forward_api_trunk/main/channel.c (original)
+++ team/dvossel/call_forward_api_trunk/main/channel.c Fri May 29 14:58:40 2009
@@ -3931,6 +3931,78 @@
}
}
+static void handle_cause(int cause, int *outstate)
+{
+ if (outstate) {
+ /* compute error and return */
+ if (cause == AST_CAUSE_BUSY)
+ *outstate = AST_CONTROL_BUSY;
+ else if (cause == AST_CAUSE_CONGESTION)
+ *outstate = AST_CONTROL_CONGESTION;
+ else
+ *outstate = 0;
+ }
+}
+
+static struct ast_channel *do_forward(struct ast_channel *orig, int *timeout, int format, struct outgoing_helper *oh, int *outstate)
+{
+ char tmpchan[256];
+ struct ast_channel *new = NULL;
+ char *data, *type;
+ int cause = 0;
+
+ /* gather data and request the new forward channel */
+ ast_copy_string(tmpchan, orig->call_forward, sizeof(tmpchan));
+ if ((data = strchr(tmpchan, '/'))) {
+ *data++ = '\0';
+ type = tmpchan;
+ } else {
+ const char *forward_context;
+ ast_channel_lock(orig);
+ forward_context = pbx_builtin_getvar_helper(orig, "FORWARD_CONTEXT");
+ snprintf(tmpchan, sizeof(tmpchan), "%s@%s", orig->call_forward, forward_context ? forward_context : orig->context);
+ ast_channel_unlock(orig);
+ data = tmpchan;
+ type = "Local";
+ }
+ if (!(new = ast_request(type, format, data, &cause))) {
+ ast_log(LOG_NOTICE, "Unable to create channel for call forward to '%s/%s' (cause = %d)\n", type, data, cause);
+ handle_cause(cause, outstate);
+ ast_hangup(orig);
+ return NULL;
+ }
+
+ /* Copy important information from orig channel to new channel */
+ //todohere some of this is repeat code and i hate it
+ if (oh) {
+ if (oh->vars)
+ ast_set_variables(new, oh->vars);
+ /* XXX why is this necessary, for the parent_channel perhaps ? */
+ if (!ast_strlen_zero(oh->cid_num) && !ast_strlen_zero(oh->cid_name))
+ ast_set_callerid(new, oh->cid_num, oh->cid_name, oh->cid_num);
+ if (oh->parent_channel) {
+ ast_channel_inherit_variables(oh->parent_channel, new);
+ ast_channel_datastore_inherit(oh->parent_channel, new);
+ }
+ if (oh->account)
+ ast_cdr_setaccount(new, oh->account);
+ }
+
+ ast_party_caller_copy(&new->cid, &orig->cid);
+ ast_party_connected_line_copy(&new->connected, &orig->connected);
+
+ /* call new channel */
+ if ((*timeout = ast_call(new, data, 0))) {
+ ast_log(LOG_NOTICE, "Unable to call forward to channel %s/%s\n", type, (char *)data);
+ ast_hangup(orig);
+ ast_hangup(new);
+ return NULL;
+ }
+ ast_hangup(orig);
+
+ return new;
+}
+
struct ast_channel *__ast_request_and_dial(const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, struct outgoing_helper *oh)
{
int dummy_outstate;
@@ -3948,11 +4020,7 @@
chan = ast_request(type, format, data, &cause);
if (!chan) {
ast_log(LOG_NOTICE, "Unable to request channel %s/%s\n", type, (char *)data);
- /* compute error and return */
- if (cause == AST_CAUSE_BUSY)
- *outstate = AST_CONTROL_BUSY;
- else if (cause == AST_CAUSE_CONGESTION)
- *outstate = AST_CONTROL_CONGESTION;
+ handle_cause(cause, outstate);
return NULL;
}
@@ -3989,6 +4057,13 @@
break;
if (timeout > -1)
timeout = res;
+ if (!ast_strlen_zero(chan->call_forward)) {
+ if (!(chan = do_forward(chan, &timeout, format, oh, outstate))) {
+ return NULL;
+ }
+ continue;
+ }
+
f = ast_read(chan);
if (!f) {
*outstate = AST_CONTROL_HANGUP;
_______________________________________________
--Bandwidth and Colocation Provided by
http://www.api-digital.com--
svn-commits mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/svn-commits
Back to top
Display posts from previous:
All Posts
1 Day
7 Days
2 Weeks
1 Month
3 Months
6 Months
1 Year
Oldest First
Newest First
AsteriskGuru Archives Forum Index
->
Asterisk-CVS
All times are GMT
Page
1
of
1
Jump to:
Select a forum
Asterisk Mailing Lists
----------------
Asterisk-Users
Asterisk-Dev
Asterisk-CVS
Asterisk-Biz
Asterisk-Doc
Asterisk-BSD
Asterisk-Announce
Asterisk Call Centers
Asterisk-Video
Asterisk-Speech-Rec
Bristuff-Users
You
cannot
post new topics in this forum
You
cannot
reply to topics in this forum
You
cannot
edit your posts in this forum
You
cannot
delete your posts in this forum
You
cannot
vote in polls in this forum
Powered by
phpBB
© 2001, 2005 phpBB Group