[Asterisk-code-review] app_dial: Allow empty Dial targets. (asterisk[13])
Joshua Colp
asteriskteam at digium.com
Thu Jan 2 08:58:40 CST 2020
Joshua Colp has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/13506 )
Change subject: app_dial: Allow empty Dial targets.
......................................................................
app_dial: Allow empty Dial targets.
This change makes it so that the following no longer
results in Dial failing:
Dial(PJSIP/1000&)
Dial(&PJSIP/1000)
As long as a single dial target is provided any
subsequent empty ones are not treated as fatal.
ASTERISK-28638
Change-Id: I641320a501aaf7429d0091d668a28cd99f445b85
---
M apps/app_dial.c
1 file changed, 9 insertions(+), 3 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/06/13506/1
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 77b3ace..5b13795 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -2254,7 +2254,7 @@
);
struct ast_flags64 opts = { 0, };
char *opt_args[OPT_ARG_ARRAY_SIZE];
- int fulldial = 0, num_dialed = 0;
+ int fulldial = 0, num_dialed = 0, num_invalid = 0;
int ignore_cc = 0;
char device_name[AST_CHANNEL_NAME];
char forced_clid_name[AST_MAX_EXTENSION];
@@ -2530,8 +2530,8 @@
num_dialed++;
if (ast_strlen_zero(number)) {
- ast_log(LOG_WARNING, "Dial argument takes format (technology/resource)\n");
- goto out;
+ num_invalid++;
+ continue;
}
tech_len = strlen(tech) + 1;
@@ -2804,6 +2804,12 @@
outgoing = AST_LIST_FIRST(&out_chans);
if (!outgoing) {
+ if (num_invalid == num_dialed) {
+ ast_log(LOG_WARNING, "Dial argument takes format (technology/resource)\n");
+ strcpy(pa.status, "INVALIDARGS");
+ goto out;
+ }
+
strcpy(pa.status, "CHANUNAVAIL");
if (fulldial == num_dialed) {
res = -1;
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13506
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I641320a501aaf7429d0091d668a28cd99f445b85
Gerrit-Change-Number: 13506
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200102/e7308f83/attachment.html>
More information about the asterisk-code-review
mailing list