hang up calls with FXO

Version 1
    This document was generated from CDN thread

    Created by: Erick Alfredo Zabala Sanjines on 05-07-2011 08:32:24 AM
    HI I have a little problem with my cisco 2600. I want to hang up a call  when this into from PSTN. I want to disconnect port FXO when I hang up phone analog.
     
                                      =============
                                      ==ROUTER2600  =
    ======                      =                      =
    phone   <===PSTN==> FXO                ========== > SWITCH 2935 ======= CISCO IP PHONE 7940
    Analog =                      =============
    ======
     
     
    This is my code:
     
    Thanks.
     

    #
    #---------------------------------
    # Script
    #---------------------------------

     

     
    proc init { } {
    global param
     
    set param(interruptPrompt) true
    set param(abortKey) *
    set param(terminationKey) #
    set param(dialPlanTerm) false
    set param(initialDigitTimeout) 5
    set param(dialPlan) true
    set param(maxDigits) 3
     
    }
     
    proc act_Setup { } {
    global dest
    global param
     
     
     
    leg setupack leg_incoming
    media play leg_incoming flash:test4.wav
    leg collectdigits leg_incoming param
    puts "\n estoy colectando"
     
    }
     
    proc act_GotDest { } {
    global dest
    set status [infotag get evt_status]
    puts "\ Estado [infotag get evt_status] "
    if { $status == "cd_001" } {
    # Si no disca ningún número de interno va a la operadora
    puts "\ Estado [infotag get evt_status] "
    call close
    } elseif { $status == "cd_005" || $status == "cd_004" } {
    set dest [infotag get evt_dcdigits]
    puts "\estoy por conectar $dest"
    if { $dest == "0" } {
    leg setup 502 callInfo leg_incoming
    } else {set dest [infotag get evt_dcdigits]
    puts "\estoy por conectar $dest"
    leg setup $dest callInfo leg_incoming}
     
    } else {
     
    puts "\nEl numero [infotag get evt_dcdigits] No marca con ningun dial peer"
    puts "\nLa variable dest tiene $dest "
    puts "\nLa llamada [infotag get con_all] tiene un evento $status "
    fsm setstate GETDEST
    }
    }
     
     
    proc act_CallSetupDone { } {
    global beep
    set status [infotag get evt_status]
    puts "\n Valor de Estado "
     
    if { $status == "ls_006"} {
    puts "\nLa extension esta ocupada"
    leg proceeding leg_incoming
    leg setup 501 callInfo leg_incoming
    } elseif { $status == "ls_000" } {
     
    puts "\nConectado"
    } elseif { $status == "ls_004"} {
    puts "\nDisco un numero invalido"
    leg setup 501 callInfo leg_incoming
    } elseif { $status == "ls_003"} {
    puts "\ Paso la llamada pero tiene problemas al conectarla"
    leg setup 501 callInfo leg_incoming
    } elseif { $status == "ls_007"} {
    puts "\ Pequeño truco ocupado"
    leg setup 501 callInfo leg_incoming
    } else {
    puts "\n Leg setup status [infotag get evt_status]"
    puts " Cierro la llamada "
    puts "\n Incoming leg [infotag get evt_legs]"
    call close
    }
    }
     
     
     
    proc act_Cleanup { } {
    call close
    }
     
    init
     
    #----------------------------------
    # State Machine
    #----------------------------------
    set fsm(any_state,ev_disconnected) "act_Cleanup same_state"
    set fsm(CALL_INIT,ev_setup_indication) "act_Setup GETDEST"
    set fsm(GETDEST,ev_collectdigits_done) "act_GotDest PLACECALL"
    set fsm(PLACECALL,ev_setup_done) "act_CallSetupDone CALLACTIVE"
    set fsm(FERSTATE,ev_media_done) "act_collect_again GETDEST_AGAIN"
    set fsm(GETDEST_AGAIN,ev_collectdigits_done) "act_GotDest_again PLACECALL"
    set fsm(CALLACTIVE,ev_disconnected) "act_Cleanup CALLCLOSE"
    set fsm(CALLDISCONNECT,ev_disconnected) "act_Cleanup CALLCLOSE"
    set fsm(CALLDISCONNECT,ev_media_done) "act_Cleanup CALLCLOSE"
    set fsm(CALLDISCONNECT,ev_disconnect_done) "act_Cleanup CALLCLOSE"
    set fsm(CALLDISCONNECT,ev_leg_timer) "act_Cleanup CALLCLOSE"
     
    fsm define fsm CALL_INIT
     
    Can you give me some example to disconect FXO, I want to disconect whatever call. Thank you 

     
     
     

    Subject: RE: hang up calls with FXO
    Replied by: Yaw-Ming Chen on 05-07-2011 05:31:49 PM
    You might want to turn on debug "deb voip app tcl" to see if you got disconnect event