mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 16:20:37 +00:00
res_parking: Replace Parker snapshots with ParkerDialString
This process also involved a large amount of rework regarding how to redial the Parker when a channel leaves a parking lot due to timeout. An attended transfer channel variable has been added to attended transfers to extensions that will eventually park (but haven't at the time of transfer) as well. This resolves one of the two BUGBUG comments remaining in res_parking. (issues ASTERISK-21877) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2638/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393704 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -220,22 +220,14 @@ void parked_call_retrieve_enable_features(struct ast_channel *chan, struct parki
|
||||
return;
|
||||
}
|
||||
|
||||
void flatten_peername(char *peername)
|
||||
void flatten_dial_string(char *dialstring)
|
||||
{
|
||||
int i;
|
||||
char *dash;
|
||||
|
||||
/* Truncate after the dash */
|
||||
dash = strrchr(peername, '-');
|
||||
if (dash) {
|
||||
*dash = '\0';
|
||||
}
|
||||
|
||||
/* Replace slashes with underscores since slashes are reserved characters for extension matching */
|
||||
for (i = 0; peername[i]; i++) {
|
||||
if (peername[i] == '/') {
|
||||
for (i = 0; dialstring[i]; i++) {
|
||||
if (dialstring[i] == '/') {
|
||||
/* The underscore is the flattest character of all. */
|
||||
peername[i] = '_';
|
||||
dialstring[i] = '_';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,39 +235,37 @@ void flatten_peername(char *peername)
|
||||
int comeback_goto(struct parked_user *pu, struct parking_lot *lot)
|
||||
{
|
||||
struct ast_channel *chan = pu->chan;
|
||||
char *peername;
|
||||
|
||||
peername = ast_strdupa(S_OR(pu->blindtransfer, pu->parker->name));
|
||||
char *peername_flat = ast_strdupa(pu->parker_dial_string);
|
||||
|
||||
/* Flatten the peername so that it can be used for performing the timeout PBX operations */
|
||||
flatten_peername(peername);
|
||||
flatten_dial_string(peername_flat);
|
||||
|
||||
if (lot->cfg->comebacktoorigin) {
|
||||
if (ast_exists_extension(chan, PARK_DIAL_CONTEXT, peername, 1, NULL)) {
|
||||
ast_async_goto(chan, PARK_DIAL_CONTEXT, peername, 1);
|
||||
if (ast_exists_extension(chan, PARK_DIAL_CONTEXT, peername_flat, 1, NULL)) {
|
||||
ast_async_goto(chan, PARK_DIAL_CONTEXT, peername_flat, 1);
|
||||
return 0;
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Can not start %s at %s,%s,1 because extension does not exist. Terminating call.\n",
|
||||
ast_channel_name(chan), PARK_DIAL_CONTEXT, peername);
|
||||
ast_channel_name(chan), PARK_DIAL_CONTEXT, peername_flat);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ast_exists_extension(chan, lot->cfg->comebackcontext, peername, 1, NULL)) {
|
||||
ast_async_goto(chan, lot->cfg->comebackcontext, peername, 1);
|
||||
if (ast_exists_extension(chan, lot->cfg->comebackcontext, peername_flat, 1, NULL)) {
|
||||
ast_async_goto(chan, lot->cfg->comebackcontext, peername_flat, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ast_exists_extension(chan, lot->cfg->comebackcontext, "s", 1, NULL)) {
|
||||
ast_verb(2, "Could not start %s at %s,%s,1. Using 's@%s' instead.\n", ast_channel_name(chan),
|
||||
lot->cfg->comebackcontext, peername, lot->cfg->comebackcontext);
|
||||
lot->cfg->comebackcontext, peername_flat, lot->cfg->comebackcontext);
|
||||
ast_async_goto(chan, lot->cfg->comebackcontext, "s", 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ast_verb(2, "Can not start %s at %s,%s,1 and exten 's@%s' does not exist. Using 's@default'\n",
|
||||
ast_channel_name(chan),
|
||||
lot->cfg->comebackcontext, peername, lot->cfg->comebackcontext);
|
||||
lot->cfg->comebackcontext, peername_flat, lot->cfg->comebackcontext);
|
||||
ast_async_goto(chan, "default", "s", 1);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user