Setting the source number on nodejs with Plivo - node.js

If i want make a call using the Plivo API i need to have a source number and destination number. However, the source number has to be linked with my Plivo account. But when reading their tutorials, they mentioned that buying a Plivo number is optional and only needed if you want to receive calls. I only want to sent calls. Anyone know how to make a call with free account using Plivo in nodejs?
var params = {
'to': '2222222222', // The phone numer to which the all has to be placed
'from' : '1111111111', // The phone number to be used as the caller id
'answer_url' : "https://some-url/speak.xml", // The URL invoked by Plivo when the outbound call is answered
'answer_method' : "GET", // The method used to call the answer_url
};

Apparently, you could use any number as source. Like it doesn't have to be registered. So, 'from' : '1111111111' would actually work.

Related

Blind Call Transfer in Asterisk | ari-client (Node.js)

Precise overview about the flow:
I am calling my initial extension(100) using Zoiper through Twilio sip domain using Zoiper as soft phone which actually direct the call to my asterisk server.
Now when my call is in asterisk server I'm trying to forward it to another extension using Zoiper. I have already configured it according to documentation provided by asterisk will also be attaching the reference links.
I just want to forward the current call to a particular extension. So please can anyone guide me that how it can be possibly done?
ari-client
bridge.once(‘BridgeAttendedTransfer’, event => {
var transferee = new ari.Channel(event.transferee.id);
transferee.continueInDialplan({
context: event.context,
extension: event.exten,
priority: 1
});
});
extension.conf
exten => 201,1,Dial(SIP/201,20,tT)
features.conf
blindxfer = #2 ("#2" or "##" instead of "#1")
atxfer = *2
transferdigittimeout = 1; Number of seconds to wait between digits when transferring a call
xfersound = beep ; to indicate an attended transfer is complete
xferfailsound = beeperr ; to indicate a failed transfer
transferdialattempts = 3 ; Number of times that a transferer may attempt to dial an extension before
being kicked back to the original call.
transferretrysound = "beep" ; Sound to play when a transferer fails to dial a valid extension.
transferinvalidsound = "beeperr" ; Sound to play when a transferer fails to dial a valid extension
Using Zoiper to make a transfer
References:
https://wiki.asterisk.org/wiki/display/AST/Feature+Code+Call+Transfers
https://www.aska-ltd.jp/en/blog/185
https://community.asterisk.org/t/call-transfer-not-working-on-softphones/33817
https://asteriskfaqs.org/2020/12/22/uncategorized/handling-transfers-with-ari.html
Trying to implement blind call transfer.

How can I access Chrome Devtools Network Logs data in NodeJS script?

I'm currently trying to build a project that requires me to read data from a website (OpenSea marketplace). When I go to the page, it sends a POST request to an API (in pic 1), I want to access the data it returns (in pic 2) in my NodeJS/TypeScript project.
Is there maybe an API that can do this or is it not even possible?
Pic 1 (I'm trying to access the graphql/ request):
Pic 2 (This is the data I'm trying to get into my code):
you can hijack the XMLHttpRequest and fetch functions. unconventional, but it would work
Based on the comment I placed, a small function can be used on the client side to do such
function listen(fn){
//this line simply adds functions to call in an array based on setup below
if(listen.prototype.arguments){listen.prototype.arguments.push(fn)}
//below is setup(functions hijacked so services that use them report to this too)
listen.prototype.arguments=[] //array of functions to call
let original1=XMLHttpRequest.prototype.send, original2=fetch
function replace1(){
let toReturn=original1.bind(this)(...arguments)
this.addEventListener("load",res=>fn(this.responseText))
return toReturn
}
function replace2(){
let toReturn=original2.bind(this)(...arguments)
toReturn.then(res=>res.text().then(fn))
return toReturn
}
Object.defineProperty(XMLHttpRequest.prototype,"send",{value:replace1})
Object.defineProperty(window,"fetch",{value:replace2})
}
//example usage
let socket=some_Web_Socket_Your_Backend_To_Handle_This_Data
//perhaps this is not the most elaborate example but I hope the point is understood
listen(socket.send.bind(socket))

Dial pad implementation for reply extensions in Twilio SDK

I'm implementing call based application using twilio SDK and Ract + Node.js. I have the following requirement.
During an incoming or outgoing (audio) call, a user(any user that’s using the system to call) should be able to see the number pad button.A user should be able to open a popup with the number pad and be able to press numbers. When a user uses the dial pad to press numbers the pressed numbers should be communicated to the other end.
I tried searching the documentation for related methods. found that we can use SendDigits function and implemented some basic logic to trigger when click on a custom button on call screen. but it seems it is not sending the data to other end.
const sendDigit = () => {
console.log("Press 1");
outboundCall.sendDigit('1');
};
if anyone can guide me on how to do this would be a great help. basically, I want to have a dial pad on incoming and outgoing calls and then send press buttons according to the request by other end.
Your code has a function call to sendDigit but the function is called sendDigits.
const sendDigit = () => {
console.log("Press 1");
outboundCall.sendDigits('1');
};

Transfer a call programmatically inside a FreeSWITCH node-esl server when it is already bridged to another endpoint

I am trying to transfer the call that is connected to node-esl. I have successfully bridged that call to another endpoint. Now, I want to programatically transfer that call over to another extension or another number without the call flow being cut.
I had set the hangup after bridge to be false. However, I am not able to transfer the calls. The npm package I use is "modesl".
I had also tried to bridge the calls (which is not the requirement, since the call should be live when it is transferred).
I have the UUID of that call, which can be transferred as conn. execute or as conn.api.
var esl = require('modesl');
var esl_server = new esl.Server({port: 8085, myevents:true}, function(){
console.log("esl server is up");
});
esl_server.on('connection::ready', function(conn, id) {
conn.execute('answer');
conn.execute('set',"hangup_after_bridge=false");
conn.execute('bridge','name_of_the_bridge'); `
// conn.api('uuid_transfer',uuid,'-bleg or both',description,dialplan, context
conn.api('uuid_transfer',id,'-bleg',1000,'XML','default');}
The calls get disconnected as the commands get executed. Please look into this and let me know your answers.
You need to attach parameters as one string argument. Like:
esl_server.on('connection::ready', function(conn, id) {
conn.execute('answer');
conn.execute('set',"hangup_after_bridge=false");
conn.execute('bridge','name_of_the_bridge'); `
conn.api('uuid_transfer',id + ' -bleg 1000 XML default');
}

AWS IoT Button "JSON.stringify"

Dear all AWS IoT developers
I realized that I can only get three parameters as illustrated from the code below:
// Amazon's IoT button sends three parameters when it is pressed ...
var body = JSON.stringify({
clickType: event.clickType, // (string) the type of press; can be "SINGLE", "DOUBLE" or "LONG"
serialNumber: event.serialNumber, // (string) device's serial number, from the back of the button.
batteryVoltage: event.batteryVoltage // (string) device's voltage level in millivolts. e.g. "1567mV"
});
My question is: is there any way to get other parameters utilizing from
JSON.stringify.
PS: here is the complete code by this link.
According to this post by Stackoverflow link, json can only specify these parameters. Other parameters such as ""lat/log"" would be hard define.
A suggested solution for finding lat/long would probably by writing nodeJS code utilizing from npm googlemaps.

Resources