No ${BLINDTRANSFER} set

  1. 11 years ago

    Hi,

    I have a complex dialplan which takes care of the ${BLINDTRANSFER} variable. If this is set, the called party will ring up a few seconds and if unanswered the call goes back to the transfering extension. This works well for months, when the phone does the transfer.

    But if I transfer a call via FOP2 (blindtransfer), the variable will not be set, so the destination rings for ever (or 'til the caller hung up). Is there a way, to set this variable, when transfering with FOP2?

    Asterisk 1.8, FOP2.27 (same with 2.26).

    Kind regards
    Dominique Görsch

    Dialplan example (See prio 4 and 19ff.):

    CLI> dialplan show 490@from-internal                                                                       [553/20005]
    [ Context 'from-internal' created by 'pbx_config' ]
      '490' =>          hint: SIP/4901&SIP/4902                       [pbx_config]
      '_XXX' =>         hint: SIP/${EXTEN}                            [pbx_config]
    [ Included context 'localphones' created by 'pbx_config' ]
      '490' =>          1. NoOp(=== Interner Double-Ruf ===)          [pbx_config]
                        2. NoOp(CLI:${CALLERID(NUM)}   CLD:490 (SIP/4901 & SIP/4902)) [pbx_config]
                        3. NoOp(STATE:SIP/4901/${DEVICE_STATE(SIP/4901)}   SIP/4902/${DEVICE_STATE(SIP/4902)}) [pbx_config]
                        4. GotoIf($["${BLINDTRANSFER}" != ""]?TRANSFER) [pbx_config]
                        5. GotoIf($["${DB_EXISTS(RUL/${EXTEN})}]?RUL) [pbx_config]
                        6. Set(_PICKUPMARK=${EXTEN})                  [pbx_config]
                        7. Macro(Normalize)                           [pbx_config]
                        8. GotoIf($["${CALLERID(NAME):0:3}"="Uml"]?DIAL) [pbx_config]
                        9. GotoIf($["${CALLERID(NAME):0:3}"="Abw"]?DIAL) [pbx_config]
                        10. GotoIf($["${CALLERID(NAME):0:3}"="Ret"]?DIAL) [pbx_config]
                        11. GotoIf($["${CALLERID(NAME):0:6}"="Wieder"]?DIAL) [pbx_config]
                        12. SIPAddHeader("Alert-Info:<http://www.notused.com>;info=alert-internal") [pbx_config]
                        13. AGI(ast_get_phonebook.php)                [pbx_config]
         [DIAL]         14. NoOp()                                    [pbx_config]
                        15. GotoIf($[ $["${DEVICE_STATE(SIP/4901)}" != "NOT_INUSE"] & $["${DEVICE_STATE(SIP/4901)}" != "UNAVAILABLE"] & $["${DEVICE_STATE(SIP/4901)}" != "INVALID"]]?BUSY) [pbx_config]
                        16. GotoIf($[ $["${DEVICE_STATE(SIP/4902)}" != "NOT_INUSE"] & $["${DEVICE_STATE(SIP/4902)}" != "UNAVAILABLE"] & $["${DEVICE_STATE(SIP/4902)}" != "INVALID"]]?BUSY) [pbx_config]
                        17. Dial(SIP/4901&SIP/4902)                   [pbx_config]
                        18. Goto(HANGUP)                              [pbx_config]
         [TRANSFER]     19. NoOp(TRANS FROM: ${CUT(BLINDTRANSFER,,1)}) [pbx_config]
                        20. GotoIf($[ $["${DEVICE_STATE(SIP/4901)}" != "NOT_INUSE"] & $["${DEVICE_STATE(SIP/4901)}" != "UNAVAILABLE"] & $["${DEVICE_STATE(SIP/4901)}" != "INVALID"]]?RECALL) [pbx_config]
                        21. GotoIf($[ $["${DEVICE_STATE(SIP/4902)}" != "NOT_INUSE"] & $["${DEVICE_STATE(SIP/4902)}" != "UNAVAILABLE"] & $["${DEVICE_STATE(SIP/4902)}" != "INVALID"]]?RECALL) [pbx_config]
                        22. Dial(SIP/4901&SIP/4902,25,m)              [pbx_config]
         [RECALL]       23. NoOp(WIEDERANRUF)                         [pbx_config]
                        24. SIPAddHeader(Diversion: "${EXTEN}" <sip:${EXTEN}@10.9.8.1>;reason=unconditional) [pbx_config]
                        25. Set(CALLERID(NAME)=Ret ${EXTEN})          [pbx_config]
                        26. RetryDial(,5,-1,${CUT(BLINDTRANSFER,,1)},,m) [pbx_config]
                        27. Goto(HANGUP)                              [pbx_config]
         [RUL]          28. NoOp(Anruf umgeleitet zu ${DB(RUL/${EXTEN})}) [pbx_config]
                        29. SIPAddHeader(Diversion: <sip:${EXTEN}@10.9.8.1>;reason=unconditional;screen=yes) [pbx_config]
                        30. Set(CALLERID(NAME)=Uml ${EXTEN})          [pbx_config]
                        31. Set(CONNECTEDLINE(num)=${DB(RUL/${EXTEN})}) [pbx_config]
                        32. Set(CONNECTEDLINE(num-pres)=allowed)      [pbx_config]
                        33. Set(CONNECTEDLINE(name)=Uml ${DB(RUL/${EXTEN})}) [pbx_config]
                        34. Set(CONNECTEDLINE(name-pres)=allowed)     [pbx_config]
                        35. Dial(LOCAL/${DB(RUL/${EXTEN})}@from-internal) [pbx_config]
         [BUSY]         36. Busy()                                    [pbx_config]
                        37. Goto(HANGUP)                              [pbx_config]
         [HANGUP]       38. NoOp(=== STATUS: ${DIALSTATUS} ===)       [pbx_config]
                        39. NoOp(=== HANGUP: ${HANGUPCAUSE} ===)      [pbx_config]
                        40. HangUp()                                  [pbx_config]
  2. admin

    16 Oct 2013 Administrator

    The way to extend FOP2 is via FOP2Callbacks.pm , you will have to intercept the redirect/transfer commands received from flash and act upon it on the callsbacks file (like setting the variable via AMI). In FOP 2.27, the blind transfer button sends the blindxfer command, so you can insert that into the flashCommand if/else block. You will have to modify the bellow code to your environment, the channel and value depends on your dialplan/configuration, so they might be wrong, look at the print output to see the data you receive that you can use to set them correctly:

        } elsif($command eq "blindxfer") {
    
             my $cont=0;
             foreach my $param (@parameters) {
                 print "Parameter $cont = $param\n";
                 $cont++;
             }
    
            // look at the above to see what parameter to use for your purpose
    
            $channel = $parameters[2];
            $value     = $parameters[3];
    
            $return  = "Action: Setvar\r\n";
            $return .= "Channel: $channel\r\n";
            $return .= "Variable: BLINDTRANSFER\r\n";
            $return .= "Value: $value\n";
            $return .= "\r\n";
            push @allreturn, $return;
            return @allreturn;
    

    Best regards,

  3. Thanks for your reply, but it don't work.
    [code]10.0.1.219:4319 <= <msg data="98|blindxfer|96|201a5f6c61cca57502cdfe73469638f7" />

    127.0.0.1 -> Action: Redirect
    127.0.0.1 -> Channel: SIP/ys2mAmt1-0003030c
    127.0.0.1 -> Exten: 488
    127.0.0.1 -> Context: from-internal
    127.0.0.1 -> Priority: 1
    127.0.0.1 -> Async: True

    127.0.0.1 -> Action: Setvar
    127.0.0.1 -> Channel: SIP/ys2mAmt1-0003030c
    127.0.0.1 -> Variable: BLINDTRANSFER
    127.0.0.1 -> Value: SIP/4901-0003030d
    [/code]

    The variable will be set after the redirect is initiated on the Channel that is redirecting. But I need the var set on the new call, to see that this call is an redirected call.
    If I redirect with the phone, asterisk fires up the new channel with this variable set. If I redirect via FOP/AMI that var is not set. Do you have any idea, how to fire up the new channel with this var set?

    Kind regards
    Dominique Görsch

  4. admin

    21 Oct 2013 Administrator

    Prefix the variable name with an underscore so it is inherited. You can use double underscore to inherit it further.

    Variable: _BLINDTRANSFER

    Best regards,

  5. Hi,

    thanks for your fast reply, but it still don't work. I guess, the problem is that the var is set after the redirect command. The redirect is done and the new channel is allready fired up (and my GotoIf to decide whether it is an transfer or not is done) 'till the AMI answers with Success on the Variable Set.

    It is possible, to change the order? So that I can set the var before the Redirect-Command?

    10.0.1.219:2916      <= <msg data="98|blindxfer|96|f635ec21a101102c541b82c67e4505a3" />
    
    127.0.0.1            -> Action: Redirect
    127.0.0.1            -> Channel: SIP/ys2mAmt1-00030f5c
    127.0.0.1            -> Exten: 488
    127.0.0.1            -> Context: from-internal
    127.0.0.1            -> Priority: 1
    127.0.0.1            -> Async: True
    
    127.0.0.1            -> Action: Setvar
    127.0.0.1            -> Channel: SIP/ys2mAmt1-00030f5c
    127.0.0.1            -> Variable: _BLINDTRANSFER
    127.0.0.1            -> Value: SIP/4901-00030f5d
    
    127.0.0.1            <- Response: Success
    127.0.0.1            <- Message: Redirect successful
    
    127.0.0.1            <- Event: Unlink
    127.0.0.1            <- Privilege: call,all
    127.0.0.1            <- Channel1: SIP/ys2mAmt1-00030f5c
    127.0.0.1            <- Channel2: SIP/4901-00030f5d
    127.0.0.1            <- Uniqueid1: 1382428822.208932
    127.0.0.1            <- Uniqueid2: 1382428822.208933
    127.0.0.1            <- CallerID1: 00216685828000104
    127.0.0.1            <- CallerID2: 490
    
    127.0.0.1            <- Event: Hangup
    127.0.0.1            <- Privilege: call,all
    127.0.0.1            <- Channel: SIP/4901-00030f5d
    127.0.0.1            <- Uniqueid: 1382428822.208933
    127.0.0.1            <- CallerIDNum: 490
    127.0.0.1            <- CallerIDName: Goersch Dominique
    127.0.0.1            <- ConnectedLineNum: 00216685828000104
    127.0.0.1            <- ConnectedLineName: <unknown>
    127.0.0.1            <- Cause: 16
    127.0.0.1            <- Cause-txt: Normal Clearing
    
    127.0.0.1            <- Response: Success
    127.0.0.1            <- Message: Variable Set

    Kind regards
    Dominique Görsch

  6. admin

    22 Oct 2013 Administrator

    It is not possible to change the order right now, but I might add the feature/option on the next version, so you can return pre and post ami commands somehow.

  7. Hi Nicolás,

    that sounds good, so I wait for the next beta ;)
    Is there a mailinglist or the like where you announce new beta/version?

    Kind Regards
    Dominique Görsch

or Sign Up to reply!