我是靠谱客的博主 成就母鸡,最近开发中收集的这篇文章主要介绍java对接freeswitch_java通过http协议与Freeswitch对接实现动态添加用户,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

/** *@author cyq *号码注册认证 */

class DirectoryHandler implements HttpHandler{

@Override

public void handle(HttpExchange exc) throws IOException {

//String uri=exc.getRequestURI().toString();

//获得输入流

BufferedReader reader=new BufferedReader(new InputStreamReader(exc.getRequestBody()));

//用于存储请求信息 请求参数

String valueString = null;

StringBuilder sbf=new StringBuilder();

while ((valueString=reader.readLine())!=null){

sbf.append(valueString);

}

String param=sbf.toString();

//System.out.println(param);

String[] str_= param.split("&");

@SuppressWarnings("unused")

String section=null;

String req_key = null;

String req_user = null;

String req_domain = null;

@SuppressWarnings("unused")

String req_ip = null;

String req_callout = null;

String req_pswd = "1234";

for(int i=0;i

String[] str2_ = str_[i].split("=");

switch (str2_[0]) {

case "section":

section=str2_[1];

break;

case "key":

req_key=str2_[1];

break;

case "user":

req_user=str2_[1];

req_callout=str2_[1];

break;

case "domain":

req_domain=str2_[1];

break;

case "ip":

req_ip=str2_[1];

break;

default:

break;

}

}

//此处查询数据库

DirectoryEntity directorys=directoryManageServerBusiness.selectExtensions(req_user,req_domain);

req_pswd = directorys.get(0).getExtensionPswd();

responseMessage=

""+

"" +

" "+

" "+

"

" value='{presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}'/>" +

" "+

" "+

" " +

" "+

" "+

" "+

" "+

" "+

" " +

" " +

" "+

" " +

" " +

" " +

" " +

" "+

" "+

" "+

" "+

" "+

" "+

" "+

" "+

" "+

" "+

" " +

" " +

" " +

"";

}else{

responseMessage=

" " +

" " +

" " +

" ";

}

//回应信息

exc.sendResponseHeaders(HttpURLConnection.HTTP_OK, responseMessage.getBytes().length);

OutputStream out = exc.getResponseBody();

out.write(responseMessage.getBytes());

out.flush();

exc.close();

}

}

最后

以上就是成就母鸡为你收集整理的java对接freeswitch_java通过http协议与Freeswitch对接实现动态添加用户的全部内容,希望文章能够帮你解决java对接freeswitch_java通过http协议与Freeswitch对接实现动态添加用户所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(65)

评论列表共有 0 条评论

立即
投稿
返回
顶部