爱博

专业性的个人博客...

导航

VIVR 主源程...

#function main
#function AlarmTimeOff0
#function AlarmTimeOff1
#function AlarmTimeOff2
#iniparam string @vox_path   //相关的配置文件参考sports 流程的 .ini相应文件
#iniparam string @ServerID
#declare SR wsTopic //公司语音流程
#declare IR NETW       //传送端口号
#declare SR userID
#declare SR ServerID
#declare SR Calltelephone="********"
#declare SR Calltelephone1
#declare SR quhao
#declare SR T_AreaCode
#declare IR ifCallerMobile
#declare SR TempCallerID
#declare SR Jiedianhao
#declare SR Seatdataid//坐席和数据库表的ID号
#declare SR Callerid//转人工中,传送的电话号码
#declare SR CallerID//主叫号码


// SR29 语音路径存放  SR28用户按键存放 sr27,sr26,ir9用户按键临时变量  IR1 全播放时记数器
main
{
:stWait
     Connect->stAllocResource                                            //用户呼入

:stAllocResource
     [Assign ServerID,""]
     [Assign SR29,@ServerID]
     [StrCat ServerID,SR29]
     [Assign SR29,""]
     [Assign SR29,@vox_path ]                                            //语音变量存放在变量SR29中
     [AllocMediaDevice 1]                                                //分配媒体资源,资源类型为vox
     AllocResourceOK-> stGetGORParam//分配资源
     AllocResourceFail -> stExit

:stGetGORParam
 [ Assign SR0,"select reserve1,areacode from tbl_areacode" ]
       [ ExecSQL SR0 ]
 Passed -> stonstopflow
 Failed -> stExit
 TimeOut->stExit
 [ SToI FD0 ]
 [ Assign NETW,IR0 ]
 [Assign T_AreaCode,FD1]

:stonstopflow
 [Assign IR6,30]
       [Onstopflow &AlarmTimeOff2]
       [Onstopwatch &AlarmTimeOff2]
 [Oncallcleared &AlarmTimeOff2]
 -> stfuzhi


//************************************提取区号******************************
:stfuzhi
 [Assign CallerID,$CallerID]
 ->stEraseareacode

:stEraseareacode
  [StrLen CallerID]
 [Less IR0,10]
 Passed -> stGetAreaCode        //小于11为的号码为不带区号的裸号
 Failed -> stphoneWait               //大于11的号码再做判断
:stphoneWait
 [Assign IR22,1]
 [Assign SR10,CallerID]  //判断主叫电话号码第一位是不是0,如果是则去掉0
 [StrSub SR10,1,1]
 [Equal SR0,"0"]
 Passed -> stErasePhoneZero
 Failed -> stJudgePhoneLen
:stErasePhoneZero
 [StrSub SR10,2,30]
 [Assign SR10,SR0]
 ->stJudgePhoneLen
:stJudgePhoneLen
 [Assign CallerID,SR10]
 [StrLen SR10]
 [Great IR0,11]            //区别是手机或是市话
 Passed -> stJudgePhone
 Failed -> stIfMobile
:stJudgePhone
 [StrSub SR10,1,1]
 [SToI SR0]
 [Less IR0,3]
 Passed -> stEarsePhone2Bit
 Failed -> stEarsePhone3Bit
:stEarsePhone2Bit
 [StrSub SR10,3,30]
       [Assign SR14,SR0]
 [Assign CallerID,SR0]
 -> stEraseareacode  //剔除第一个区号后再返回开头处理主叫
:stEarsePhone3Bit
 [StrSub SR10,4,30]
 [Assign SR14,SR0]
 [Assign CallerID,SR0]
 -> stEraseareacode
:stGet2bitAreaCode
 [StrSub SR10,1,2]
 [Assign SR15,"0"]
 [StrCat SR15,SR0]
 [Assign quhao,SR15]
 [StrSub SR10,3,13]
       [Assign SR14,SR0]
 [Assign CallerID,SR0]
 ->stStartFlow                                                            
:stGet3bitAreaCode
 [StrSub SR10,1,3]
 [Assign SR15,"0"]
 [StrCat SR15,SR0]
 [Assign quhao,SR15]
 [StrSub SR10,4,13]
       [Assign SR14,SR0]
 [Assign CallerID,SR0]
 ->stStartFlow                                                            
:stIfMobile
 [StrSub SR10,1,2]
 [Equal SR0,"13"]
 Passed ->stChange
 Failed ->stGetAreaCode
:stGetAreaCode
 [StrLen SR10]
 [Great IR0,8]                   //判断是否不带区号的固话
 Passed ->stParseAreaCode
 Failed ->stAssignLocalCode
:stAssignLocalCode             //主叫没有区号信息,在号码前强加本地ips节点区号
 [Assign quhao,T_AreaCode]
 ->stStartFlow                                                            
:stParseAreaCode
 [StrSub SR10,1,1]
 [SToI SR0]
 [Less IR0,3]
 Passed ->stGet2bitAreaCode
 Failed ->stGet3bitAreaCode

:stChange
       [SwitchDBA 400]
       Passed->stParseMobileArea
       Failed->stExit

:stParseMobileArea
 [StrSub SR10,1,3]
 [Assign SR17,SR0]
 [StrSub SR10,4,7]
 [Assign SR18,SR0]
 [Assign SR1 ,"select disno from t_cellno where startchars='"]
 [StrCat SR1,SR17 ]
 [StrCat SR1,"' and startno ='"]
 [StrCat SR1 , SR18 ]
 [StrCat SR1 ,"'"]
 [ExecSQL SR1 ]
 Passed ->stGetMobileArea
 Failed ->stExit
       TimeOut  -> stExit
:stGetMobileArea
 [Assign ifCallerMobile,1]         //主叫是手机用户
 [Assign quhao,FD0]
 ->stStartFlow                                                            

//************************************************************************
:stStartFlow                
     Connect(0)->stExit

  //Add user's code

  :stExit
     [RETURN 0]
}


AlarmTimeOff2
{
#declare SR cmessage
:stWait
      Connect->stEndBill

:stEndBill
      [BillEnd]
      Verify(0)->stDirect4
      Verify(-1)->stDirect4

:stDirect4
    [Assign cmessage,""]
    [STRCAT cmessage,ServerID]
    [STRCAT cmessage,"&4&"]
    [STRCAT cmessage,Calltelephone1]
    [STRCAT cmessage,"$"]
    [STRCAT cmessage,quhao]
    [STRCAT cmessage,"$"]
    [STRCAT cmessage,CallerID] 
    [STRCAT cmessage,"$"]
    [STRCAT cmessage,Seatdataid]
    [ASSIGN SR1,cmessage]
    [directrequestdata NETW,1020,SR1]  
    DataReceived -> stExit
    TimeOut -> stExit
    GatewayNotExist->stExit//注意别丢了这一行
    Failed->stExit//注意别丢了这一行

:stExit
   [RETURN 0]
}

 

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