How to pass variables in originate application?

asterisk -rx 'channel originate SIP/NUM1 extension NUM2@context'
Hello everyone, I use this way to initialize a call. If I want to pass a variable $ARG1 to the Dialplan, can it be achieved? What should be done?

I think call files would be a better approach. Here you can work with variables.

Yes I agree with you, but I really don’t want to change the existing code… …

You can’t. That functionality does not support such a thing.


You would have to make them part of the extension and then parse them out in the dial plan.

asterisk -rx "channel originate SIP/NUM1 extension NUM2@context"
Do you mean to say hide the variable in NUM2 and then in the dialplan go and parse the variable?
That’s what I do now, but unfortunately NUM2 is truncated in the dialplan. . . By the way, do you know how long a NUM2 can be here?

That’s what I meant. I don’t know all the hard limits on string lengths, but I’d expect both limits on dialstring lengths and on expanded dialplan lines to hit you.

If you want to do complex things with variables, you should use AMI. CLI is primarily intended for human input.

The length of EXTEN should be 79.

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