cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
813
Views
0
Helpful
31
Replies
Highlighted
Beginner

Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

Hi,

i've been tasked with helping a customer integrate a legacy pbx to some new SIP terminals. 

Call flow is as follows:

PSTN --> PBX / ACD -- call delivered to extension 1001 through 1004.  These are analog lines.

The FXS on the PBX is wired to matching FXO on the 2921 Router with the ports configured with PLAR OPX to the SIP devices that are registered to a SIP proxy.  So if 1001 gets the call it will go out the analog line, connect to the FXO and Plar to, say 1001 that is the IP phone.

This all works.

Issue is when the terminal needs to transfer the call back into the old pbx.   They need to grab dial tone from the FXS off of the pbx through the FXO and send the call back.  Everything i've tried to do has failed and is sending me back to a TCL script with some call handling to be able to release the call back to the pbx off of that incoming call leg.

Some extremely nice people have shared a similar TCL script with me, and we are finally attacking it, and trying to understand but if someone has some better ideas or a way to pair down the script to make it easy to follow it would be great.

What i have tried is using CME instead of the sip proxy server and have the terminals register directly.  no luck.  I used CIPC to see if we can emulate what happens - and actually CIPC has a flash softkey and it worked - so we know it's possible.  The flash key does not exist on any SIP profiles for CME.  I wanted to pcap a successful flash and transfer but it would not work.   Transfer off a cisco ip phone registered as a sip client results in a new call going back, hairpinning the call  and not flashing and re-using the same line, and therefore freeing it up.

Any help / direction is appreciated.   For those that can help I'll share the TCL with you directly as it is not my work, and was given it by the authors when they solved a similar, but not identical problem.  They had a few more constraints.   So i know it's doable, i just need help and i'm willing to debug, test and learn.  

Thanks

Jim

Everyone's tags (4)
31 REPLIES 31
Beginner

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

SIP Hookflash.png

Cisco Employee

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

Hi Jim,

You can raise Devnet support case along with your TCL script. Please refer below link for devnet support..

Cisco DevNet: DevNet Developer Support

Thanks,

Raghavendra

Beginner

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

Raghavendra,

Thanks – no problem purchasing a ticket – from what I read, this should be very achievable for the proper skillset – will the ticket cover this script creation – as i’ve described. If so – i’ll get support for sure.

Jim

Sent from Mail for Windows 10

Cisco Employee

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

Hi Jim,

I can help with TCL script modification.TCL script should get "ev_transfer_request" to transfer the call.

The TCL script you shared is able to handle the transfer request, did you try to test the script.

Please collect logs with below debugs.

debug voip app

debug ccsip messages

debug voip ccapi inout

Thanks,
Raghavendra

Beginner

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

Thanks – i’m trying now – that script had a bit much for me to process.

I think I just need to focus on identifying the inbound and outbound call legs and then identifying a message to trigger the transfer and hookflash – i’m setting up the router right now. Thanks for the tips i’ll see where I get today.

jim

Sent from Mail for Windows 10

Cisco Employee

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

Hi Jim,

The picture you attached it nice, if can have it more detail that will help to come out with the alternative solution if things do come out with the way you are expecting.

What I like to see is a simple call flow according to that picture, assuming call is from the external caller A to the called party, say 1001(B). Now 1001 need to initiate the transfer, is the transfer to party(C) an external user as well. I think the technical issue is getting the hookflash trigger (the event for Tcl). If the flash doesn't work there are options, like inband DTMF trigger.

For example, called party press "*8" to ask Tcl make a transfer. Any way if you can add a call flow that will be easier to understand the whole picture.

Yawming

Beginner

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

Yawming - you have the callflow exactly. 

External caller A calls hunt group 5000 (the ACD) - that gets routed to the FXS lines on the PBX and then PLAR'd via the FXO to the SIP extensions.    Say 1001 answers on the SIP endpoint.   They require to transfer BACK through the FXS-FXO

That's where we need the hookflash out to the FXO, grab dialtone off the pbx, then transfer back into the pbx.

I thought originally we could look for a SIP REFER but they are very capable on the SIP side, and can program a "flash" key if required.  I think they can send "*8" or any combination of DTMF to be recognized to trigger the send hookflash to the call let attached to the FXO.

I found an older TCL script that Bryan Deaver put toghether and haven't been back to the customer site yet to test - and I only just got my lab up and working yesterday but my FXO is not recognized....  

Does that help clear up the call flow - but yes - you are 100% correct on the requirement.

---  this was Bryan Deaver's script that references using DTMF as a reference.

app_hookflash.tcl

#

# written by Bryan Deaver based on the default session application.

# This is an example of converting a * dtmf event into hookflash out the fxo port.

#

# This is written as is with no claims of support.  It has been shown to work

# to convert a * h245-alhpanumeric event from callmanager while running on a c2800

# gateway running 12.4(20)T.  There are other modifications that would be done

# for example look at * 8 before forwarding the other digits.

# Or converting an A/B/C/D dtmf event into hookflash to interwork with

# other applications.  If you find a useful modification, please do drop me a note

# at bdeaver@cisco.com

#

# This is based upon the default session application as seen with

# "show call application voice session" on the router.  This provides an

# easy start by which to modify scripts to fit your needs.

#

# The modification of the session script was to add the act_ProcessDTMF function,

# add a section to look for digits coming in from the outgoing call leg

# as well as add an entry to the fsm table.

#

#---------------------------------

#   Example Script

#-----------------

proc act_Setup { } {

    global dest

    global beep

    set beep 0

    if { [infotag get leg_isdid] } {

        set dest [infotag get leg_dnis]

        leg proceeding leg_incoming

        leg setup $dest callInfo leg_incoming

        fsm setstate PLACECALL

    } else {

        leg setupack leg_incoming

        playtone leg_incoming tn_dial

        set param(dialPlan) true

        leg collectdigits leg_incoming param

    }

  

  

}

proc act_GotDest { } {

    global dest

  

    set status [infotag get evt_status]

  

    if {  $status == "cd_004" } {

        set dest [infotag get evt_dcdigits]

        leg proceeding leg_incoming

        leg setup $dest callInfo leg_incoming

    } else {

        puts "\nCall [infotag get con_all] got event $status collecting destination"

        # use invalid-number cause code

        leg disconnect leg_incoming -c28

        call close

    }

}

# here is the process that intercepts the '*' and sends out a hookflash

proc act_ProcessDTMF { } {

# get the dtmf and duration

     set dtmf_value [infotag get evt_digit]

     set dtmf_duration [infotag get evt_digit_duration]

     if {$dtmf_value == "A"} {

          leg sendhookflash leg_incoming

     } else {

# ok, not a * so playout the dtmf event with the same duration

          leg senddigit leg_incoming $dtmf_value -t $dtmf_duration

     }

}

proc act_CallSetupDone { } {

    global beep

    set status [infotag get evt_status]

    if { $status == "ls_000"} {

        set  creditTimeLeft [infotag get leg_settlement_time leg_all]

        if { ($creditTimeLeft == "unlimited") ||

             ($creditTimeLeft == "uninitialized") } {

            puts "\n Unlimited Time"

        } else {

            # start the timer for ...

            if { $creditTimeLeft < 10 } {

                set beep 1

                set delay $creditTimeLeft

            } else {

                set delay [expr $creditTimeLeft - 10]

            }

            timer start leg_timer $delay leg_incoming

        }

# setup the outgoing leg to monitor for digits

          set param(consumeDigit) true

          set param(enableReporting) true

        leg collectdigits leg_outgoing param

    } else {

        puts "Call [infotag get con_all] got event $status collecting destination"

        call close

    }

}

proc act_Timer { } {

    global beep

    global incoming

    global outgoing

    set incoming [infotag get leg_incoming]

    set outgoing [infotag get leg_outgoing]

  

    if { $beep == 0 } {

        #insert a beep ...to the caller

        connection destroy con_all

        set beep 1

    } else {

        connection destroy con_all

        fsm setstate LASTWARN

    }

}

proc act_LastWarn { } {

    media play leg_incoming flash:out_of_time.au }

proc act_Destroy { } {

    media play leg_incoming flash:beep.au }

proc act_Beeped { } {

    global incoming

    global outgoing

    connection create $incoming $outgoing }

proc act_ConnectedAgain { } {

    timer start leg_timer 10 leg_incoming }

proc act_Ignore { } {

# Dummy

    puts "Event Capture"

}

proc act_Cleanup { } {

    call close

}

#------------------

#   State Machine

#----------------------------------

  set fsm(any_state,ev_disconnected)  "act_Cleanup              same_state"

  set fsm(any_state,ev_digit_end)     "act_ProcessDTMF     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(CALLACTIVE,ev_leg_timer)    "act_Timer            INSERTBEEP"

  set fsm(INSERTBEEP,ev_destroy_done) "act_Destroy          same_state"

  set fsm(INSERTBEEP,ev_media_done)   "act_Beeped           same_state"

  set fsm(INSERTBEEP,ev_create_done)    "act_ConnectedAgain   CALLACTIVE"

  set fsm(LASTWARN,ev_destroy_done)     "act_LastWarn        CALLDISCONNECT"

  set fsm(CALLACTIVE,ev_disconnected)   "act_Cleanup         CALLDISCONNECT"

  set fsm(CALLDISCONNECT,ev_disconnected)   "act_Cleanup         same_state"

  set fsm(CALLDISCONNECT,ev_media_done)     "act_Cleanup         same_state"

  set fsm(CALLDISCONNECT,ev_disconnect_done) "act_Cleanup         same_state"

  set fsm(CALLDISCONNECT,ev_leg_timer)      "act_Cleanup         same_state"

  fsm define fsm CALL_INIT

Cisco Employee

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

I think the that SIP proxy created trouble for you.  The Tcl script can do SIP refer but you don't use SIP on Tcl gateway. Try the suggestion Raghavendra gave and collect debug first.

Beginner

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

Raghavendra and Yaw-Ming,

i am testing as follows - so i may be introducing different errors... while i wait for my FXO card for my lab i'm running the 2911 in CME mode and have a SIP registered phone.   Extension 101.    I also have a FXS voice-port 0/1/0 and reference that from

dial peer 200 pots

service jimflash

destination-pattern 200

port 0/1/0

The jimflash is the tcl that has a lot of parameters, including an ivr number, etc

To test i dial 200 from 101 - i would hope that gets 2 call legs set up.

i then am looking for any events i can generate from the SIP phone (dtmf, sip REFER, etc) that i can use to trigger the hookflash to the FXS port.     Again - this is a quick lab based on the fact that i don't have my fxo in place - i would think that hooklash should work the same to either fxo or fxs.     

I'm not referencing the service or call appliation in the CME portion, when i do - calls don't complete , so i think it only should exist in the dial-peer portion of the call.

using the above log captures - there is a lot of information, but i'm not seeing "ev_transfer_request" at all.   I tried referencign the above tcl script that Bryan Deaver did where he looks for DTMF and applied that to the dial peer via service hookflash command (both jimflash and hookflash are in the flash:) and i saw no dtmf events.   I am going to be at the site tomorrow and i can load both tcl - i just want to make sure i'm invoking them properly via the dial-peer sub command.

I will be using FXO tomorrow and the call that comes in via sip will be either a cme registered sip client (7841) or the remote soft client tied to the proxy server and referenced with a dial-peer voice xxxx voip command. 

Anyways - if you can confirm where i should put the  service <tcl application name>  if it's needed other than on those dial peers.  I don't know if it will get invoked properly via CME.

thanks,

Jim

Cisco Employee

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

Hi Jim,

TCL script should be applied under incoming dialpeer, hope in your case 200 is incoming dialpeer.

Once you transfer the call TCL script should get "ev_transfer_request" after SIP refer message.

Please share the logs so that we can take a look.

Thanks,
Raghavendra

Beginner

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

Raghanvendra,

I now have the exact scenario as per my diagram above.  

I will receive an inbound call via the FXO.   Send it out via PLAR to proxy, with a SIP phone registered to it.   Once answered i will attemp to transfer and see what messages get generated based on the recommended debug.

I will  use:

voice port 0/2/0

description "FXO port to PBX"

connection plar opx 101

Dial-peer 101 voip

description "dial peer to sip proxy with extension 101"

destination-pattern 101

session target ipv4: 10.10.10.90

session protocol sipv2

codec g711ulaw

dtmf-relay rtp-nte

dial-peer voice 201 pora

port 0/2/0

service jimflash

And i will look for the messages -  the tcl script i load is the one i shared with you over email, not the one pasted above from Bryan Deaver that is looking for DTMF events - correct?

I'll grab the logs and see what is going on.    Thanks so much for the assistance.

Jim

Beginner

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

Hi,

I was able to reproduce my diagram and I made  calls in - I don't think I have the script initialized properly as there are some parameters I think I need to populate - perhaps you can verify - attached is the debug and script and configuration of the router connected to the FXO.

Call came in from PSTN onto FXO and was Connection PLAR OPX to 101.

101 is a sip phone on a cme system.  once the call was up I would hit transfer - I indicated where in the logs - to see what would happen - after the timeout I attempted to transfer again, and then I hung up.

Beginner

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

I realize I used the script for using *8 to detect a transfer request instead - here is what happened after I hit *8   I'll load the other script and try to set the variables properly.

thanks.

Beginner

Re: Total newbie looking for assistance with TCL - SIP and Hookflash to FXO

this is the result of using the script that is suppose to take the refer and do a hookflash.

The issue is the parameters = it was originally written to reference a IVR at ext 253.  I used the same parameters but pointed it to 101 and removed the connection plar opx 101 command.  Instead the service hookflash command in the dial-peer voice 201 pots invoked the tcl and it dialed 101 for me - from there once answered at 101 I hit the transfer key in an attempt to generate a sip refer to trigger a hookflash...  attached are the debugs.

thanks

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards
This widget could not be displayed.