[asterisk-users] 1.4.38 passing a Regular expression containing a pipe character to a macro ?

John Kiniston johnkiniston at gmail.com
Mon Aug 15 18:29:01 CDT 2011


Howdy,

I'm working on a macro that authenticates the calling extension against a
list of allowed extensions but it looks like the Expression I'm attempting
to send of  pipe separated extensions is showing up as additional arguments
to my macro.

I expected to have 4 arguments to the below macro, Instead it looks like I'm
actually getting 6.

I'm open to suggestions to other ways to do this, I've tried escaping the
pipe character without any help.

My Test Macro
[macro-jktest1]
;   ${ARG1} - Org ID/CustGroup
;   ${ARG2} - Group to use for spying
;   ${ARG3} - Target to Spy/Barge on
;   ${ARG4} - Users allowed to use the Macro
exten => s,1,Set(OrgID=${ARG1})
exten => s,n,Set(SpyGroup=${ARG2})
exten => s,n,Set(Target=${ARG3})
exten => s,n,Set(AllowedUsers=${ARG4})
exten => s,n,NoOP(AllowedUsers:${AllowedUsers} Arg5:${ARG5} Arg6:${ARG6} )
exten => s,n,Set(caller1=${CDR(accountcode)})
exten => s,n,Set(Caller=${CUT(caller1,-,3)})
exten => s,n,GotoIf($[${Caller} =~ "${AllowedUsers}"]?ALLOW:DENY)
exten => s,n(DENY),Congestion(5)
exten => s,n,Hangup
exten => s,n(ALLOW),Playback(tt-monkeys)
exten => s,n,Hangup

Extension that calls the Macro

exten => _*3XXXX,1,Macro(jktest1,ls,1,${EXTEN:2},7131|7110|7125)

Console output follows:

    -- Executing [*31743 at ls-intern:1] Macro("SIP/7124ls-00001b4a",
"jktest1|ls|1|1743|7131|7110|7125") in new stack
    -- Executing [s at macro-jktest1:1] Set("SIP/7124ls-00001b4a", "OrgID=ls")
in new stack
    -- Executing [s at macro-jktest1:2] Set("SIP/7124ls-00001b4a",
"SpyGroup=1") in new stack
    -- Executing [s at macro-jktest1:3] Set("SIP/7124ls-00001b4a",
"Target=1743") in new stack
    -- Executing [s at macro-jktest1:4] Set("SIP/7124ls-00001b4a",
"AllowedUsers=7131") in new stack
    -- Executing [s at macro-jktest1:5] NoOp("SIP/7124ls-00001b4a",
"AllowedUsers:7131 Arg5:7110 Arg6:7125 ") in new stack
    -- Executing [s at macro-jktest1:6] Set("SIP/7124ls-00001b4a",
"caller1=ls-000-7124") in new stack
    -- Executing [s at macro-jktest1:7] Set("SIP/7124ls-00001b4a",
"Caller=7124") in new stack
    -- Executing [s at macro-jktest1:8] GotoIf("SIP/7124ls-00001b4a",
"0?ALLOW:DENY") in new stack
    -- Goto (macro-jktest1,s,9)
    -- Executing [s at macro-jktest1:9] Congestion("SIP/7124ls-00001b4a", "5")
in new stack


-- 
A human being should be able to change a diaper, plan an invasion, butcher a
hog, conn a ship, design a building, write a sonnet, balance accounts, build
a wall, set a bone, comfort the dying, take orders, give orders, cooperate,
act alone, solve equations, analyze a new problem, pitch manure, program a
computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects.
---Heinlein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110815/64777903/attachment.htm>


More information about the asterisk-users mailing list