grandstream UCM6104 VOIP PBX phone - voip

I am using grandstream UCM6104.
The system displays list of call start time, call duration, end time.
I want to display the list of number of incoming call and display on
the website which is accessed using the IP address..
How can I do this??
Which api should I use?

You need to work with device's web services which you can access with the local IP address of the grandstream.
Reference:
http://www.grandstream.com/sites/default/files/Resources/GXV_GMI_Web_Service_Guide.pdf
Example.
You can use the following command to do curl from the terminal
To login and get cookies saved of HTTP response
curl -H "Content-Type: text/xml" -D "cookies.txt" "http://192.168.123.127/manager?action=login&username=admin&secret=admin&format=json&jsoncallback=?"
Here, I am using default username(admin) and password(admin) in above command; change accordingly
Here, 192.168.123.127 is the IP address of the grandstream phone
To see phone SIP's information
curl -H "Content-Type: text/xml" --cookie "cookies.txt" "http://192.168.123.127/manager?action=status&format=json&jsoncallback=?"

Related

How to get all the NFTs of particular smart contract

I tried https://docs.opensea.io/reference opensea.io docs to fetch data. However, I think there are 2 APIs.
curl --request GET \
--url https://api.opensea.io/api/v1/asset/0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb/1/
This is for a single asset and it requires a token id as well. But I want data of all the NFTs of a particular smart contract address just by giving the smart contract address.
And this is for a single contract.
curl --request GET \
--url https://api.opensea.io/api/v1/asset_contract/0x06012c8cf97bead5deae237070f9587f8e7a266d
The assets endpoint (docs) has the asset_contract_address filter that allows you to filter by a contract address. Which will effectively allow you to paginate through all NFTs of the contract (that Opensea knows of).
Example:
curl 'https://api.opensea.io/api/v1/assets?offset=0&limit=20&asset_contract_address=0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb'

Can slack webhooks mention multiple users in a single webhook request?

As title says, I'm looking to send a single request to a web-hook to mention multiple users. At the moment, from testing I can only seem to get it to mention one and any more results in it either converting the entire body to a string or simply mentioning one.
curl --header "Content-Type: application/json" \
--request POST \
--data '{"incoming":"user#email.com"}' \
https://hooks.slack.com/workflows/ID
This is the call I'm making to the workflow Webhook URL & I was trying to use the user's email as an indetifier. It works for the first but not for any others.
Any info is greatly appreciated, I know I'm doing something dumb here!
I managed to resolve this myself the bad way.
I simply added additional values that I can fill in as needed. It's messy, but however I believe the best way to do this based on the limited permissions and the available functionality of Workflows.

How do I authenticate when testing a GET to Webhooks

I am using Zapier Webhooks with Airtable with the intention that when there is a new record in my Airtable, I can take action with the webhook!
However, I am having trouble setting up the API on Zapier.
Here is where I am getting the error: And I think it's because I am not authorizing properly, because afterwards it says:
I know my values are correct because when I make a CURL request, I use the following:
curl "https://api.airtable.com/v0/appyRAw7MAgenvkqu/RTS" \
-H "Authorization: Bearer MY_KEY_HERE | json_pp
And I am returned with proper JSON... but through Zapier, I cannot get past this step.
David here, from the Zapier Platform team.
I did a little digging here and it turns out there's a bug on Airtable's end (which has now been reported) where the User-Agent: Zapier header (which we send by default) causes API calls to 404. There are two solutions:
Overwrite the User-Agent header with anything else
Use the table id instead of the table name in the url
I've tested each and found that it works as expected. Here's a picture of my successful setup:
Sorry about that confusion. ​Let me know if you've got any other questions!

How to get same track/song from Spotify on Apple Music and vice versa?

I'm building a simple app, where users can share the song they're listening with friends. If the user is a Spotify subscriber and his/her friend is an Apple Music subscriber, and the Spotify user is sharing the song,
how can I search for the same song in apple catalog? Is there any common ID, like ISRC on Apple Music? Or any other comparison method?
I know how to use search already for songs/albums etc. The question is how to make sure that the result is the same song from spotify. Any ideas?
Thank you!
The ISRC code is certainly the trick here. Here's how to search in either direction:
Spotify to Apple Music
curl -g -X "GET" "https://api.music.apple.com/v1/catalog/us/songs?filter[isrc]=ISRC" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer DEVELOPER_TOKEN"
Apple Music to Spotify
curl -X "GET" "https://api.spotify.com/v1/search?q=isrc:ISRC&type=track" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer OAUTH_TOKEN"
I wrote more about this on my Medium. Good luck!
Song model for MusicKit does not have ISRC according to the documentation. iTunes EPF has ISRC info, but this is not a part of MusicKit API.
I did something similar with one of my projects, so hopefully it can get you on the right track. In short, you can use the iTunes API alongside the Spotify API to search for the same results.
An example in Python.
Get the current playing song/artist with the Spotify API. Search through the response for the information you want, in my case, it was the artist name and album name.
results = sp.currently_playing()
artist = results["item"]["album"]["artists"][0]["name"]
album = results["item"]["album"]["name"]
Look it up with the iTunes API.
i_artist = itunes.search_album(album, artist)[0]
You'll have to learn how the API's work. With iTunes, a search results in a list of results. I'm taking my chances and just grabbing the first one (the most popular). But you can certainly filter through them to make sure it matches what you want. You'll obviously run into things like artists having the same album titles, or even sharing the same name.
It looks like your target platform is iOS, but my code should be a starting point. It's just a matter of saving the information from one platform into variables, and the searching then next one with them.
Hopefully I understood your question correctly, I can expand or provide more code if needed.

How to fetch data from a website that requires permission using curl?

I am familiar with the curl command in Linux. However, I want to know if there is a way to access a URL which when accessed asks for a user interaction/permission to proceed forward for example, asking for a license agreement whether user agrees or not.
Is there a way I can either skip this permission check or pass the "I agree" kind of argument in the curl command which takes me to the actual website data?
Edit 1: Some more information on how the user interaction/permission appears on the site:
When using a browser to visit the URL, the webpage asks the user to confirm if he agrees with the terms and license conditions and provides two options "I Agree" and "I Disagree". If the user clicks on "I Agree" he proceeds to the actual webpage.
I want to know if the same can be done via command line in a shell script using curl or equivalent?
Edit 2:
When using a browser (I used firefox) to visit the URL, the URL asks for the user permission only for the first time. Next time when I visit the URL it simply skips this and proceeds to the main site. I reckon the cookie for this session is saved by the browser and used next time onwards. Having this understanding, I tried to generate cookie files and use it through curl in the following way:
To generate cookie:
curl --cookie-jar cookies.txt http://url
To use the cookie:
curl --cookie cookies.txt http://url
But I could not succeed. I traced out the location of cookies saved by firefox and tried to use it in the same way but failed again. I think I am close but I am unable to take any step forward.
Using the information given by Géza Török and wick above and my own understanding I was able to achieve this. I used a Firefox browser to visit the URL and then located the cookies stored on the disk. After reading and understanding the content and format of the cookies I created my own cookie text file with appropriate response and passed it to the curl command in the following way to proceed to the main website:
curl --cookie cookies.txt http://url
Thanks for help!
As comments are rightly suggest there are many ways to implement this. To start with, I would install firebug (if using firefox) or press Ctrl+Shift+I in chrome to check what is going on after you hit the URL in question. If there are different objects associated with initial checks and the main function you will see it there, and decide whether curl will help.
Curl is just a tool to pull http objects. Probably the only case when it could replace browser's interaction is basic authentication, when you can supply keystring in request header. For the case you describe, http debugger would be the place to start.

Resources