Ashwin Chandar
Ashwin Chandar

Reputation: 31

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.

Upvotes: 2

Views: 1687

Answers (1)

norbeq
norbeq

Reputation: 3076

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');
}

Upvotes: 1

Related Questions