Using Application Gosub with Originate

I’m writing a little click to dial type tool and I’ve run into a snag where my Originate command needs to call a Sub routine to do a database lookup and some other stuff.

I can’t seem to get the syntax right to call Gosub with Originate

Just testing with the command line I’ve been unable to make it work with any of these attempts:

originate PJSIP/johntest application Gosub sub-callout s,1

originate PJSIP/johntest application Gosub sub-callout(s,1)

originate PJSIP/johntest application Gosub (sub-callout,s,1)

What Syntax should I be using?

And if it helps I’ll be calling this via AJAM over HTTPS.


The format would be “originate PJSIP/johntest application Gosub sub-callout,s,1” but I’m not sure if Gosub would actually work there. It’s written to work within the dialplan, and when executed like that it is not in dialplan. It wouldn’t surprise me if it doesn’t.

Aww shoot.

Macro works for what I want to do so I guess I’ll use it then.


Macro is deprecated. In any case, the extension form of Originate should work here.

Right, Macro being deprecated is why I wanted to use Gosub in the first place.