Create dial-peer handle

Version 1
    This document was generated from CDN thread

    Created by: Dan Armstrong on 08-02-2010 07:38:03 PM
    How do I create a dial-peer handle for use with leg setup?
     
    I want to run this line:
    1
    2leg setup leg_outgoing callInfo leg_incoming -d $dialpeer_handle

    and i want $dialpeer_handle to be a handle on  dial-peer 2.

    Subject: RE: Create dial-peer handle
    Replied by: Dan Armstrong on 08-02-2010 08:17:51 PM
    I've already looked into that.
     
    I get the list of dial peers:

    1set matchcnt [object create dial-peer dp_handle:0 $DNIS]


    Now, to get the dial peer I want do I have to loop through the list (dp_handle) and call "object get dial-peer dp_handle$i voicePeerTag" for each one and then if it == 2 use it for the leg setup?

    Subject: RE: Create dial-peer handle
    Replied by: Yawming Chen on 08-02-2010 08:15:15 PM
     
    Please check out this example:
     

    Dial-Peer Hunting Sample Script
    in
     
    http://developer.cisco.com/web/vgapi/resources
     

    Subject: RE: Create dial-peer handle
    Replied by: Dan Armstrong on 08-02-2010 08:31:19 PM
    Alright I tried that, but it does not get the two peers that match that destination.
     
    Here are my peers:

    dial-peer voice 1 voip
     destination-pattern [2-9].........
     session protocol sipv2
     session target sip-server
     codec g711ulaw
     no vad
    !
    dial-peer voice 2 mmoip
     service fax_on_vfc_onramp_app out-bound
     destination-pattern [2-9].........
     information-type fax
     session target mailto:$d$@inbound.efax.beanfield.com
     dsn success
    !

     
    And here is the code that prints the voice tags for each dial peer found:
     1set matchcnt [object create dial-peer dp_handle:0 $DNIS]
     2    puts "\nDial peers found for $DNIS: $matchcnt"
     3    set peerinfo [object get dial-peer dp_handle0 voicePeerTag]
     4    puts "\nDial peer voice tags for $DNIS: $peerinfo"
     5
     6    set peerinfo1 [object get dial-peer dp_handle1 voicePeerTag]
     7    puts "\nDial peer voice tags (dp_handle1) for $DNIS: $peerinfo1"
     8
     9    set peersinfo [object get dial-peer dp_handle:0:$matchcnt voicePeerTag]
    10    puts "\nAll dial peer voice tags for $DNIS: $peersinfo"
    11    

     
    And here is the output that does not include the second dial-peer for some reason:

    Dial peers found for 4165832182: 1

    Dial peer voice tags for 4165832182: 1

    Dial peer voice tags (dp_handle1) for 4165832182:


    All dial peer voice tags for 4165832182:

     
    I really need a handle for the dial-peer 2.

    Subject: RE: Create dial-peer handle
    Replied by: Dan Armstrong on 08-02-2010 09:15:06 PM
    If you look at my output there is only 1 dial-peer returned and that is dial-peer 1.  
     
    I do not understand why only dial-peer 1 is returned by object create when there is two dial-peers that should match that destination.
     
    If I can get both those dial-peers into the list then I can split them out fine and possibly solve all my problems.

    Subject: RE: Create dial-peer handle
    Replied by: Yawming Chen on 08-02-2010 08:59:43 PM
    See if I undetstand the question.
    Your question is not in Tcl IVR API anymore.
    Now you have a string contains dial-peer handle
    from the programming guilde we know

    Return Values
    "A string containing the requested dial peer information. Depending on the command argument, either information about a set of dial peer handles or a specific one is returned. If information from more than one dial peer handle is returned, the values are separated by space.
    "

    So you need to split it with space into a list so you can index it
     
    example
    % set str " abc def aaa bbb ccc"
     abc def aaa bbb ccc
    % set f [split $str " "]
    {} abc def aaa bbb ccc
    % set tmp [lindex $f 1]
    abc
    % set tmp [lindex $f 2]
    def
    Is is what you are asking ?
     
     
     

    Subject: RE: Create dial-peer handle
    Replied by: Dan Armstrong on 08-02-2010 10:20:16 PM
    That's irrelevant to my situation though; if that works or breaks it will not get me closer to my goal. I must get a dial peer handle to that mmoip dial-peer.

    Subject: RE: Create dial-peer handle
    Replied by: Yawming Chen on 08-02-2010 10:04:44 PM
    I know it should work. That make me wonder if it is related to mmoip dialpeer
    Is it possible for you to create another voip dial peer which mact the same dest number to try ?
     
    Thanks !

    Subject: RE: Create dial-peer handle
    Replied by: Yawming Chen on 08-02-2010 10:26:45 PM
    Undersatnd, just like to quick check if that's issue so we can focus on others

    Subject: RE: Create dial-peer handle
    Replied by: Vijay Prasad Neelamegam on 09-02-2010 07:19:15 AM
    Hi Dan,
     
    I just recreated this issue in my lab,and i too didnt get first time.Instead of voicePeerTag i tried with matchTarget and now i am able to match mmoip dial-peer too.After that i tried back with voicePeerTag and now too i got mmoip dial-peer matched.
     
    These are the attrib's supported.
    ¿  encapType
    ¿  voicePeerTag
    ¿  matchTarget
    ¿  matchDigitsE164
    ¿ sessionProtocol

    Here is my configs,code and traces
     
    dial-peer voice 1 voip
     description "GK controlled dial-peer for reaching all GW"
     destination-pattern [4,5,9]0..
     session target ras
     incoming called-number [6-8]0..
     dtmf-relay h245-alphanumeric
     codec g711ulaw
     no vad

    dial-peer voice 10 voip
     description "Pointing to H323 Dial-peer in IPIPGW"
     preference 3
     destination-pattern [4,5,9]0..
     session target ipv4:10.78.236.51
     incoming called-number [6-8]0..
     dtmf-relay h245-alphanumeric
     codec g711ulaw

    dial-peer voice 11 mmoip
     destination-pattern [4,5,9]0..
     session target mailto:ras
     incoming called-number [6-8]0..

      ¿set dialpeerHandleCnt [object create dial-peer dialpeerHandle:1 $dest]
      puts "Sample Script Dial-Peer Hunt: This is the count :$dialpeerHandleCnt"
      set matchedPeer [object get dial-peer dialpeerHandle:1:$dialpeerHandleCnt voicePeerTag]
      puts "Sample Script Dial-Peer Hunt: These are the dial peers matched: $matchedPeer"
      set callInfo(originationNum) $ani ¿

    Feb  9 2010 10:12:17.169 GMT: //-1//AFW_:/tcl_CreateDialpeerObjCmd: 
    Feb  9 2010 10:12:17.169 GMT: //35//TCL :/tcl_PutsObjCmd: Sample Script Dial-Peer Hunt: This is the count :3
    Feb  9 2010 10:12:17.169 GMT:
    Feb  9 2010 10:12:17.169 GMT: //35//TCL :/tcl_ObjectObjCmd:  object get dial-peer dialpeerHandle:1:3 voicePeerTag
    Feb  9 2010 10:12:17.169 GMT: //-1//AFW_:/tcl_GetDialpeerObjCmd: 
    Feb  9 2010 10:12:17.169 GMT: //-1//AFW_:/tcl_dialPeerGetTypeFromName: 
    Feb  9 2010 10:12:17.169 GMT: //-1//AFW_:/tcl_getDialPeerAttr: 
    Feb  9 2010 10:12:17.169 GMT: //-1//AFW_:/tcl_getDialPeerAttrSimple:  dial-peer handle dialpeerHandle1
    Feb  9 2010 10:12:17.169 GMT: //-1//AFW_:/tcl_getDialPeerAttrSimple:  dial-peer handle dialpeerHandle2
    Feb  9 2010 10:12:17.169 GMT: //-1//AFW_:/tcl_getDialPeerAttrSimple:  dial-peer handle dialpeerHandle3
    Feb  9 2010 10:12:17.169 GMT: //35//TCL :/tcl_PutsObjCmd: Sample Script Dial-Peer Hunt: These are the dial peers matched: 1 11 10
    Feb  9 2010 10:12:17.169 GMT:
    Feb  9 2010 10:12:17.169 GMT: //35//TCL :/tcl_LegObjCmd:  leg setup 5003 callInfo leg_incoming -d dialpeerHandle1
    I tried with sample script Dial-Peer_Hunt_Sample_Script.tcl
     
    Thanks
    Vijay

    Subject: RE: Create dial-peer handle
    Replied by: Yawming Chen on 09-02-2010 08:17:05 PM
    Tcl and VXML will handle every call coming to the dialpeer which enabled the service. But it only limited to call to that dial peer not every call coming to CME or trunk.
     
    You siad "will handle every single inbound call", do you mean every call coming to dialpeer or something else ?
     
     

    Subject: RE: Create dial-peer handle
    Replied by: Dan Armstrong on 09-02-2010 08:09:59 PM
    What should we deduce from these spurious results?  This TCL script will handle every single inbound call, and we are a VoIP provider.  We cannot use a system that works randomly.
     
    Should we switch to VXML?  Would we get more functional control, or less?  As it is it¿s a thousand miles away from acceptable.
     
     

    Subject: RE: Create dial-peer handle
    Replied by: Dan Armstrong on 09-02-2010 09:39:12 PM
    Attached is the script in its entirety