Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
ab042335
Commit
ab042335
authored
5 years ago
by
Friendly Automation
Committed by
Gerrit Code Review
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge "app_page.c: Simplify dialplan using Page." into 16
parents
a71f3294
2780be33
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/app_page.c
+17
-13
17 additions, 13 deletions
apps/app_page.c
doc/CHANGES-staging/app_page_empty_page_list.txt
+5
-0
5 additions, 0 deletions
doc/CHANGES-staging/app_page_empty_page_list.txt
with
22 additions
and
13 deletions
apps/app_page.c
+
17
−
13
View file @
ab042335
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
Page series of phones
Page series of phones
</synopsis>
</synopsis>
<syntax>
<syntax>
<parameter name="Technology/Resource" required="
tru
e" argsep="&">
<parameter name="Technology/Resource" required="
fals
e" argsep="&">
<argument name="Technology/Resource" required="true">
<argument name="Technology/Resource" required="true">
<para>Specification of the device(s) to dial. These must be in the format of
<para>Specification of the device(s) to dial. These must be in the format of
<literal>Technology/Resource</literal>, where <replaceable>Technology</replaceable>
<literal>Technology/Resource</literal>, where <replaceable>Technology</replaceable>
...
@@ -270,17 +270,12 @@ static int page_exec(struct ast_channel *chan, const char *data)
...
@@ -270,17 +270,12 @@ static int page_exec(struct ast_channel *chan, const char *data)
AST_APP_ARG
(
timeout
);
AST_APP_ARG
(
timeout
);
);
);
if
(
ast_strlen_zero
(
data
))
{
ast_log
(
LOG_WARNING
,
"This application requires at least one argument (destination(s) to page)
\n
"
);
return
-
1
;
}
if
(
!
(
app
=
pbx_findapp
(
"ConfBridge"
)))
{
if
(
!
(
app
=
pbx_findapp
(
"ConfBridge"
)))
{
ast_log
(
LOG_WARNING
,
"There is no ConfBridge application available!
\n
"
);
ast_log
(
LOG_WARNING
,
"There is no ConfBridge application available!
\n
"
);
return
-
1
;
return
-
1
;
};
};
parse
=
ast_strdupa
(
data
);
parse
=
ast_strdupa
(
data
?:
""
);
AST_STANDARD_APP_ARGS
(
args
,
parse
);
AST_STANDARD_APP_ARGS
(
args
,
parse
);
...
@@ -301,7 +296,7 @@ static int page_exec(struct ast_channel *chan, const char *data)
...
@@ -301,7 +296,7 @@ static int page_exec(struct ast_channel *chan, const char *data)
/* Count number of extensions in list by number of ampersands + 1 */
/* Count number of extensions in list by number of ampersands + 1 */
num_dials
=
1
;
num_dials
=
1
;
tmp
=
args
.
devices
;
tmp
=
args
.
devices
?:
""
;
while
(
*
tmp
)
{
while
(
*
tmp
)
{
if
(
*
tmp
==
'&'
)
{
if
(
*
tmp
==
'&'
)
{
num_dials
++
;
num_dials
++
;
...
@@ -334,13 +329,20 @@ static int page_exec(struct ast_channel *chan, const char *data)
...
@@ -334,13 +329,20 @@ static int page_exec(struct ast_channel *chan, const char *data)
int
state
=
0
;
int
state
=
0
;
struct
ast_dial
*
dial
=
NULL
;
struct
ast_dial
*
dial
=
NULL
;
tech
=
ast_strip
(
tech
);
if
(
ast_strlen_zero
(
tech
))
{
/* No tech/resource in this position. */
continue
;
}
/* don't call the originating device */
/* don't call the originating device */
if
(
!
strcasecmp
(
tech
,
originator
))
if
(
!
strcasecmp
(
tech
,
originator
))
{
continue
;
continue
;
}
/* If no resource is available, continue on */
/* If no resource is available, continue on */
if
(
!
(
resource
=
strchr
(
tech
,
'/'
)))
{
if
(
!
(
resource
=
strchr
(
tech
,
'/'
)))
{
ast_log
(
LOG_WARNING
,
"Incomplete destination '%s' supplied.
\n
"
,
tech
);
ast_log
(
LOG_WARNING
,
"Incomplete destination
:
'%s' supplied.
\n
"
,
tech
);
continue
;
continue
;
}
}
...
@@ -348,9 +350,11 @@ static int page_exec(struct ast_channel *chan, const char *data)
...
@@ -348,9 +350,11 @@ static int page_exec(struct ast_channel *chan, const char *data)
if
(
ast_test_flag
(
&
options
.
flags
,
PAGE_SKIP
))
{
if
(
ast_test_flag
(
&
options
.
flags
,
PAGE_SKIP
))
{
state
=
ast_device_state
(
tech
);
state
=
ast_device_state
(
tech
);
if
(
state
==
AST_DEVICE_UNKNOWN
)
{
if
(
state
==
AST_DEVICE_UNKNOWN
)
{
ast_log
(
LOG_WARNING
,
"Destination '%s' has device state '%s'. Paging anyway.
\n
"
,
tech
,
ast_devstate2str
(
state
));
ast_verb
(
3
,
"Destination '%s' has device state '%s'. Paging anyway.
\n
"
,
tech
,
ast_devstate2str
(
state
));
}
else
if
(
state
!=
AST_DEVICE_NOT_INUSE
)
{
}
else
if
(
state
!=
AST_DEVICE_NOT_INUSE
)
{
ast_log
(
LOG_WARNING
,
"Destination '%s' has device state '%s'.
\n
"
,
tech
,
ast_devstate2str
(
state
));
ast_verb
(
3
,
"Destination '%s' has device state '%s'.
\n
"
,
tech
,
ast_devstate2str
(
state
));
continue
;
continue
;
}
}
}
}
...
@@ -365,7 +369,7 @@ static int page_exec(struct ast_channel *chan, const char *data)
...
@@ -365,7 +369,7 @@ static int page_exec(struct ast_channel *chan, const char *data)
/* Append technology and resource */
/* Append technology and resource */
if
(
ast_dial_append
(
dial
,
tech
,
resource
,
NULL
)
==
-
1
)
{
if
(
ast_dial_append
(
dial
,
tech
,
resource
,
NULL
)
==
-
1
)
{
ast_log
(
LOG_ERROR
,
"Failed to add %s to outbound dial
\n
"
,
tech
);
ast_log
(
LOG_ERROR
,
"Failed to add %s
/%s
to outbound dial
\n
"
,
tech
,
resource
);
ast_dial_destroy
(
dial
);
ast_dial_destroy
(
dial
);
continue
;
continue
;
}
}
...
...
This diff is collapsed.
Click to expand it.
doc/CHANGES-staging/app_page_empty_page_list.txt
0 → 100644
+
5
−
0
View file @
ab042335
Subject: app_page
The Page application now tolerates empty positions in the supplied
destination list. Dialplan can now be simplified by not having to check
for empty positions in the destination list.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment