Showing results for 
Search instead for 
Did you mean: 

Leg setup returning to initial dial peer script

Good afternoon,

I have been working on an out-bound script (based on a the ) that applies to all calls that go through a specific voip dial-peer.  It is basically a form of force authorization code, but simpler to manage (at least the way I see it).

For some reason I can't force the dial-peer to appear as incoming, because of that I cannot use the incoming service, so I have to use the service fac_moded out-bound. (I am attaching the script that I am using)

the dial peer configuration is this:

dial-peer voice 5 voip

service fac_moded out-bound

destination-pattern 2....

session protocol sipv2

session target ipv4:x.x.x.x

I finally am able to play media to ask for pin,  capture the pin, the pin authenticates with what I need.  Everything works as planned, but then when it comes time to proceed with the authorized connection of the call, I issue a leg setup command with the ndis value.  Instead of going right to the sip connection,  the call is coming again into the dial peer and the script runs a second time (a loop I cannot break).

I guess if I used the inbound service script, the leg setup command would simply finish the second leg of the call, and I would be able to finish the call without this problem, but I still have not found a way to configure the dial-peer to be classified as Incoming.

I need to understand if this is an expected behavior?  maybe I am doing something wrong with the script?

Any idea on how to achieve this will be highly appreciated.  when I finish the script and it is working I will post it for others to use.

Best regards.


Cisco Employee

Re: Leg setup returning to initial dial peer script

I think you should fix the issue from IOS config but not script itself. Looks like incoming dial-peer should handle the script.

The problem you have is that you get the DNIS from incoming call (called number) then you do the call setup to that number which created a loop.

If you like to keep current outbound script  you can add a prefix on DNIS and create an outgoing dial-peer for that (but you need to remove that  prefix  before send the call out in that new dialpeer)

Re: Leg setup returning to initial dial peer script

Thanks for the response Yawchen,  I agree with what you say, but I have been trying for a week to make the dial-peer to act as an incoming and be able to execute the incoming script, and I don't know what else to do.

Can you help me fixing the IOS config? how can I make the dial-peer to be accepted as incoming?

Cisco Employee

Re: Leg setup returning to initial dial peer script

Are you using CME or voice gateway ? i.e. the calling phone is registered in the same box Tcl script is running or from outside of BOX. A simple network diagram will help.

Re: Leg setup returning to initial dial peer script

Hello Yawchen,

The telephone is registered in the same box the TCL script is running.  the configuration diagram would be something like this.

My goal is to control with a PIN code all the calls the SIP Phone can make to different dial patterns. (international, cellphone, local).  Right now I was able to work this out doing this:

1. Setup a dial-peer with the 9 destination-pattern prefix that has the CME Router itself as the session target, and has the authorization application associated to the out-bound dial-peer.

2. The script ask for a PIN, then does the authentication as expected, then does a regular expression to substitute the 9 with 8 and place the call using the leg setup command.

3. Setup a dial-peer with the 8 destination-pattern prefix that has the SIP Server as the session target.  this dial-peer has no scripts.

With this, my goal is achieved, but I am still not happy with how I am achieving it.

My ideal setup would be to have only one dial-peer with an incoming application, and when the script authenticates the user, proceed with the outbound leg setup.  Can this be achieved?


Cisco Employee

Re: Leg setup returning to initial dial peer script

I think this is something to do with the phone is registered locally.

With typical voice gateway , you may have 2 dialpeers  incoming and outgoing but should not need the outbound script.

In you case call coming with 9xxxx on incoming dialpeers then go out with xxxx on outgoing dialpeer. You can try it with an external phone. With the old ISR  3845 I am using I can do what you like to do, but in new 29xx I have similar issue.

I don't think your script (in and out) has any issue. Maybe you want to consult Cisco Tech Support for this dial-peer config.

The following is a typical config used in voice gateway.

dial-peer voice 900000 voip

description <==  Incoming Dial-Peer VOIP - TCL

service abc

session protocol sipv2

session transport tcp

incoming called-number .

voice-class codec 1 

voice-class sip profiles 2

dtmf-relay rtp-nte

ip qos dscp cs3 signaling

no vad


dial-peer voice 900001 voip

description <= outgoing dial peer - TCL

destination-pattern 321…….

session protocol sipv2

session target

voice-class codec 1 

dtmf-relay cisco-rtp rtp-nte

no vad


Re: Leg setup returning to initial dial peer script

Do you have an answer from CISCO Tech Support ???

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