Using jsSIP in A Project - webrtc

We're using jsSIP in our project and I'm trying to get phone number of the caller when receiving an incoming call. I could't find the answer in the jsSIP documentation.
In the above image, i want to take "1004" telephone number. How can i do that?

You can also use
session.remote_identity.display_name
for incoming calls

You can try this for incoming and outgoing calls and you will get the user that is calling you or you are calling
session.remote_identity.uri.user
You can try this for incoming and outgoing calls and you will get the user call-id name
session.remote_identity.display_name

In newRTCSession Event you will get a session object.
session.request.header.
Use session.request.getHeader('From') to get From number
coolPhone.on('newRTCSession',function(session){
console.log(session.request);
console.log('call Id',session.request.getHeader('From'));
})

Related

Slack API remove bot from channel

I'd like to remove a slack bot from a channel using slack's API.
I've tried channels.kick but ofcourse, a bot is not a user so it can't be deleted that way. I haven't found any solutions so far on the interwet or on Slacks API documentation.
You are not correct. You can remove a bot user from a public channel or private channel using API methods just fine. I just tested it on a private channel to confirm.
So there must be another reason why this does not work for you. Please check if any of these reasons below apply to your case. Also, please provide the error message you are getting from the API, as that would greatly help to identify the reason.
Here are some potential reasons why kicking a bot user might not work for you:
wrong method: channels.kick only works for public channel, use groups.kick for private channels.
wrong token: bot tokens can not use the kick methods. You need to use a user access token to invoke that API method. (you would get the user_is_bot error)
trying to remove oneself: a user can not kick himself. (you would get the cant_kick_self error)
not using channel IDs: the kick methods require you to provide a channel ID, the name will not work. (you would get the channel_not_found error)
Based on your question I would assume you are getting the user_is_bot error, which let you to assume (incorrectly) that you can't kick a bot. In that case the solution would be to use a user token (not a bot token) to execute the method.

Using Twilio StatusCallback when a call on queue hangs up

I'm implementing a Twilio-powered Call Center and I'm currently using Enqueue to hold calls until an operator can answer them. I'd like to use StatusCallback to warn operators that a call that was on hold is now "completed" (caller terminated the call) but StatusCallback seems only to work with a "Client" verb. I'd want to use it with along with "Enqueue" or a "Gather" in the WaitURL.
Am I missing something?
I found that setting the StatusCallback endpoint in the Application configuration in the Twilio Dashboard globally solves this.

How to use offset on Telegram bot API webHook

Since 2 days I've been exploring the Telegram bot API, which is pretty neat. But there is one thing I can't figure out.
When you don't use the webHook but the /getUpdates call, you can tell the API via the offset parameter which message where processed by the server.
But how do you do this with the webHook in place? I keep getting the same message as an update. Which results in the server spamming the user with the same message.
The solution I came up with is as follows:
Receive an update from the webhook
Save the update_id
Reply to the user /sendMessage
disable the webHook /setWebhook?url=
Set the offset /getUpdates?offset={update_id+1}
Reinstate the webHook /setWebhook?url=https://mywebhook.domain.com
There must be a better way right? Anyone?
Ok, problem solved. It appeared that just a 200 (OK) wasn't enough (the body of my response was null. I've added a body to the response {}, and know it works fine.
You must say to telegram that you get updates successfully with this:
- 200 response code
&
- empty json like this {}
use This on webHook to get data from telegram servers:
// get the raw POST data
$rawData = file_get_contents("php://input");
// this returns null if not valid json
$jsonData = json_decode($rawData);
What HTTP status code are you returning on the page handling your webhook? It is possible that Telegram is attempting to retry your webhook endpoint because it's not receiving a status 200 (OK) from you.

SetHITTypeNotification does not take the Notification destination

I am using Mturk Sandbox environment. I have also created a queue (SQS) which will receive assignment submitted notification. I am trying to call SetHITTypeNotification API. But it always gives me following error
The value "https://sqs.XXXXXXXXXX.amazonaws.com/XXXXXXXX/XXXXXXXXXXX" is not valid for the parameter Destination.
I am sure I am providing the destination correctly. Can anybody suggest what I am missing here ?
The issue was with &Notification.1.Transport=Email which needs to be passed along with the API URL.
I changed it to &Notification.1.Transport=SQS and it works like a charm.

How to capture the response object from a webhook call

I am creating a Rails 3.2 app and I am using Paymill as the payment gateway.
I am trying to setup a webhook on my system (Already setup on Paymill side). This webhook should respond to callbacks when a transaction was successful.
How can I "capture" the response object in my code? Using params?
Thankful for all help!
I don't know paymill, but it looks like it works the same way as stripe.
Thus, you have to handle the response with params.
You can have a look on this code sample: https://github.com/apalancat/paymill-rails
A webhook call from Paymill includes a JSON in the request. This JSON includes some meta data about the event that was triggered and the objects affected. So, you'd have to take the request body and parse the JSON to extract the information you are looking for. You can see a sample JSON file here:
https://www.paymill.com/de-de/dokumentation/referenz/api-referenz/#events