aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-09-15 19:22:15 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-09-15 19:22:15 +0000
commit70546b85ab7d34d156bf3107ddc7eb52e016ab69 (patch)
tree8fc9b889f36af46092a7469f154dce801bd4b697 /channels
parent875423271150e62e0c6d568fd54abb1c87f5c3f8 (diff)
Add parking extension for non-default parking lots.
This is a new feature that allows for parking to custom parking lots to be accessed directly, rather than with channel variables or by changing the default parking lot. The extension is set with the parkext option just as the default parking lot is done. Also, the manager action has been updated to optionally allow a specified parking lot. (closes issue #14882) Reported by: vmikhnevych Patches: patch_14882.txt uploaded by mnick (license 874) modified by me Review: https://reviewboard.asterisk.org/r/884/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@286931 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_dahdi.c4
-rw-r--r--channels/chan_iax2.c12
-rw-r--r--channels/chan_mgcp.c2
-rw-r--r--channels/chan_sip.c25
-rw-r--r--channels/sig_analog.c4
-rw-r--r--channels/sip/include/sip.h1
6 files changed, 29 insertions, 19 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 364c85d04..ad10f0034 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -9714,7 +9714,7 @@ static void *analog_ss_thread(void *data)
tone_zone_play_tone(p->subs[idx].dfd, -1);
else
tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALTONE);
- if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && strcmp(exten, ast_parking_ext())) {
+ if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && !ast_parking_ext_valid(exten, chan, chan->context)) {
if (!res || !ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
if (getforward) {
/* Record this as the forwarding extension */
@@ -9850,7 +9850,7 @@ static void *analog_ss_thread(void *data)
getforward = 0;
memset(exten, 0, sizeof(exten));
len = 0;
- } else if ((p->transfer || p->canpark) && !strcmp(exten, ast_parking_ext()) &&
+ } else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan, chan->context) &&
p->subs[SUB_THREEWAY].owner &&
ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
/* This is a three way call, the main call being a real channel,
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index e4ff58773..b5eee3ba8 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -9112,7 +9112,7 @@ static void dp_lookup(int callno, const char *context, const char *callednum, co
memset(&ied1, 0, sizeof(ied1));
mm = ast_matchmore_extension(NULL, context, callednum, 1, callerid);
/* Must be started */
- if (!strcmp(callednum, ast_parking_ext()) || ast_exists_extension(NULL, context, callednum, 1, callerid)) {
+ if (ast_parking_ext_valid(callednum, NULL, context) || ast_exists_extension(NULL, context, callednum, 1, callerid)) {
dpstatus = IAX_DPSTATUS_EXISTS;
} else if (ast_canmatch_extension(NULL, context, callednum, 1, callerid)) {
dpstatus = IAX_DPSTATUS_CANEXIST;
@@ -9167,6 +9167,7 @@ static void spawn_dp_lookup(int callno, const char *context, const char *calledn
struct iax_dual {
struct ast_channel *chan1;
struct ast_channel *chan2;
+ const char *parkexten;
};
static void *iax_park_thread(void *stuff)
@@ -9183,13 +9184,13 @@ static void *iax_park_thread(void *stuff)
f = ast_read(chan1);
if (f)
ast_frfree(f);
- res = ast_park_call(chan1, chan2, 0, &ext);
+ res = ast_park_call(chan1, chan2, 0, d->parkexten, &ext);
ast_hangup(chan2);
ast_log(LOG_NOTICE, "Parked on extension '%d'\n", ext);
return NULL;
}
-static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2)
+static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2, const char *parkexten)
{
struct iax_dual *d;
struct ast_channel *chan1m, *chan2m;
@@ -9231,6 +9232,7 @@ static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2)
if ((d = ast_calloc(1, sizeof(*d)))) {
d->chan1 = chan1m;
d->chan2 = chan2m;
+ d->parkexten = parkexten;
if (!ast_pthread_create_detached_background(&th, NULL, iax_park_thread, d)) {
return 0;
}
@@ -10604,10 +10606,10 @@ retryowner:
}
pbx_builtin_setvar_helper(bridged_chan, "BLINDTRANSFER", iaxs[fr->callno]->owner->name);
- if (!strcmp(ies.called_number, ast_parking_ext())) {
+ if (ast_parking_ext_valid(ies.called_number, c, iaxs[fr->callno]->context)) {
struct ast_channel *saved_channel = iaxs[fr->callno]->owner;
ast_mutex_unlock(&iaxsl[fr->callno]);
- if (iax_park(bridged_chan, saved_channel)) {
+ if (iax_park(bridged_chan, saved_channel, ies.called_number)) {
ast_log(LOG_WARNING, "Failed to park call on '%s'\n", bridged_chan->name);
} else {
ast_debug(1, "Parked call on '%s'\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name);
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 2f953a9ae..499b5e55e 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -3107,7 +3107,7 @@ static void *mgcp_ss(void *data)
getforward = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
len = 0;
- } else if (!strcmp(p->dtmf_buf, ast_parking_ext()) &&
+ } else if (ast_parking_ext_valid(p->dtmf_buf, chan, chan->context) &&
sub->next->owner && ast_bridged_channel(sub->next->owner)) {
/* This is a three way call, the main call being a real channel,
and we're parking the first call. */
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index f382fe2ff..eb5ae4e14 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1260,7 +1260,7 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *totag, const char *fromtag);
static void check_pendings(struct sip_pvt *p);
static void *sip_park_thread(void *stuff);
-static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct sip_request *req, int seqno);
+static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct sip_request *req, int seqno, char *parkexten);
static int sip_sipredirect(struct sip_pvt *p, const char *dest);
static int is_method_allowed(unsigned int *allowed_methods, enum sipmethod method);
@@ -4877,7 +4877,9 @@ static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer)
ast_string_field_set(dialog, cid_name, peer->cid_name);
ast_string_field_set(dialog, cid_tag, peer->cid_tag);
ast_string_field_set(dialog, mwi_from, peer->mwi_from);
- ast_string_field_set(dialog, parkinglot, peer->parkinglot);
+ if (!ast_strlen_zero(peer->parkinglot)) {
+ ast_string_field_set(dialog, parkinglot, peer->parkinglot);
+ }
ast_string_field_set(dialog, engine, peer->engine);
ref_proxy(dialog, obproxy_get(dialog, peer));
dialog->callgroup = peer->callgroup;
@@ -14866,7 +14868,9 @@ static enum check_auth_result check_peer_ok(struct sip_pvt *p, char *of,
ast_string_field_set(p, subscribecontext, peer->subscribecontext);
ast_string_field_set(p, mohinterpret, peer->mohinterpret);
ast_string_field_set(p, mohsuggest, peer->mohsuggest);
- ast_string_field_set(p, parkinglot, peer->parkinglot);
+ if (!ast_strlen_zero(peer->parkinglot)) {
+ ast_string_field_set(p, parkinglot, peer->parkinglot);
+ }
ast_string_field_set(p, engine, peer->engine);
p->disallowed_methods = peer->disallowed_methods;
set_pvt_allowed_methods(p, req);
@@ -19998,7 +20002,7 @@ static void *sip_park_thread(void *stuff)
return NULL;
}
- res = ast_park_call(transferee, transferer, 0, &ext);
+ res = ast_park_call(transferee, transferer, 0, d->parkexten, &ext);
#ifdef WHEN_WE_KNOW_THAT_THE_CLIENT_SUPPORTS_MESSAGE
@@ -20035,7 +20039,7 @@ static void *sip_park_thread(void *stuff)
/*! \brief Park a call using the subsystem in res_features.c
This is executed in a separate thread
*/
-static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct sip_request *req, int seqno)
+static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct sip_request *req, int seqno, char *parkexten)
{
struct sip_dual *d;
struct ast_channel *transferee, *transferer;
@@ -20116,6 +20120,7 @@ static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct
d->chan1 = transferee; /* Transferee */
d->chan2 = transferer; /* Transferer */
d->seqno = seqno;
+ d->parkexten = parkexten;
if (ast_pthread_create_detached_background(&th, NULL, sip_park_thread, d) < 0) {
/* Could not start thread */
deinit_req(&d->req);
@@ -22008,9 +22013,8 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int
/* Fallthrough if we can't find the call leg internally */
}
-
/* Parking a call */
- if (p->refer->localtransfer && !strcmp(p->refer->refer_to, ast_parking_ext())) {
+ if (p->refer->localtransfer && ast_parking_ext_valid(p->refer->refer_to, p->owner, p->owner->context)) {
/* Must release c's lock now, because it will not longer be accessible after the transfer! */
*nounlock = 1;
ast_channel_unlock(current.chan1);
@@ -22027,7 +22031,7 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int
p->refer->refer_to);
if (sipdebug)
ast_debug(4, "SIP transfer to parking: trying to park %s. Parked by %s\n", current.chan2->name, current.chan1->name);
- sip_park(current.chan2, current.chan1, req, seqno);
+ sip_park(current.chan2, current.chan1, req, seqno, p->refer->refer_to);
return res;
}
@@ -26430,6 +26434,7 @@ static int reload_config(enum channelreloadreason reason)
ast_set_flag(&global_flags[0], SIP_DTMF_RFC2833); /*!< Default DTMF setting: RFC2833 */
ast_set_flag(&global_flags[0], SIP_DIRECT_MEDIA); /*!< Allow re-invites */
ast_copy_string(default_engine, DEFAULT_ENGINE, sizeof(default_engine));
+ ast_copy_string(default_parkinglot, DEFAULT_PARKINGLOT, sizeof(default_parkinglot));
/* Debugging settings, always default to off */
dumphistory = FALSE;
@@ -26938,7 +26943,9 @@ static int reload_config(enum channelreloadreason reason)
ast_log(LOG_WARNING, "subscribe_network_change_event value %s is not valid at line %d.\n", v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "snom_aoc_enabled")) {
- ast_set2_flag(&global_flags[2], ast_true(v->value), SIP_PAGE3_SNOM_AOC);
+ ast_set2_flag(&global_flags[2], ast_true(v->value), SIP_PAGE3_SNOM_AOC);
+ } else if (!strcasecmp(v->name, "parkinglot")) {
+ ast_copy_string(default_parkinglot, v->value, sizeof(default_parkinglot));
}
}
diff --git a/channels/sig_analog.c b/channels/sig_analog.c
index 7bb3c293c..89e4b827f 100644
--- a/channels/sig_analog.c
+++ b/channels/sig_analog.c
@@ -1939,7 +1939,7 @@ static void *__analog_ss_thread(void *data)
} else {
analog_play_tone(p, index, ANALOG_TONE_DIALTONE);
}
- if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && strcmp(exten, ast_parking_ext())) {
+ if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && !ast_parking_ext_valid(exten, chan, chan->context)) {
if (!res || !ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
if (getforward) {
/* Record this as the forwarding extension */
@@ -2090,7 +2090,7 @@ static void *__analog_ss_thread(void *data)
getforward = 0;
memset(exten, 0, sizeof(exten));
len = 0;
- } else if ((p->transfer || p->canpark) && !strcmp(exten, ast_parking_ext()) &&
+ } else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan, chan->context) &&
p->subs[ANALOG_SUB_THREEWAY].owner &&
ast_bridged_channel(p->subs[ANALOG_SUB_THREEWAY].owner)) {
/* This is a three way call, the main call being a real channel,
diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h
index 2bd1bc75f..385d9663b 100644
--- a/channels/sip/include/sip.h
+++ b/channels/sip/include/sip.h
@@ -768,6 +768,7 @@ struct sip_dual {
struct ast_channel *chan2; /*!< Second channel involved */
struct sip_request req; /*!< Request that caused the transfer (REFER) */
int seqno; /*!< Sequence number */
+ const char *parkexten;
};
/*! \brief Parameters to the transmit_invite function */