Pass parameters in the file extensions_override_freepbx.conf [SOLVED]

I am working on an IVR procedure inside extensions_override_freepbx.conf
I need to pass parameters to this string:
exten => s,n,Set(CURL_RESULT=${CURL(http://localhost/ergotel/parla.php?cosa=${datistringa})})

string inside “datistringa” often contains spaces and arrives at the php file cut at the first spaces …
Is there a way to call the php file and make it take the spaces as well?

Spaces have never been allowed in HTTP URLs. The client should escape them as “%20”, or, in parameters only, as “+”, and the server should un-escape them before using them. (Many web browsers do this automatically at the client end, although the theory behind it was to ensure that URLs could be reliably read from printed versions, so the original expectation was that spaces be ignored, by the client.

Thanks, I’m aware of “%20” but I can replaces de space inside AGI script?

There is a dialplan function to encode spaces and other problem characters, although some experimentation may be needed as Asterisk tends to handle protection of special characters in individual applications and funtions, rather than consistently across everything.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Function_URIENCODE

You will need to ensure that the receiving end decodes them.

i am not being able to use URIENCODE

it does not work this way…

exten => s,n,Set(CURL_RESULT=${CURL(http://localhost/ergotel/parla.php?cosa=(URIENCODE(${utterance})))})

SOLVED

exten => s,n,Set(CURL_RESULT=${CURL(http://localhost/ergotel/parla.php?cosa=${URIENCODE(${utterance})})})

As an Asterisk function, you would need to wrap it in ${} to get the value, i.e.

${URIENCODE(string_to_be_encoded)}

Thanks David you were very helpful

${URIENCODE(${string_to_be_encoded})}

That’s how it works for me, thanks to everyone

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.