使用OpenSER构建电话通信系统——第四章(1)

阿里巴巴-AI Agent工程师面试题精选:10道高频考题+答案解析(附PDF) 阿里巴巴AIAgent技术面试要点摘要(149字) 阿里巴巴在AIAgent领域布局完整,面试重点考察系统架构、幻觉治理、成本优化等核心能力。候选人需掌握分层架构设计、多Agent协作死锁处理、Token成本优化策略等关键技术。面试强调工程落地能力,包括工具调用容错、记忆系统设计、安全防护等实践要点。评估体系需覆盖效果、效率、成本多维度指标。未来趋势关注垂直领域专业化、多模态融合等方向。建议准备实际项目案例,突出技术深度与业务价值的结合,展现系统思维和工程能力。 阅读详情

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!

第四章:OpenSER标准配置(OpenSER Standard Configuration)

OpenSER的标准配置文件安装在/etc/openser/openser.cfg。它是OpenSER的最简单的配置文件之一。而且它还是一个可以开始进行解释OpenSER功能的理想脚本。和一些基本的模块,参数和函数一样,还有一些区段是你应该熟悉了解的。

这个章节结束后,你将能够:

l        识别出openser.cfg配置文件的各个区段

l        识别出标准配置的限制

l        使用ngrep工具跟踪SIP事务

l        使用XLOG模块记录路由过程

l        使用append_hf命令标记ngrep工具跟踪的包

标准配置是一个好的出发点。它拥有最小化的功能集合,不支持验证,所以你可以不使用密码就可以连接你的SIP话机。不管怎样,你都可以从一部话机呼向另一部,我们将在之后测试之。

我们在哪?(Where Are We?)

我们要再一次提到的是,VoIP服务提供商的解决方案中有许多的部件。为了失去对整体的把握,我们会在大多数的章节中展示这幅图片。在这一章中,我们仍然会与标准配置的SIP代理部件打交道。

分析标准配置(Analyzing the Standard Configuration)

下面是OpenSER 1.2.2 版本的标准配置的展示。在这一节,我们将开始描述标准配置中的每一行的命令和函数。

#

# $Id: openser.cfg 1676 2007-02-21 13:16:34Z bogdan_iancu $

 #

 #simple quick-start config script

 #Please refer to the Core CookBook at http://www.openser.org/dokuwiki/

 doku.php

 #for a explanation of possible statements, functions and parameters.

 #

 # ----------- global configuration parameters ------------------------

 debug=3             # debug level (cmd line: -dddddddddd)

 fork=yes

 log_stderror=no     # (cmd line: -E)

 children=4

 port=5060

 #uncomment the following lines for TLS support

 #disable_tls = 0

 #listen = tls:your_IP:5061

 #tls_verify_server = 1

 #tls_verify_client = 1

 #tls_require_client_certificate = 0

 #tls_method = TLSv1

 #tls_certificate = "//etc/openser/tls/user/user-cert.pem"

 #tls_private_key = "//etc/openser/tls/user/user-privkey.pem"

 #tls_ca_list = "//etc/openser/tls/user/user-calist.pem"

 # ------------------ module loading ----------------------------------

 #set module path

 mpath="/lib/openser/modules/"

 #Uncomment this if you want to use SQL database

 #loadmodule "mysql.so"

 loadmodule "sl.so"

 loadmodule "tm.so"

 loadmodule "rr.so"

 loadmodule "maxfwd.so"

 loadmodule "usrloc.so"

 loadmodule "registrar.so"

 loadmodule "textops.so"

 loadmodule "mi_fifo.so"

 # Uncomment this if you want digest authentication

 # mysql.so must be loaded !

 #loadmodule "auth.so"

 #loadmodule "auth_db.so"

 # ----------------- setting module-specific parameters ---------------

 # -- mi_fifo params --

 modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")

 # -- usrloc params --

 modparam("usrloc", "db_mode", 0)

 # Uncomment this if you want to use SQL database

 # for persistent storage and comment the previous line

 #modparam("usrloc", "db_mode", 2)

 # -- auth params --

 # Uncomment if you are using auth module

 #

 #modparam("auth_db", "calculate_ha1", yes)

 #

# If you set "calculate_ha1" parameter to yes (which true in this

config),

# uncomment also the following parameter)

#

 #modparam("auth_db", "password_column", "password")

 # -- rr params --

 # add value to ;lr param to make some broken UAs happy

 modparam("rr", "enable_full_lr", 1)

 # -------------------------     request routing logic -------------------

 # main routing logic

 route{

           # initial sanity checks -- messages with

           # max_forwards==0, or excessively long requests

           if (!mf_process_maxfwd_header("10")) {

                   sl_send_reply("483","Too Many Hops");

                   exit;

           };

           if (msg:len >= 2048 ) {

                   sl_send_reply("513", "Message too big");

                   exit;

           };

           # we record-route all messages -- to make sure that

           # subsequent messages will go through our proxy; that's

           # particularly good if upstream and downstream entities

           # use different transport protocol

           if (!method=="REGISTER")

                   record_route();

            # subsequent messages withing a dialog should take the

           # path determined by record-routing

           if (loose_route()) {

                   # mark routing logic in request

                   append_hf("P-hint: rr-enforced\r\n");

                    route(1);

           };

           if (!uri==myself) {

                   # mark routing logic in request

                   append_hf("P-hint: outbound\r\n");

                   # if you have some interdomain connections via TLS

                   #if(uri=~"@tls_domain1.net") {

                   #        t_relay("tls:domain1.net");

                   #        exit;

                  #} else if(uri=~"@tls_domain2.net") {

                  #         t_relay("tls:domain2.net");

                  #         exit;

                   #}

                  route(1);

          };

          # if the request is for other domain use UsrLoc

          # (in case, it does not work, use the following command

          # with proper names and addresses in it)

          if (uri==myself) {

                   if (method=="REGISTER") {

                           # Uncomment this if you want to use digest

                             authentication

                           #if (!www_authorize("openser.org",

                                 "subscriber")) {

                           #         www_challenge("openser.org", "0");

                           #         exit;

                           #};

                           save("location");

                           exit;

                  };

                   lookup("aliases");

                  if (!uri==myself) {

                           append_hf("P-hint: outbound alias\r\n");

                           route(1);

                  };

                  # native SIP destinations are handled using our

                      USRLOC DB

                  if (!lookup("location")) {

                           sl_send_reply("404", "Not Found");

                           exit;

                  };

                  append_hf("P-hint: usrloc applied\r\n");

          };

          route(1); 

}

 route[1] {

          # send it out now; use stateful forwarding as it works

          # reliably even for UDP2TCP

          if (!t_relay()) {

                  sl_reply_error();

          };

        exit;

}

这个标准的配置是最简单的可以使用的配置。我们将以它作为出发点,然后再在接下来的章节中循序渐进的包含新的命令和函数。使用这个配置,客户端能够进行注册(不需要认证)并且UACs能够互相之间进行沟通。注册服务器,定位服务器和代理服务器使用最小配置进行工作。下面我们将解释一些脚本中的引用。

debug=3 # debug level (cmd line: -dddddddddd)

设置日志级别(Set log level):它是一个-3到4之间的一个数。默认为2。数越大,那么写道日志中的信息就越多。不过如果将其设为4,那么系统的性能可能会变得很差。日志级别是:

l        L_ALERT(-3)——这个级别只被用来报告需要立即响应的错误。

l        L_CRIT(-2)——这个级别只被用来报告造成危险状况的错误。

l        L_ERR(-1)——这个级别用来报告数据处理过程中不会造成系统故障的错误。

l        L_WARN(1)——这个级别用来写入一些警告消息。

l        L_NOTICE(2)——这个级别用来报告不寻常的状况。

l        L_INFO(3)——这个解别用来写入一些提示信息的消息。

l        L_DBG(4)——这个级别用来写入用来调试的消息。

fork=yes

fork参数用来定义OpenSER进程是运行在前台还是后台。运行在后台则设置fork=yes。有时候你会发现如果在前台运行对于定位脚本错误是非常有用的。如果fork被禁用的话,OpenSER将不能够同时监听多个接口,TCP/TLS支持功能将被自动禁用。在单进程模式下,只有一个UDP接口被接受。

log_stderror=no # (cmd line: -E)

如果被设为yes,服务器将打印调试信息到标准错误输出。如果设为no,syslog会被使用。

Children=4

“children”核心参数告诉OpenSER每个创建处理接入请求的进程的接口有多少孩子进程。四个进程对于大多数系统来书都是很好的一个出发点。这个参数只适用于UDP接口,对于TCP没有影响。

Port=5060

如果在监听参数中没有被指明,那么这个参数就是默认使用的端口号。

mpath="/lib/openser/modules/"

设置模块搜索路径。这可以被用来简化模块的加载。

loadmodule "sl.so"

loadmodule "tm.so"

loadmodule "rr.so"

loadmodule "maxfwd.so"

loadmodule "usrloc.so"

loadmodule "registrar.so"

loadmodule "textops.so"

loadmodule "mi_fifo.so"

上面的这些行是OpenSER加载外部的模块。这个时候,只有需要的那些模块被加载了。其余附加的功能需要加载其他诸如RADIUS和MYSQL的模块。所有这些模块都有一个README文件来描述其功能。

modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")

创建FIFO文件及其名称用来监听和读取外部命令。

modparam("usrloc", "db_mode", 0)

modparam核心命令配置了相应的模块。上面的usrloc模块负责定位服务。当一个用户注册时,它用来保存定位信息,也就是我们知道的变量db_mode表明的相对于位置的AOR(Address of Record)。为0表示是内存。所以如果你关闭了服务器,那么你将丢失所有的注册记录。表的位置靠的就是db_mode变量。将db_mode设置为0表明这个数据将被保存到数据库中。换句话说,如果OpenSER关闭,所有记录丢失。

modparam("rr", "enable_full_lr", 1)

上面的语句设置rr(Record Routing)模块的enable_full_1r变量为1。它告诉OpenSER要支持那些不对record_route头域进行管理的SIP客户端。如果设为1,;lr=on将被使用而不是;lr。

Route {

这是SIP请求的路由逻辑的开始。“块(block)”起始于“{”。在这个块中,SIP请求将被处理。通过下面的语句你将看清大概:

# initial sanity checks -- messages with

# max_forwards==0, or excessively long requests

if (!mf_process_maxfwd_header("10")) {

        sl_send_reply("483","Too Many Hops");

        exit;

};

if (msg:len >= 2048 ) {

        sl_send_reply("513", "Message too big");

        exit;

};

当一个请求进入主路由块时,要进行一些检查。

首先检查的是前转(forward)的最大次数。为了避免回环(loop),我们使用mf_process_maxfwd_header()函数来检查包到底传递了多少SIP跳(SIP hops)。如果回环(loop)被发现,那么脚本则使用s1_send_reply()函数发送“483 too many hops”消息。

Msg:len是OpenSER核心用来返回SIP请求长度(单位byte)的函数。这是一个标准的用来检查消息大小限制方法。

if (!method=="REGISTER")

        record_route();

如果不是REGISTER方法,OpenSER将进行record-route。这条消息告诉SIP服务器要处在两个UAC请求的路径当中。

record_route()函数只是简单的增加了一个新的record-route头域。

# Subsequent messages within a dialog should take the

        # Path determined by record-routing

        if (loose_route()) {

               # mark routing logic in request

                append_hf("P-hint: rr-enforced\r\n");

                route(1);

        };

loose_route()函数是用来试着看看请求有没有使用record-route头域进行路由的。这个函数标识的请求将使用最上面的record-route头域的内容进行路由。

如果请求是在同一个对话中,我们将进入if,并前转该包。我们只是简单的前转该请求。我们将调用次级路由块route(1)做这件事,在该块中t_relay()函数将被调用。

按照record-route头域(rr-enforced),append_hf函数将添加一个表明请求被处理的提示。

if (!uri==myself) {

        # mark routing logic in request

        append_hf("P-hint: outbound\r\n");

        # if you have some interdomain connections via TLS

        #if(uri=~"@tls_domain1.net") {

        #       t_relay("tls:domain1.net");

        #       exit;

        #} else if(uri=~"@tls_domain2.net") {

        #       t_relay("tls:domain2.net");

        #       exit;

        #}

        route(1);

};

上面的代码将处理一个我们的代理不处理的域中的请求,if(!uri==myself),使用调用t_relay的route(1)来前转该请求。 默认的情况下,代理只是一个开放式的中继器。在下面的章节中我们将讨论怎样改进带外通话(outbound call)的处理过程。将请求前转至其他的代理是很重要的;然而,还应该进行一些合适的标识检查。现在,我们将处理指向被我们的SIP代理处理的域的请求。

if (uri==myself) {

        if (method=="REGISTER") {

                # Uncomment this if you want to use digest

                  authentication

                #if (!www_authorize("openser.org",

                  "subscriber")) {

                #        www_challenge("openser.org", "0");

                #        exit;

                #};

                save("location");

                exit;

        };

如果是REGISTER请求,使用save(“location”)将AOR保存至位置表(location table)中。理解两个概念至关重要。验证被取消(www_authorize被注释掉)和因为我们没有把数据库安装在SIP代理上,所以定位数据库不是持续起作用的。

lookup("aliases");

if (!uri==myself) {

        append_hf("P-hint: outbound alias\r\n");

        route(1);

};

别名(alias)是可选的URI(比如,8590@voffice.com.br可以是原有URI flavio@voffice.com.br的别名)。lookup(“aliases”)函数寻找在请求中表示的URI的典型的URI。如果该URI被找到,则在操作进行前用其取代R-URI。最终的URI既可以被放置在我们域的里面,也可以是外面。如果在外面,那么系统只是简单的将包前转到负责该域的SIP代理上。如果在外面则开始请求的处理。

if (!lookup("location")) {

        sl_send_reply("404", "Not Found");

        exit;

};

append_hf("P-hint: usrloc applied\r\n");

lookup(“location”)函数将试着恢复R-URI的AOR。如果AOR被定位到(UA注册了)那么UA的ip地址将替代R-URI。如果没有找到,我们只是简单的发回错误消息“404 Not Found”。

route(1);

如果找到AOR我们将使用route(1)结束;

route[1] {

         # send it out now; use stateful forwarding as it works

reliably

         # even for UDP2TCP

         if (!t_relay()) {

                 sl_reply_error();

         };

         exit;

}

最后,路由块被调用。t_relay()函数前转基于请求URI的有状态的请求。域部分将使用NAPTR,SRV和A records等来进行解析。这个函数是由TRANSACTION模块(tm.so)提供的,负责发送请求并处理重发和响应。如果请求不能被成功的被发送到目的地,错误信息将由t_relay()函数自动产生。如果错误产生,s1_reply_error()将发送响应信息给UA。

Using标准配置(Using the Standard Configuration)

在这个实验中,我们将使用协议分析机来抓取一个完整的SIP通话。我们将分析消息头和消息流程。你可以创建一个PC和带有两个UAC的实验环境。UAC可以是软电话,ATA,或是IP电话。

|           调整以满足你的实验需要。                                                               |

|                  1:使用ngrep开始抓取包。如果你没有安装ngrep,               |

|                         使用下面的命令安装:                                                       |

|                         apt-get install ngrep                                                           |

|                  2:使用下面命令抓取包:                                                         |

|                         ngrep -p -q -W byline port 5060 > test.txt                             |

|                  3:配置UAC(软电话,IP电话,或ATA)。                                |

使用下面的描述来配置第一个UAC:

sip proxy 10.1.x.y – IP of your proxy

 user: 1000

 password: 1000

  使用下面的描述来配置第二个UAC:

sip proxy 10.1.x.y – IP of your proxy

 user: 1001

password: 1001

  在完成配置后,你需要注册IP话机。不是所有的设备都会做自动注册的操作。

  1. 使用下面的命令检查电话是否注册上:

                     openserctl u1 show

  1. 用第一个UAC拨打1001。第二个UAC会振铃。
  2. 验证抓取的包没有相对于INVITE请求的“407- Proxy authentication required”错误和相对于REGISTER请求的“401- Unauthorize”错误。这证明了不需要验证。
  3. 你可以使用如下命令查看抓包:

more test.txt

<script>window._bd_share_config={"common":{"bdsnskey":{},"bdtext":"","bdmini":"2","bdminilist":false,"bdpic":"","bdstyle":"0","bdsize":"16"},"share":{}};with(document)0[(getelementsbytagname('head')[0]||body).appendchild(createelement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new date()/36e5)];</script>
阅读(1259) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
磁环电感参数计算 电感饱和是指当电感中的电流超过一定阈值时,电感中的磁场无法继续增加,而是达到一个饱和状态,导致电感的感应电动势减小或消失。电感通常由线圈组成,当通过线圈的电流不断增加时,线圈内部的磁场也随之增加。然而,当电流达到一定程度时,线圈的铁芯磁化达到饱和,无法进一步增加磁场强度。电感饱和的阈值取决于电感的结构、材料和尺寸等因素。通常情况下,电感的额定电流会标明其饱和电流值。一旦电感中的电流超过了饱和电流,电感将饱和并出现异常行为。当我们谈论电感饱和的时候,实际上是在谈论磁芯饱和——空心的电感永远不会饱和。 阅读详情

相关推荐

Ubuntu 22.04 搭建 PX4 飞控系统完全指南:从仿真到硬件试飞

定义消息文件protobufuint64 timestamp # 时间戳float32 temperature # 温度float32 humidity # 湿度生成代码:bashPX4 在 Ubuntu 22.04 的搭建涉及环境配置、编译仿真、硬件连接等多环节,核心是理解 PX4 1.14 的新特性(uXRCE-DDS、动态控制分配)。通过本文指南,开发者可快速构建稳定的 PX4 开发环境,为无人机应用开发奠定基础。

zqmgx13291的博客 3042

转ubuntu--sip服务器openser 的搭建

http://jituo666.blog.163.com/blog/static/294817212010224468542/ ubuntu--sip服务器openser 的搭建   2010-03-24 16:06:08|  分类: VOIP related |字号 订阅 本文作者:宣寄托 1,搭建sip测试用的环境(ubuntu 9.10/9.04)

killmice的专栏 4343

PG-FP6编程器错误代码解析与高效排障实战指南

在嵌入式系统开发与量产烧录中,编程器是连接开发环境与目标硬件的重要桥梁。其工作原理是通过特定的通信协议(如UART、SWD)与微控制器(MCU)建立连接,完成程序代码的写入、擦除与校验。这项技术的核心价值在于确保固件能够准确、可靠地部署到硬件中,是产品从原型到量产的关键环节。在实际的工程实践中,尤其是在使用瑞萨(Renesas)PG-FP6这类编程器进行调试或批量生产时,工程师常会遇到各种通信失败、编程验证错误或电源异常等问题,这些问题往往以特定的错误代码形式呈现。深入理解这些错误代码背后的硬件连接、电源时

weixin_34387468的博客 581

使用OpenSER构建VoIP通话 (转载)

使用OpenSER构建VoIP通话   使用OpenSER构建电话通信系统——第一章(1)       前言:openser已经成为opensips项目,但是本书的内容绝大部分是适合于学习相关知识的。所以还是针对原书原封不动的做的翻译。   使用OpenSER

Android 开发 6668

【Qt】Window环境下搭建Qt6、MSVC2022开发环境(无需提前安装Visual Studio)

本文介绍 Windows 环境下无需安装 Visual Studio,搭建 Qt6 与 MSVC2022 开发环境的方法,以节省磁盘空间。核心步骤包括:用中科大镜像提速 Qt6 在线安装,需勾选 Qt Creator 17.0.1、MSVC 2022 x64 等组件;配置环境变量,添加 mingw_64、msvc2022_64 及 Qt Creator 的二进制目录;安装 MSVC 2022 编译器与 Windows 10 SDK 并记录版本;配置 Qt Creator 构建套件,可选设置 vcvarsal

油炸自行车的博客 2933

macOS安装Cplex+yalmip

macOS安装Cplex+yalmip

DS 4248

Kamailio SIP服务器的配置与运行

Kamailio(原名OpenSER)是一款基于SIP(Session Initiation Protocol)协议的开源服务器,适用于构建VoIP(Voice over Internet Protocol)、视频会议、即时消息和 presence服务等实时通信应用。它基于 GPL 许可证发布,支持多种操作系统,如 Linux、FreeBSD 等。

ziven的博客 2916

密码学与信息安全面试题及参考答案(2万字长文)

密码学是一门研究信息安全的学科,它涉及加密、解密以及保护数据免受非授权访问的技术和方法。这门学科的核心在于设计并分析各种协议,使通信双方即使在存在潜在敌手的环境中也能安全地传输信息。保密性:确保信息只能被预期的接收方读取,阻止未经授权的第三方获取信息的真实内容。完整性:保证数据在传输过程中不被篡改,确保接收方接收到的信息与发送方发送的信息完全一致。认证性:验证信息的来源,即确认信息确实是由声称的发送方发出的。不可否认性:确保发送方不能在事后否认曾经发送过某条信息。访问控制。

大模型大数据攻城狮的专栏 1995

使用OpenSER构建电话通信系统——第八章(2)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!实现呼叫盲转(Implementing Blind Call Forwarding) <p class="MsoNormal" style="text-indent:21.0pt;line-height:22.0pt;mso-line-height-rule: exactly"><span style="font-family:宋体;m

老黑 682

SAP Joule Studio 全景解析

摘要:SAP Joule Studio是SAP Build平台中的低代码/专业级复合工作台,用于构建和管理企业专属的Joule智能体与技能。它支持通过拖拽和声明式编排实现跨系统任务自动化,与SAP及第三方系统集成。核心构件包括Agent(智能体)、Skill(技能)、Action(动作)和Project(项目)。Joule Studio强调企业级落地,与SAP Build Process Automation等工具协同,实现从设计到运行的全生命周期管理。典型应用场景包括供应链补货、财务关账和人力服务台自动化

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 396

制作你自己的yolov5数据集并进行训练

项目地址:make-your-yolov5_dataset 一、数据集标注软件 labelImg labelMe 精灵标注助手 更多的标注工具你可以去看:深度学习图像标注工具汇总 、 十个最常用深度学习图像/视频数据标注工具 、 百度一下 在这里我选择使用labelImg 二、数据集标注 下载labelImg 解压,直接打开labelimg.exe labelImg标注数据 标注完成后即可获得VOC格式(生成.xml文件)的数据 目录结构: dataset │ ├─Annotations .

年少的勇气已经用完,剩下的就是三思而后行 1万+

使用OpenSER构建电话通信系统——第五章(3)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!Openserctl shell脚本Openserctl工具是安装在/usr/sbin上的shell脚本。被用来使用命令行的方式来对OpenSER进行管理。可以用来进行:l         启动,终止,重启OpenSERl         展示,授权,撤销ACLsl         添加,删除,列出别名l         添加,删除,配置AVP

老黑 1632

CKS-CN考试之路----11

显然是alpine-b的镜像有libcrypto3-3.1.4-r5。新版本发布老版本会被回收,此时pod只剩下2个container。我们依次测试是哪个镜像里包含libcrypto3。可以看到alpine的pod有3个副本.

Q先生 652

提供《使用OpenSER构建电话通信系统》中文翻译版本下载

提供《使用OpenSER构建电话通信系统》中文翻译版本下载    感谢网友将这本《使用OpenSER构建电话通信系统》整理城doc文档,方便了大家,在此非常之感谢,感谢这个开源的世界,感谢互联网。《使用OpenSER构建电话通信系统》 管理员在2009年8月13日编辑了该文章文章。 -->

老黑 865

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

使用OpenSER构建电话通信系统——第三章(1)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!这一章前半部分的内容是介绍系统安装和openser安装的,图片较多,而本blog文章中嵌入图片太过费时,所以直接将pdf文档链接公布如下,请直接下载。使用OpenSER构建电话通信系统——第三章(1) 管理员在2009年8月13日编辑了该文章文章。 -->

老黑 436

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

使用OpenSER构建电话通信系统——第七章(3)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!实验——使用LCR特性(Lab——using the LCR Feature)<p class="MsoNormal" style="text-indent:21.0pt;line-height:22.0pt;mso-line-height-rule: exactly"><span style="font-family:宋体;mso-asci

老黑 804

使用OpenSER构建电话通信系统——第八章(3)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!     检查配置文件(Ispecting the Configureation File) 我们的脚本正变得难以debug。现在,让我们介绍XLOG模块。它实现了XLOG函数。这个函数与LOG()函数很相似,但是它允许你在消息中使用诸如请求URI($ru)的伪变量。下面有一个使用XLOG的例子。 loadmodule "xlog

老黑 725

使用OpenSER构建电话通信系统——第一章(1)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!前言:openser已经成为opensips项目,但是本书的内容绝大部分是适合于学习相关知识的。所以还是针对原书原封不动的做的翻译。使用OpenSER构建电话通信系统 Building Telephony Systems with OpenSER第一章:SIP介绍(Introduction to SIP) 会话初始化协议是互联网工程

老黑 763

使用OpenSER构建电话通信系统——第五章(1)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!第五章:用MySQL添加认证(Adding Authentication with MySQL)在这一章中我们将学到如何使用几种数据库后端来对SIP请求进行鉴定并提供诸如位置和别名表等数据的持续性。最主要的是,我们将使用MySQL来做每一件事。这一章分为两个部分。第一个部分,我们将学到如何实现认证,第二部分我们将学到如何处理不同方向的通话。这一

老黑 1086

使用OpenSER构建电话通信系统——第六章(1)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!<h1 style="mso-line-height-alt:5.0pt;page-break-before:always;mso-list:none; tab-stops:21.0pt"><span lang="AR-SA" style="font-size:14.0pt;font-family:宋体; mso-ascii-font-fa

老黑 866

使用OpenSER构建电话通信系统——第七章(1)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!<h1 style="mso-line-height-alt:5.0pt;page-break-before:always;mso-list:none; tab-stops:21.0pt"><span lang="AR-SA" style="font-size:14.0pt;font-family:宋体; mso-ascii-font-fa

老黑 603

使用OpenSER构建电话通信系统——第三章(2)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!OpenSER v1.2 目录结构 <p class="MsoNormal" style="text-indent:21.0pt;line-height:22.0pt;mso-line-height-rule: exactly"><span lang="AR-SA" style="mso-bidi-font-size:10.5pt;f

老黑 501

使用OpenSER构建电话通信系统——第五章(2)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!安装 MySQL支持 <p class="MsoNormal" style="text-indent:21.0pt;line-height:22.0pt;mso-line-height-rule: exactly"><span lang="AR-SA" style="mso-bidi-font-size:10.5pt;font-fami

老黑 596

使用OpenSER构建电话通信系统——第四章(2)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!路由基础(Routing Basics) <p class="MsoNormal" style="text-indent:21.0pt;line-height:22.0pt;mso-line-height-rule: exactly"><span lang="AR-SA" style="mso-bidi-font-size:10.5pt

老黑 548

使用OpenSER构建电话通信系统——第八章(1)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!<h1 style="mso-line-height-alt:5.0pt;page-break-before:always;mso-list:none; tab-stops:21.0pt"><span lang="AR-SA" style="font-size:14.0pt;font-family:宋体; mso-ascii-font-fa

老黑 747

使用OpenSER构建电话通信系统——第七章(2)

注:以下文章如需转载,请注明所属作者,转载地址,谢谢!实验——用Asterisk做PSTN网关(Lab——Using Asterisk as a PSTN Gateway) <p class="MsoNormal" style="text-indent:21.0pt;line-height:22.0pt;mso-line-height-rule: exactly"><span lang="

老黑 512
上一篇: 使用OpenSER构建电话通信系统——第三章(2)
下一篇: 使用OpenSER构建电话通信系统——第四章(2)
老黑徒
博客等级 码龄23年 9粉丝 22原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值