爱博

专业性的个人博客...

导航

VIVR 发送传真函数


//★★★★★★★★★★★★116发送传真部分★★★★★★★★★★★★
FuncXkzysendfax
{
#declare SR cmessage//给数据库网关发送的参数
#declare SR Tonghuabianma//通话编码,用来确定打长途还是市话
#declare SR sendfaxphonenum//接受传真电话号码
#declare IR sendfaxphonelen//接受传真电话号码长度
:stWait
 [ClearDTMF]
       [SetDTMF "?"]
       [Assign SR1,SR29]
       [StrCat SR1, "sendfax1.vox"]                                 
       [PlayFile SR1]
       StopPlayBack->stchoicethisoranother
       DialTerminate->stchoicethisoranother
       Failed->stBaseError

:stchoicethisoranother
       [Digit 10]
       StopDigits('1')->stfaxthis
       StopDigits('2')->stfaxanother
 StopDigits->stWait
 TimeOut->stWait

:stfaxthis
 [equal quhao,"010"]
 passed->stfaxthis1
 failed->stfaxthis2

:stfaxthis1
 [strcat sendfaxphonenum,CallerID]
 ->Directsendfax

:stfaxthis2
 [strcat sendfaxphonenum,quhao]
 [strcat sendfaxphonenum,CallerID]
 ->Directsendfax

:stfaxanother
 [ClearDTMF]
       [SetDTMF "?"]
       [Assign SR1,SR29]
       [StrCat SR1, "sendfax2.vox"]                                 
       [PlayFile SR1]
       StopPlayBack->stInputsendfax
       DialTerminate->stInputsendfax
       Failed->stBaseError 

:stInputsendfax
       [SetDTMF "#"]
 [Input 15,30]                                                   //输入公司代号,用#号键返回
 StopDigits('#') -> stGetAccount
 StopDigits -> stfaxanother
 TimeOut -> stfaxanother

:stGetAccount
       [ParseParam SR0,1,"#"]                                        //分析字符串,从第一个数字到#号之前的数字取出,一共4位
 [Assign sendfaxphonenum,SR0]
 [strlen sendfaxphonenum]
 [Assign sendfaxphonelen,IR0]
 ->streadsendfaxnum

:streadsendfaxnum
 [StrSub sendfaxphonenum,1,1]
 [Assign SR11,SR0]
 [StrCat SR11,".vox"]
 [StrSub sendfaxphonenum,2,2]
 [Assign SR12,SR0]
 [StrCat SR12,".vox"]
 [StrSub sendfaxphonenum,3,3]
 [Assign SR13,SR0]
 [StrCat SR13,".vox"]
 [StrSub sendfaxphonenum,4,4]
 [Assign SR14,SR0]
 [StrCat SR14,".vox"]
 [StrSub sendfaxphonenum,5,5]
 [Assign SR15,SR0]
 [StrCat SR15,".vox"]
 [StrSub sendfaxphonenum,6,6]
 [Assign SR16,SR0]
 [StrCat SR16,".vox"]
 [StrSub sendfaxphonenum,7,7]
 [Assign SR17,SR0]
 [StrCat SR17,".vox"]
 [StrSub sendfaxphonenum,8,8]
 [Assign SR18,SR0]
 [StrCat SR18,".vox"]
 [StrSub sendfaxphonenum,9,9]
 [Assign SR19,SR0]
 [StrCat SR19,".vox"]
 [StrSub sendfaxphonenum,10,10]
 [Assign SR20,SR0]
 [StrCat SR20,".vox"]
 [equal sendfaxphonelen,10]
 passed->stPlayshuru
 failed->sendfaxlen11

:sendfaxlen11
 [StrSub sendfaxphonenum,11,11]
 [Assign SR21,SR0]
 [StrCat SR21,".vox"]
 [equal sendfaxphonelen,11]
 passed->stPlayshuru
 failed->sendfaxlen12

:sendfaxlen12
 [StrSub sendfaxphonenum,12,12]
 [Assign SR22,SR0]
 [StrCat SR22,".vox"]
 [equal sendfaxphonelen,12]
 passed->stPlayshuru
 failed->sendfaxlen13

:sendfaxlen13
 [StrSub sendfaxphonenum,13,13]
 [Assign SR23,SR0]
 [StrCat SR23,".vox"]
 ->stPlayshuru

:stPlayshuru
       [ClearDTMF]
       [SetDTMF "?"]
       [Assign SR1,SR29]        
       [StrCat SR1, "sendfax3.vox"]         //您输入的防伪码是                            
       [PlayFile  SR1]
       StopPlayBack->stPlayagainfw1
       DialTerminate->stPlayagainfw1
       Failed->stBaseError

:stPlayagainfw1
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR11]
      [PlayFile SR1]                                
      StopPlayBack->stPlayagainfw2
      DialTerminate->stPlayagainfw2
      Failed->stBaseError

:stPlayagainfw2
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR12]
      [PlayFile SR1]                               
      StopPlayBack->stPlayagainfw3
      DialTerminate->stPlayagainfw3
      Failed->stBaseError

:stPlayagainfw3
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR13]
      [PlayFile SR1]                                
      StopPlayBack->stPlayagainfw4
      DialTerminate->stPlayagainfw4
      Failed->stBaseError

:stPlayagainfw4
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR14]
      [PlayFile SR1]                                 
      StopPlayBack->stPlayagainfw5
      DialTerminate->stPlayagainfw5
      Failed->stBaseError

:stPlayagainfw5
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR15]
      [PlayFile SR1]                               
      StopPlayBack->stPlayagainfw6
      DialTerminate->stPlayagainfw6
      Failed->stBaseError

:stPlayagainfw6
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR16]
      [PlayFile SR1]                            
      StopPlayBack->stPlayagainfw7
      DialTerminate->stPlayagainfw7
      Failed->stBaseError

:stPlayagainfw7
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR17]
      [PlayFile SR1]                               
      StopPlayBack->stPlayagainfw8
      DialTerminate->stPlayagainfw8
      Failed->stBaseError

:stPlayagainfw8
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR18]
      [PlayFile SR1]                              
      StopPlayBack->stJudgesendfax8

      DialTerminate->stJudgesendfax8
      Failed->stBaseError

:stJudgesendfax8
 [equal sendfaxphonelen,8]
 passed->stDecidedfw
 failed->stPlayagainfw9

:stPlayagainfw9
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR19]
      [PlayFile SR1]                                //第九个电话号码
      StopPlayBack->stPlayagainfw10
      DialTerminate->stPlayagainfw10
      Failed->stBaseError


:stPlayagainfw10
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR20]
      [PlayFile SR1]                           
      StopPlayBack->stJudgesendfax11
      DialTerminate->stJudgesendfax11
      Failed->stBaseError

:stJudgesendfax11
 [equal sendfaxphonelen,10]
 passed->stDecidedfw
 failed->stPlayagainfw11

:stPlayagainfw11
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR21]
      [PlayFile SR1]                               
      StopPlayBack->stJudgesendfax12
      DialTerminate->stJudgesendfax12
      Failed->stBaseError

:stJudgesendfax12
 [equal sendfaxphonelen,11]
 passed->stDecidedfw
 failed->stPlayagainfw12

:stPlayagainfw12
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR22]
      [PlayFile SR1]                                
      StopPlayBack->stJudgesendfax13
      DialTerminate->stJudgesendfax13
      Failed->stBaseError

:stJudgesendfax13
 [equal sendfaxphonelen,12]
 passed->stDecidedfw
 failed->stPlayagainfw13

:stPlayagainfw13      //第十三个电话号码
      [SetDTMF "?"]
      [Assign SR1,SR29]
      [StrCat SR1,SR23]
      [PlayFile SR1]                             
      StopPlayBack->stDecidedfw
      DialTerminate->stDecidedfw
      Failed->stBaseError

:stDecidedfw
 [SetDTMF "?"]
 [Assign SR1,SR29]
 [StrCat SR1,"sendfax4.vox"]   //确认请按1字键,重新输入请按2字键
 [PlayFile SR1]
 StopPlayBack->stPlayfinish
 DialTerminate->stPlayfinish
 Failed->stBaseError

:stPlayfinish
       [Digit 20]
       StopDigits('1')->Directsendfax
 StopDigits('2')->stfaxanother
 TimeOut->stPlayshuru


:Directsendfax
    [Assign cmessage,""]
    [Assign sendfaxsmallnum,""]
    [Assign sendfaxsmallnum,"11698577"]
    [STRCAT cmessage,ServerID]
    [STRCAT cmessage,"&9&"]
    [STRCAT cmessage,Calltelephone1]
    [STRCAT cmessage,"$"]
    [STRCAT cmessage,quhao]
    [STRCAT cmessage,"$"]
    [STRCAT cmessage,CallerID] 
    [Assign Callerid,CallerID]
    [STRCAT cmessage,"$"]
    [STRCAT cmessage,VMCodify] //功能键编号,存放在全局变量VMCodify
    [STRCAT cmessage,"$2"]
    [STRCAT cmessage,"$"]
    [STRCAT cmessage,sendfaxphonenum]
    [STRCAT cmessage,"$"]
    [STRCAT cmessage,sendfaxsmallnum]//发送传真小号
    [ASSIGN SR1,cmessage]
    [directrequestdata NETW,1020,SR1]  
    DataReceived -> stsuccesssendfax
    TimeOut -> stBaseError
    GatewayNotExist->stBaseError//注意别丢了这一行
    Failed->stBaseError//注意别丢了这一行

:stsuccesssendfax
 [SetDTMF "?"]
 [Assign SR1,SR29]
 [StrCat SR1, "sendfax6.vox"]                          //
 [PlayFile SR1] 
 StopPlayBack  -> sttimer
 DialTerminate -> sttimer
 Failed        -> stExit 

:sttimer
       [TIMER 999]
       timeout -> stExit
       Failed -> stExit

:stBaseError
 [SetDTMF "?"]
 [Assign SR1,SR29]
 [StrCat SR1, "BaseError.vox"]                          //

 [PlayFile SR1] 
 StopPlayBack  -> stExit
 DialTerminate -> stExit
 Failed        -> stExit

:stExit
     [Return 0]
}
//★★★★★★★★★★★★116发送传真部分结束★★★★★★★★★★★★

posted on 2006-10-12 14:43  Sandy  阅读(355)  评论(0编辑  收藏  举报