VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
gonvaled at gonvaled.com Guest
|
Posted: Tue Dec 09, 2014 4:45 am Post subject: [asterisk-users] Passing literals with commas to subroutine |
|
|
Hi,
Let's say I do:
Set(data=xxx,yyy)
Gosub(my-sub,s,1(${data}))
My subroutine will only receive "xxx" for ARG1. How can I pass a literal with a comma to a single argument in a subroutine?
(The point is: when calling the subroutine I do not know if the variable has a comma or not.)
Thanks,
Daniel |
|
Back to top |
|
|
johnkiniston at gmail.com Guest
|
Posted: Tue Dec 09, 2014 10:23 am Post subject: [asterisk-users] Passing literals with commas to subroutine |
|
|
You can escape characters with a backslash, I've not tried it in this case but it may help you.
Another idea is you could encode your data with the BASE64_ENCODE or URIENCODE * functions and decode it in your subroutine.
https://wiki.asterisk.org/wiki/display/AST/Function_BASE64_ENCODE
https://wiki.asterisk.org/wiki/display/AST/Function_URIENCODE
* I'm not certain if URIENCODE will escape the comma, it sounds like it should reading the RFC.
On Tue, Dec 9, 2014 at 2:44 AM, Daniel Gonzalez <gonvaled@gonvaled.com (gonvaled@gonvaled.com)> wrote:
Quote: | Hi,
Let's say I do:
Set(data=xxx,yyy)
Gosub(my-sub,s,1(${data}))
My subroutine will only receive "xxx" for ARG1. How can I pass a literal with a comma to a single argument in a subroutine?
(The point is: when calling the subroutine I do not know if the variable has a comma or not.)
Thanks,
Daniel
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
|
--
A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.
---Heinlein |
|
Back to top |
|
|
asterisk_list at earth... Guest
|
Posted: Tue Dec 09, 2014 10:38 am Post subject: [asterisk-users] Passing literals with commas to subroutine |
|
|
On Tuesday 09 Dec 2014, Daniel Gonzalez wrote:
Quote: | Hi,
Let's say I do:
Set(data=xxx,yyy)
Gosub(my-sub,s,1(${data}))
My subroutine will only receive "xxx" for ARG1. How can I pass a literal
with a comma to a single argument in a subroutine?
(The point is: when calling the subroutine I do not know if the variable
has a comma or not.)
|
What happens if you use speech marks around the variable, like so: "${data}" ?
--
AJS
Note: Originating address only accepts e-mail from list! If replying off-
list, change address to asterisk1list at earthshod dot co dot uk .
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|