[Home]

Summary:ASTERISK-25136: gosub issue
Reporter:Schneur Rosenberg (thesipguy)Labels:
Date Opened:2015-05-27 04:42:43Date Closed:2015-05-27 11:54:07
Priority:MinorRegression?
Status:Closed/CompleteComponents:
Versions:Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:
Description:I'm having a issue with gosubs, in this example I'm using a sub to dial out, first argument is destination, second is options, third is timeout, in ARG2 I have a macro which requires ( and ) when the gosub sees the ) character it thinks that the gosub is done and therefore anything afterwards does not get processed, in my case the m (for music on hold) and the 30 (for timeout), I tried using quotes or the "\" as a escape character but nothing works, in my opinion this is a bug even though I can use a different symbol and use the replace function in my gosub to convert it to the ) symbol, as there should be a way at least to escape the ) character
{noformat}
[testtest]
exten => s,1,gosub(sub_dialing_smart,s,1(sip/test,M(screen)m,30)

[sub_dialing_smart]
exten => s,1,set(__destination1=${ARG1})
exten => s,n,set(__options=${ARG2})
exten => s,n,set(__timeout=${ARG3})
{noformat}

{noformat}
   -- Executing [s@testtest:1] Gosub("Console/dsp", "sub_dialing_smart,s,1(sip/test,M(screen)m,30") in new stack
   -- Executing [s@sub_dialing_smart:1] Set("Console/dsp", "__destination1=test") in new stack
     -- Executing [s@sub_dialing_smart:3] Set("Console/dsp", "__options=M(screen") in new stack
   -- Executing [s@sub_dialing_smart:4] Set("Console/dsp", "__timeout=") in new stack
{noformat}
Comments:By: Schneur Rosenberg (thesipguy) 2015-05-27 05:12:03.527-0500

My workaround was to use use < and > instead of ( and ) and use the REPLACE function , and there the escape character works, but I still think is a bug
{noformat}
exten => s,n,set(_options=${REPLACE(options,<,\()})
exten => s,n,set(_options=${REPLACE(options,>,\))})
{noformat}


By: Richard Mudgett (rmudgett) 2015-05-27 10:37:15.599-0500

Your parentheses are not balanced.  You are missing the closing parentheses of the gosub:
{noformat}
exten => s,1,gosub(sub_dialing_smart,s,1(sip/test,M(screen)m,30)
{noformat}
Add the missing parentheses and try again.
{noformat}
exten => s,1,gosub(sub_dialing_smart,s,1(sip/test,M(screen)m,30))
{noformat}


By: Schneur Rosenberg (thesipguy) 2015-05-27 11:47:06.535-0500

I can swear I had the parentheses before, I must of deleted it by mistake and did not recheck :-) ticket should be closed