I'm trying to execute an extension from the command line (via asterisk -rx "command") on a context that makes a AGI based query to determine which extension needs to be dialed (these extensions are updated on the DB).
It's something like this:
[autodialer]
exten => 2,1,Answer()
exten => 2,n,AGI(database_query.php); Makes a database query and generates vars
exten => 2,n,Set(CALLERID(name)=${db_customer_name}); Sets callerid from DB data
exten => 2,n,Dial(SIP/${db_customer_extension}); Also, extensions are stored on DB
exten => 2,n,Playback(custom/important_message)
exten => 2,n,SayDigits(${important_numbers}); The message, stored on DB too.
exten => h,1,Hangup()
Here, I need that context executed from command line, without having to dial it from any extension (it is supposed to be executed with a crontab every X time).
I tried with originate command, but I think I misunderstood the command syntax and didn't work.
I think that it should be something like: asterisk -rx "channel originate 2@autodialer" and then Asterisk executes that context and we're all happy with our important numbers.
I know that's not the right syntax, just trying to explain how I imagine it could work.
Thanks for your help.