Pass parameters in the file extensions_override_freepbx.conf [SOLVED]


(Claudio Pelosi) #1

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?


(David55) #2

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.


(Claudio Pelosi) #3

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


(David55) #4

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.


(Claudio Pelosi) #5

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})))})


(Claudio Pelosi) #6

SOLVED

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


(Lorne Gaetz) #7

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

${URIENCODE(string_to_be_encoded)}

(Claudio Pelosi) #8

Thanks David you were very helpful


(Claudio Pelosi) #9

${URIENCODE(${string_to_be_encoded})}

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


(system) closed #10

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