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.
Kevin Larsen
2015-Jun-03 13:29 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!I love this question, simply because it allows me to talk about one of the neatest features I programmed into my system that barely anyone knows exists. Plus it lines up pretty much exactly with what you are trying to do. We have our gate control system tied into our Asterisk phone system so it is possible to dial a code on the phone and open the entrance gate to let someone in after hours. Only problem is this happens so rarely that no one (myself included) ever remembered the code. Thus a search for a better way. Now, when someone uses the gate phone to request entry, I change the caller ID on the display of the person who answers to read "Press 9 to open gate". During the call, they can hit 9 at any time and the gate will open for them. Up until they answer, the caller ID reads Gate Phone, but when they answer, it changes to that text. The part about opening the gate is the magic piece you want to look into. Read up on applicationmap in features.conf. It's pretty simple and very effective. Here is what mine looks like. I am going to replace my actual command with <insert command here>. gate => 9,self/callee,System,<insert command here> ; Custom application to open the gate. This says that this feature is active in the 'gate' context of my dialplan. The dialing pattern it is looking for is a 9. 'self' tells it to activate on the channel that dialed it and callee says that the person receiving the call is the only one that can activate it (otherwise the person at the gate phone could hit 9 to open it). I am running the System dialplan application and passing it the <insert command here> value. Everything after the ';' is a comment as normal. The <insert command here> is equivalent to what you would put inside the '()' if it were in the dialplan (i.e. 'System(<insert command here>)'). Pretty straightforward to get it working once you know what to look for. Let me know if you want to know how I manipulate the Caller ID upon answering the call to give the instructions to the callee on how to open the gate/door. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20150603/f824a967/attachment-0001.html>
Kevin Larsen
2015-Jun-03 13:34 UTC
[asterisk-users] RES: RES: How to invoke a binary file from the dial plan?
> I love this question, simply because it allows me to talk about one > of the neatest features I programmed into my system that barely > anyone knows exists. Plus it lines up pretty much exactly with what > you are trying to do. > > We have our gate control system tied into our Asterisk phone system > so it is possible to dial a code on the phone and open the entrance > gate to let someone in after hours. Only problem is this happens so > rarely that no one (myself included) ever remembered the code. Thus > a search for a better way. > > Now, when someone uses the gate phone to request entry, I change the > caller ID on the display of the person who answers to read "Press 9 > to open gate". During the call, they can hit 9 at any time and the > gate will open for them. Up until they answer, the caller ID reads > Gate Phone, but when they answer, it changes to that text. > > The part about opening the gate is the magic piece you want to look > into. Read up on applicationmap in features.conf. It's pretty simple > and very effective. Here is what mine looks like. I am going to > replace my actual command with <insert command here>. > > gate => 9,self/callee,System,<insert command here> ; Custom > application to open the gate. > > This says that this feature is active in the 'gate' context of my > dialplan. The dialing pattern it is looking for is a 9. 'self' tells > it to activate on the channel that dialed it and callee says that > the person receiving the call is the only one that can activate it > (otherwise the person at the gate phone could hit 9 to open it). I > am running the System dialplan application and passing it the > <insert command here> value. Everything after the ';' is a comment > as normal. The <insert command here> is equivalent to what you would > put inside the '()' if it were in the dialplan (i.e. 'System(<insert > command here>)'). > > Pretty straightforward to get it working once you know what to look > for. Let me know if you want to know how I manipulate the Caller ID > upon answering the call to give the instructions to the callee on > how to open the gate/door.I just realized I said one piece wrong in this. 'gate' is not the context, it is the dynamic feature designator. I can illustrate this better by posting my front gate context. [front_gate] exten => <number gate dials goes here>,1,Set(__DYNAMIC_FEATURES=gate) same => n,Goto(frontgate_queue,${EXTEN},1) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20150603/d48aae49/attachment.html>
Guenther Boelter
2015-Jun-03 13:35 UTC
[asterisk-users] RES: RES: How to invoke a binary file from the dial plan?
Great !!!! On Jun 3, 2015 9:29 PM, "Kevin Larsen" <kevin.larsen at pioneerballoon.com> wrote:> > 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! > > I love this question, simply because it allows me to talk about one of the > neatest features I programmed into my system that barely anyone knows > exists. Plus it lines up pretty much exactly with what you are trying to do. > > We have our gate control system tied into our Asterisk phone system so it > is possible to dial a code on the phone and open the entrance gate to let > someone in after hours. Only problem is this happens so rarely that no one > (myself included) ever remembered the code. Thus a search for a better way. > > Now, when someone uses the gate phone to request entry, I change the > caller ID on the display of the person who answers to read "Press 9 to open > gate". During the call, they can hit 9 at any time and the gate will open > for them. Up until they answer, the caller ID reads Gate Phone, but when > they answer, it changes to that text. > > The part about opening the gate is the magic piece you want to look into. > Read up on applicationmap in features.conf. It's pretty simple and very > effective. Here is what mine looks like. I am going to replace my actual > command with <insert command here>. > > gate => 9,self/callee,System,<insert command here> ; Custom application to > open the gate. > > This says that this feature is active in the 'gate' context of my > dialplan. The dialing pattern it is looking for is a 9. 'self' tells it to > activate on the channel that dialed it and callee says that the person > receiving the call is the only one that can activate it (otherwise the > person at the gate phone could hit 9 to open it). I am running the System > dialplan application and passing it the <insert command here> value. > Everything after the ';' is a comment as normal. The <insert command here> > is equivalent to what you would put inside the '()' if it were in the > dialplan (i.e. 'System(<insert command here>)'). > > Pretty straightforward to get it working once you know what to look for. > Let me know if you want to know how I manipulate the Caller ID upon > answering the call to give the instructions to the callee on how to open > the gate/door. > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20150603/54dcfef6/attachment.html>
Rodrigo Pimenta Carvalho
2015-Jun-03 14:20 UTC
[asterisk-users] RES: RES: RES: How to invoke a binary file from the dial plan?
Hi Kevin. Thank you again for help me! In my case, in the final application for smartphones or in a softphone for PCs, there will be a button on the GUI and the user will have just to touch it, and the door or gate will open. I mean, during an ongoing call, the callee will see a button in the interface of its SIP application. For example, we can use the lib of Linphone and implement a GUI over it, having a new button to open doors and gates. So, the callee will not have to remember about codes, because there will be a button in someplace to be touched. When the button be touched, during an ongoing call, the software (SIP client) will sends a request to Asterisk executes the "gate => 9,self/callee,System,<insert command here>" , for example. So, it will works like the user pressing number 9. I will take a look at applicationmap in features.conf to understand what exactly can be done. But, let me ask you: This idea seems to be good to run during ongoing calls. What about moments when there is no ongoing call? That is, can Asterisk execute a dial plan (maybe by means of some kind of SIP request received from the SIP client) even without establishing a call? 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: quarta-feira, 3 de junho de 2015 10:29 Para: Asterisk Users Mailing List - Non-Commercial Discussion Assunto: Re: [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!I love this question, simply because it allows me to talk about one of the neatest features I programmed into my system that barely anyone knows exists. Plus it lines up pretty much exactly with what you are trying to do. We have our gate control system tied into our Asterisk phone system so it is possible to dial a code on the phone and open the entrance gate to let someone in after hours. Only problem is this happens so rarely that no one (myself included) ever remembered the code. Thus a search for a better way. Now, when someone uses the gate phone to request entry, I change the caller ID on the display of the person who answers to read "Press 9 to open gate". During the call, they can hit 9 at any time and the gate will open for them. Up until they answer, the caller ID reads Gate Phone, but when they answer, it changes to that text. The part about opening the gate is the magic piece you want to look into. Read up on applicationmap in features.conf. It's pretty simple and very effective. Here is what mine looks like. I am going to replace my actual command with <insert command here>. gate => 9,self/callee,System,<insert command here> ; Custom application to open the gate. This says that this feature is active in the 'gate' context of my dialplan. The dialing pattern it is looking for is a 9. 'self' tells it to activate on the channel that dialed it and callee says that the person receiving the call is the only one that can activate it (otherwise the person at the gate phone could hit 9 to open it). I am running the System dialplan application and passing it the <insert command here> value. Everything after the ';' is a comment as normal. The <insert command here> is equivalent to what you would put inside the '()' if it were in the dialplan (i.e. 'System(<insert command here>)'). Pretty straightforward to get it working once you know what to look for. Let me know if you want to know how I manipulate the Caller ID upon answering the call to give the instructions to the callee on how to open the gate/door.
Seemingly Similar Threads
- 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?
- RES: RES: RES: How to invoke a binary file from the dial plan?
- RES: How to invoke a binary file from the dial plan?