Got a strange situation
[ext-queues]
...
exten => h,2,ExecIf($[${CALLERID(num)} = ' ']?Set(var29=${SHELL(curl
-X
POST --header "Content-Type: application/json" --header "Accept:
application/json" -d "{\"Phone\": ${FROMEXTEN},
\"Source\": \"asterisk\"}" "
http://sIte.com:80/api/v1/calls?apiKey=UABVAEI&clientId=3")}))
exten => h,3,NoOp(${var29})
exten => h,4,Macro(hangupcall,)
;--== end of [ext-queues] ==--;
so when i execute it got
-- Executing [h at ext-queues:1] NoOp("SIP/100-00000050",
"100") in new stack
-- Executing [h at ext-queues:2] ExecIf("SIP/100-00000050",
"0?Set(var29=[{"RequestedCount":0,"MissedCount":7,"Total":7}])")
in new stack
-- Executing [h at ext-queues:3] NoOp("SIP/100-00000050",
"") in new stack
-- Executing [h at ext-queues:4] Macro("SIP/100-00000050",
"hangupcall,")
in new st
U can see that Execif = 0 = falce but somehow
Shell ${SHELL(curl -X POST --header "Content-Type: application/json"
--header "Accept: application/json" -d "{\"Phone\":
${FROMEXTEN},
\"Source\": \"asterisk\"}" "
http://sIte.com:80/api/v1/calls?apiKey=UABVAEI&clientId=3")}
executes and get answer from the server
[{"RequestedCount":0,"MissedCount":7,"Total":7}]
i dont want it to be executed
Thanks list for your help
--
Best regards
Antony
tel. +380669197533
tel2. +380636564340
Paypal http://paypal.me/Satskiy
<http://paypal.me/Satskiy?ppid=PPC000654&cnac=PL&rsta=en_PL(en_DK)&cust=NN8XJS9XEP22C&unptid=21db79ac-ef8d-11e5-9553-9c8e992ea258&t=&cal=4d776c21ca7d2&calc=4d776c21ca7d2&calf=4d776c21ca7d2&unp_tpcid=ppme-social-business-profile-created&page=main:email&pgrp=main:email&e=op&mchn=em&s=ci&mail=sys>
satskiy.a at gmail.com <mail%3Asatskiy.a at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.digium.com/pipermail/asterisk-users/attachments/20170224/a9f68c30/attachment.html>
On Fri, Feb 24, 2017 at 3:30 PM, ????? ?????? <satskiy.a at gmail.com> wrote:> Got a strange situation > > [ext-queues] > ... > exten => h,2,ExecIf($[${CALLERID(num)} = ' ']?Set(var29=${SHELL(curl -X > POST --header "Content-Type: application/json" --header "Accept: > application/json" -d "{\"Phone\": ${FROMEXTEN}, \"Source\": \"asterisk\"}" " > http://sIte.com:80/api/v1/calls?apiKey=UABVAEI&clientId=3")})) > > exten => h,3,NoOp(${var29}) > exten => h,4,Macro(hangupcall,) > ;--== end of [ext-queues] ==--; > > > so when i execute it got > > > -- Executing [h at ext-queues:1] NoOp("SIP/100-00000050", "100") in new stack > -- Executing [h at ext-queues:2] ExecIf("SIP/100-00000050", "0 > ?Set(var29=[{"RequestedCount":0,"MissedCount":7,"Total":7}])") in new > stack > -- Executing [h at ext-queues:3] NoOp("SIP/100-00000050", "") in new > stack > -- Executing [h at ext-queues:4] Macro("SIP/100-00000050", > "hangupcall,") in new st > > > U can see that Execif = 0 = falce but somehow > Shell ${SHELL(curl -X POST --header "Content-Type: application/json" > --header "Accept: application/json" -d "{\"Phone\": ${FROMEXTEN}, > \"Source\": \"asterisk\"}" "http://sIte.com:80/api/v1/ > calls?apiKey=UABVAEI&clientId=3")} > executes and get answer from the server [{"RequestedCount":0," > MissedCount":7,"Total":7}] >The Set isn't being executed by the ExecIf. However the ${} substitution containing the SHELL is evaluated before anything else is examined. This isn't a bug but the order of how things are evaluated. You will have to do what you want another way: same = n,GotoIf($["${CALLERID(num)}" = ""]?skip) same = n,Set(var29=${SHELL(...)}) same = n(skip),NoOp(${var29}) Richard -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20170224/68846cde/attachment.html>
Thanks U Richard
i know about this solution
but the main question why "${} substitution containing
the SHELL is evaluated before anything else"
Can U describe the rules when and why it happens?
Thanks
2017-02-24 23:44 GMT+02:00 Richard Mudgett <rmudgett at digium.com>:
>
>
> On Fri, Feb 24, 2017 at 3:30 PM, ????? ?????? <satskiy.a at
gmail.com> wrote:
>
>> Got a strange situation
>>
>> [ext-queues]
>> ...
>> exten => h,2,ExecIf($[${CALLERID(num)} = '
']?Set(var29=${SHELL(curl -X
>> POST --header "Content-Type: application/json" --header
"Accept:
>> application/json" -d "{\"Phone\": ${FROMEXTEN},
\"Source\": \"asterisk\"}" "
>> http://sIte.com:80/api/v1/calls?apiKey=UABVAEI&clientId=3")}))
>>
>> exten => h,3,NoOp(${var29})
>> exten => h,4,Macro(hangupcall,)
>> ;--== end of [ext-queues] ==--;
>>
>>
>> so when i execute it got
>>
>>
>> -- Executing [h at ext-queues:1] NoOp("SIP/100-00000050",
"100") in new
>> stack
>> -- Executing [h at ext-queues:2]
ExecIf("SIP/100-00000050", "0
>>
?Set(var29=[{"RequestedCount":0,"MissedCount":7,"Total":7}])")
in new
>> stack
>> -- Executing [h at ext-queues:3] NoOp("SIP/100-00000050",
"") in new
>> stack
>> -- Executing [h at ext-queues:4]
Macro("SIP/100-00000050",
>> "hangupcall,") in new st
>>
>>
>> U can see that Execif = 0 = falce but somehow
>> Shell ${SHELL(curl -X POST --header "Content-Type:
application/json"
>> --header "Accept: application/json" -d
"{\"Phone\": ${FROMEXTEN},
>> \"Source\": \"asterisk\"}"
"http://sIte.com:80/api/v1/cal
>> ls?apiKey=UABVAEI&clientId=3")}
>> executes and get answer from the server
>>
[{"RequestedCount":0,"MissedCount":7,"Total":7}]
>>
>
> The Set isn't being executed by the ExecIf. However the ${}
substitution
> containing
> the SHELL is evaluated before anything else is examined. This isn't a
bug
> but the
> order of how things are evaluated. You will have to do what you want
> another way:
>
> same = n,GotoIf($["${CALLERID(num)}" = ""]?skip)
> same = n,Set(var29=${SHELL(...)})
> same = n(skip),NoOp(${var29})
>
> Richard
>
>
> --
> _____________________________________________________________________
> -- 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
>
--
Best regards
Antony
tel. +380669197533
tel2. +380636564340
Paypal http://paypal.me/Satskiy
<http://paypal.me/Satskiy?ppid=PPC000654&cnac=PL&rsta=en_PL(en_DK)&cust=NN8XJS9XEP22C&unptid=21db79ac-ef8d-11e5-9553-9c8e992ea258&t=&cal=4d776c21ca7d2&calc=4d776c21ca7d2&calf=4d776c21ca7d2&unp_tpcid=ppme-social-business-profile-created&page=main:email&pgrp=main:email&e=op&mchn=em&s=ci&mail=sys>
satskiy.a at gmail.com <mail%3Asatskiy.a at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.digium.com/pipermail/asterisk-users/attachments/20170225/cc432967/attachment.html>
Reasonably Related Threads
- RoutingError with RSpec Controller test on Scoped Route
- Disallow CALLS without registry
- Disallow CALLS without registry
- [PATCH 0 of 2] Parse image elfnotes, write them to xenstore, save and load via image sxpr
- Weird behaviour using ssl connection (OpenSSL::SSL::SSLError)