Hi guys.....
 
the header searching and saving the Q850 code didn't work.
here is what i wrote in the cfg, in the failure route:
 
# manage failure routing cases
failure_route[MANAGE_FAILURE] {
  xlog("L_CRIT", "failure \n");
 if($avp(CAR)=="CALLOUT"){
 xlog("L_CRIT", "failure in callout \n");
  ##if(is_present_hf("Reason")) {
  xlog("L_CRIT", "failure in reason\n");
   $avp(Q850)=$(hdr(Reason){param.value,cause}{s.int});
   xlog("L_CRIT", "failure in reason $avp(Q850)\n");
  ##}
 
here is the log print......
 
 3(3433) CRITICAL: <script>: failure
 3(3433) CRITICAL: <script>: failure in callout
 3(3433) CRITICAL: <script>: failure in reason
 3(3433) ERROR: <core> [lvalue.c:347]: non existing right pvar
 3(3433) ERROR: <core> [lvalue.c:407]: assignment failed at pos: (524,15-524,54)
 3(3433) CRITICAL: <script>: failure in reason <null>
 
 
the command is_present_hf("Reason"))  is under ## because of tests... when it was in use, the script didn't even went in the "if", the command didn't recognize the header.
 
here is the sip trace for the 486, the header is there...
 
    Message Header
        Call-ID: 6994099017399497785-1328029200-13379
        From: <sip:36264529;ss7-cpc=10;cpc=ordinary@172.16.10.3;user=phone>;tag=6994099017399497785
        To: <sip:39955011@172.16.60.161;user=phone>;tag=9299942026613191738
        CSeq: 1 INVITE
        Via: SIP/2.0/UDP 172.16.60.161;received=172.16.60.161;branch=z9hG4bK08d6.c653f346.2,SIP/2.0/UDP 172.16.10.3:5060;branch=z9hG4bK-6110080000017439-ac100a03-1
        Supported: timer,100rel
        Reason: Q.850;cause=17;text="UserBusy"
            Reason Protocols: Q.850
            Cause: 17(0x11)[User busy]
        Content-Length: 0