Any help? Do I need to post my issue to dev ? On Wed, Jul 14, 2021 at 10:55 AM SAMPro <mousavy.system2...@gmail.com> wrote:
> Hi > I need to check the return value of a sub, the sub may return empty so I > need to check for that. If the return value isn't empty set another > variable (ARG1) . This is the code I've used in extension.conf, but didn't > work (the CLI log is after the code). > > *Extension.conf:* > > [macro-dial] > same => 1,GosubIf($["${CHANNEL(peername):0:4}" = > "peer"]?sub-apply_peer_incom_trans_profiles,s,1(${ARG1})) > same => n,Set(ARG1=${IF($["${GOSUB_RETVAL}" != "" & "${GOSUB_RETVAL}" != > "0"]?${GOSUB_RETVAL}:${ARG1})}) > > [sub-apply_peer_incom_trans_profiles] > exten => s,1,NoOp() > ;Currently this sub is empty because no profile is set. > same => n,Return() > > *The CLI logs:* > > -- Executing [5151@from-trunk:2] Macro("SIP/peer-1-00000000", > "dial,5151,20") in new stack > -- Executing [s@macro-dial:1] GosubIf("SIP/peer-1-00000000", > "1?sub-apply_peer_incom_trans_profiles,s,1(5151)") in new stack > == Channel 'SIP/peer-1-00000000' jumping out of macro 'dial' > -- Executing [s@sub-apply_peer_incom_trans_profiles:1] > NoOp("SIP/peer-1-00000000", "") in new stack > -- Executing [s@sub-apply_peer_incom_trans_profiles:2] > Return("SIP/peer-1-00000000", "") in new stack > -- Executing [s@macro-dial:2] Set("SIP/peer-1-00000000", "ARG1=") in > new stack > > We are using Asterisk 11. > > The return value of "sub-apply_peer_incom_trans_profiles" may contain > nothing or 0 characters (from a regex expression evaluation). > I can simply return ARG1 in "sub-apply_peer_incom_trans_profiles" to > resolve the issue, but this really challenged me to find another solution > and make IF work. > > Thanks in advance. > Regards. >
-- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users