Browse Source

Merge pull request #3 from remcovanvugt/cf-ng-webhook

Cf ng webhook
pull/4/head
Remco van Vugt 8 years ago
committed by GitHub
parent
commit
ee8dec54f0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 84 additions and 2 deletions
  1. +8
    -1
      src/apps/callflows/i18n/en-US.json
  2. +48
    -1
      src/apps/callflows/submodules/misc/misc.js
  3. +28
    -0
      src/apps/callflows/views/webhook-callflowEdit.html

+ 8
- 1
src/apps/callflows/i18n/en-US.json View File

@ -1138,6 +1138,7 @@
"advanced_cat": "Advanced",
"call_recording_cat": "Call Recording",
"caller_id_cat": "Caller-ID",
"integrations_cat": "Integrations",
"delete_callflow": "Delete callflow",
"save_changes": "Save changes",
"invalid_number": "Invalid number!",
@ -1292,7 +1293,13 @@
"check_cid_match": "Match",
"check_cid_nomatch": "No match",
"check_cid_matchnomatch": "Match or no match?",
"regex": "Regex"
"regex": "Regex",
"webhook": "Send webhook",
"webhook_tip": "Send a webhook to an external webservice when this callflow node is hit",
"webhook_title": "Send a HTTP webhook",
"webhook_uri": "URI",
"webhook_method": "HTTP method",
"webhook_retry": "# retries"
},
"__comment": "UI-1260: created common control for carrier selection",
"__version": "v3.20_s2",


+ 48
- 1
src/apps/callflows/submodules/misc/misc.js View File

@ -397,7 +397,7 @@ define(function(require){
},
'check_cid[]': {
name: self.i18n.active().oldCallflows.check_cid,
icon: 'lightbulb-o',
icon: 'list-ol',
category: self.i18n.active().oldCallflows.caller_id_cat,
module: 'check_cid',
tip: self.i18n.active().oldCallflows.check_cid_tip,
@ -477,6 +477,53 @@ define(function(require){
}
},
'webhook[]': {
name: self.i18n.active().oldCallflows.webhook,
icon: 'upload',
category: self.i18n.active().oldCallflows.integrations_cat,
module: 'webhook',
tip: self.i18n.active().oldCallflows.webhook_tip,
data: {
},
rules: [
{
type: 'quantity',
maxSize: '1'
}
],
isUsable: 'true',
weight: 40,
caption: function(node, caption_map) {
return node.getMetadata('webhook') || '';
},
edit: function(node, callback) {
var popup_html = $(monster.template(self, 'webhook-callflowEdit', {
data_webhook: {
'http_verb': node.getMetadata('http_verb') || 'get',
'retries': node.getMetadata('retries') || '3',
'uri': node.getMetadata('uri') || ''
}
})),
popup;
$('#add', popup_html).click(function() {
node.setMetadata('http_verb', $('#http_verb option:selected', popup_html).val());
node.setMetadata('retries', $('#retries_input', popup_html).val());
node.setMetadata('uri', $('#uri_input', popup_html).val());
popup.dialog('close');
});
popup = monster.ui.dialog(popup_html, {
title: self.i18n.active().oldCallflows.webhook_title,
beforeClose: function() {
if(typeof callback == 'function') {
callback();
}
}
});
}
},
'manual_presence[]': {
name: self.i18n.active().oldCallflows.manual_presence,


+ 28
- 0
src/apps/callflows/views/webhook-callflowEdit.html View File

@ -0,0 +1,28 @@
<div class="dialog_popup">
<h1>{{ i18n.oldCallflows.webhook }}</h1>
<form name="form" method="post" action="#">
<div class="form_content">
<div class="popup_field">
<label for="uri_input">{{ i18n.oldCallflows.webhook_uri }} </label>
<input type="text" id="uri_input" class="medium" value="{{data_webhook.uri}}"/>
</div>
<div class="popup_field">
<label for="retries_input">{{ i18n.oldCallflows.webhook_retry }} </label>
<input type="text" id="retries_input" class="medium" value="{{data_webhook.retries}}"/>
</div>
<div class="popup_field">
<label for="http_verb">{{ i18n.oldCallflows.webhook_method }}: </label>
<select id="http_verb" style="width: 100px; height: 28px;">
<option value="get"{{#compare data_webhook.http_verb '===' 'get'}} selected="selected"{{/compare}}>GET</option>
<option value="post"{{#compare data_webhook.http_verb '===' 'post'}} selected="selected"{{/compare}}>POST</option>
</select>
</div>
</div>
</form>
<div class="buttons-center">
<button id="add" class="monster-button monster-button-primary">{{i18n.save}}</button>
</div>
</div>

Loading…
Cancel
Save