Call through example
From FreeSWITCH Wiki
The scenario is this way:-
User A wants to call user B
A is, say in India,
B is, say in US.
A doesnt want to make an international call to B So, A dials a GATEWAY which can route to B, and which is also in India (call to GATEWAY is local)
A --> GATEWAY --> B
Effectively A makes local call to B. The script assumes you have the destination number (B's number) stored in a temp file
//Answer the call
session.answer();
// Assuming you have the destination number stored in a temp file
var fd = new File("<path to temp file containing destination number>");
var buff = fd.readln();
console_log("notice","\nYou are trying to reach "+buff+"\n");
route = "sofia/gateway/net4india/"+buff;
session.execute("bridge", route);
session.waitForAnswer(5000);
console_log("notice", "Disconnect cause: " + session.cause + "\n");
~ gakul

