为何要研究freepbx呢,之前研究了asterisk 17,当时创建分机,是在配置文件里面完成的。存在一个问题,那就是每次创建分机后,或者改动配置后,都需要重新启动应用,才能生效,这个会影响线上的业务。于是转而研究动态加载的方案,原生的asterisk方案里面有realtime技术,这个非常灵活,但是呢,就是因为太灵活,需要学习的东西,基本都是底层的,比较难一时半会弄清楚。
于是选择freepbx作为替代产品,freepbx产品是包装asterisk的一款产品,安装非常方便,配置是图形化的界面,每个配置项有相对明确的解释,支持国际化,想看那个语言就那个语言,当然,我们看中文就好了。
我这里安装采用的是ISO版本安装,从freepbx官网(https://www.freepbx.org/)下载的,V15版本。
安装非常方便,可以在一台裸的物理机上,像安装操作系统一样的安装,也可以通过VMware,基于虚拟机内安装。置于怎么安装,这里不做介绍,自己可以去网上找资料学习如何安装操作系统即可。我这里是基于VMware的虚拟机实现的安装。这里要介绍的是网络的问题,因为我再Win10的机器上,安装VMware,虚拟出了一个机器(2C2G30G),安装freepbx大概花了10分钟吧,不用费什么劲。
我的虚拟机和我的宿主机之间是通过NAT通信的,这里配置的过程,简单说下:
1)在freepbx的系统里面,将默认的IP分配机制由DHCP调整为static。为何这么做呢?这里主要考虑到方便后续建立分机号对应的AOR,Endpoint等对象数据的一致性,不至于出现机器IP变化了,而asterisk对应的pjsip的对象没有变,导致不必要的错误。
TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" #BOOTPROTO="DHCP" BOOTPROTO="static" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="eth0" UUID="b75f1df9-9b30-4e00-8f9a-5e96a07dd5e1" DEVICE="eth0" ONBOOT="yes" IPADDR="192.168.38.129" NETMASK="255.255.255.0" GATEWAY="192.168.38.2"
2)将Win10机器的对外上网的网卡共享给VMware8,方便虚拟机通过Win10宿主机访问外网
具体的操作流程,请参考图中的编号,体现了操作的顺序,完成4的步骤后,点击确认即可。
配置完后,在freepbx的虚拟机上,ping宿主机,以及从宿主机上ping下freepbx宿主机,若双方都能ping通,说明没有问题了。若有问题,ping不通,则可能需要将虚拟机的network重启一下(service network restart)。
或者将宿主机上的VMware8网络节点禁用启用一下,如下图(选择VMware8,点击鼠标右键,选择禁用,然后再启用,即可)
在完成了freepbx的安装和基本的网络配置后,我们就需要验证一下基于freepbx的简单实用了。这里,我创建两个分机10001和10002,这两个电话之间进行互打电话。
1)建分机
step1:
在“通信接口连接”里面选择“分机”,或者英文界面时,“connectivity”---》“Extensions”。
step2:
然后,选择上图中的1或者2任何一个入口,都可以进入进行pjsip的分机的创建。这里没有选择chan_sip,而是chan_pjsip,因为pjsip相对来说模块更独立,性能相对更好。
step3:
按照上图中的编号,填写相关的内容,最后按照6指示,提交保存。
step4:
创建完分机后,准备打电话,在yateclient上配置上10002这个分机,发现无法认证,认证过程失败。这个是为什么呢?
上面截图是freepbx后台显示的日志,认证失败
分析了很久,然后在freepbx的官方网站上看到操作步骤里面,每一步操作,只要涉及到数据配置的变更,都强调了点击“Apply Config”,即下图所示的红色的按钮。
我也点击了这个按钮后,然后再拨打电话,还的确就是这个问题,因为没有“更新配置”,页面上修改的配置,并没有触发后台系统的相关Endpoints的表结构中去让其生效,可以通过命令行,在系统查看当前系统的Endpoints的信息进行确认当前的Endpoints中是否有你想要的,若么有,就需要考虑这个“更新配置”按钮是不是没有点击。
其实,在freepbx的操作界面上,也可以查看当前asterisk系统下的pjsip的Endpoints信息的,请看下图(先点击1,然后在2对应的框中,输入“pjsip show endpoints”,最后回车即可):
2)打电话
在基于yateClient的工具进行拨号,在本地启用两个yate客户端,一个作为10001的终端,一个作为10002的终端。拨打电话界面效果如下图
从这个图,很清晰的可以看出,电话是从10002的分机拨打给10001这个分机的。此时,点击Accept按键,即可接通电话。(细心的小伙伴,可能会说,打电话和接电话怎么在一个截图里?呵呵,我这里是在模拟,在同一台机器上完成的通话)
再看看后面的日志,清晰看看通话的asterisk的逻辑:
[2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [10001@from-internal:1] GotoIf("PJSIP/10002-00000022", "1?ext-local,10001,1:followme-check,10001,1") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx_builtins.c: Goto (ext-local,10001,1) [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [10001@ext-local:1] Set("PJSIP/10002-00000022", "__RINGTIMER=15") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [10001@ext-local:2] Macro("PJSIP/10002-00000022", "exten-vm,novm,10001,1,1,1") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:1] Macro("PJSIP/10002-00000022", "user-callerid,") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:1] Set("PJSIP/10002-00000022", "TOUCH_MONITOR=1595524692.34") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:2] Set("PJSIP/10002-00000022", "AMPUSER=10002") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:3] GotoIf("PJSIP/10002-00000022", "0?report") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:4] ExecIf("PJSIP/10002-00000022", "1?Set(REALCALLERIDNUM=10002)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:5] Set("PJSIP/10002-00000022", "AMPUSER=10002") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:6] GotoIf("PJSIP/10002-00000022", "0?limit") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:7] Set("PJSIP/10002-00000022", "AMPUSERCIDNAME=10002") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:8] ExecIf("PJSIP/10002-00000022", "0?Set(__CIDMASQUERADING=TRUE)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:9] GotoIf("PJSIP/10002-00000022", "0?report") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:10] Set("PJSIP/10002-00000022", "AMPUSERCID=10002") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:11] Set("PJSIP/10002-00000022", "__DIAL_OPTIONS=HhTtr") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:12] Set("PJSIP/10002-00000022", "CALLERID(all)="10002" <10002>") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:13] ExecIf("PJSIP/10002-00000022", "0?Set(CALLERID(all)=10001)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:14] GotoIf("PJSIP/10002-00000022", "0?limit") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:15] ExecIf("PJSIP/10002-00000022", "0?Set(GROUP(concurrency_limit)=10002)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:16] ExecIf("PJSIP/10002-00000022", "0?Set(CHANNEL(language)=)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:17] NoOp("PJSIP/10002-00000022", "Macro Depth is 2") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:18] GotoIf("PJSIP/10002-00000022", "1?report2:macroerror") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx_builtins.c: Goto (macro-user-callerid,s,19) [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:19] GotoIf("PJSIP/10002-00000022", "0?continue") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:20] ExecIf("PJSIP/10002-00000022", "1?Set(__CALLEE_ACCOUNCODE=)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:21] Set("PJSIP/10002-00000022", "__TTL=64") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:22] GotoIf("PJSIP/10002-00000022", "1?continue") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx_builtins.c: Goto (macro-user-callerid,s,38) [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:38] Set("PJSIP/10002-00000022", "CALLERID(number)=10002") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:39] Set("PJSIP/10002-00000022", "CALLERID(name)=10002") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:40] GotoIf("PJSIP/10002-00000022", "0?cnum") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:41] Set("PJSIP/10002-00000022", "CDR(cnam)=10002") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:42] Set("PJSIP/10002-00000022", "CDR(cnum)=10002") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-user-callerid:43] Set("PJSIP/10002-00000022", "CHANNEL(language)=en") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:2] Set("PJSIP/10002-00000022", "RingGroupMethod=none") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:3] Set("PJSIP/10002-00000022", "__EXTTOCALL=10001") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:4] Set("PJSIP/10002-00000022", "__PICKUPMARK=10001") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:5] Set("PJSIP/10002-00000022", "RT=15") in new stack [2020-07-23 17:18:12] WARNING[41749][C-00000013] chan_sip.c: This function can only be used on SIP channels. [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:6] ExecIf("PJSIP/10002-00000022", "0?Macro(vm,novm,DIRECTDIAL,)") in new stack [2020-07-23 17:18:12] WARNING[41749][C-00000013] chan_sip.c: This function can only be used on SIP channels. [2020-07-23 17:18:12] WARNING[41749][C-00000013] chan_sip.c: This function can only be used on SIP channels. [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:7] ExecIf("PJSIP/10002-00000022", "0?MacroExit()") in new stack [2020-07-23 17:18:12] WARNING[41749][C-00000013] chan_sip.c: This function can only be used on SIP channels. [2020-07-23 17:18:12] WARNING[41749][C-00000013] chan_sip.c: This function can only be used on SIP channels. [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:8] ExecIf("PJSIP/10002-00000022", "0?Gosub(ext-intercom,*8010001,1())") in new stack [2020-07-23 17:18:12] WARNING[41749][C-00000013] chan_sip.c: This function can only be used on SIP channels. [2020-07-23 17:18:12] WARNING[41749][C-00000013] chan_sip.c: This function can only be used on SIP channels. [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:9] ExecIf("PJSIP/10002-00000022", "0?MacroExit()") in new stack [2020-07-23 17:18:12] WARNING[41749][C-00000013] chan_sip.c: This function can only be used on SIP channels. [2020-07-23 17:18:12] WARNING[41749][C-00000013] chan_sip.c: This function can only be used on SIP channels. [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:10] ExecIf("PJSIP/10002-00000022", "0?ChanSpy(PJSIP/10001,q)") in new stack [2020-07-23 17:18:12] WARNING[41749][C-00000013] chan_sip.c: This function can only be used on SIP channels. [2020-07-23 17:18:12] WARNING[41749][C-00000013] chan_sip.c: This function can only be used on SIP channels. [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:11] ExecIf("PJSIP/10002-00000022", "0?MacroExit()") in new stack [2020-07-23 17:18:12] WARNING[41749][C-00000013] chan_sip.c: This function can only be used on SIP channels. [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:12] ExecIf("PJSIP/10002-00000022", "0?Macro(vm,novm,DIRECTDIAL,)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:13] ExecIf("PJSIP/10002-00000022", "0?MacroExit()") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:14] ExecIf("PJSIP/10002-00000022", "0?Gosub(ext-intercom,*8010001,1())") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:15] ExecIf("PJSIP/10002-00000022", "0?MacroExit()") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:16] ExecIf("PJSIP/10002-00000022", "0?ChanSpy(PJSIP/10001,q)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:17] ExecIf("PJSIP/10002-00000022", "0?MacroExit()") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:18] Gosub("PJSIP/10002-00000022", "sub-record-check,s,1(exten,10001,dontcare)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:1] GotoIf("PJSIP/10002-00000022", "0?initialized") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:2] Set("PJSIP/10002-00000022", "__REC_STATUS=INITIALIZED") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:3] Set("PJSIP/10002-00000022", "NOW=1595524692") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:4] Set("PJSIP/10002-00000022", "__DAY=23") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:5] Set("PJSIP/10002-00000022", "__MONTH=07") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:6] Set("PJSIP/10002-00000022", "__YEAR=2020") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:7] Set("PJSIP/10002-00000022", "__TIMESTR=20200723-171812") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:8] Set("PJSIP/10002-00000022", "__FROMEXTEN=10002") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:9] Set("PJSIP/10002-00000022", "__MON_FMT=wav") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:10] NoOp("PJSIP/10002-00000022", "Recordings initialized") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:11] ExecIf("PJSIP/10002-00000022", "0?Set(ARG3=dontcare)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:12] Set("PJSIP/10002-00000022", "REC_POLICY_MODE_SAVE=") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:13] ExecIf("PJSIP/10002-00000022", "0?Set(REC_STATUS=NO)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:14] GotoIf("PJSIP/10002-00000022", "5?checkaction") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx_builtins.c: Goto (sub-record-check,s,17) [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-record-check:17] GotoIf("PJSIP/10002-00000022", "1?sub-record-check,exten,1") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx_builtins.c: Goto (sub-record-check,exten,1) [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [exten@sub-record-check:1] NoOp("PJSIP/10002-00000022", "Exten Recording Check between 10002 and 10001") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [exten@sub-record-check:2] Set("PJSIP/10002-00000022", "CALLTYPE=internal") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [exten@sub-record-check:3] ExecIf("PJSIP/10002-00000022", "0?Set(CALLTYPE=)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [exten@sub-record-check:4] Set("PJSIP/10002-00000022", "CALLEE=dontcare") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [exten@sub-record-check:5] ExecIf("PJSIP/10002-00000022", "0?Set(CALLEE=dontcare)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [exten@sub-record-check:6] GotoIf("PJSIP/10002-00000022", "0?callee") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [exten@sub-record-check:7] GotoIf("PJSIP/10002-00000022", "1?caller") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx_builtins.c: Goto (sub-record-check,exten,13) [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [exten@sub-record-check:13] Set("PJSIP/10002-00000022", "RECMODE=dontcare") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [exten@sub-record-check:14] ExecIf("PJSIP/10002-00000022", "0?Set(RECMODE=dontcare)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [exten@sub-record-check:15] ExecIf("PJSIP/10002-00000022", "1?Set(RECMODE=dontcare)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [exten@sub-record-check:16] Gosub("PJSIP/10002-00000022", "recordcheck,1(dontcare,internal,10001)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [recordcheck@sub-record-check:1] NoOp("PJSIP/10002-00000022", "Starting recording check against dontcare") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [recordcheck@sub-record-check:2] Goto("PJSIP/10002-00000022", "dontcare") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx_builtins.c: Goto (sub-record-check,recordcheck,3) [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [recordcheck@sub-record-check:3] Return("PJSIP/10002-00000022", "") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [exten@sub-record-check:17] Return("PJSIP/10002-00000022", "") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:19] GotoIf("PJSIP/10002-00000022", "1?macrodial") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx_builtins.c: Goto (macro-exten-vm,s,25) [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:25] GosubIf("PJSIP/10002-00000022", "0?clrheader,1()") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-exten-vm:26] Macro("PJSIP/10002-00000022", "dial-one,15,HhTtr,10001") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:1] Set("PJSIP/10002-00000022", "DEXTEN=10001") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:2] Set("PJSIP/10002-00000022", "__CRM_SOURCE=10002") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:3] ExecIf("PJSIP/10002-00000022", "0?Set(__EXTTOCALL=10001)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:4] Set("PJSIP/10002-00000022", "DIALSTATUS_CW=") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:5] GosubIf("PJSIP/10002-00000022", "0?screen,1()") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:6] GosubIf("PJSIP/10002-00000022", "0?cf,1()") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:7] GotoIf("PJSIP/10002-00000022", "1?skip1") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx_builtins.c: Goto (macro-dial-one,s,10) [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:10] GotoIf("PJSIP/10002-00000022", "0?nodial") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:11] GotoIf("PJSIP/10002-00000022", "0?continue") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:12] Set("PJSIP/10002-00000022", "EXTHASCW=ENABLED") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:13] GotoIf("PJSIP/10002-00000022", "0?next1:cwinusebusy") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx_builtins.c: Goto (macro-dial-one,s,25) [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:25] GotoIf("PJSIP/10002-00000022", "0?next3:continue") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx_builtins.c: Goto (macro-dial-one,s,27) [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:27] GotoIf("PJSIP/10002-00000022", "0?nodial") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:28] GosubIf("PJSIP/10002-00000022", "1?dstring,1():dlocal,1()") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:1] Set("PJSIP/10002-00000022", "DSTRING=") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:2] Set("PJSIP/10002-00000022", "DEVICES=10001") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:3] ExecIf("PJSIP/10002-00000022", "0?Return()") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:4] ExecIf("PJSIP/10002-00000022", "0?Set(DEVICES=0001)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:5] Set("PJSIP/10002-00000022", "LOOPCNT=1") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:6] Set("PJSIP/10002-00000022", "ITER=1") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:7] Set("PJSIP/10002-00000022", "THISDIAL=PJSIP/10001") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:8] GotoIf("PJSIP/10002-00000022", "0?docheck") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:9] NoOp("PJSIP/10002-00000022", "Debug: Found PJSIP Destination PJSIP/10001") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:10] GotoIf("PJSIP/10002-00000022", "0?doset") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:11] NoOp("PJSIP/10002-00000022", "Debug: Updating PJSIP Destination with PJSIP_DIAL_CONTACTS") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:12] Set("PJSIP/10002-00000022", "THISDIAL=PJSIP/10001/sip:10001@192.168.38.132:51361") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:13] ExecIf("PJSIP/10002-00000022", "0?Set(DIALSTATUS=CHANUNAVAIL)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:14] GotoIf("PJSIP/10002-00000022", "0?skipset") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:15] Set("PJSIP/10002-00000022", "DSTRING=PJSIP/10001/sip:10001@192.168.38.132:51361&") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:16] Set("PJSIP/10002-00000022", "ITER=2") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:17] GotoIf("PJSIP/10002-00000022", "0?begin") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:18] ExecIf("PJSIP/10002-00000022", "0?Return()") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:19] Set("PJSIP/10002-00000022", "DSTRING=PJSIP/10001/sip:10001@192.168.38.132:51361") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [dstring@macro-dial-one:20] Return("PJSIP/10002-00000022", "") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:29] GotoIf("PJSIP/10002-00000022", "0?nodial") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:30] GotoIf("PJSIP/10002-00000022", "0?skiptrace") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:31] GosubIf("PJSIP/10002-00000022", "1?ctset,1():ctclear,1()") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [ctset@macro-dial-one:1] Set("PJSIP/10002-00000022", "DB(CALLTRACE/10001)=10002") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [ctset@macro-dial-one:2] Return("PJSIP/10002-00000022", "") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:32] Set("PJSIP/10002-00000022", "D_OPTIONS=HhTtr") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:33] GosubIf("PJSIP/10002-00000022", "0?func-set-sipheader,s,1(Alert-Info,)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:34] NoOp("PJSIP/10002-00000022", "Blind Transfer: , Attended Transfer: , User: 10002, Alert Info: ") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:35] ExecIf("PJSIP/10002-00000022", "1?Set(ALERT_INFO=)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:36] ExecIf("PJSIP/10002-00000022", "0?Set(ALERT_INFO=)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:37] ExecIf("PJSIP/10002-00000022", "0?Set(ALERT_INFO=)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:38] ExecIf("PJSIP/10002-00000022", "0?Set(ALERT_INFO=Normal;volume=)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:39] ExecIf("PJSIP/10002-00000022", "0?Set(ALERT_INFO=Normal;volume=)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:40] GosubIf("PJSIP/10002-00000022", "0?func-set-sipheader,s,1(Alert-Info,)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:41] ExecIf("PJSIP/10002-00000022", "0?Set(CHANNEL(musicclass)=)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:42] GosubIf("PJSIP/10002-00000022", "0?qwait,1()") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:43] Set("PJSIP/10002-00000022", "__CWIGNORE=") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:44] Set("PJSIP/10002-00000022", "__KEEPCID=TRUE") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:45] GotoIf("PJSIP/10002-00000022", "0?usegoto,1") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:46] GotoIf("PJSIP/10002-00000022", "0?godial") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:47] Gosub("PJSIP/10002-00000022", "sub-presencestate-display,s,1(10001)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@sub-presencestate-display:1] Goto("PJSIP/10002-00000022", "state-not_set,1") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx_builtins.c: Goto (sub-presencestate-display,state-not_set,1) [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [state-not_set@sub-presencestate-display:1] Set("PJSIP/10002-00000022", "PRESENCESTATE_DISPLAY=") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [state-not_set@sub-presencestate-display:2] Return("PJSIP/10002-00000022", "") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:48] Set("PJSIP/10002-00000022", "CONNECTEDLINE(name,i)=10001") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:49] Set("PJSIP/10002-00000022", "CONNECTEDLINE(num)=10001") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:50] Set("PJSIP/10002-00000022", "D_OPTIONS=HhTtr") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:51] Macro("PJSIP/10002-00000022", "dialout-one-predial-hook,") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dialout-one-predial-hook:1] MacroExit("PJSIP/10002-00000022", "") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:52] ExecIf("PJSIP/10002-00000022", "0?Set(D_OPTIONS=HhtrI)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:53] ExecIf("PJSIP/10002-00000022", "0?Set(CWRING=r(callwaiting)):Set(CWRING=)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:54] NoOp("PJSIP/10002-00000022", "") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:55] ExecIf("PJSIP/10002-00000022", "0?Set(D_OPTIONS=HhTtrg)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@macro-dial-one:56] Dial("PJSIP/10002-00000022", "PJSIP/10001/sip:10001@192.168.38.132:51361,15,HhTtrb(func-apply-sipheaders^s^1)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] app_stack.c: PJSIP/10001-00000023 Internal Gosub(func-apply-sipheaders,s,1) start [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@func-apply-sipheaders:1] ExecIf("PJSIP/10001-00000023", "0?Set(CHANNEL(hangup_handler_push)=crm-hangup,s,1)") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@func-apply-sipheaders:2] NoOp("PJSIP/10001-00000023", "Applying SIP Headers to channel PJSIP/10001-00000023") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@func-apply-sipheaders:3] Set("PJSIP/10001-00000023", "TECH=PJSIP") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@func-apply-sipheaders:4] Set("PJSIP/10001-00000023", "SIPHEADERKEYS=") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@func-apply-sipheaders:5] While("PJSIP/10001-00000023", "0") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] app_while.c: Jumping to priority 13 [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] pbx.c: Executing [s@func-apply-sipheaders:14] Return("PJSIP/10001-00000023", "") in new stack [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] app_stack.c: Spawn extension (from-internal, 10001, 1) exited non-zero on 'PJSIP/10001-00000023' [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] app_stack.c: PJSIP/10001-00000023 Internal Gosub(func-apply-sipheaders,s,1) complete GOSUB_RETVAL= [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] app_dial.c: Called PJSIP/10001/sip:10001@192.168.38.132:51361 [2020-07-23 17:18:12] VERBOSE[10034] netsock2.c: Using SIP RTP Audio TOS bits 184 [2020-07-23 17:18:12] VERBOSE[10034] netsock2.c: Using SIP RTP Audio CoS mark 5 [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] app_dial.c: PJSIP/10001-00000023 is ringing [2020-07-23 17:18:12] VERBOSE[41749][C-00000013] app_dial.c: PJSIP/10001-00000023 is ringing
好了,到此,freepbx的first call成功完成,是不是还是比较简单的?其实,freepbx有很多需要深入研究的,我这才刚开始,希望和博友一起探讨。