mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Updated to make calls
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Copyright 2013 Andrew D Lindsay @AndrewDLindsay
|
||||
Copyright 2014 Andrew D Lindsay @AndrewDLindsay
|
||||
http://blog.thiseldo.co.uk
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -27,10 +27,25 @@
|
||||
<label for="node-input-twilio"><i class="fa fa-user"></i> Twilio</label>
|
||||
<input type="text" id="node-input-twilio">
|
||||
</div>
|
||||
<div class="form-row node-input-twiliotype-row">
|
||||
<label for="node-input-twilioType"><i class="fa fa-list-ul"></i> Output</label>
|
||||
<select id="node-input-twilioType" style="width:125px !important">
|
||||
<option value="sms">SMS</option>
|
||||
<option value="call">Call</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-input-number"><i class="fa fa-envelope-o"></i> SMS to</label>
|
||||
<label for="node-input-number">
|
||||
<i class="fa fa-envelope-o" id="node-input-number-icon-sms"></i>
|
||||
<i class="fa fa-phone hidden" id="node-input-number-icon-call"></i>
|
||||
To</label>
|
||||
<input type="text" id="node-input-number" placeholder="01234 5678901">
|
||||
</div>
|
||||
<div class="form-row hidden" id="node-input-twiliourl-row">
|
||||
<label for="node-input-url"><i class="fa fa-globe"></i> URL</label>
|
||||
<input type="text" id="node-input-url" placeholder="http://someurl.com/twiml.xml" >
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
@@ -38,9 +53,9 @@
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="twilio out">
|
||||
<p>Sends an SMS message using the Twilio service.</p>
|
||||
<p><code>msg.payload</code> is used as the body of the message. The node can be configured with the number
|
||||
to send the message to. Alternatively, if the number is left blank, it can be set using <code>msg.topic</code>.</p>
|
||||
<p>Sends an SMS message or makes a call using the Twilio service.</p>
|
||||
<p><code>msg.payload</code> is used as either the body of the SMS message or the URL of the TWiML to create the call. The node can be configured with the number
|
||||
to send the message to. Alternatively, if the number is left blank, it can be set using <code>msg.topic</code>. If the node is configured to make a call then the URL can be entered into the node or if left blank then the <code>msg.payload</code> is used.</p>
|
||||
<p>You must have an account with Twilio to use this node. You can register for one <a href="https://www.twilio.com/">here</a>.</p>
|
||||
<p>You can either set your account details within the node, or provide it globally using either the settings file or a file
|
||||
called 'twiliokey.js' located in the directory above node-red.</p>
|
||||
@@ -129,6 +144,8 @@
|
||||
twilio:{type:"twilio-api",validate:function(v) {
|
||||
return hasGlobal || (v && v!="_ADD_");
|
||||
}},
|
||||
twilioType: {value:"sms"},
|
||||
url: {value:""},
|
||||
number: {value:""},
|
||||
name: {value:""}
|
||||
},
|
||||
@@ -163,6 +180,29 @@
|
||||
} else {
|
||||
$("#node-input-credentials-row").hide();
|
||||
}
|
||||
|
||||
if (this.twilioType == null) {
|
||||
if (this.url == "") {
|
||||
this.twilioType = "call";
|
||||
} else {
|
||||
this.twilioType = "sms";
|
||||
}
|
||||
}
|
||||
|
||||
$("#node-input-twilioType").change(function() {
|
||||
var twilioType = $("#node-input-twilioType option:selected").val();
|
||||
if (twilioType == "call") {
|
||||
$("#node-input-twiliourl-row").show();
|
||||
$("#node-input-number-icon-call").show();
|
||||
$("#node-input-number-icon-sms").hide();
|
||||
} else {
|
||||
$("#node-input-twiliourl-row").hide();
|
||||
$("#node-input-number-icon-call").hide();
|
||||
$("#node-input-number-icon-sms").show();
|
||||
}
|
||||
});
|
||||
$("#node-input-twilioType").val(this.twilioType);
|
||||
$("#node-input-twilioType").change();
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
Reference in New Issue
Block a user