對視頻的支持
ZXVXI對VoiceXML擴展支持的視頻包括三個部分:
視頻呼叫
視頻會議
視頻疊加文字
錄製視頻
視頻呼叫:在使用<transfer>標籤或擴展的callout標籤進行轉接時,用<param>標籤設置isVideo的屬性爲1.具體實例如下:
<?xml version=“1.0” encoding=“gb2312”?>
<vxml version=“2.0”>
<form>
<var name=“Specialssp”/>
<var name=“Oldssp”/>
<var name=“Curssp”/>
<object name=“getcurssp1” classid=“method://ngcc/Other/GetCurCallID”>
<param name=“CallID” expr=“Oldssp”/>
<filled>
<prompt bargein=“false”>
初始呼叫:<value expr=“Oldssp”/>
</prompt>
</filled>
</object>
<object name=“callsetup” classid=“method://ngcc/Call/CallOut”>
<param name=“CLD” value=“88880502”/>
<param name=“CallID” expr=“Specialssp”/>
<param name=“isVideo” expr=“1”/>
<filled>
<if cond=“callsetup !=‘HOOK_OFF’”>
<exit/>
<else/>
<log>
呼叫result:<value expr=“callsetup”/>
呼叫CallID:<value expr=“Specialssp”/>
</log>
</if>
</filled>
</object>
<object name=“connectcall” classid=“method://ngcc/Resource/ConnectCall”>
<param name=“CallIDSrc” expr=“Specialssp”/><!—源ssp—>
<param name=“CallIDDes” expr=“Oldssp”/><!—目的ssp—>
<param name=“ControlMode” value=“0”/>
<filled>
<prompt> 建立兩個呼叫連接返回<value expr=“connectcall.result”/></prompt>
</filled>
</object>
<!—等待用戶掛機—>
<object name=“asynTrans” classid=“method://function/waitEvent”/>
</form>
</vxml>
視頻會議:在使用classid=“method://ngcc/Conf/CreateConf”的擴展標籤創建會議時,用<param>標籤設置isVideoConf的屬性爲1,即可創建視頻會議。
具體實例如下:
<?xml version=“1.0” encoding=“gb2312”?>
<vxml version=“2.0”>
<var name =“ConfNo” expr=“0”/>
<var name=“CurrentConfNO” expr=“0” />
<var name=“CurrentChannelNO” expr=“0”/>
<var name=“outputinfo” expr=“0”/>
<var name=“isplayadduser” expr=“0”/>
<var name=“newUser” expr=“0”/>
<var name=“MinValue” expr=“0”/>
<form id=“createConf”><!—創建會場,用戶自動加入會場並佔用1通道—>
<object name=“create” classid=“method://ngcc/Conf/CreateConf”>
<param name=“ChannelNum” expr=“10”/>
<param name=“ConfNO” expr=“ConfNo”/><!—vxi會返回創建好的會場號—>
<param name=“isVideoConf” expr=“1”/>
<filled>
<if cond=“create == ‘SUCCESS’ ”>
<assign name=“CurrentConfNO” expr=“ConfNo”/>
<assign name=“CurrentChannelNO” expr=“1”/>
<log>創建會議成功,會場號爲<value expr=“ConfNo”/>
create <value expr=“create”/>
</log>
<goto next=“#callOutUser”/>
<elseif cond=“create == ‘FAILURE’”/>
<prompt>創建會議失敗,謝謝使用</prompt>
<exit/>
</if>
</filled>
</object>
</form>
<form id=“callOutUser”><!—發散式外呼—>
<object name=“callOutUser1” classid=“method://cm-ngcc/call/callout”>
<param name=“CLD” expr=“‘33330002’”/>
<param name=“CLI” expr=“’45801008’”/>
<param name=“CallID” expr=“newUser”/>
<filled>
<if cond=“callOutUser1 != ‘HOOK_OFF’”>
<goto next =“#callOutUserFailed”/>
</if>
</filled>
</object>
<object name=“connectres” classid=“method://cm-ngcc/Call/ExtStartPlay”>
<param name=“CallID” expr=“newUser”/>
<param name=“PlayType” expr=“0”/>
<param name=“PlayPara” expr=“‘對被叫放音’”/>
</object>
<block>
<assign name=“isplayadduser” expr=“2”/>
<goto next=“#waitEvent”/>
</block>
</form>
<form id=“adduser”>
<block>
<assign name=“isplayadduser” expr=“3”/>
</block>
<object name=“join_1” classid=“method://cm-ngcc/conf/confadduser”>
<param name=“ConfNO” expr=“ConfNo”/>
<param name=“CallID” expr=“newUser”/><!—要加入會議的leg的標識—>
<param name=“connPartyType” expr=“0”/>
<param name=“ConnMode” expr=“3”/>
<param name=“ChannelNO” expr=“CurrentChannelNO”/><!—vxi會返回佔用的通道號—>
<filled>
<if cond=“join_1==‘SUCCESS’”>
<log>user has joined in conference , channelno is :<value expr=“CurrentChannelNO”/></log>
<goto next=“#ConfPlayWelcome”/>
<elseif cond=“join_1==‘FAILURE’”/>
<log> 加入會議失敗,謝謝使用</log>
</if>
<goto next=“#waitEvent”/>
</filled>
</object>
</form>
<form id=“callOutUserFailed”>
<object name=“play5” classid=“method://cm-ngcc/conf/confstartplay”>
<param name=“ConfNO” expr=“CurrentConfNo”/>
<param name=“ChannelNO” expr=“0”/>
<param name=“PlayType” expr=“5”/>
<param name=“PlayPara” expr=“‘發散式呼出用戶失敗’”/>
</object>
<block><goto next =“#waitEvent”/></block>
</form>
<form id=“waitEvent”>
<block>
<log>進入wait event標籤</log>
</block>
<object name=“wait” classid=“method://cm-ngcc/Other/WaitEvent”>
<param name=“OutputInfo” expr=“outputinfo”/>
<filled>
<log>outputinfo:<value expr=“outputinfo”/>
<assign name=“CurrentChannelNO” expr=“session.telephone.lastchannelno”/>
<log>event:<value expr=“wait”/></log>
<if cond=“wait==‘ERROR’ && MinValue==1”>
<goto next=“#PCfromChannel1”/>
</if>
<if cond=“wait==‘CP_USERJOIN’”>
<log>user add in, channelno is :<value expr=“CurrrentChannelNO” /> </log>
<if cond=“CurrentChannelNO == 3”>
<goto next=“#ChangeUser2”/>
<else/>
<goto next =“#ConfPlayWelcome”/>
</if>
</if>
<if cond=“wait==‘CP_PALYEND’”>
<assign name=“CurrentChannelNO” expr=“session.telephone.lastchannelno”/>
<log> CurrentChannelNO:<value expr=“CurrentChannelNO”/></log>
<if cond=“isplayadduser==2”>
<log>user play end,add to conf</log>
<goto next=“#adduser”/>
</if>
</if>
<if cond=“wait==‘USER_HOOK’”>
<log> user quit, channelno is:<value expr=“CurrentChannelNO”/></log>
<if cond=“CurrentChannelNO==2”>
<goto next=“#confstopplay”/>
</if>
</if>
<if cond=“wait==‘NOEVENT’”>
<exit/>
</if>
<!—不滿足上述條件的時間不處理,繼續等待其他事件—>
<goto next =“#waitEvent”/>
</filled>
</object>
</form>
<form id=“confstopplay”>
<object name=“connectres” classid=“method://cm-ngcc/conf/confstopplay”>
<param name=“ConfNO” expr=“CurrentConfNO”/>
<param name=“ChannelNO “ expr=“1”/>
</object>
<block>
<goto next=“#waitEvent”/>
</block>
</form>
</vxml>
視頻疊加文字
視頻疊加文字,首先需要在異步放音標籤classid=“method://ngcc/Call/ExtStartPlay”、異步收號標籤classid=“method://ngcc/Call/ExCollectDIgit”、
會場放音標籤classid=“method://ngcc/Conf/ConfStartPlay”、會場收號標籤classid=“method://ngcc/Conf/CollectDigit” 中添加視頻疊加的標籤<videooverlay>,
再添加其包含的屬性有文字大小、文字位置、文字格式、文字顏色、背景顏色、背景的透明度。
示例1:添加一條文字
<?xml version=“1.0” encoding=“UTF-8”?>
<vxml version=“2.0”>
<var name=“Oldssp” expr=“0”/>
<var name=“outputinfo” expr=“0”/>
<form>
<object name=“getcurssp1” classid=“method://ngcc/Other/GetCurCallID”>
<param name=“CallID” expr=“Oldssp”/>
<filled>
<log>呼叫ID:<value expr=“Oldssp”/></log>
</filled>
</object>
<object name=“connectres” classid=“method://ngcc/Call/ExtStartPlay”>
<param name=“CallID” expr=“Oldssp”/>
<param name=“PlayType” expr=“1”/>
<param name=“PlayPara” expr=“‘ipfile://welcome.3gp’”/>
<videooverlay id=“1” text-str=“Text Overlay 1” text-font=“en-default” location=“0,0”/>
</object>
<block>
<goto next=“#waitform”/>
</block>
</form>
<form id=“waitform”>
<object name=“asynTrans” classid=“method://fumctiom/waitEvent”>
<param name=“OutputInfo” expr=“outputinfo”/>
<filled>
<log>=========<value expr=“asynTrans”/>::<value expr=“outputinfo”/>============</log>
<if cond=“asynTrans==‘VP_END’ && session.telephone.lastchannelno==2”>
<log> VP_END recv……..</log>
</if>
<goto next =“#waitform”/>
</filled>
</object>
</form>
</vxml>
示例2:添加多條文字
<?xml version=“1.0” encoding=“UTF-8”?>
<vxml version=“2.0”>
<var name=“Oldssp” expr=“0”/>
<var name=“outputinfo” expr=“0”/>
<form >
<object name=“getcurssp1” classid=“method://ngcc/Other/GetCurCallID”>
<param name=“CallID” expr=“Oldssp”/>
<filled>
<log>呼叫ID:<value expr=“Oldssp”/></log>
</filled>
</object>
<object name=“connectres” classid=“method://ngcc/Call/ExtStartPlay”>
<param name=“CallID” expr=“Oldssp”/>
<param name=“PlayType” expr=“1”/>
<param name=“PlayPara” expr=“‘ipfile://welcom.3gp’”/>
<videooverlay id=“1” text-str=“Text Overlay 1” text-font=“en-default” size=“160,12” border-width=“1” border-color=“red” location=“0,0”/>
<videooverlay id=“2” text-str=“中文” text-font=“ch-default” text-color=“green” location=“0,50”/>
<videooverlay id=“3” text-str=“Text Overlay 2” text-font=“en-default” location=“50,0”/>
</object>
<block>
<goto next=“#waitform”/>
</block>
</form>
<form id=“waitform”>
<object name=“asynTrans” classid=“method://fumctiom/waitEvent”>
<param name=“OutputInfo” expr=“outputinfo”/>
<filled>
<log>=========<value expr=“asynTrans”/>::<value expr=“outputinfo”/>============</log>
<if cond=“asynTrans==‘VP_END’ && session.telephone.lastchannelno==2”>
<log> VP_END recv……..</log>
</if>
<goto next =“#waitform”/>
</filled>
</object>
</form>
</vxml>
示例3:在會議中視頻疊加文字
<?xml version=“1.0” encoding=“UTF-8”?>
<vxml version=“2.0”>
<var name=“ConfNo” expr=“0”/>
<var name=“CurrentConfNO” expr=“0”/>
<var name=“CurrentChannelNO” expr=“0”/>
<var name=“outputinfo” expr=“0”/>
<!—申請會場—>
<form id=“createConf”>
<object name=“createConf” classid=“method://ngcc/Conf/CreateConf”>
<param name=“ChannelNum” expr=“5”/>
<param name=“ConfNO” expr=“ConfNo”/>
<param name=“isVideoConf” expr=“1”/>
<filled>
<if cond=“createConf==‘SUCCESS’”>
<!—將當前通道設置爲1號通道—>
<assign name=“CurrentChannelNO” expr=“1”/>
<!—當前會場號賦值給變量CurrentConfNO—>
<assign name=“CurrentConfNO” expr=“ConfNo”/>
<goto next=“#ConfPlayWelcome”/>
<else/>
<prompt>創建會議失敗,謝謝使用</prompt>
<disconnect/>
</if>
</filled>
</object>
</form>
<!—會場放音—>
<!—對剛剛加入的用戶放歡迎音—>
<form id=“ConfPlayWelcome”>
<block>
<log>==========進入ConfPlayWelcome標籤===========</log>
</block>
<object name=“play” classid=“method://ngcc/Conf/ConfStartPlay”>
<param name=“ConfNO” expr=“CurrentConfNO”/>
<param name=“ChannelNO” expr=“CurrentChannelNO”/>
<param name=“PlayType” expr=“1”/>
<param name=“PlayPara” expr=“‘ipfile://welcom.3gp’”/>
<videooverlay id=“1” text-str=“Text Overlay 1” text-font=“en-default” text-size=“10” text-color=“green” text-background-color=“black” text-location=“2,4” text-background-transparency=“70” location=“0,0”/>
<videooverlay id=“2” text-str=“中文” text-font=“ch-default” text-size=“12” text-color=“yellow” text-background-color=“black” text-location=“1,4” text-background-transparency=“70” location=“50,50”/>
</object>
<!—跳到等待事件標籤—>
<block>
<log>============退出ConfPlayWelcome標籤=========</log>
<goto next =“#waitEvent”/>
</block>
</form>
<form id=“callOutUser”><!—發散式外呼—>
<object name=“callOutUser1” classid=“method://cm-ngcc/call/callout”>
<param name=“CLD” expr=“’’45801010”/>
<param name=“CLI” expr=“’45801008’”/>
<param name=“CallID” expr=“newUser”/>
<filled>
<if cond=“callOutUser1 !=‘HOOK_OFF’”》
<goto next=“#callOutUserFailed”/>
</if>
</filled>
</object>
<object name=“connectres” classid=“method://cm-ngcc/Call/ExtStartPlay”>
<param name=“CallID” expr=“newUser”/>
<param name=“PlayType” expr=“0”/>
<param name=“PlayPara” expr=“‘對被叫放音’”/>
</object>
<blcok>
<assign name=“isplayadduser” expr=“2”/>
<goto next=“#waitEvent”/>
</block>
</form>
<!—等待事件—>
<form id=“waitEvent”>
<block>
<log>=============進入wait event標籤==========</log>
</block>
<object name=“wait” classid=“method://ngcc/Other/WaitEvent”>
<param name=“OutputInfo” expr=“outputinfo”/>
<filled>
<log>==========outputinfo:<value expr=“outputinfo”/>========</log>
<!—session.telephone.lastchannelno表示最近一次操作的通道號,0表示是對整個會議的操作—>
<assign name=“CurrentChannelNO” expr=“session.telephone.lastchannelno”/>
<log>========event:<value expr=“wait”/>======</log>
<if cond=“wait ==‘CP_USERJOIN’”>
<log>========user add in,channelno is :<value expr=“CurrentChannelNO”/>======</log>
<goto next=“#ConfPlayWelcome”/>
</if>
<if cond=“wait==‘CP_PLAYEND’”>
<log>========CP_PLAYEND333======</log>
<assign name=“CurrentChannelNO” expr=“session.telephone.lastchannelno”/>
<log>CurrentChannelNO:<value expr=“CurrentChannelNO” /></log>
<if cond=“CurrentChannelNO==1”>
<goto next=“#callOutUser”/>
</if>
</if>
<!—不滿足上述條件的事件不處理,繼續等待其他事件—>
<goto next=“#waitEvent”/>
</filled>
</object>
</form>
<form id=“realseconf”>
<object name=“realseconf” classid=“method://ngcc/Conf/ReleaseConf”>
<param name=“ConfNO” expr=“CurrentConfNO”/>
</object>
<block><return/></block>
</form>
</vxml>
錄製視頻
錄製視頻:在使用<record>標籤錄製時,將錄製的文件名設置爲視頻的後綴,如.3gp或.mov。具體實例如下:
<?xml version=“1.0”?>
<vxml version=“2.0”>
<form>
<record name=“user_record”>
<property name=“filenamesrc” value=“recordtest.mov”/>
<property name=“maxtime” value=“15s”/>
<property name=“dtmfterm” value=“true”/>
<property name=“finalsilence” value=“4000ms”/>
<property name=“record type” value=“2”/>
</record>
<block><audio src=“ipfile://recordtest.mov”/></block>
</form>
</vxml>