2 * Asterisk -- A telephony toolkit for Linux.
6 * Copyright (C) 1999, Mark Spencer
8 * Mark Spencer <markster@linux-support.net>
10 * This program is free software, distributed under the terms of
11 * the GNU General Public License
14 #include <asterisk/lock.h>
15 #include <asterisk/file.h>
16 #include <asterisk/logger.h>
17 #include <asterisk/channel.h>
18 #include <asterisk/pbx.h>
19 #include <asterisk/module.h>
28 static char *tdesc = "Transfer";
30 static char *app = "Transfer";
32 static char *synopsis = "Transfer caller to remote extension";
34 static char *descrip =
35 " Transfer(exten): Requests the remote caller be transferred to\n"
36 "a given extension. Returns -1 on hangup, or 0 on completion\n"
37 "regardless of whether the transfer was successful. If the transfer\n"
38 "was *not* supported or successful and there exists a priority n + 101,\n"
39 "then that priority will be taken next.\n" ;
45 static int transfer_exec(struct ast_channel *chan, void *data)
49 if (!data || !strlen(data)) {
50 ast_log(LOG_WARNING, "Transfer requires an argument (destination)\n");
55 res = ast_transfer(chan, data);
58 /* Look for a "busy" place */
59 if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
60 chan->priority += 100;
68 int unload_module(void)
70 STANDARD_HANGUP_LOCALUSERS;
71 return ast_unregister_application(app);
76 return ast_register_application(app, transfer_exec, synopsis, descrip);
79 char *description(void)
87 STANDARD_USECOUNT(res);
93 return ASTERISK_GPL_KEY;