﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-八叶草</title><link>http://www.cppblog.com/byc/</link><description>学习资料记录</description><language>zh-cn</language><lastBuildDate>Sun, 05 Apr 2026 17:27:36 GMT</lastBuildDate><pubDate>Sun, 05 Apr 2026 17:27:36 GMT</pubDate><ttl>60</ttl><item><title>本博客不在更新， 欢迎访问 www.ddrj.com</title><link>http://www.cppblog.com/byc/archive/2013/04/26/199739.html</link><dc:creator>八叶草</dc:creator><author>八叶草</author><pubDate>Fri, 26 Apr 2013 11:42:00 GMT</pubDate><guid>http://www.cppblog.com/byc/archive/2013/04/26/199739.html</guid><wfw:comment>http://www.cppblog.com/byc/comments/199739.html</wfw:comment><comments>http://www.cppblog.com/byc/archive/2013/04/26/199739.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/byc/comments/commentRss/199739.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/byc/services/trackbacks/199739.html</trackback:ping><description><![CDATA[关于 asterisk(elastix,freepbx) freeswitch 呼叫中心 等方面的信息欢迎访问<a target="_self" href="http://www.ddrj.com"> www.ddrj.com</a><img src ="http://www.cppblog.com/byc/aggbug/199739.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/byc/" target="_blank">八叶草</a> 2013-04-26 19:42 <a href="http://www.cppblog.com/byc/archive/2013/04/26/199739.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>freepbc 呼出等待时间修改</title><link>http://www.cppblog.com/byc/archive/2013/04/17/199505.html</link><dc:creator>八叶草</dc:creator><author>八叶草</author><pubDate>Wed, 17 Apr 2013 03:17:00 GMT</pubDate><guid>http://www.cppblog.com/byc/archive/2013/04/17/199505.html</guid><wfw:comment>http://www.cppblog.com/byc/comments/199505.html</wfw:comment><comments>http://www.cppblog.com/byc/archive/2013/04/17/199505.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/byc/comments/commentRss/199505.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/byc/services/trackbacks/199505.html</trackback:ping><description><![CDATA[modules\core\functions.inc.php<br />查找 macro-dialout-trunk<br />然后<br />&nbsp;$ext-&gt;add($context, $exten, '', new ext_dial('${OUT_${DIAL_TRUNK}}/${OUTNUM}', '300,${DIAL_TRUNK_OPTIONS}'));&nbsp; // Regular Trunk Dial<br /><br />&nbsp;&nbsp;$ext-&gt;add($context, $exten, 'skipoutnum', new ext_dial('${pre_num:4}${the_num}${post_num}', '300,${DIAL_TRUNK_OPTIONS}'));<br /><br />300 改成你自己设置的时间 <img src ="http://www.cppblog.com/byc/aggbug/199505.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/byc/" target="_blank">八叶草</a> 2013-04-17 11:17 <a href="http://www.cppblog.com/byc/archive/2013/04/17/199505.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>proxmox ve 2.2 elastix2.3模板制作</title><link>http://www.cppblog.com/byc/archive/2012/11/06/194720.html</link><dc:creator>八叶草</dc:creator><author>八叶草</author><pubDate>Tue, 06 Nov 2012 08:59:00 GMT</pubDate><guid>http://www.cppblog.com/byc/archive/2012/11/06/194720.html</guid><wfw:comment>http://www.cppblog.com/byc/comments/194720.html</wfw:comment><comments>http://www.cppblog.com/byc/archive/2012/11/06/194720.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/byc/comments/commentRss/194720.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/byc/services/trackbacks/194720.html</trackback:ping><description><![CDATA[安装好proxmox ve 2.2<br />ssh 到 proxmox ve <br /><br />apt-get -y update<br />apt-get -y makedev<br />apt-get -y install build-essential make pve-headers-`uname -r`<br />cd /usr/src/<br />wget <a class="external free" title="http://downloads.digium.com/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz" href="http://downloads.digium.com/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz" rel="nofollow">http://downloads.digium.com/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz</a><br />tar zxfv dahdi-linux-complete-current.tar.gz<br />cd dahdi-linux-complete-*<br />make all<br />make install<br />make config<br />mkdir /etc/asterisk<br />service dahdi start<br />dahdi_genconf<br />vi /etc/dahdi/modules 全部加#号注释<br /><br />sed -i 's|ipt_REJECT ipt_tos ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length|ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp|' /etc/vz/vz.conf<br />/etc/init.d/vz restart<br /><br />//禁用ipv6<br />/boot/grub/grub.cfg 中 linux&nbsp;&nbsp; /vmlinuz-2.6.32-16-pve root=/dev/mapper/pve-root ro&nbsp; quiet 替换成 <font color="#000000" face="Verdana">linux&nbsp;&nbsp; /vmlinuz-2.6.32-16-pve root=/dev/mapper/pve-root ro&nbsp; ipv6.disable=1 quiet</font><br /><br /><br />在elastix2.3机器上 参考 <a href="http://wiki.openvz.org/Creating_a_CentOS_5.0_Template">http://wiki.openvz.org/Creating_a_CentOS_5.0_Template</a><br /><br />
<p>First, create a file called <strong>/tmp/exclude</strong> and add the following lines to it:</p>
<p>.bash_history</p>
<p>lost+found</p>
<p>/dev/*</p>
<p>/mnt/*</p>
<p>/tmp/*</p>
<p>/proc/*</p>
<p>/sys/*</p>
<p>/usr/src/*<br /><br />&nbsp;<strong>tar --numeric-owner -czvf /tmp/centos-5.7-x86_64-elasitx_orig-image.tar.gz -X /tmp/exclude /<br /></strong></p>
<ol><li>where &lt;<strong>ARCH</strong>&gt; represents the system architecture (<strong>i386</strong> or</li><li><strong>x86_64</strong>) and &lt;<strong>DISTRO</strong>&gt; represents the distribution (default, minimal, etc.).</li></ol>
<p>scp <strong>/tmp/centos-5.7-x86_64-elasitx_orig-image.tar.gz </strong>root@ip:/var/lib/vz/template/iso<br /><br />回到proxmox ve 机器 使用 web以<strong>centos-5.7-x86_64-elasitx_orig-image </strong>为模板创建vt虚拟机&nbsp; 假设 vm id 为 100<br />ssh 到 proxmox ve<br />cd /var/lib/vz/private/100<br />Edit the <strong>etc/inittab</strong> file and comment out the lines that respawn <strong>/sbin/mingetty</strong> on <strong>tty1</strong> through <strong>tty6</strong>. Just put a # at the beginning of the line. <br /><br />在 etc/inittab 文件最后面加入 <br />1:2345:respawn:/sbin/agetty tty1 38400 linux<br /><br />Remove the <strong>etc/mtab</strong> file and then create a symbolic link by typing <strong>ln -s /proc/mounts etc/mtab</strong><br />Remove all of the lines from <strong>etc/fstab</strong> except for the line that mounts <strong>/dev/pts</strong><br />Edit <strong>etc/rc.d/rc.sysinit</strong> and comment out the line that starts <strong>/sbin/start_udev</strong> by placing a # at the beginning of the line.<br /><br />mknod dev/ptmx c 5 2 <br />mkdir dev/pts</p>
<p>cd dev<br />/sbin/MAKEDEV ttyp ptyp<br />cd ../</p>
<p>mknod dev/null c 1 3</p>
<p>mknod -m 644 dev/random c 1 8</p>
<p>mknod dev/urandom c 1 9<br />mknod dev/tty9 c 4 9<br /><br />Create the <strong>var/lock/rpm</strong> folder.<br /><br />Edit <strong>etc/sysconfig/network</strong> and set <strong>NETWORKING_IPV6</strong> to <strong>no</strong>.<br />Add the following lines to <strong>etc/modprobe.d/blacklist.conf</strong>:<br />blacklist ipv6 </p>
<p>blacklist net-pf-10<br />&nbsp;</p>
<p>Disable any physical NICs by modifying the <strong>etc/sysconfig/network-scripts/ifcfg-ethX</strong> files (where <strong>X</strong> is the interface number starting from <strong>0</strong>) and setting <strong>ONBOOT</strong> to <strong>no</strong>.</p>
<p>Check etc/sysconfig/init to see if PROMPT=yes, and then change to no. Otherwise when startup init script rc will enter interactive mode and wait there forever</p>
<p>&nbsp;</p>
<p>vzctl set 100 --devnodes dahdi/pseudo:rw --save<br />vzctl start 100<br />vzctl enter 100<br />chkconfig haldaemon off<br />chkconfig dahdi off<br />chkconfig wanrouter off<br /><br />rm -rf /etc/init.d/dahdi<br />rm -rf /etc/init.d/wanrouter<br /><br />chkconfig acpid off<br />chkconfig kudzu off<br /><br />chkconfig xfs off <br />chkconfig rpcidmapd off <br />chkconfig rpcgssd off <br />chkconfig nfslock off<br />chkconfig mdmonitor off<br />chkconfig ip6tables off<br /><br />exit<br />cd /var/lib/vz/private/100<br />tar -czvf /var/lib/vz/template/cache/centos-5-x86_64-elasitx.tar.gz ./<br /><br /><br /><br /><br /><br /><br />&nbsp;</p><img src ="http://www.cppblog.com/byc/aggbug/194720.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/byc/" target="_blank">八叶草</a> 2012-11-06 16:59 <a href="http://www.cppblog.com/byc/archive/2012/11/06/194720.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>移除bzImage文件中'1f8b08'之前内容，存为gz文件</title><link>http://www.cppblog.com/byc/archive/2012/10/29/194021.html</link><dc:creator>八叶草</dc:creator><author>八叶草</author><pubDate>Mon, 29 Oct 2012 08:02:00 GMT</pubDate><guid>http://www.cppblog.com/byc/archive/2012/10/29/194021.html</guid><wfw:comment>http://www.cppblog.com/byc/comments/194021.html</wfw:comment><comments>http://www.cppblog.com/byc/archive/2012/10/29/194021.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/byc/comments/commentRss/194021.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/byc/services/trackbacks/194021.html</trackback:ping><description><![CDATA[<p>&nbsp;</p>
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /><span style="color: #000000">#include&nbsp;</span><span style="color: #000000">&lt;</span><span style="color: #000000">stdlib.h</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />#include&nbsp;</span><span style="color: #000000">&lt;</span><span style="color: #000000">stdio.h</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;_tmain(</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;argc,&nbsp;_TCHAR</span><span style="color: #000000">*</span><span style="color: #000000">&nbsp;argv[])<br /><img id="Codehighlighter1_77_1249_Open_Image" onclick="this.style.display='none'; Codehighlighter1_77_1249_Open_Text.style.display='none'; Codehighlighter1_77_1249_Closed_Image.style.display='inline'; Codehighlighter1_77_1249_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_77_1249_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_77_1249_Closed_Text.style.display='none'; Codehighlighter1_77_1249_Open_Image.style.display='inline'; Codehighlighter1_77_1249_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_77_1249_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_77_1249_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;FILE</span><span style="color: #000000">*</span><span style="color: #000000">&nbsp;r</span><span style="color: #000000">=</span><span style="color: #000000">fopen(</span><span style="color: #000000">"</span><span style="color: #000000">linux26</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">"</span><span style="color: #000000">rb</span><span style="color: #000000">"</span><span style="color: #000000">);<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;FILE</span><span style="color: #000000">*</span><span style="color: #000000">&nbsp;w</span><span style="color: #000000">=</span><span style="color: #000000">fopen(</span><span style="color: #000000">"</span><span style="color: #000000">linux26.gz</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">"</span><span style="color: #000000">wb</span><span style="color: #000000">"</span><span style="color: #000000">);<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;s</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">for</span><span style="color: #000000">(;;)<br /><img id="Codehighlighter1_181_1206_Open_Image" onclick="this.style.display='none'; Codehighlighter1_181_1206_Open_Text.style.display='none'; Codehighlighter1_181_1206_Closed_Image.style.display='inline'; Codehighlighter1_181_1206_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_181_1206_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_181_1206_Closed_Text.style.display='none'; Codehighlighter1_181_1206_Open_Image.style.display='inline'; Codehighlighter1_181_1206_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_181_1206_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_181_1206_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;</span><span style="color: #0000ff">char</span><span style="color: #000000">&nbsp;c;<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;l</span><span style="color: #000000">=</span><span style="color: #000000">fread(</span><span style="color: #000000">&amp;</span><span style="color: #000000">c,</span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">1</span><span style="color: #000000">,r);<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(l</span><span style="color: #000000">&gt;=</span><span style="color: #000000">1</span><span style="color: #000000">)<br /><img id="Codehighlighter1_264_1148_Open_Image" onclick="this.style.display='none'; Codehighlighter1_264_1148_Open_Text.style.display='none'; Codehighlighter1_264_1148_Closed_Image.style.display='inline'; Codehighlighter1_264_1148_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_264_1148_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_264_1148_Closed_Text.style.display='none'; Codehighlighter1_264_1148_Open_Image.style.display='inline'; Codehighlighter1_264_1148_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_264_1148_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_264_1148_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(s</span><span style="color: #000000">==</span><span style="color: #000000">3</span><span style="color: #000000">)<br /><img id="Codehighlighter1_299_347_Open_Image" onclick="this.style.display='none'; Codehighlighter1_299_347_Open_Text.style.display='none'; Codehighlighter1_299_347_Closed_Image.style.display='inline'; Codehighlighter1_299_347_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_299_347_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_299_347_Closed_Text.style.display='none'; Codehighlighter1_299_347_Open_Image.style.display='inline'; Codehighlighter1_299_347_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_299_347_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_299_347_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fwrite(</span><span style="color: #000000">&amp;</span><span style="color: #000000">c,</span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">1</span><span style="color: #000000">,w);<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">else</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(s</span><span style="color: #000000">==</span><span style="color: #000000">2</span><span style="color: #000000">)<br /><img id="Codehighlighter1_387_770_Open_Image" onclick="this.style.display='none'; Codehighlighter1_387_770_Open_Text.style.display='none'; Codehighlighter1_387_770_Closed_Image.style.display='inline'; Codehighlighter1_387_770_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_387_770_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_387_770_Closed_Text.style.display='none'; Codehighlighter1_387_770_Open_Image.style.display='inline'; Codehighlighter1_387_770_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_387_770_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_387_770_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(c</span><span style="color: #000000">==</span><span style="color: #000000">0x08</span><span style="color: #000000">)<br /><img id="Codehighlighter1_433_674_Open_Image" onclick="this.style.display='none'; Codehighlighter1_433_674_Open_Text.style.display='none'; Codehighlighter1_433_674_Closed_Image.style.display='inline'; Codehighlighter1_433_674_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_433_674_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_433_674_Closed_Text.style.display='none'; Codehighlighter1_433_674_Open_Image.style.display='inline'; Codehighlighter1_433_674_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_433_674_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_433_674_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c</span><span style="color: #000000">=</span><span style="color: #000000">0x1f</span><span style="color: #000000">;<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fwrite(</span><span style="color: #000000">&amp;</span><span style="color: #000000">c,</span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">1</span><span style="color: #000000">,w);<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c</span><span style="color: #000000">=</span><span style="color: #000000">0x8b</span><span style="color: #000000">;<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fwrite(</span><span style="color: #000000">&amp;</span><span style="color: #000000">c,</span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">1</span><span style="color: #000000">,w);<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c</span><span style="color: #000000">=</span><span style="color: #000000">0x08</span><span style="color: #000000">;<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fwrite(</span><span style="color: #000000">&amp;</span><span style="color: #000000">c,</span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">1</span><span style="color: #000000">,w);<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000">++</span><span style="color: #000000">s;<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">else</span><span style="color: #000000"><br /><img id="Codehighlighter1_713_756_Open_Image" onclick="this.style.display='none'; Codehighlighter1_713_756_Open_Text.style.display='none'; Codehighlighter1_713_756_Closed_Image.style.display='inline'; Codehighlighter1_713_756_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_713_756_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_713_756_Closed_Text.style.display='none'; Codehighlighter1_713_756_Open_Image.style.display='inline'; Codehighlighter1_713_756_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_713_756_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_713_756_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">else</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(s</span><span style="color: #000000">==</span><span style="color: #000000">1</span><span style="color: #000000">)<br /><img id="Codehighlighter1_810_995_Open_Image" onclick="this.style.display='none'; Codehighlighter1_810_995_Open_Text.style.display='none'; Codehighlighter1_810_995_Closed_Image.style.display='inline'; Codehighlighter1_810_995_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_810_995_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_810_995_Closed_Text.style.display='none'; Codehighlighter1_810_995_Open_Image.style.display='inline'; Codehighlighter1_810_995_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_810_995_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_810_995_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(c</span><span style="color: #000000">==</span><span style="color: #000000">0x8b</span><span style="color: #000000">)<br /><img id="Codehighlighter1_856_899_Open_Image" onclick="this.style.display='none'; Codehighlighter1_856_899_Open_Text.style.display='none'; Codehighlighter1_856_899_Closed_Image.style.display='inline'; Codehighlighter1_856_899_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_856_899_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_856_899_Closed_Text.style.display='none'; Codehighlighter1_856_899_Open_Image.style.display='inline'; Codehighlighter1_856_899_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_856_899_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_856_899_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000">++</span><span style="color: #000000">s;<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">else</span><span style="color: #000000"><br /><img id="Codehighlighter1_938_981_Open_Image" onclick="this.style.display='none'; Codehighlighter1_938_981_Open_Text.style.display='none'; Codehighlighter1_938_981_Closed_Image.style.display='inline'; Codehighlighter1_938_981_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_938_981_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_938_981_Closed_Text.style.display='none'; Codehighlighter1_938_981_Open_Image.style.display='inline'; Codehighlighter1_938_981_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_938_981_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_938_981_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">else</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(s</span><span style="color: #000000">==</span><span style="color: #000000">0</span><span style="color: #000000">)<br /><img id="Codehighlighter1_1035_1138_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1035_1138_Open_Text.style.display='none'; Codehighlighter1_1035_1138_Closed_Image.style.display='inline'; Codehighlighter1_1035_1138_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1035_1138_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1035_1138_Closed_Text.style.display='none'; Codehighlighter1_1035_1138_Open_Image.style.display='inline'; Codehighlighter1_1035_1138_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1035_1138_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1035_1138_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(c</span><span style="color: #000000">==</span><span style="color: #000000">0x1f</span><span style="color: #000000">)<br /><img id="Codehighlighter1_1081_1124_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1081_1124_Open_Text.style.display='none'; Codehighlighter1_1081_1124_Closed_Image.style.display='inline'; Codehighlighter1_1081_1124_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1081_1124_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1081_1124_Closed_Text.style.display='none'; Codehighlighter1_1081_1124_Open_Image.style.display='inline'; Codehighlighter1_1081_1124_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1081_1124_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1081_1124_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000">++</span><span style="color: #000000">s;<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">else</span><span style="color: #000000"><br /><img id="Codehighlighter1_1171_1200_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1171_1200_Open_Text.style.display='none'; Codehighlighter1_1171_1200_Closed_Image.style.display='inline'; Codehighlighter1_1171_1200_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1171_1200_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1171_1200_Closed_Text.style.display='none'; Codehighlighter1_1171_1200_Open_Image.style.display='inline'; Codehighlighter1_1171_1200_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1171_1200_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1171_1200_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">break</span><span style="color: #000000">;<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;fclose(w);<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;fclose(r);<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">0</span><span style="color: #000000">;<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif"  alt="" />}</span></span></div>
<p>&nbsp;</p><img src ="http://www.cppblog.com/byc/aggbug/194021.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/byc/" target="_blank">八叶草</a> 2012-10-29 16:02 <a href="http://www.cppblog.com/byc/archive/2012/10/29/194021.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转 a2billing</title><link>http://www.cppblog.com/byc/archive/2012/10/11/193154.html</link><dc:creator>八叶草</dc:creator><author>八叶草</author><pubDate>Thu, 11 Oct 2012 02:56:00 GMT</pubDate><guid>http://www.cppblog.com/byc/archive/2012/10/11/193154.html</guid><wfw:comment>http://www.cppblog.com/byc/comments/193154.html</wfw:comment><comments>http://www.cppblog.com/byc/archive/2012/10/11/193154.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/byc/comments/commentRss/193154.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/byc/services/trackbacks/193154.html</trackback:ping><description><![CDATA[A2Billing 安裝篇 <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk/Addons/A2Billing_%e5%ae%89%e8%a3%9d%e7%af%87">http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk/Addons/A2Billing_%e5%ae%89%e8%a3%9d%e7%af%87</a><br /><br />A2Billing 管理篇 
<div class="pageStatus">
<div id="sessionMsg">
<div class="inner">
<ul></ul></div></div></div>
<div class="PageDW-VoIPIPPBXIPPBXAsteriskIPPBXAddonsA2Billing">
<div id="page-top">
<div id="pageToc">
<div class="pageToc">
<h5><a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87">http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87</a></h5>
<ol style="list-style-type: none; padding-left: 0px; margin-left: 0px"><li><span>1.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#.e5.89.8d.e8.a8.80" rel="internal">前言</a></li><li><span>2.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#.e5.88.9d.e5.a7.8b.e5.8c.96.e8.a8.ad.e5.ae.9a" rel="internal">初始化設定</a></li><li><span>3.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#.e6.87.89.e7.94.a8.e4.b8.80.ef.bc.9a.e5.9c.8b.e9.9a.9b.e9.9b.bb.e8.a9.b1.e5.8d.a1.e6.a8.a1.e5.bc.8f" rel="internal">應用一：國際電話卡模式</a></li><li><span>4.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#.e6.87.89.e7.94.a8.e4.ba.8c.ef.bc.9aDID_.e8.bd.89.e6.8e.a5.e6.a5.ad.e5.8b.99" rel="internal">應用二：DID 轉接業務</a></li><li><span>5.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#.e6.87.89.e7.94.a8.e4.b8.89.ef.bc.9a.e9.a0.90.e4.bb.98.e5.88.b6.e3.80.81.e6.9c.88.e4.bb.98.e5.88.b6.e6.9c.83.e5.93.a1.e6.a8.a1.e5.bc.8f" rel="internal">應用三：預付制、月付制會員模式</a></li><li><span>6.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#.e6.87.89.e7.94.a8.e5.9b.9b.ef.bc.9a.e6.95.b4.e5.90.88_FreePBX_.e7.9a.84.e6.87.89.e7.94.a8" rel="internal">應用四：整合 FreePBX 的應用</a></li><li><span>7.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#.e6.87.89.e7.94.a8.e4.ba.94.ef.bc.9aCaller_ID_.e8.aa.8d.e8.ad.89.e6.a8.a1.e5.bc.8f" rel="internal">應用五：Caller ID 認證模式</a></li><li><span>8.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#F.A.Q" rel="internal">F.A.Q</a> 
<ol style="list-style-type: none; padding-left: 15px; margin-left: 0px"><li><span>8.1.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#Q.3a.e5.a6.82.e4.bd.95.e5.a4.a7.e9.87.8f.e5.88.aa.e9.99.a4_Customers.3f" rel="internal">Q:如何大量刪除 Customers?</a></li><li><span>8.2.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#Q.3a.e5.a6.82.e4.bd.95.e5.a4.a7.e9.87.8f.e5.88.aa.e9.99.a4_VoIP_Settings.3f" rel="internal">Q:如何大量刪除 VoIP Settings?</a></li><li><span>8.3.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#Q.3a.e5.a6.82.e4.bd.95.e8.ae.8a.e6.9b.b4.e7.b3.bb.e7.b5.b1.e9.a0.90.e8.a8.ad.e5.b9.a3.e5.88.a5_USD" rel="internal">Q:如何變更系統預設幣別 USD</a></li><li><span>8.4.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#Q.3a.e5.8c.af.e5.85.a5_ratecard_.e6.99.82.e7.b8.bd.e6.98.af.e5.87.ba.e7.8f.be.e9.8c.af.e8.aa.a4_ERROR.3a_file_type_is_not_allowed.3a_application.2fforce-download" rel="internal">Q:匯入 ratecard 時總是出現錯誤 ERROR: file type is not allowed: application/force-download</a></li><li><span>8.5.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#.e7.9b.b8.e9.97.9c.e9.80.a3.e7.b5.90" rel="internal">相關連結</a></li><li><span>8.6.</span> <a href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk_-_%e5%85%8d%e8%b2%bb_IP_PBX_%e7%b6%b2%e8%b7%af%e9%9b%bb%e8%a9%b1%e4%ba%a4%e6%8f%9b%e5%b9%b3%e5%8f%b0/Addons/A2Billing_%e7%ae%a1%e7%90%86%e7%af%87#.e7.99.bc.e7.8f.be_Bug" rel="internal">發現 Bug</a></li></ol></li></ol></div></div>
<div id="pageText" class="pageText">
<div id="section_1"><span id=".e5.89.8d.e8.a8.80"></span>
<h4 class="editable">前言</h4>
<p>A2Billing 是目前社群開發最熱門的計費系統套件，因為是開放原始碼授權所以可以合法免費使用。</p>
<p>本篇主要在是教導如何使用這套件，<strong>若還沒完成安裝的朋友，請先前往閱讀</strong> <a title="VoIP/IP PBX/軟體式 IP PBX/Asterisk/Addons/A2Billing 安裝篇" href="http://www.osslab.com.tw/VoIP/IP_PBX/%e8%bb%9f%e9%ab%94%e5%bc%8f_IP_PBX/Asterisk/Addons/A2Billing_%e5%ae%89%e8%a3%9d%e7%af%87" rel="internal">A2Billing 安裝篇</a>。</p></div>
<div id="section_2"><span id=".e5.88.9d.e5.a7.8b.e5.8c.96.e8.a8.ad.e5.ae.9a"></span>
<h4 class="editable">初始化設定</h4>
<p>系統在完成安裝後，第一個所要做的設定有：</p>
<p>// FreePBX UI &gt; Trunks</p>
<p style="margin-left: 40px">新增 Outbound Trunk，本篇以 Voxalot 為例。</p>
<p style="margin-left: 40px">Outgoing Settings<br />Trunk Name = voxalot</p><pre style="margin-left: 40px">host=us.voxalot.com
username=&lt;sip_number&gt;
fromuser=&lt;sip_number&gt;
secret=&lt;sip_pass&gt;
fromdomain=voxalot.com
nat=yes
insecure=port,invite
qualify=yes
canreinvite=yes
dtmfmode=auto
disallow=all
allow=ulaw&amp;alaw
type=peer
context=from-trunk</pre>
<p style="margin-left: 40px">新增 Inbound Trunk，這個主要在展示國際電話卡及 DID 轉接的應用，本篇以 iptel 為例。</p>
<p style="margin-left: 40px">Outgoing Settings<br />Trunk Name: iptel</p><pre style="margin-left: 40px">username=&lt;sip_username&gt;
type=friend
secret=&lt;sip_pass&gt;
qualify=yes
insecure=port,invite
host=iptel.org
fromuser=osslab
fromdomain=iptel.org
context=a2billing
</pre>
<p style="margin-left: 40px">Register String: &lt;sip_username&gt;:&lt;sip_pass&gt;@iptel.org/&lt;sip_number&gt;</p>
<p style="margin-left: 40px"><span style="color: rgb(255,0,0)">注意：context 必須是 a2billing</span><br /></p>
<p>// A2Billing Admin UI &gt; Trunk &gt; Create Provider</p>
<p style="margin-left: 40px">provider name = VOXALOT_PROVIDER<br />description = Voxalot Provider</p>
<p>// A2Billing Admin UI &gt; Trunk &gt; Add Trunk</p>
<p style="margin-left: 40px">voip-provider = VOXALOT_PROVIDER<br />label = VOXALOT_TRUNK<br />add prefix = 空白<br />provider tech = SIP<br />provider ip = voxalot<br />status = Active</p>
<p><span style="color: rgb(0,0,255)"><strong>TIPs:</strong></span></p>
<blockquote>
<p>provider ip 必須與 FreePBX 的 trunk name 相同</p></blockquote>
<p style="margin-left: 40px"></p>
<p>// A2Billing Admin UI &gt; Ratecard &gt; Create call plan</p>
<p style="margin-left: 40px">name = VOXALOT_CALLPLAN<br />remove inter prefix = YES</p>
<p><span style="color: rgb(0,0,255)"><strong>TIPs:</strong></span></p>
<blockquote>
<p>remove inter prefix = YES 若撥號有包含 00 或 011 開頭的國際冠碼，在套用 ratecard 的規則前會被去除。</p></blockquote>
<p>// A2Billing Admin UI &gt; Ratecard &gt; Create new ratecard</p>
<p style="margin-left: 40px">tariffname = VOXALOT_RATECARD<br />trunk = VOXALOT_TRUNK<br />description = through voxalot trunk</p>
<p>// A2Billing Admin UI &gt; Ratecard &gt; Add Rate</p>
<p style="margin-left: 40px">ratecard = VOXALOT_RATECARD<br />dialprefix = 1800<br />destination = US-Tollfree<br />buying rate = 1<br />buyrate min duration = 6<br />buyrate billing block = 6<br />selling rate = 1.5<br />sellrate min duration = 60<br />sellrate billing block = 60<br />trunk = VOXALOT_TRUNK</p>
<p><span style="color: rgb(0,0,255)"><strong>TIPs:</strong></span></p>
<blockquote>
<p>＊ dialprefix 若撥號規則符合，會以此費率計算<br />＊ destination 用來敘述此費率的區域</p></blockquote>
<p>//新增 rate 後要再回到 call plan 將 rate card 加入到 call plan<br />A2Billing Admin UI &gt; Ratecard &gt; List Call Plan &gt; Edit: VOXALOT_CALLPLAN</p>
<p style="margin-left: 40px">ratecard = 選擇 VOXALOT_RATECARD, Add Ratecard</p></div>
<div id="section_3"><span id=".e6.87.89.e7.94.a8.e4.b8.80.ef.bc.9a.e5.9c.8b.e9.9a.9b.e9.9b.bb.e8.a9.b1.e5.8d.a1.e6.a8.a1.e5.bc.8f"></span>
<h4 class="editable">應用一：國際電話卡模式</h4>
<p>客戶操作流程：<br />&#9312; 使用手機或一般電話機撥打系統號碼(Access Number)</p>
<p>&#9313; 語音提示：輸入電話卡號＋＃</p>
<p>&#9314; 語音提示餘額，輸入目的地電話號碼（00＋國碼＋區碼＋電話號碼＋＃）</p>
<p>// A2Billing Admin UI &gt; Customers &gt; Create Customers</p>
<p style="margin-left: 40px">card number = &lt;隨機產生&gt;<br />card alias = &lt;隨機產生&gt;；web 登入帳號<br />webui password = &lt;隨機產生&gt;；web 登入密碼<br />balance = 50.0；不可為零，且必須以 USD 計算<br />call plan = VOXALOT_CALLPLAN<br />activated = YES<br />simultaneous access = INDIVIDUAL ACCESS<br />card type = PREPAID CARD<br />country = TAIWAN<br />sip account = NO<br />iax account = NO</p>
<p>實際操作：</p>
<p style="margin-left: 40px">因為本篇實做是以 iptel 的號碼作為系統號碼，所以用其他 IPTel 帳號撥入系統號碼，系統會提示語音：請輸入 card number，將剛剛新增的卡號輸入，完成後按＃，若正確，系統會提示餘額及可用通話時間，並提示：請輸入目的地電話號碼，將完整電話號碼 011 + 國碼 + 區碼 + 電話號碼 輸入，完成後按＃。</p>
<p><span style="color: rgb(0,0,255)"><strong>TIPs:</strong></span></p>
<blockquote>
<p>＊ 新增電話卡(Customer)，有一些主要的設定，例如 card number, card alias, password，這些是由系統隨機產生，且沒有任何規則，hacker 無法事先計算出這些資訊。<br />＊ 附加在 card number 的 另一組代號 alias，這個號碼或 email 地址都可以用來登入用戶的網頁，密碼就是 webui password。 <br />＊ 若用戶撥號時有加 00，請注意 <strong>Call Plan</strong> 的 <strong>REMOVE INTER PREFIX</strong> 建議設為 <strong>YES</strong>，以避免 outbound 路由錯誤。</p></blockquote></div>
<div id="section_4"><span id=".e6.87.89.e7.94.a8.e4.ba.8c.ef.bc.9aDID_.e8.bd.89.e6.8e.a5.e6.a5.ad.e5.8b.99"></span>
<h4 class="editable">應用二：DID 轉接業務</h4>
<p>A2Billing 提供 DID 接駁至經由 outbound trunk 的外部號碼、SIP URI、</p>
<p>// A2Billing Admin UI &gt; DID &gt; Add DID Group</p>
<p style="margin-left: 40px">name = DID TWN</p>
<p>// A2Billing Admin UI &gt; DID &gt; Add DID</p>
<p style="margin-left: 40px">DID = 99474<br />billing = only dialout rate<br />DID group = DID TWN<br />country = TAIWAN<br />activated = YES<br />monthly rate = 0</p>
<p>// A2Billing Admin UI &gt; Customers &gt; Create Customers</p>
<p style="margin-left: 40px">balance = 50.0<br />call plan = VOXALOT_CALLPLAN<br />didgroup = DID TWN<br />activated = YES<br />card type = PREPAID CARD<br />country = TAIWAN<br />sip account = NO<br />iax account = NO</p>
<p><strong>設定轉接的目的號碼，可以透過 Admin UI 或 Customer UI 來作</strong><br />客戶自行購買 DID 號碼<br />// A2Billing Customer UI &gt; DID</p>
<p style="margin-left: 40px">select country = TAIWAN<br />select virtual phone number = 99474<br />voip call = NO<br />destination = 8864123456</p>
<p><span style="color: rgb(0,0,255)"><strong>TIPs:</strong></span></p>
<blockquote>
<p>＊ select country 這裡內容會與 DID 的 country 相同<br />＊ 若沒有出現 DID number 可選擇，請檢查所登入的 customer 帳號的 DIDGROUP 是否正確<br />＊ voip call 若是 NO，輸入外部的 PSTN/SIP 號碼；若是 YES，輸入 SIP URI。</p></blockquote>
<p>管理員分配 DID 號碼給指定的客戶<br />// A2Billing Admin UI &gt; INBOUND DID &gt; Destination</p>
<p style="margin-left: 40px">destination = 8864123456<br />customer ID = 選擇適當的 customer<br />DID = 選擇適當的 DID<br />activated = yes<br />validated = 皆可<br />voip_call = no</p>
<p><span style="color: rgb(0,0,255)"><strong>TIPs:</strong></span></p>
<blockquote>
<p>＊ voip call 若是 NO，輸入外部的 PSTN/SIP 號碼；若是 YES，輸入 SIP URI。</p>
<p>＊ 若需 DID 接入內部分機號碼(不經過 A2B 的 trunk)，可以這樣設<br />-- destination = Local/101@from-internal (適用 FreePBX 的分機 101)<br />-- destination = SIP/123456 (適用 A2Billing card number 123456)<br />-- voip_call = yes</p>
<p>* 如果 destination number 要走 A2B 的 trunk，不管該 trunk 是 SIP 或 Zaptel，voip_call 必須是 no。</p></blockquote>
<p>相關文章連結：</p>
<ul><li><a class=" external" title="http://www.elastix.org/en/component/kunena/33-a2billing/61386-inbound-did-billing-for-a2billing.html" href="http://www.elastix.org/en/component/kunena/33-a2billing/61386-inbound-did-billing-for-a2billing.html" rel="external nofollow" target="_blank">Elastix Forum :: Inbound DID Billing for A2Billing</a></li></ul></div>
<div id="section_5"><span id=".e6.87.89.e7.94.a8.e4.b8.89.ef.bc.9a.e9.a0.90.e4.bb.98.e5.88.b6.e3.80.81.e6.9c.88.e4.bb.98.e5.88.b6.e6.9c.83.e5.93.a1.e6.a8.a1.e5.bc.8f"></span>
<h4 class="editable">應用三：預付制、月付制會員模式</h4>
<p>用戶操作流程：<br />&#9312; 用戶使用 X-Lite 或 ATA 設備透過網路註冊為分機。</p>
<p>&#9313; 直接撥目的地電話號碼，例如 886+XXXXXXXX，886 是國碼。<br />過程中不會有任何額外的提示音，就像一般的 SIP 分機操作相同。</p>
<p>// A2Billing Admin UI &gt; Customers &gt; Create Customers</p>
<p style="margin-left: 40px">card number = &lt;隨機產生&gt;<br />card alias = &lt;隨機產生&gt;；web 登入帳號<br />webui password = &lt;隨機產生&gt;；web 登入密碼<br />balance = 50.0；不可為零，且必須以 USD 計算<br />call plan = VOXALOT_CALLPLAN<br />activated = YES<br />simultaneous access = INDIVIDUAL ACCESS<br />card type = PREPAID CARD<br />country = TAIWAN<br />sip account = YES<br />iax account = YES</p>
<p><span style="color: rgb(0,0,255)"><strong>TIPs:</strong></span></p>
<blockquote>
<p>＊ 這裡與(應用一)模式設定相同，只差在 sip/iax account 為 YES。<br />＊ 新增 customer 後，要 reload Asterisk 後，SIP 用戶端才能註冊使用。</p></blockquote>
<p>// 取消 "輸入目的地號碼" 及其他提示音<br />// A2Billing Admin UI &gt; System Settings &gt; Global List<br />如果這裡的所有項目沒有 GROUP 為 <span style="color: rgb(255,0,0)">agi-conf</span><strong><span style="color: rgb(255,0,0)">2</span></strong> 的(可善用 GROUP 搜尋功能)，請先前往 <span style="color: rgb(0,0,255)">Add agi-conf &gt; CREATE AGI-CONF2</span>。</p>
<p>回到 Global List 找到 GROUP 為 <span style="color: rgb(255,0,0)">agi-conf</span><strong><span style="color: rgb(255,0,0)">2</span></strong> 且 KEY/VALUE 按以下所述修改：</p>
<p style="margin-left: 40px">use_dnid = yes</p>
<p>這個SIP帳號除了要撥外部的路由外，如果還要撥內部的其他 SIP 分機號，需要繼續下面的修改：</p>
<p style="margin-left: 40px">sip_iax_friends = yes<br />sip_iax_pstn_direct_call_prefix = 555<br />sip_iax_pstn_direct_call = yes</p>
<p>&#8251;是否要提示餘額的語音</p>
<p style="margin-left: 40px">say_balance_after_auth = no<br />say_timetocall = no</p>
<p>如果電話不通，不要提示輸入目的地號碼的語音</p>
<p style="margin-left: 40px">number_try = 1</p>
<p><span style="color: rgb(0,0,255)"><strong>TIPs:</strong></span></p>
<blockquote>
<p>＊ 參數說明：</p>
<p>- <strong>Use DNID</strong> : YES 表示使用 DNID，並且不會提示 輸入目的地電話號碼的語音<br />- <strong>SIP Call = yes, SIP Call Prefix, Direct Call</strong>: 這三個參數是用來使 SIP 註冊帳號後，也能撥其他分機號碼，撥法為 555+SIP Extension<br />- <strong>Say Balance After Auth</strong>: 認證後是否提示餘額<br />- <strong>Say Duration</strong>: 是否提示剩餘通話時間</p>
<p>- 另一種比較快速的設定是：play_audio = no, use_dnid=yes, number_try=1。</p></blockquote>
<p>//為此模式新增 dialplan<br />//編輯 /etc/asterisk/extensions_a2billing.conf，在底下加入：</p><pre style="margin-left: 40px">[custom-a2billing-sipclient]
exten =&gt; _X.,1,Answer
exten =&gt; _X.,n,Wait(1)
exten =&gt; _X.,n,deadAGI(a2billing.php|2)
exten =&gt; _X.,n,Hangup
</pre>
<p>&nbsp;</p>
<p>// 在 A2Billing 套用新增的 dialplan<br />// A2Billing Admin UI &gt; Customer &gt; VoIP Settings<br />找到 SIP 分機項目，按編輯</p>
<p style="margin-left: 40px">Context = custom-a2billing-sipclient</p>
<p>// 最後，執行指令套用所有的修改</p>
<p># asterisk -rx "reload"</p>
<p><span style="color: rgb(0,0,255)"><strong>TIPs:</strong></span></p>
<blockquote>
<p><span style="color: rgb(255,0,0)">由於版本 1.7.x 的 bug 關係，在 UI 做完操作後，並不會同步修改 asterisk 的設定檔，所以請依照方式作手動修改：<br />編輯 /etc/asterisk/additional_a2billing_sip.conf ，修改 context 的內容。<br />要避免每次都要作手動修改，可以參考 F.A.Q 的方法。<br /></span></p></blockquote></div>
<div id="section_6"><span id=".e6.87.89.e7.94.a8.e5.9b.9b.ef.bc.9a.e6.95.b4.e5.90.88_FreePBX_.e7.9a.84.e6.87.89.e7.94.a8"></span>
<h4 class="editable">應用四：整合 FreePBX 的應用</h4>
<p>用途：FreePBX 的分機用戶，在 Outbound Calling 時可以透過 A2Billing 來計費，但其他原有PBX的功能都不會有影響。</p>
<p>// 編輯 /etc/asterisk/extensions_custom.conf</p><pre style="margin-left: 40px">[macro-dialout-trunk-predial-hook]
exten =&gt; s,1,GotoIf($["${OUT_${DIAL_TRUNK}:4:4}" = "A2B/"]?custom-freepbx-a2billing,${OUTNUM},1:2)
exten =&gt; s,2,MacroExit

[custom-freepbx-a2billing]
exten =&gt; _X.,1,DeadAGI(a2billing.php,${OUT_${DIAL_TRUNK}:8})
exten =&gt; _X.,n,Hangup()
</pre>
<p>&nbsp;</p>
<p>// FreePBX UI &gt; Trunks &gt; Add Custom Trunk</p>
<p style="margin-left: 40px">Custom Dial String = A2B/2</p>
<p>Tips:</p>
<blockquote>
<p>2 代表是 agi-conf 2</p></blockquote>
<p>// FreePBX UI &gt; Outbound Routes <br />自行設定需要的參數，並導向剛剛的 Trunk。</p>
<p>// FreePBX UI &gt; Extensions<br />在需要計費的分機設定裡，參數 <span style="color: rgb(0,0,255)">accountcode</span> 填入 A2Billing 的 Card Number。</p>
<p>Tips:</p>
<blockquote>
<p>分機在外撥的路由規則，除了 outbound route 外，還要考慮 A2Billing 的，也就是 <span style="color: rgb(0,0,255)">RATES</span> 的相關設定。</p></blockquote>
<p>延伸閱讀</p>
<ul><li><a class="external" title="http://sysadminman.net/blog/2010/using-a2billing-to-account-for-extension-calls-in-elastix-1307" href="http://sysadminman.net/blog/2010/using-a2billing-to-account-for-extension-calls-in-elastix-1307" rel="external nofollow" target="_blank">Using A2Billing to account for extension calls in Elastix</a> (A2Billing 1.3.x)</li></ul></div>
<div id="section_7"><span id=".e6.87.89.e7.94.a8.e4.ba.94.ef.bc.9aCaller_ID_.e8.aa.8d.e8.ad.89.e6.a8.a1.e5.bc.8f"></span>
<h4 class="editable">應用五：Caller ID 認證模式</h4>
<p>用途：設定電話卡時除了使用輸入卡號的認證方式以外，還能以來電號碼(Caller ID) 辨識來認證。</p>
<ul><li>啟用 Caller ID 後，用戶不需要先輸入卡號，就可以直接撥目的地號碼。</li><li>一個卡號可以設定一組或多組的來電號碼。</li><li>使用 Admin UI 來管理來電號碼。</li><li>一旦啟用後，當用戶的來電號碼並非系統所允許時，系統會提示卡號的認證的方式。</li></ul>
<p>&nbsp;</p>
<p>// 啟用方式<br />A2Billing Admin UI &gt; Syetem Settings &gt;</p>
<p>以 agi-conf 的方式來設，可以很容易啟用/關閉這功能，需要用到的參數(Key)如下：</p>
<ul><li>cid_enable = yes ；yes 啟用，no 關閉，預設是關閉的</li><li>cid_askpincode_ifnot_callerid = yes ; 預設 yes，若 CID 認證失敗，系統會提示輸入 Card Number。</li><li>cid_auto_assign_card_to_cid = yes ; 預設 yes，用戶撥入系統後，如果 CID 認證失敗，系統會提示輸入 Card Number，一旦用戶輸入資訊正確，系統會自動新增 CID，以致於該用戶下次再撥入時，就可以通過 CID 認證，且不會再提示輸入 Card Number。</li><li>cid_auto_create_card = no</li></ul>
<p>// 新增 Caller ID</p>
<p>A2Billing Admin UI &gt; Customers &gt; Caller-ID</p>
<p style="margin-left: 40px">CallerID = &lt;用戶的來電號碼&gt;<br />Activated = yes<br />ID Card = &lt;選擇卡號&gt;</p></div>
<div id="section_8"><span id="F.A.Q"></span>
<h4 class="editable">F.A.Q</h4>
<div id="section_9"><span id="Q.3a.e5.a6.82.e4.bd.95.e5.a4.a7.e9.87.8f.e5.88.aa.e9.99.a4_Customers.3f"></span>
<h5 class="editable">Q:如何大量刪除 Customers?</h5>
<p>Ans: A2Billing UI &gt; Customers &gt; Add::Search &gt; Search Customers</p>
<p>設定搜尋條件 &gt; 按 Search &gt; 再按旁邊的 Delete All</p>
<p>注意：這個方法無法將 VoIP Setting 一併刪除。</p></div>
<div id="section_10"><span id="Q.3a.e5.a6.82.e4.bd.95.e5.a4.a7.e9.87.8f.e5.88.aa.e9.99.a4_VoIP_Settings.3f"></span>
<h5 class="editable">Q:如何大量刪除 VoIP Settings?</h5>
<p>Ans: 目前沒有合適的作法。</p></div>
<div id="section_11"><span id="Q.3a.e5.a6.82.e4.bd.95.e8.ae.8a.e6.9b.b4.e7.b3.bb.e7.b5.b1.e9.a0.90.e8.a8.ad.e5.b9.a3.e5.88.a5_USD"></span>
<h5 class="editable">Q:如何變更系統預設幣別 USD</h5>
<p>Ans: 要改兩個地方，修改 base_currency 的參數及更新 currency list。</p>
<ol><li>A2Billing UI &gt; System Settings &gt; Global List<br />搜尋 GROUP = global, Key = base_currency<br />base_curreny = twd</li><li>即使修改了幣別，系統預設的 currency list 仍是以美金 1:1 計算，所以必須修改這個匯率對照表為 TWD 1:1。<br />A2Billing UI &gt; BILLING &gt; Currency List &gt; CLICK HERE TO UPDATE NOW</li></ol></div>
<div id="section_12"><span id="Q.3a.e5.8c.af.e5.85.a5_ratecard_.e6.99.82.e7.b8.bd.e6.98.af.e5.87.ba.e7.8f.be.e9.8c.af.e8.aa.a4_ERROR.3a_file_type_is_not_allowed.3a_application.2fforce-download"></span>
<h5 class="editable">Q:匯入 ratecard 時總是出現錯誤 ERROR: file type is not allowed: application/force-download</h5>
<p>Ans: 將副檔名 csv 改成 txt。</p></div>
<div id="section_13"><span id=".e7.9b.b8.e9.97.9c.e9.80.a3.e7.b5.90"></span>
<h5 class="editable">相關連結</h5>
<ul><li><a class=" external" title="http://blogtech.oc9.com/index.php?view=article&amp;id=237:as20091005&amp;option=com_content&amp;Itemid=6" href="http://blogtech.oc9.com/index.php?view=article&amp;id=237%3Aas20091005&amp;option=com_content&amp;Itemid=6" rel="external nofollow" target="_blank">Asterisk: optimizing a2billing mysql database with more than 1,000,000 rates in cc_ratecard</a></li><li><a class=" external" title="http://sysadminman.net/blog/category/a2billing-100-call-plan-hosting/" href="http://sysadminman.net/blog/category/a2billing-100-call-plan-hosting/" rel="external nofollow" target="_blank">一些有用的教學(英文)</a></li></ul></div>
<div id="section_14"><span id=".e7.99.bc.e7.8f.be_Bug"></span>
<h5 class="editable">發現 Bug</h5>
<p>&nbsp;</p>
<table style="width: 100%; table-layout: fixed" border="1" cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td style="width: 100px">版本</td>
<td>問題描述</td></tr>
<tr>
<td style="width: 100px">1.7.0/1</td>
<td>修改 VoIP Settings 的 內容，不會同步更新 Asterisk 設定</td></tr>
<tr>
<td style="width: 100px"></td>
<td><span style="color: rgb(0,0,255)">Ans:這是因為 A2Billing 預設是啟動了 Realtime Asterisk 模式(Asterisk 以資料庫型式儲存設定)，若只是檢查 *.conf 來判斷 Asterisk 是否更新是不準確的，然而這 bug 卻造成 A2Billing 無法以 relatime 模式更新 Asterisk。暫時的解決方法是使 A2Billing 關閉 realtime asterisk 模式，恢復成 *.conf 方式來更新 asterisk，步驟如下： </span>
<p><span style="color: rgb(0,0,255)">A2Billing UI &gt; System Settings &gt; Global List<br />搜尋 GROUP = global</span></p>
<p style="margin-left: 40px"><span style="color: rgb(0,0,255)">use_realtime = no (預設為 yes)</span></p>
<p><span style="color: rgb(0,0,255)">Notes: 當關閉了 Realtime 後，爾後若有新增/編輯 VoIP Settings 時，在 CONFIRM DATA 之後，需要在作以下步驟完成 Asterisk 的更新：</span></p>
<ol><li><span style="color: rgb(0,0,255)">點選 GENERATE ADDITIONAL_A2BILLING_SIP.CONF</span></li><li><span style="color: rgb(0,0,255)">click here to reload your asterisk server</span></li></ol></td></tr>
<tr>
<td style="width: 100px">1.7.0</td>
<td>新增 CUSTOMER 時，若 balance 欄位維持預設的 0，仍可以存檔</td></tr>
<tr>
<td style="width: 100px"></td>
<td><span style="color: rgb(0,0,255)">Ans: 這項不確定是否為 bug，但在 1.3.x 穩定版，存檔前系統會檢查 balance 不可為 0。 </span></td></tr>
<tr>
<td style="width: 100px">1.7.0</td>
<td>若建立電話卡是有 SIP 註冊帳號的，刪除這個電話卡後，SIP 終端仍可以註冊，但已無法正常撥出。</td></tr>
<tr>
<td style="width: 100px">1.7.0</td>
<td>在 Customer UI 的 DID 功能，操作 Release DID，按下 Release 後，雖然 DID 有 release，但畫面會成空白頁。</td></tr>
<tr>
<td style="width: 100px">1.7.0</td>
<td>在 Customer UI 的 DID 功能，從項目列表中刪除 destination number 時，所有欄位的值會出現空白，再按下 Delete 後，雖然資料仍會刪除，但需要再做一次 Release DID。</td></tr></tbody></table></div></div></div></div></div><img src ="http://www.cppblog.com/byc/aggbug/193154.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/byc/" target="_blank">八叶草</a> 2012-10-11 10:56 <a href="http://www.cppblog.com/byc/archive/2012/10/11/193154.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux qt 静态编译</title><link>http://www.cppblog.com/byc/archive/2012/09/04/189435.html</link><dc:creator>八叶草</dc:creator><author>八叶草</author><pubDate>Tue, 04 Sep 2012 08:01:00 GMT</pubDate><guid>http://www.cppblog.com/byc/archive/2012/09/04/189435.html</guid><wfw:comment>http://www.cppblog.com/byc/comments/189435.html</wfw:comment><comments>http://www.cppblog.com/byc/archive/2012/09/04/189435.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/byc/comments/commentRss/189435.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/byc/services/trackbacks/189435.html</trackback:ping><description><![CDATA[<div>yum install glibc-static<br />cd qt-everywhere-opensource-src-4.*.*<br />./configure -release -static -nomake examples -nomake demos -no-qt3support -no-script -no-scripttools -no-multimedia -no-audio-backend -no-openssl -no-opengl -no-webkit -no-phonon -no-sql-sqlite<br />
<p>make</p>
<p>make install</p>在.pro文件中加上 QMAKE_LFLAGS += -static&nbsp; -static-libgcc -static-libstdc++<br />
<div class="postText">
<p><br />5.5.4 共享(shared)庫和靜態(static)庫的混合連接<br /><br />默認情況下，假如共享庫可用，連接器會使用共享庫。但是-Bdynamic和<br />-Bstatic提供了很好控制庫的方法。它們可以決定用共享庫還是用靜態庫。<br />傳-Bdynamic和-Bstatic選項給連接器，如下操作：<br /># gcc -o main main.o -Wl,-Bstatic -lfoo -Wl,-Bdynamic -lbar<br />Bdynamic 後面的庫都使用共享版本<br />直到遇到Bstatic <br />Bstatic 後面的庫都使用靜態版本<br />直到遇到Bdynamic <br /><br /><br /><a href="http://www.lslnet.com/linux/f/docs1/i44/big5307264.htm">http://www.lslnet.com/linux/f/docs1/i44/big5307264.htm</a>&nbsp;<br /><br /><br />启用RTTI<br /><span class="caps">CONFIG</span> += rtti</p></div></div><img src ="http://www.cppblog.com/byc/aggbug/189435.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/byc/" target="_blank">八叶草</a> 2012-09-04 16:01 <a href="http://www.cppblog.com/byc/archive/2012/09/04/189435.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>mysql 多实例</title><link>http://www.cppblog.com/byc/archive/2012/08/10/186829.html</link><dc:creator>八叶草</dc:creator><author>八叶草</author><pubDate>Fri, 10 Aug 2012 07:24:00 GMT</pubDate><guid>http://www.cppblog.com/byc/archive/2012/08/10/186829.html</guid><wfw:comment>http://www.cppblog.com/byc/comments/186829.html</wfw:comment><comments>http://www.cppblog.com/byc/archive/2012/08/10/186829.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/byc/comments/commentRss/186829.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/byc/services/trackbacks/186829.html</trackback:ping><description><![CDATA[mkdir /var/lib/mysql_new<br />mysql_install_db --datadir=/var/lib/mysql_new --user=mysql<br /><span style="font-family: 宋体; mso-ascii-theme-font: minor-fareast; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-size: 10.5pt"><strong><br /><br />vi /etc/my.cnf 添加<br />
<p>&nbsp;</p>
<p>[mysqld_multi]<br />mysqld=/usr/bin/mysqld_safe<br />mysqladmin=/usr/bin/mysqladmin<br />log=/var/log/mysqld_multi.log<br />user = multi_admin<br />password = multipass</p>
<p><br />[mysqld1]<br />datadir=/var/lib/mysql_new<br />socket=/var/lib/mysql_new/mysql.sock<br />port=4000<br />pid-file=/var/lib/mysql_new/mysql.pid<br />user=mysql</p>
<p><br /><br />多实例启动<span lang="EN-US"><o:p></o:p></span></strong></span> <br /><span style="font-family: 宋体; mso-ascii-theme-font: minor-fareast; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-size: 10.5pt" lang="EN-US">mysqld_multi start 1</span><br /><br /><span style="font-family: 宋体; mso-ascii-theme-font: minor-fareast; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-size: 10.5pt"><strong>关闭<span lang="EN-US">MySQL</span>多实例</strong></span><br /><span style="font-family: 宋体; mso-ascii-theme-font: minor-fareast; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-size: 10.5pt" lang="EN-US"><strong>mysqld_multi stop 1</strong></span><br /><br /><strong>查看<span lang="EN-US">MySQL</span>端口启动状态</strong><br /><span><strong>netstat -ntlp | grep mysqld　　　<br /><br />查看<span lang="EN-US">MySQL</span>实例进程</strong></span><br /><span><strong>ps -ef | grep mysql　　　　　<br /><br />通过port连接<br />mysql -u root -h 127.0.0.1 -P 4000</strong></span> <br />通过sock<br />mysql -u root -S&nbsp;/var/lib/mysql_new/mysql.sock -p <br /><br /><br /><br />faq<br />my.cnf-[mysqld_multi]设置的user和password是用来关闭数据库实例的，根据配置中的用户名和密码授权该用户shutdown权限<br />mysql&nbsp;&nbsp;-S /var/lib/mysql_new/mysql.sock<br />mysql&gt; grant shutdown on *.* to multi_admin@'localhost' identified by 'multipass'; <br /></p><img src ="http://www.cppblog.com/byc/aggbug/186829.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/byc/" target="_blank">八叶草</a> 2012-08-10 15:24 <a href="http://www.cppblog.com/byc/archive/2012/08/10/186829.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>log4cplus-1.1.0-rc6  链接问题</title><link>http://www.cppblog.com/byc/archive/2012/08/03/186139.html</link><dc:creator>八叶草</dc:creator><author>八叶草</author><pubDate>Fri, 03 Aug 2012 04:04:00 GMT</pubDate><guid>http://www.cppblog.com/byc/archive/2012/08/03/186139.html</guid><wfw:comment>http://www.cppblog.com/byc/comments/186139.html</wfw:comment><comments>http://www.cppblog.com/byc/archive/2012/08/03/186139.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/byc/comments/commentRss/186139.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/byc/services/trackbacks/186139.html</trackback:ping><description><![CDATA[&nbsp;链接了lib&nbsp; #pragma comment (lib,"log4cplusD.lib") <br />字符集设置了 使用多字节字符集<br />还会出现这个编译错误。<br />LNK2019: 无法解析的外部符号 "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance<br />在于处理器定义加上<br />LOG4CPLUS_BUILD_DLL <img src ="http://www.cppblog.com/byc/aggbug/186139.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/byc/" target="_blank">八叶草</a> 2012-08-03 12:04 <a href="http://www.cppblog.com/byc/archive/2012/08/03/186139.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>vc++ ice 配置</title><link>http://www.cppblog.com/byc/archive/2012/07/18/184117.html</link><dc:creator>八叶草</dc:creator><author>八叶草</author><pubDate>Wed, 18 Jul 2012 12:51:00 GMT</pubDate><guid>http://www.cppblog.com/byc/archive/2012/07/18/184117.html</guid><wfw:comment>http://www.cppblog.com/byc/comments/184117.html</wfw:comment><comments>http://www.cppblog.com/byc/archive/2012/07/18/184117.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/byc/comments/commentRss/184117.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/byc/services/trackbacks/184117.html</trackback:ping><description><![CDATA[命令:C:\Program Files\ZeroC\Ice-3.4.2\bin\slice2cpp.exe<br />参数:-I ./ -I "C:\Program Files\ZeroC\Ice-3.4.2\slice" $(ItemPath)<br />初始目录:$(ItemDir)<img src ="http://www.cppblog.com/byc/aggbug/184117.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/byc/" target="_blank">八叶草</a> 2012-07-18 20:51 <a href="http://www.cppblog.com/byc/archive/2012/07/18/184117.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>asterisk 调试 设置</title><link>http://www.cppblog.com/byc/archive/2012/07/14/183302.html</link><dc:creator>八叶草</dc:creator><author>八叶草</author><pubDate>Fri, 13 Jul 2012 23:39:00 GMT</pubDate><guid>http://www.cppblog.com/byc/archive/2012/07/14/183302.html</guid><wfw:comment>http://www.cppblog.com/byc/comments/183302.html</wfw:comment><comments>http://www.cppblog.com/byc/archive/2012/07/14/183302.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/byc/comments/commentRss/183302.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/byc/services/trackbacks/183302.html</trackback:ping><description><![CDATA[<h2>Logging</h2>
<p><wbr></p>
<p>Sometimes, when debugging an issue, it's useful to see and log extra information and at</p>
<p>other times, you want logging to be minimal. Asterisk provides a number of ways of</p>
<p>logging information, to files or to a syslog server. The file /etc/asterisk/logger.conf</p>
<p>contains the configuration elements for logging. Asterisk has different types of message</p>
<p>that can be logged these are:</p>
<p><wbr></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><wbr></p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="203">
<p><wbr></p>
<p>Verbose</p>
<p><wbr></p></td>
<td valign="top" width="254">
<p><wbr></p>
<p>General 'chatter' about what is</p>
<p>happening on the system.</p>
<p>Verbosity levels greater than 3</p>
<p>display dialplan commands as</p>
<p>they are executed. This</p>
<p>generates lots of log information</p>
<p><wbr></p></td></tr>
<tr>
<td valign="top" width="203">
<p><wbr></p>
<p>Debug</p></td>
<td valign="top" width="254">
<p><wbr></p>
<p>Debug messages, normally only</p>
<p>used by programmers to extract</p>
<p>extended information</p>
<p><wbr></p></td></tr>
<tr>
<td valign="top" width="203">
<p><wbr></p>
<p>Notice</p>
<p><wbr></p></td>
<td valign="top" width="254">
<p><wbr></p>
<p>Non urgent alert messages</p></td></tr>
<tr>
<td valign="top" width="203">
<p><wbr></p>
<p>Warning</p></td>
<td valign="top" width="254">
<p><wbr></p>
<p>Warning alert messages,</p>
<p>something happened that might</p>
<p>be bad. Some tell you how bad</p>
<p>the warning is</p>
<p><wbr></p></td></tr>
<tr>
<td valign="top" width="203">
<p><wbr></p>
<p>Error</p>
<p><wbr></p></td>
<td valign="top" width="254">
<p><wbr></p>
<p>Error messages, something bad</p>
<p>happened &#8211; These should be rare.</p>
<p><wbr></p></td></tr></tbody></table>
<p><wbr></p>
<p>In logger.conf you will see the [logfiles] section, this is where you define the filename</p>
<p>and content of log files. Take a look at this example entry</p>
<p><wbr></p>
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td valign="top" width="32">
<p><wbr></p></td>
<td valign="top" width="611">
<p><wbr></p>
<p>[logfiles]</p>
<p>debug =&gt; debug</p>
<p><wbr></p></td></tr></thead>
<tbody></tbody></table>
<p><wbr></p>
<p>This tells Asterisk to log debug messages (the right side of the =&gt;) to a file called debug</p>
<p>(the left side of the =&gt;) located in <strong>/var/log/asterisk/.</strong> This directory can be changed in</p>
<p><strong>/etc/asterisk/asterisk.conf</strong> by modifying the line <em>astlogdir =&gt; /var/log/asterisk</em> to point</p>
<p>to the desired directory. You can log multiple information types to the same file or you</p>
<p>can spread the information over a number of files. For example</p>
<p><wbr></p>
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td valign="top" width="32">
<p><wbr></p></td>
<td valign="top" width="611">
<p><wbr></p>
<p>[logfiles]</p>
<p>debug =&gt; debug</p>
<p>messages=&gt;warning, error</p>
<p><wbr></p></td></tr></thead>
<tbody></tbody></table>
<p><wbr></p>
<p>Will log debug messages to a file called <em>debug</em>, and will also log warning and error</p>
<p>messages to a file called <em>messages</em>. There is a special &#8220;file&#8221; called <em>console</em> which when</p>
<p>used will cause the message types specified to be logged to the Asterisk console, for</p>
<p>example:</p>
<p><wbr></p>
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td valign="top" width="32">
<p><wbr></p></td>
<td valign="top" width="611">
<p><wbr></p>
<p>[logfiles]</p>
<p>console =&gt; debug, warning, error, notice, verbose</p>
<p><wbr></p>
<p><wbr></p></td></tr></thead>
<tbody></tbody></table>
<p><wbr></p>
<p>Would log everything to the console (not to any files). The above is not recommended</p>
<p>since the amount of information that would be generated could be far to much to be of</p>
<p>any real use. If you change logger.conf you need to perform a reload or do a logger</p>
<p>rotate (see next section). You can also log messages to a syslog sever (remote logging</p>
<p>server), useful if you have either a lot of machines or want centralized logging. To do</p>
<p>this use the file syslog, with the suffix you will use in /etc/syslog.conf for example, in</p>
<p>logger.conf</p>
<p><wbr></p>
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td valign="top" width="32">
<p><wbr></p></td>
<td valign="top" width="611">
<p><wbr></p>
<p>[logfiles]</p>
<p>syslog.local0 =&gt; debug, warning, error, notice, verbose</p>
<p><wbr></p></td></tr></thead>
<tbody></tbody></table>
<p><wbr></p>
<p>And /etc/syslog.conf </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><wbr></p>
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td valign="top" width="32">
<p><wbr></p></td>
<td valign="top" width="611">
<p><wbr></p>
<p>local0.* <wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>@192.168.1.22</p>
<p><wbr></p></td></tr></thead>
<tbody></tbody></table>
<p><wbr></p>
<p><wbr></p>
<p>This would send the Asterisk logging information to the syslog server at 192.168.1.22.</p>
<p><wbr></p>
<p>Setting up a syslog server is beyond the scope of this document and is left as an exercise</p>
<p>for the reader.<br clear="all" /><strong>Rotate logs</strong></p>
<p><wbr></p>
<p>It is advisable to rotate your logs frequently, depending on the amount of logging you</p>
<p>have turned on and the about of data that is actually logged. Files larger than 2Gb can</p>
<p>cause some nasty effects resulting in Asterisk crashes. You can rotate logs by using the</p>
<p>command</p>
<p><wbr></p>
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td valign="top" width="32">
<p><wbr></p></td>
<td valign="top" width="580">
<p><wbr></p>
<p>logger rotate</p>
<p><wbr></p></td>
<td valign="top" width="32">
<p><wbr></p>
<p><wbr></p>
<p><wbr></p>
<p><wbr></p></td></tr></thead>
<tbody></tbody></table>
<p><wbr></p>
<p>This will rename the old log and start a new one. It will also reload logger.conf and</p>
<p>adopt any changes you have made to it.</p>
<p><wbr></p>
<h3>Verbosity</h3>
<p><wbr></p>
<p>You can change the verbosity (how much information we get) of the output on processes attached to the Asterisk console by setting the level of verbosity. To do this we use the <strong><em>set verbose</em></strong> command, for example:</p>
<p><wbr></p>
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td valign="top" width="32">
<p><wbr></p></td>
<td valign="top" width="580">
<p><wbr></p>
<p>set verbose 999</p>
<p><wbr></p></td>
<td valign="top" width="32">
<p><wbr></p>
<p><wbr></p>
<p><wbr></p>
<p><wbr></p></td></tr></thead>
<tbody></tbody></table>
<p><wbr></p>
<p>Sets the verbosity level to 999, Asterisk will tell you that the level of verbosity changed</p>
<p><wbr></p>
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td valign="top" width="32">
<p><wbr></p></td>
<td valign="top" width="611">
<p><wbr></p>
<p>asterisk*CLI&gt; set verbose 999</p>
<p>Verbosity is at least 999</p>
<p>asterisk*CLI&gt;</p>
<p><wbr></p></td></tr></thead>
<tbody></tbody></table>
<p><wbr></p>
<p>You should see every message when it is set to this level, whereas setting it to 1 will</p>
<p>show very little information.</p>
<p><wbr></p>
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td valign="top" width="32">
<p><wbr></p></td>
<td valign="top" width="103">
<p><br clear="all" /></p></td>
<td valign="top" width="507">
<p><em>Setting the verbosity level changes the level on every attached</em></p>
<p><em>process (connected via asterisk -r) not just the one you issue the</em></p>
<p><em>command from.</em></p>
<p><wbr></p></td></tr></thead>
<tbody></tbody></table>
<h2>Getting to Grips with sip.conf</h2>
<p><wbr></p>
<p>sip.conf is not difficult to understand, however there is a fundamental problem with SIP making it awkward to use. The problem is not so much with SIP itself, it's more to do with how we protect our networks. We all know that there are some nasty little people out there who are quite happy to steal your resources, make free calls using someone else's money etc. As a consequence of this we tend to put a firewall between them and us. This is where the problems start for SIP. In a network environment that requires no firewall, for example and Internal network, there will be no issues, but in a more complex network, perhaps using NAT (Network address translation) there are all sorts of hurdles to overcome.</p>
<p><wbr></p>
<p>You have a number of choices,</p><br /><br /><br /><br /><br />sip set debug on 设置显示更多的sip信息<br />sip set debug off关闭显示更多的sip信息<br />SIP Channels are only shown if registered<br />SIP SHOW INUSE will list all SIP extensions defined in SIP.CONF<br />SIP SHOW CHANNELS will list all SIP extensions registered at that time<br /><strong>sip set debug</strong> - Enable SIP debugging<br /><strong>sip set debug ip</strong> - Enable SIP debugging on IP<br /><strong>sip set debug off</strong> - Disable SIP debugging<br /><strong>sip set debug peer</strong> - Enable SIP debugging on Peername<br /><br /><br /><br />stop gracefully 优雅地停止asterisk<br />stop now 立即停止运行asterisk<br />core show codecs 显示所有支持的编解码器<br /><br />set verbose 10 <br />set debug 10<br /><br /><br /><strong>core set debug channel</strong> - Enable/disable debugging on a channel<br /><strong>core set debug</strong> - Set level of debug chattiness<br /><strong>core set debug off</strong> - Turns off debug chattiness<br /><strong>core set verbose</strong> - Set level of verboseness<br /><br /><strong>core show calls {uptime}</strong>: Display information on calls<br /><br /><br /><strong>logger set level {DEBUG|NOTICE}</strong>: Enables/Disables a specific logging level for this console<br />logger <font color="#cc0033">set level</font> debug off<br /><img src ="http://www.cppblog.com/byc/aggbug/183302.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/byc/" target="_blank">八叶草</a> 2012-07-14 07:39 <a href="http://www.cppblog.com/byc/archive/2012/07/14/183302.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>