Uploaded image for project: 'FreePBX Contributed'
  1. FreePBX Contributed
  2. FC-353

Issue with dynroutes if returned string has a " character

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Triage
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: None
    • Labels:
      None

      Description

      HI John Fawcett

      While doing some testing with Dynamic routes and the latest asterisk function JSON_DECODE, I ran into issues using Dynamic Routes if the API call returns a string containing a " character. The problem is on priority 6 of this block:

      
      [ Context 'dynroute-33' created by 'pbx_config' ]
        '1' =>            1. Goto(dynroute-34,s,1)                      [extensions_additional.conf:1962]
                          2. Hangup()                                   [extensions_additional.conf:1963]
        's' =>            1. Set(CURLOPT(dnstimeout)=5)                 [extensions_additional.conf:1953]
                          2. Set(CURLOPT(conntimeout)=5)                [extensions_additional.conf:1954]
                          3. Set(CURLOPT(ftptimeout)=5)                 [extensions_additional.conf:1955]
                          4. Set(CURLOPT(httptimeout)=5)                [extensions_additional.conf:1956]
                          5. Set(dynroute=${CURL("https://www.boredapi.com/api/activity")}) [extensions_additional.conf:1957]
                          6. GotoIf($["${dynroute}" = ""]?dynroute-33,1,1) [extensions_additional.conf:1958]
                          7. Set(__DYNROUTE_bored_activity=${dynroute}) [extensions_additional.conf:1959]
                          8. Goto(dynroute-33,1,1)                      [extensions_additional.conf:1960]
      

      There is a GotoIf with the expression terms wrapped in double quotes as is normal. If the value of ${dynroute} also has a quote character, this expression fails. Some trial and error reveals that replacing it with this works:

      GotoIf($[${LEN(${dynroute})}=0]?dynroute-33,1,1)

      Instead of checking of the string is null, check if the length of the string is 0. Is there any reason why that won't work here?

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                lgaetz Lorne Gaetz
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  NextupJiraPlusStatus

                  Error rendering 'slack.nextup.jira:nextup-jira-plus-status'. Please contact your Jira administrators.