Rodrigo Pimenta Carvalho
2015-Jun-02 20:42 UTC
[asterisk-users] RES: How to invoke a binary file from the dial plan?
Ok. Thanks for the hint. But, what exactly is a "System() dialplan application"? Is it a kind of command that i can call in dial plan? I will look for System() related to dial plans. Thanks. RODRIGO PIMENTA CARVALHO Inatel Competence Center Software Ph: +55 35 3471 9200 RAMAL 979 ________________________________________ De: asterisk-users-bounces at lists.digium.com [asterisk-users-bounces at lists.digium.com] em Nome de Kevin Larsen [kevin.larsen at pioneerballoon.com] Enviado: ter?a-feira, 2 de junho de 2015 17:31 Para: Asterisk Users Mailing List - Non-Commercial Discussion Assunto: Re: [asterisk-users] How to invoke a binary file from the dial plan?> Hi everyone. > > I'm new with Asterisk and I have to create a dial plan that will > invoke a binary code. That is, asterisk will execute a program in > the same machine. How to do it? > > Let me explain what I have to do: > > In the project that I am currently working, there is smartphones, > SIP servers and doors/gates to be unlocked remotely. When the user > executes an application on his/her phone, it will presents a button > to unlock a remote gate or door. > By pressing such button, the application will send a SIP INVITE to > the SIP server (Asterisk). In this moment, a existing dial plan > should call an executable hosted in the current machine. In this > case I need to know how to program my extensions.conf to let > Asterisk invoke another software to me. > The another software is the one responsible for unlocking a gate or door. > > So, how to codify my extensions.conf in order to make Asterisk > invoke another software? > Is another better way (idea) to implement my project using Asterisk > and SIP? If so, comment, please! > > Any hint will be very helpful!Look into the System() dialplan application. It will execute a command on the system for you. Be aware that it will execute it as the user your Asterisk instance is running as, so permissions can sometimes be a bit finicky to get correct. I do something similar to pop my gate open. It is using nc to make a connection to the device, but same general idea as what you are doing.
Kevin Larsen
2015-Jun-02 20:50 UTC
[asterisk-users] RES: How to invoke a binary file from the dial plan?
> Ok. Thanks for the hint. > > But, what exactly is a "System() dialplan application"? Is it a kind > of command that i can call in dial plan? > > I will look for System() related to dial plans.>From the Asterisk CLI type:core show application System It will print out the syntax for the command. One of the easier dialplan applications. exten => 1234,1,System(echo "This is a test" >> /var/log/asterisk/test.txt) That line would use the Linux echo command to place the text "This is a test" into a file named test.txt located in the /var/log/asterisk directory. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20150602/f889622f/attachment.html>
Rodrigo Pimenta Carvalho
2015-Jun-03 13:10 UTC
[asterisk-users] RES: RES: How to invoke a binary file from the dial plan?
Hi Kevin. Thank you very much for the hint! It worked very well! Your example ' exten => 1234,1,System(echo "This is a test" >> /var/log/asterisk/test.txt) ' executes when the SIP client (my softphone Jitsi) sends a SIP INVITE to asterisk. So, the softphone tries to establish a session with target 1234. Now, lets suppose my softphone rings and I answer a call. During the call, the caller asks me to execute a command (ex: to open a door or gate). In this case, what have I to program in dial plan to Asterisk execute System() again? Is it possible to execute a dial plan even during an ongoing call? Finally, lets suppose I want to use my softphone to execute a dial plan, even without establishing a call (no session with target 1234). For example, If I decide to open a dor or gate using my softphone, without existing an ongoing call, what have I to program in dial plan to Asterisk executes System(). Is this idea possible? Any hint will be very hepful! Best regards. RODRIGO PIMENTA CARVALHO Inatel Competence Center Software Ph: +55 35 3471 9200 RAMAL 979 ________________________________________ De: asterisk-users-bounces at lists.digium.com [asterisk-users-bounces at lists.digium.com] em Nome de Kevin Larsen [kevin.larsen at pioneerballoon.com] Enviado: ter?a-feira, 2 de junho de 2015 17:50 Para: Asterisk Users Mailing List - Non-Commercial Discussion Assunto: Re: [asterisk-users] RES: How to invoke a binary file from the dial plan?> Ok. Thanks for the hint. > > But, what exactly is a "System() dialplan application"? Is it a kind > of command that i can call in dial plan? > > I will look for System() related to dial plans.>From the Asterisk CLI type:core show application System It will print out the syntax for the command. One of the easier dialplan applications. exten => 1234,1,System(echo "This is a test" >> /var/log/asterisk/test.txt) That line would use the Linux echo command to place the text "This is a test" into a file named test.txt located in the /var/log/asterisk directory.
Maybe Matching Threads
- RES: How to invoke a binary file from the dial plan?
- RES: RES: How to invoke a binary file from the dial plan?
- RES: RES: RES: How to invoke a binary file from the dial plan?
- RES: RES: How to invoke a binary file from the dial plan?
- RES: RES: How to invoke a binary file from the dial plan?