Execute dialplan context from command line

*爱你&永不变心* 提交于 2019-12-25 04:26:15

问题


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.


回答1:


There are no way do originate only one leg. You have supply second argument(other channel dest)

if you not need other channel, create context like this

[wait]

exten =>s,1,Wait(10000)

and use

asterisk -rx "channel originate 2@autodialer s@wait" 

Read this article:

http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out

NOTE: it is not recommended do diallout apps for people with less then 5 years dedicated asterisk experience. If you want one, use vicidial.org or other dialler.



来源:https://stackoverflow.com/questions/24802631/execute-dialplan-context-from-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!