summaryrefslogtreecommitdiff
path: root/channels/chan_iax2.c
diff options
context:
space:
mode:
authorJeff Peeler <jpeeler@digium.com>2008-04-21 23:42:45 +0000
committerJeff Peeler <jpeeler@digium.com>2008-04-21 23:42:45 +0000
commit41fd7a6a21fc870f75ceb219d130e0bd6519636c (patch)
tree5ea0c0e4501835ff0a5f3ba5d5857d07de851abb /channels/chan_iax2.c
parentf773e294f17bf2460b1dee4b46a78aa8e59fbb68 (diff)
(closes issue #6113)
Reported by: oej Tested by: jpeeler This patch implements multiple parking lots for parked calls. The default parkinglot is used by default, however setting the channel variable PARKINGLOT in the dialplan will allow use of any other configured parkinglot. See configs/features.conf.sample for more details on setting up another non-default parkinglot. Also, one can (currently) set the default parkinglot to use in the driver configuration file via the parkinglot option. Patch initially written by oej, brought up to date and finalized by mvanbaak, and then stabilized and converted to astobj2 by me. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114487 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r--channels/chan_iax2.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index d93034054..c11fa1cd7 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -26,6 +26,8 @@
* \arg \ref Config_iax
*
* \ingroup channel_drivers
+ *
+ * \todo Implement musicclass settings for IAX2 devices
*/
/*** MODULEINFO
@@ -140,6 +142,7 @@ static int trunk_timed, trunk_untimed, trunk_maxmtu, trunk_nmaxmtu ; /*!< Trunk
static char context[80] = "default";
+static char default_parkinglot[AST_MAX_CONTEXT];
static char language[MAX_LANGUAGE] = "";
static char regcontext[AST_MAX_CONTEXT] = "";
@@ -298,6 +301,7 @@ struct iax2_user {
AST_STRING_FIELD(language);
AST_STRING_FIELD(cid_num);
AST_STRING_FIELD(cid_name);
+ AST_STRING_FIELD(parkinglot); /*!< Default parkinglot for device */
);
int authmethods;
@@ -333,6 +337,7 @@ struct iax2_peer {
AST_STRING_FIELD(cid_num); /*!< Default context (for transfer really) */
AST_STRING_FIELD(cid_name); /*!< Default context (for transfer really) */
AST_STRING_FIELD(zonetag); /*!< Time Zone */
+ AST_STRING_FIELD(parkinglot); /*!< Default parkinglot for device */
);
struct ast_codec_pref prefs;
struct ast_dnsmgr_entry *dnsmgr; /*!< DNS refresh manager */
@@ -580,6 +585,8 @@ struct chan_iax2_pvt {
AST_STRING_FIELD(mohsuggest);
/*! received OSP token */
AST_STRING_FIELD(osptoken);
+ /*! Default parkinglot */
+ AST_STRING_FIELD(parkinglot);
);
/*! permitted authentication methods */
@@ -1555,6 +1562,7 @@ static int __find_callno(unsigned short callno, unsigned short dcallno, struct s
ast_string_field_set(iaxs[x], accountcode, accountcode);
ast_string_field_set(iaxs[x], mohinterpret, mohinterpret);
ast_string_field_set(iaxs[x], mohsuggest, mohsuggest);
+ ast_string_field_set(iaxs[x], parkinglot, default_parkinglot);
} else {
ast_log(LOG_WARNING, "Out of resources\n");
ast_mutex_unlock(&iaxsl[x]);
@@ -2437,6 +2445,7 @@ static char *handle_cli_iax2_show_peer(struct ast_cli_entry *e, int cmd, struct
ast_cli(a->fd, " * Name : %s\n", peer->name);
ast_cli(a->fd, " Secret : %s\n", ast_strlen_zero(peer->secret) ? "<Not set>" : "<Set>");
ast_cli(a->fd, " Context : %s\n", peer->context);
+ ast_cli(a->fd, " Parking lot : %s\n", peer->parkinglot);
ast_cli(a->fd, " Mailbox : %s\n", peer->mailbox);
ast_cli(a->fd, " Dynamic : %s\n", ast_test_flag(peer, IAX_DYNAMIC) ? "Yes" : "No");
ast_cli(a->fd, " Callerid : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
@@ -3916,6 +3925,8 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
tmp->writeformat = ast_best_codec(capability);
tmp->tech_pvt = CALLNO_TO_PTR(i->callno);
+ if (!ast_strlen_zero(i->parkinglot))
+ ast_string_field_set(tmp, parkinglot, i->parkinglot);
/* Don't use ast_set_callerid() here because it will
* generate a NewCallerID event before the NewChannel event */
if (!ast_strlen_zero(i->ani))
@@ -5739,6 +5750,8 @@ static int check_access(int callno, struct sockaddr_in *sin, struct iax_ies *ies
ast_string_field_set(iaxs[callno], mohinterpret, user->mohinterpret);
if (!ast_strlen_zero(user->mohsuggest))
ast_string_field_set(iaxs[callno], mohsuggest, user->mohsuggest);
+ if (!ast_strlen_zero(user->parkinglot))
+ ast_string_field_set(iaxs[callno], parkinglot, user->parkinglot);
if (user->amaflags)
iaxs[callno]->amaflags = user->amaflags;
if (!ast_strlen_zero(user->language))
@@ -10421,6 +10434,8 @@ static struct iax2_user *build_user(const char *name, struct ast_variable *v, st
ast_string_field_set(user, mohinterpret, v->value);
} else if (!strcasecmp(v->name, "mohsuggest")) {
ast_string_field_set(user, mohsuggest, v->value);
+ } else if (!strcasecmp(v->name, "parkinglot")) {
+ ast_string_field_set(user, parkinglot, v->value);
} else if (!strcasecmp(v->name, "language")) {
ast_string_field_set(user, language, v->value);
} else if (!strcasecmp(v->name, "amaflags")) {
@@ -10622,6 +10637,8 @@ static int set_config(char *config_file, int reload)
#ifdef SO_NO_CHECK
nochecksums = 0;
#endif
+ /* Reset default parking lot */
+ default_parkinglot[0] = '\0';
min_reg_expire = IAX_DEFAULT_REG_EXPIRE;
max_reg_expire = IAX_DEFAULT_REG_EXPIRE;
@@ -10818,6 +10835,8 @@ static int set_config(char *config_file, int reload)
} else if (!strcasecmp(v->name, "cos")) {
if (ast_str2cos(v->value, &cos))
ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
+ } else if (!strcasecmp(v->name, "parkinglot")) {
+ ast_copy_string(default_parkinglot, v->value, sizeof(default_parkinglot));
} else if (!strcasecmp(v->name, "accountcode")) {
ast_copy_string(accountcode, v->value, sizeof(accountcode));
} else if (!strcasecmp(v->name, "mohinterpret")) {