[cisco-voip] IVR Script Help need

Mehdi Eskandari mehdi.es at gmail.com
Tue Jul 24 04:20:37 EDT 2007


Hi,
my problem is still not solved.
if anyone can help me in my script please answer me;)
the problem is when user press # key script cannot say the remaining credit.
i send you some parts of my script that may be need.
-------------------------
........
proc init_perCallVars { } {

    global NumLangPrompt;
    global NumCardPrompt;
    global NumDestPrompt;
    global PromptFlag;
    global DestPromptFlag;
    global NoPlayWarn;
    global NoTimeLimit;
    global SetupDone;

    set NumLangPrompt 0;
    set NumCardPrompt 0;
    set NumDestPrompt 0;
    set PromptFlag 0;
    set DestPromptFlag 0;
    set NoPlayWarn 0;
    set NoTimeLimit 0;
    set SetupDone 0;



    return;

}
....
proc act_CardAuthorize { } {

    global PromptFlag;
    global NumCardPrompt;
    global ParamForDest;
    global ParamForCard;
    global retryCnt;

    set status [infotag get evt_status];
    if {$status == "ao_000"} {

if {[infotag get aaa_avpair_exists h323-credit-amount]} {

  set amt [infotag get aaa_avpair h323-credit-amount]
  puts "\n***amount = $amt"
 } else {
  media play leg_incoming _no_aaa.au;
  fsm setstate CALLDISCONNECT;
  return;
 }
  fsm setstate DESTSELECTION;
  if {$amt <= 999999.99} {
  media play leg_incoming _you_have.au %a$amt _enter_dest.au;
 } else {
  media play leg_incoming _enter_dest.au;
 }

 leg collectdigits leg_incoming ParamForDest;
 return;
 }



    if {[infotag get aaa_avpair_exists h323-return-code]} {
 set return_code [infotag get aaa_avpair h323-return-code];
 } else {
 media play leg_incoming _no_aaa.au;
 fsm setstate CALLDISCONNECT;
 return;
 }



    incr NumCardPrompt;

    if {$NumCardPrompt < $retryCnt} {

 leg collectdigits leg_incoming ParamForCard;
 act_PlayCardReturnCode $return_code;
 } else {
 act_GetCard;
 }

    return;

}
.
.
.
proc act_GetDestination { } {

    global retryCnt;
    global ParamForDest;
    global DestPromptFlag;
    global NumDestPrompt;



    if {$NumDestPrompt < $retryCnt} {

switch $DestPromptFlag {

 0 {media play leg_incoming _enter_dest.au; #Abortkey pressed}
 1 {media play leg_incoming _no_dest_entered.au; #Timeout -no digits
entered}
 2 {media play leg_incoming _reenter_dest.au; #Not mutch to the dial plan}

 default {
  media play leg_incoming _no_aaa.au;
  fst setstate CALLDISCONNECT;
  return;
  }

 }
 leg collectdigits leg_incoming ParamForDest;
 } else {
 media play leg_incoming _dest_collect_fail.au;
 fsm setstate CALLDISCONNECT;
 }

    return;

}

proc act_GotDestination { } {
    global NumDestPrompt;
    global DestPromptFlag;
    global account;
    global pin;
    global destination;



    set status [infotag get evt_status];
switch $status {

"cd_001" {
 incr NumDestPrompt;
 set DestPromptFlag 1;
 act_GetDestination;
 return;
 }

"cd_002" {

 set DestPromptFlag 0;
 act_GetDestination;
 return;

 }

"cd_004" {

 set destination [infotag get evt_dcdigits];
 puts "\n************dest_number = $destination";
 aaa authorize $account $pin "" $destination leg_incoming;
 return;

 }

default {
 incr NumDestPrompt;
 set DestPromptFlag 2;
 act_GetDestination;
 return;

 }

    }
    return;
}
...
proc act_CallAuthorize { } {

    global NumDestPrompt;
    global DestPromptFlag;
    global WarnTime;
    global NoPlayWarn;
    global NoTimeLimit;
    global creditTime;
    global retryCnt;
    global ParamForDest;
    global param;

    set status [infotag get evt_status];
    set param(enableReporting) true;
    set param(interruptPrompt) false;



    if {$status == "ao_000"} {

 if {[infotag get aaa_avpair_exists h323-credit-time]} {
 set creditTime [infotag get aaa_avpair h323-credit-time];
 } else {
 media play leg_incoming _no_aaa.au;
 fsm setstate CALLDISCONNECT;
 return;
 }

 if {$creditTime <= $WarnTime} {set NoPlayWarn 1;}
 if {$creditTime == "unlimited"} {set NoTimeLimit 1;}

 media play leg_incoming _you_have.au %t$creditTime;
 leg collectdigits leg_incoming param; #For Fast leg setup
 fsm setstate PLACECALL;
 return;
 }

    incr NumDestPrompt; #Call authorize failed

    if {[infotag get aaa_avpair_exists h323-return-code]} {
 set return_code [infotag get aaa_avpair h323-return-code];
 } else {
 media play leg_incoming no_aaa.au;
 fsm setstate CALLDISCONNECT;
 return;
 }



    if {$NumDestPrompt < $retryCnt} {
 act_PlayDestReturnCode $return_code;
 leg collectdigits leg_incoming ParamForDest;
 } else {
 act_GetDestination;
 }
    return;

    }
.......
.......
proc act_CallWarnMedia { } {

    global incoming;
    global outgoing;

    connection create $incoming $outgoing;
    return;
}



proc act_LongPound { } {

    if {[infotag get evt_digit] != "#"} {
 fsm setstate same_state;
 return;
  }

    set duration [infotag get evt_digit_duration];

    if {$duration < 300} {
 fsm setstate same_state;
 return;
 }

    connection destroy con_all;
    return;
}
....
...
proc act_ConnDestroyed { } {

     global account;
     global pin;

    leg disconnect leg_outgoing;
    init_perCallVars;
#    act_GetDestination;
    aaa authorize $account $pin "" ""  leg_incoming;
    fsm setstate CARDSELECTION;
#    fsm setstate DESTSELECTION;

    return;
}
#---------------
set ivr_fsm(CALLACTIVE,ev_digit_end) "act_LongPound CONNDESTROY";
set ivr_fsm(CONNDESTROY,ev_destroy_done) "act_ConnDestroyed same_state";
set ivr_fsm(CARDSELECTION,ev_authorize_done) "act_CardAuthorize same_state";


the important part is proc act_ConnDestroyed. when two line(that i
commented) are invoked the script is good and wait for new destination but
when other two line(aaa and cardselect) are invoked the radius return 0 for
Credit-Time

i look forward to hearing from you
thanks and have a nice day
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://puck.nether.net/pipermail/cisco-voip/attachments/20070724/2c377a57/attachment.html 


More information about the cisco-voip mailing list