I've recently upgraded our PBX to Asterisk 13, in the hope that the new REST API and WebSockets support would solve some problems we were having with tracking calls via the AMI.
We're building a C# application that will sit in the Windows tool tray and bring up information based on caller ID by querying our CRM whenever a user makes or receives a call.
Can someone clarify if it's possible via WS to subscribe to a WS channel that reports all (or even just extension specific) events taking place on the PBX?
In terms of progress made so far, I've used Swagger to explore the ARI, and the channel information given back via the channel endpoint (e.g. http://10.0.0.1:8088/ari/channels?api_key=admin:secret) looks perfect:
[
{
"id": "1466860766.240522",
"name": "PJSIP/905-00000c74",
"state": "Ring",
"caller": {
"name": "",
"number": "020xxx"
},
"connected": {
"name": "CID:020xxx",
"number": "07xxx"
},
"accountcode": "",
"dialplan": {
"context": "macro-dialout-trunk",
"exten": "s",
"priority": 22
},
"creationtime": "2016-06-25T14:19:26.040+0100",
"language": "en"
},
{
"id": "1466860766.240524",
"name": "SIP/siptrunk-000003fc",
"state": "Down",
"caller": {
"name": "CID:02033554047",
"number": "07xxx"
},
"connected": {
"name": "",
"number": "020xxx"
},
"accountcode": "",
"dialplan": {
"context": "ext-did",
"exten": "07xxx",
"priority": 1
},
"creationtime": "2016-06-25T14:19:26.264+0100",
"language": "en"
}
]
That channel information gives us everything we need in a concise, easy to digest format - PJSIP channel (i.e. the extension), state, outgoing trunk CID, and outbound number being dialled.
However, the /events endpoint as far as I can see depends on you creating an 'application' within Asterisk (from what I can gather like a conference or such?) - and despite two days of trying various things using wscat and reading documentation I can't see any way whereby you can subscribe to a WS channel that will give you all events back similar to the JSON above.
Am I misunderstanding the intentions behind WS support with Asterisk 13? Is it not meant for this purpose? Is there a better way to achieve my aim without polling /channels? Any help/pointers appreciated.
I think that Asterisk WebSockets support is intended for interop between WebRTC browser and Asterisk. It's common to use WebSockets to transport SIP messages from web-browser (look at the SIPml and JSSip). So, it's not ami replacement.
Update: it seems that now Asterisk use websockets for ARI also, so my initial suggestion is wrong, sorry. So, according to another stack overflow question you should use 'application'.
Related
I was following the instructions provided by Codemagic to add a WebHook to CodeCommit. Which includes creating a topic, adding to it a subscription and then configuring Notify in repository.
Anyhow, after merging or changing my master directly no build is still triggered.
Here is my setup:
Webhook in Codemagic:
Topic with a subscription:
Notification rule targets:
What I did notice is that notification target status is unreachable. But I have no clue what it actually means.
Does my problem occur because of the unreachable status?
What exactly does it mean then?
do you reference this document? https://docs.codemagic.io/configuration/webhooks/#setting-up-webhooks-for-aws-codecommit
Have you done following steps and can you see any incoming requests from AWS in Codemagic?
6. In the Codemagic UI, navigate to your application and select the Webhooks tab.
7. Under Recent deliveries, choose the most recent webhook, and copy the subscription link under the Results tab to your browser.
Well, apparently the documentation here has been updated:
https://docs.codemagic.io/configuration/webhooks/#setting-up-webhooks-for-aws-codecommit
There is a configuration that you have to update for your topic's access policy:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "CodeNotification_publish",
"Effect": "Allow",
"Principal": {
"Service": "codestar-notifications.amazonaws.com"
},
"Action": "SNS:Publish",
"Resource": "arn:aws:sns:REGION:ACCOUNT_ID:REPOSITORY"
}
]
}
Make sure to update Resource!
"Resource": "arn:aws:sns:REGION:ACCOUNT_ID:REPOSITORY"
Copy ARN from your topic:
Apart from that(as said above) this step is important:
Under Recent deliveries (in Codemagic -> App -> Webhooks), choose the most recent webhook, and copy the
subscription link under the Results tab to your browser.
This doc says "With the Reference-Based Catalog Management API, you can create a custom slot type that references an external data source to get the slot type values. This API allows you to create and maintain a catalog of slot type values independent of your Alexa skill."
However as you dig into it, it doesn't provide some needed details on how to actually setup the catalog on an endpoint like s3.
While this resource was provided as an answer in this similar question, it actually refers to content catalogs (like music playlists), not the Reference-Based Catalog Management API, so I assume that was in error and it is not applicable.
So, for the Reference-Based Catalog Management API: The docs say it needs to be in JSON format, and offers ingredients.json as an example. However I used this directly, and it fails (see below). Also, it does not describe what the format should be to include synonyms. Please describe this.
I can successfully create the catalog with '/v1/skills/api/custom/interactionModel/catalogs/' and get a catalogId in return. However, creating the catalog version via '/skills/api/custom/interactionModel/catalogs/{catalogId}/versions' fails. I get "Website Temporarily Unavailable" when I issue the POST.
Here's the request body structure that I'm including with that post:
data: {
"source": {
"type": "URL",
"url": "https://s3.amazonaws.com/..../ingredients.json"
},
"description": "test S3 bucket"
}
Also, does the S3 endpoint have to be made public? I tried it both ways, didn't seem to matter. If it does have to be public though, how did you handle security?
Thanks for the help.
While the API call fails, I did get this to work using the CLI approach.
ask api create-model-catalog-version -c {catalogID} -f {filename}
The file should be JSON with the following structure:
{
"type": "URL",
"url": "[your catalog url]"
}
It remains an open question how to get the API approach to work, so any answers appreciated. Maybe it is a bug, because I specify the exact same 'source' definition in the data structure of the API call as I do in the JSON file used by the CLI command.
Here's what I learned as I got it to work with the CLI:
Yes, the S3 endpoint must be made public in order for the create-model-catalog-version job to succeed. This strikes me as a problem, would like to see the ability to wrap some security around these endpoints.
Here is the format of the JSON that you will want to use, including the use of synonyms which is not described in the official Amazon example. Note that you don't have to include an ID as shown in that example.
{
"values": [
{
"name": {
"value": "hair salon",
"synonyms": [
"hairdresser",
"beauty parlor"
]
}
},
{
"name": {
"value": "hospital",
"synonyms": [
"emergency room",
"clinic"
]
}
},
]
}
We are encountering a very strange condition with Apache NiFi and SQS. We are using the AWSCredentialsProviderControllerService to manage our authentication. If we use an unencrypted queue it works fine, however, if using an encrypted queue it doesn't fail but nothing gets written. It doesn't appear to be generating anything in the NiFi or cloud trail logs either. Just wondered if there is anything special that needs to get done to support this condition. If it is failing, we are not able to figure out where that is occurring. Any suggestions or ideas would be greatly appreciated.
I was able to reproduce the silent failure with PutSQS under the following conditions:
SQS Queue configured with server-side encryption using a custom KMS customer master key rather than the default AWS key
AWS credentials used by NiFi had permission to send a message, but not permissions to use the custom KMS key
The solution was to provide NiFi's AWS credential with the permissions to use both SQS and KMS. I found the example policy below documented in What AWS KMS Permissions Do I Need to Use SSE for Amazon SQS?:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"kms:GenerateDataKey",
"kms:Decrypt"
],
"Resource": "arn:aws:kms:us-east-2:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab"
}, {
"Effect": "Allow",
"Action": [
"sqs:SendMessage",
"sqs:SendMessageBatch"
],
"Resource": "arn:aws:sqs:*:123456789012:MyQueue"
}]
}
I wrote a bot using Bot Connector REST API from Microsoft Bot Framework and tested it via Bot Framework Emulator V3.5.25 on localhost and remotely with app id and app password, it work just perfect; but using Skype channel i can receive message on my endpoint but bot´s answer never reach to Skype user.
Incoming message from Skype user
{
"text": "Hello bot?",
"type": "message",
"timestamp": "2017-03-03T19:08:30.988Z",
"id": "1488568110992",
"channelId": "skype",
"serviceUrl": "https://smba.trafficmanager.net/apis/",
"from": {
"id": "29:1rILOvqsAlldnM1C4nK30sdjpveZezKC9LX5yYAvyi_k",
"name": "Skype User"
},
"conversation": {
"id": "29:1rILOvqsAlldnM1C4nK30sdjpveZezKC9LX5yYAvyi_k"
},
"recipient": {
"id": "28:e20620eb-b214-4b02-8de1-c7fd14c11005",
"name": "My_bot"
},
"entities": [{
"locale": "es-ES",
"platform": "Windows",
"type": "clientInfo"
}]
}
Outgoing message from my bot
{
"type": "message",
"text": "Bot is Ok",
"replyToId": "1488568110992",
"locale": "es",
"channelId": "skype",
"serviceUrl": "https://smba.trafficmanager.net/apis/",
"from": {
"id": "28:e20620eb-b214-4b02-8de1-c7fd14c11005",
"name": "My_bot"
},
"conversation": {
"id": "29:1rILOvqsAlldnM1C4nK30sdjpveZezKC9LX5yYAvyi_k"
},
"recipient": {
"id": "29:1rILOvqsAlldnM1C4nK30sdjpveZezKC9LX5yYAvyi_k",
"name": "Skype User"
}
}
I don't receive a json payload response from the Bot Framework just this status: 400 Bad Request. Just for test purposes my bot sent a response with some missing parameters and the Bot Framework response with the same status and a json payload with an error message code and text.
I did not publish my bot, but according to Bot Framework docs, is not necessary.
I´m missing something? Anybody have an idea?
Thanks in advance.
Yes, it is not required to be published for the skype bot to work. I'd like to suggest you few checkpoints and check if you have already tried them:
The Bot Framework Developer Portal contains a test panel where you can test the connection from the Bot Connector service to your bot. The security model used by the Bot Connector differs slightly from the security model used by the Emulator, and this is the most realistic step in testing your bot’s authentication.
Follow these steps to test your bot in the cloud with security enabled:
Make sure your bot is deployed and running
Log in to the Bot Framework Developer Portal, click on “My bots,” and if necessary, select the bot you want to debug from the list.
Locate the test panel in the bottom-left corner of the screen and click the blue “Test” button. The results of the test appear just below the button.
Please check the status of your bot on Skype Developer Portal.
If the bot has status Pending Review. It looks like that bot will not work while the status is in "Pending Review". Check this screenshot.
The bot is successfully registered only if it looks like this before publishing.
Let me know in details if you still have any issues.
Thanks
-Jyo
Sorry, the problem is solved.
The bearer scheme was in bad format, instead of Bearer, had bearer.
Changed that and everything work.
Really sorry.
First of all i am a newbie at jmeter. I searched a lot of documents but unfortunately i did not find to answer for my problem. I have a web api rest service with following sign. I can't send dictionary format parameter.
[HttpPost,ActionName("DummyService")]
public Dictionary<string,string> DummyService([FromBody] Dictionary<string,string> parameters)
I used Parameters section and BodyData section but parameters are always null.
How can i achieve that?
Thanx in advance.
I believe you need to pass some form of a JSON Array to your web service, in order to do it:
Switch to Body Data tab
Put your JSON payload there like:
{
"Parameters": [
{
"Key": "Key1",
"Value": "Value1"
},
{
"Key": "Key2",
"Value": "value2"
}
]
}
Most likely you will need to add a HTTP Header Manager to your test plan and configure it to send Content-Type header with the value of application/json
(optional) Consider upgrading to JMeter 3.0, looking into screenshot it seems you're sitting on an older version
See Testing SOAP/REST Web Services Using JMeter guide for more information on setting up JMeter for API testing