''' 语音流程 '''
eventtype=["振铃","接通","按键","语音结束","语音超时","己方挂机","对方挂机","其他事件"]
Info.IvrResult = -1
try:
    atprint(eventtype[Info.EventType] + ",分机号=" + Info.linenumber + "; 外线号码=" + Info.outCode + "; 电话=" + Info.CalledId)
except:
    atprint("收到其他事件="+str(Info.EventType))
''' ///////////////////////////////////////////////////// '''  

if Info.EventType == 0: 
    '''电话响铃代码写在这下面'''
    Info.IvrResult = 0
    Pickup(Info.chindex)
    PlayStr(Info.chindex, "有一天，一只小猴子下山来。它走到一块玉米地里，看见玉米结得又大又多，非常高兴，就掰了一个，扛着往前走。小猴子扛着玉米，走到一棵桃树下。它看见满树的桃子又大又红，非常高兴，就扔了玉米去摘桃子。")
elif Info.EventType == 1:
    PlayStr(Info.chindex, "你按的是爸爸的电话，按键正确")
    Info.IvrResult = 0
elif Info.EventType == 2:
    '''按键代码写在这下面'''
    StopPlay(Info.chindex)
    PlayStr(Info.chindex, Info.IvrButton)
elif Info.EventType == 3:
    '''语音结束代码写在这下面'''
    i = GetInt(Info.chindex, 'i', 't')
    i = i+1
    if i<=1:
        PlayStr(Info.chindex, "小猴子捧着几个桃子，走到一片瓜地里。它看见满地的西瓜又大又圆，非常高兴，就扔了桃子去摘西瓜。小猴子抱着一个大西瓜往回走。走着走着，看见一只小兔蹦蹦跳跳的，真可爱。它非常高兴，就扔了西瓜去追小兔。小兔跑进树林子，不见了。小猴子只好空着手回家去。你按的是爸爸的电话，按键正确")
    SetInt(Info.chindex, 'i', 't', i)
elif Info.EventType == 4:
    '''语音超时代码写在这下面'''
    atprint("")
    
elif Info.EventType == 5:
    '''己方挂机代码写在这下面'''
    atprint("")
    
elif Info.EventType == 6:
    '''对方挂机代码写在这下面'''
    atprint("")
    
else:
    atprint("")

