India First JSON Based Developer Telephony
Manage all incoming and outgoing calls through your web server
Manage all your incoming and outgoing calls through PIOPIY JSON based developer telephony platform, using your web programming language.
Create Account
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/you-have-call/', methods=['POST'])
def queue_example():
piopiy = request.get_json()
DID = piopiy['did']
call_from = piopiy['from']
# send JSON queue response to PIOPIY
queue = {
'queue': {
'record': True,
'call': [967769xxxx,978985xxxx,989439xxxx],
'ringback': 'https://example.com/waiting.wav'
}
}
return jsonify(queue)
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=True)
var express = require('express');
var bodyParser = require("body-parser");
var app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.post('/you-have-call',function(req,res){
//Request body
var did = req.body.did;
var from = req.body.from;
//JSON responce to PIOPIY
var queue= {
queue:{
record:true,
call:[989439xxxx,967769xxxx],
ringback:'https://example.com/waiting.wav'
}
}
res.send(queue);
})
package com.telecmi.piopiy;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
@WebServlet("/YouHaveCall")
public class RouteCall extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String did = request.getParameter("did");
String from = request.getParameter("from");
System.out.println(from);
System.out.println(did);
JSONObject queue = new JSONObject();
JSONObject queueProp = new JSONObject();
JSONArray call = new JSONArray();
call.add(9894);
call.add(9677);
queueProp.put("record", true);
queueProp.put("ringback","https://example.com/music/waiting.wav");
queueProp.put("call",call);
queue.put("queue",queueProp);
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
out.print(queue);
out.flush();
}
}
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/you-have-call/', methods=['POST'])
def queue_example():
piopiy = request.get_json()
DID = piopiy['did']
call_from = piopiy['from']
# send JSON queue response to PIOPIY
playmusic = {
'play': {
'url': 'https://example.com/vote.wav'
}
}
return jsonify(playmusic)
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=True)
var express = require('express');
var bodyParser = require("body-parser");
var app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.post('/you-have-call',function(req,res){
//Request body
var did = req.body.did;
var from = req.body.from;
//JSON responce to PIOPIY
var playmusic= {
play: {
url:'https://example.com/vote'
}
}
res.send(playmusic);
})
package com.telecmi.piopiy;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
@WebServlet("/PlayAudio")
public class PlayAudio extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String did = request.getParameter("did");
String from = request.getParameter("from");
System.out.println(from);
System.out.println(did);
JSONObject play = new JSONObject();
JSONObject url = new JSONObject();
url.put("url", "http://8ed8c9c9.ngrok.io/telecmi/waiting.wav");
play.put("play",url);
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
out.print(play);
out.flush();
}
}
Dynamic IVR from Web Server.
Now design telephony IVR from your webserver in your own programing language, by using our PIOPIY platform. An web developer can now design their own IVR dynamically for every call based on their own logic without any restriction.
Dynamic Call routing from web server.
Route all your incoming calls to an group of numbers or to an particular number from your web server and record all your conversation.
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/you-have-call/', methods=['POST'])
def queue_example():
piopiy = request.get_json()
DID = piopiy['did']
call_from = piopiy['from']
# send JSON queue response to PIOPIY
hangup = {hangup:True}
return jsonify(hangup)
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=True)
var express = require('express');
var bodyParser = require("body-parser");
var app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.post('/you-have-call',function(req,res){
//Request body
var did = req.body.did;
var from = req.body.from;
//JSON responce to PIOPIY
var hangup= {hangup:true}
res.send(hangup);
})
package com.telecmi.piopiy;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
@WebServlet("/YouHaveCall")
public class Hangup extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String did = request.getParameter("did");
String from = request.getParameter("from");
System.out.println(from);
System.out.println(did);
JSONObject hangup = new JSONObject();
hangup.put("hangup",true);
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
out.print(hangup);
out.flush();
}
}