Re: [asterisk-users] GotoIf Double Pattern Match [SEC=UNCLASSIFIED]
> On 28/11/2016, at 12:29 pm, Calum Powerwrote: > > > > What I have written come up with is below, but I just wanted to see if I was > going about this the right way, and that this expression would actually > work... > > exten => B,n,GotoIf($["${CALLERID(num):-2}" = "13"] & > $["${CALLERID(num):0:2}" = [5-9][5-9])?change_context) > > Any advice/suggestions/flames welcome J Hi Calum I think you'll need another closing square-bracket at the end of the second conditional test in your example, ie: 5-9]])?cha I also think you may need to wrap that second conditional up in the REGEX function, although there are much smarter people on-list who will likely come back with a better suggestion! Also, checking the second character of CID is the same as the first character (otherwise you'd match 56, 69, 97 etc). I'm thinking something like: $[${REGEX("[5-9]" ${CALLERID(num):0:1})}] & $[${CALLERID(num):0:1} = ${CALLERID(num):1:1}] Hope this helps anyway :) Pete smime.p7s Description: S/MIME cryptographic signature -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Subscribe to events via ARI from node.js without sending to Stasis
On Wed, Nov 23, 2016, at 06:41 PM, Matt Riddell wrote: > Hi, > > I'm writing a node.js backend to pass events via a websocket to a CRM. > > Basically what I want to do is notice when things happen (i.e. new > channel, new bridge etc) without sending the channels to the Stasis app. > > The channels I'm interested in are agents who are in a queue only because > they are in a realtime MySQL database for the queue_member_table. > > There doesn't appear to be a way to monitor general Asterisk events like > you can in the Asterisk manager without polling for channel statuses or > sending the channels to the Stasis app and recreating the logic of the > Queue application. You can subscribe to events for everything, but ARI events are a subset of what are available over AMI so you may not get what you want. Events raised by applications for example would not be present. You can subscribe to all channels by subscribing to "channel:" using the /applications//subscription resource, and "bridge:" for all bridges. Cheers, -- Joshua Colp Digium, Inc. | Senior Software Developer 445 Jan Davis Drive NW - Huntsville, AL 35806 - US Check us out at: www.digium.com & www.asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
[asterisk-users] GotoIf Double Pattern Match [SEC=UNCLASSIFIED]
Hi guys, Sorry if this is a really basic question, but I'm fairly new to Asterisk and am self-teaching so please go easy on me :) Basically what I am trying to do is match 2 patterns in a conditional GotoIf. The first condition is that the callerid(num) must end in '13' The second condition is that the first two digits of callerid(num) must be one of 66,77,88 or 99 eg. 9913 would match, but 9013 would not. 6613 would match, but 6612 would not. What I have written come up with is below, but I just wanted to see if I was going about this the right way, and that this expression would actually work... exten => B,n,GotoIf($["${CALLERID(num):-2}" = "13"] & $["${CALLERID(num):0:2}" = [5-9][5-9])?change_context) Any advice/suggestions/flames welcome :) Cheers Calum ___ Australian Antarctic Division - Commonwealth of Australia IMPORTANT: This transmission is intended for the addressee only. If you are not the intended recipient, you are notified that use or dissemination of this communication is strictly prohibited by Commonwealth law. If you have received this transmission in error, please notify the sender immediately by e-mail or by telephoning +61 3 6232 3209 and DELETE the message. Visit our web site at http://www.antarctica.gov.au/ ___ -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Non-global variable that follows channel?
Thanks. I did a while ago, but I couldn't make it "fit" what I wanted to do. Maybe with my increase Asterisk knowledge now I'll take another look. Thanks! On 27 November 2016 at 18:27, Richard Mudgettwrote: > Have you looked into ARI [1]? I think it would be a closer fit to what you > want to do. -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Non-global variable that follows channel?
On Sun, Nov 27, 2016 at 11:13 AM, Jonathan Hwrote: > Thanks, Richard - your code does indeed work reliably 100% of the > time, and thank you for that explanation. > > I do think the docs at > https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Function_SHARED > could do with more clarification. > > BTW, there were a couple of typos in your code, so for anyone who > wants to copy/paste, here's Richard's code WITH the curly braces ( > Set(SHARED(sharedVar,MY_CALLER) should be > Set(SHARED(sharedVar,${MY_CALLER}) ) > > [svtest1] > exten => s,1,Answer() > same => n,Verbose(1,Answered channel:${CHANNEL}) > same => n,Set(__MY_CALLER=${CHANNEL(name)}) > same => n,Dial(Local/s@svtest2,,g) > same => n,Verbose(1,***In channel:${CHANNEL} > sharedVar:${SHARED(sharedVar)}) > same => n,Hangup() > > [svtest2] > exten => s,1,NoOp() > same => n,Set(SHARED(sharedVar,${MY_CALLER})="I have been set in > svtest2 by ${CHANNEL(name)}") > same => n,Verbose(1,***In channel:${CHANNEL} sharedVar: > ${SHARED(sharedVar,Local/s@svtest2)}) > same => n,Answer() > same => n,Hangup() > > Thanks again. > > (BTW, looking forward to the day when Asterisk gets some kind of > asynchronous dialplan application - all this "dialling a local > channel" is just to get via music on hold so there's not silence while > a long operation happening, as per > http://lists.digium.com/pipermail/asterisk-users/2016-November/290384.html > :) ) > Have you looked into ARI [1]? I think it would be a closer fit to what you want to do. Richard [1] https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Non-global variable that follows channel?
Thanks, Richard - your code does indeed work reliably 100% of the time, and thank you for that explanation. I do think the docs at https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Function_SHARED could do with more clarification. BTW, there were a couple of typos in your code, so for anyone who wants to copy/paste, here's Richard's code WITH the curly braces ( Set(SHARED(sharedVar,MY_CALLER) should be Set(SHARED(sharedVar,${MY_CALLER}) ) [svtest1] exten => s,1,Answer() same => n,Verbose(1,Answered channel:${CHANNEL}) same => n,Set(__MY_CALLER=${CHANNEL(name)}) same => n,Dial(Local/s@svtest2,,g) same => n,Verbose(1,***In channel:${CHANNEL} sharedVar:${SHARED(sharedVar)}) same => n,Hangup() [svtest2] exten => s,1,NoOp() same => n,Set(SHARED(sharedVar,${MY_CALLER})="I have been set in svtest2 by ${CHANNEL(name)}") same => n,Verbose(1,***In channel:${CHANNEL} sharedVar: ${SHARED(sharedVar,Local/s@svtest2)}) same => n,Answer() same => n,Hangup() Thanks again. (BTW, looking forward to the day when Asterisk gets some kind of asynchronous dialplan application - all this "dialling a local channel" is just to get via music on hold so there's not silence while a long operation happening, as per http://lists.digium.com/pipermail/asterisk-users/2016-November/290384.html :) ) On 27 November 2016 at 16:16, Richard Mudgettwrote: > [svtest1] > exten = s,1,NoOp() > same = n,Answer() > same = n,Set(__MY_CALLER=${CHANNEL(name)}) > same = n,Dial(Local/s@svtest2,,g) > same = n,NoOp(Returned SHARED(sharedVar) = '${SHARED(sharedVar)'} > same = n,Hangup() > > [svtest2] > exten = s,1,NoOp() > exten = n,Set(SHARED(sharedVar,MY_CALLER)="I have been set in svtest2 by > ${CHANNEL(name)}") > exten = n,Answer() > exten = n,Hangup() -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Non-global variable that follows channel?
On Sun, Nov 27, 2016 at 8:07 AM, Jonathan Hwrote: > Thanks, Max. > > Yes, of course, you are right, and I am an idiot because I was tired > and putting underscores before the variable name when I read it back! > Then I forgot to post the followup email to say I had figured it out. > > Now, this SHARED was not something I was aware of, but looked like an > ideal solution to passing variables BACK from to the parent channel. > > However, it does not seem to be very reliable. > > Code: > > [svtest1] > exten => s,1,Answer() > same => n,Verbose(1,Answered channel:${CHANNEL}) > same => n,Dial(Local/s@svtest2,,g) > same => n,Verbose(1,***In channel:${CHANNEL} sharedVar: > ${SHARED(sharedVar,Local/s@svtest2)} ) > same => n,Hangup() > > [svtest2] > exten => s,1,NoOp() > same => n,Set(SHARED(sharedVar,Local/s@svtest2)="I have been set > in svtest2") > same => n,Verbose(1,***In channel:${CHANNEL} sharedVar: > ${SHARED(sharedVar,Local/s@svtest2)}) > same => n,Answer() > same => n,Hangup() > There are a few problems with the way you are trying to use SHARED here. 1) Dial with the g option continues in the dialplan when the called channel hangs up and you are accessing a SHARED variable on the called channel while it is being destroyed. Thus it may or may not still exist when you attempt to access it. 2) You are using local channels. Remember local channels always come in pairs. The local channel name you are using to reference the SHARED variable is ambiguous. Not only do you not know which half of a local channel pair you will get, you may not even get one of the local channels the Dial created for this call if you have more than one of these calls happening in parallel. Executing this CLI command: CLI> originate local/s@svtest1 application echo Your dialplan creates this channel chain when Local/s@svtest2 executes the Answer: Echo() -- Local/s@svtest1-;1 -- Local/s@svtest1-;2 -- Local/s@svtest2-0001;1 -- Local/s@svtest2-0001;2 -- Answer() These problems can be avoided if we make a couple of changes. 1) Change which channel maintains the SHARED variables to the calling channel. 2) Pass the calling channel name to the called channel using variable inheritance. [svtest1] exten = s,1,NoOp() same = n,Answer() same = n,Set(__MY_CALLER=${CHANNEL(name)}) same = n,Dial(Local/s@svtest2,,g) same = n,NoOp(Returned SHARED(sharedVar) = '${SHARED(sharedVar)'} same = n,Hangup() [svtest2] exten = s,1,NoOp() exten = n,Set(SHARED(sharedVar,MY_CALLER)="I have been set in svtest2 by ${CHANNEL(name)}") exten = n,Answer() exten = n,Hangup() Richard -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Non-global variable that follows channel?
Thanks, Max. Yes, of course, you are right, and I am an idiot because I was tired and putting underscores before the variable name when I read it back! Then I forgot to post the followup email to say I had figured it out. Now, this SHARED was not something I was aware of, but looked like an ideal solution to passing variables BACK from to the parent channel. However, it does not seem to be very reliable. Code: [svtest1] exten => s,1,Answer() same => n,Verbose(1,Answered channel:${CHANNEL}) same => n,Dial(Local/s@svtest2,,g) same => n,Verbose(1,***In channel:${CHANNEL} sharedVar: ${SHARED(sharedVar,Local/s@svtest2)} ) same => n,Hangup() [svtest2] exten => s,1,NoOp() same => n,Set(SHARED(sharedVar,Local/s@svtest2)="I have been set in svtest2") same => n,Verbose(1,***In channel:${CHANNEL} sharedVar: ${SHARED(sharedVar,Local/s@svtest2)}) same => n,Answer() same => n,Hangup() Output, 4 times from console, 4 times from a normal PJSIP dialin: Of the 8 attempts. in only 3 instances the variable survives the journey back to the parent channel, and seemingly randomly, too. Am I using it incorrectly? CLI> originate local/s@svtest1 application echo Answered channel:Local/s@svtest1-0027;2 ***In channel:Local/s@svtest2-0028;2 sharedVar: "I have been set in svtest2" ***In channel:Local/s@svtest1-0027;2 sharedVar: CLI> originate local/s@svtest1 application echo Answered channel:Local/s@svtest1-0029;2 ***In channel:Local/s@svtest2-002a;2 sharedVar: "I have been set in svtest2" ***In channel:Local/s@svtest1-0029;2 sharedVar: CLI> originate local/s@svtest1 application echo Answered channel:Local/s@svtest1-002b;2 ***In channel:Local/s@svtest2-002c;2 sharedVar: "I have been set in svtest2" ***In channel:Local/s@svtest1-002b;2 sharedVar: "I have been set in svtest2" CLI> originate local/s@svtest1 application echo Answered channel:Local/s@svtest1-002d;2 ***In channel:Local/s@svtest2-002e;2 sharedVar: "I have been set in svtest2" ***In channel:Local/s@svtest1-002d;2 sharedVar: Answered channel:PJSIP/6001-0007 ***In channel:Local/s@svtest2-002f;2 sharedVar: "I have been set in svtest2" ***In channel:PJSIP/6001-0007 sharedVar: "I have been set in svtest2" Answered channel:PJSIP/6001-0008 ***In channel:Local/s@svtest2-0030;2 sharedVar: "I have been set in svtest2" ***In channel:PJSIP/6001-0008 sharedVar: Answered channel:PJSIP/6001-0009 ***In channel:Local/s@svtest2-0031;2 sharedVar: "I have been set in svtest2" ***In channel:PJSIP/6001-0009 sharedVar: Answered channel:PJSIP/6001-000a ***In channel:Local/s@svtest2-0032;2 sharedVar: "I have been set in svtest2" ***In channel:PJSIP/6001-000a sharedVar: "I have been set in svtest2" On 27 November 2016 at 11:39, Max Grobeckerwrote: > Hi, > > is channel variable inheritance working for your setup? > Passing variables to other channels can normally simply be done by naming the > variable with one or two prefixed undersorces > to make it available to the channel that is created from that one defining > the variable. > But I have no idea if it's getting inherited to Gosub called from a Dial > command... > -> https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Set > > If that is not working for you, you might use the SHARED() variables which > are kind of global accessible by the channel ID. > So you might call your Gosub with only the (unique) reference name of the > variables you wish to pass and then call it from your Gosub. > -> https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_SHARED > > > Greetings, > Max > > > Am 23.11.2016 um 13:06 schrieb Jonathan H: >> Related to >> http://lists.digium.com/pipermail/asterisk-users/2016-November/290384.html, >> at the moment I'm passing one variable via DIAL. >> >> Now I'd like to pass a whole bunch, and my idea was to rather than >> having a great string of >> >> b(synctest3b^setVar^1(something)^2(more things)^3(etc)) >> >> and then get them with ARG1..ARGn etc, I could bundle the whole lot >> into a HASH and then unbundle them at the called channel. >> >> Passing the HASH as a var isn't working (I wasn't expecting it to!) >> but is there any other way of doing this, or is it setVar for each >> one? >> > > > -- > _ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: https://community.asterisk.org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: >http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check
Re: [asterisk-users] Touch tone stutter
Hi, you could try switching the DTMF mode of the ATA's SIP peer (and also in the ATA itself) to INBAND transmission. In this mode, the ATA doesn't need to recognise DTMF tones and your Asterisk can interpret it. For this to work, the ATA needs to use a G.711 codec. Inband DTMF needs an uncompressed codec to work properly. Another way is (if the ATA supports it) to switch DMTF mode to SIP INFO. In this mode, DTMF is not interpreted out of the audio stream. For external peers which are not supporting this mode Asterisk then generates the proper RTP messages or tones. With SIP INFO mode I made my best results with all devices, sadly it's not very common used. Max Am 23.11.2016 um 20:02 schrieb D'Arcy Cain: > On 2016-11-22 07:49 PM, Pete Mundy wrote: >> >> One direction that may be worth exploring further is his ATA's config (or >> perhaps swapping it for a different model). Eg adjusting echo cancellation >> or line impedance settings. > > I have to be careful here as I auto-provison these devices and changes would > propogate to every user. Echo cancellation is off. Do you think it should > be on? > >> Is the ATA he is using the same as the ATA you use? > > No but it is the same as other users who do not have the problem. I use a > SIP phone and a Cisco ATA. > >> Failure to correctly recognise and decode DTMF is just one of many reasons >> why I never use them (ATAs). Like faxing over VoIP, they're just too much >> trouble :( > > I understand but some use cases just need it. > >> Genuine IP phones are pretty good value these days. Could you drop one of >> those on-site as a temporary measure to prove that it's phone and/or ATA >> related? > > He does want to have an extension so that won't work. > >> Ps, you might also want to consider joining VoiceOps (if you're not already >> subscribed) and posting there. >> https://puck.nether.net/mailman/listinfo/voiceops > > I have subscribed. Thanks. > signature.asc Description: OpenPGP digital signature -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Non-global variable that follows channel?
Hi, is channel variable inheritance working for your setup? Passing variables to other channels can normally simply be done by naming the variable with one or two prefixed undersorces to make it available to the channel that is created from that one defining the variable. But I have no idea if it's getting inherited to Gosub called from a Dial command... -> https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Set If that is not working for you, you might use the SHARED() variables which are kind of global accessible by the channel ID. So you might call your Gosub with only the (unique) reference name of the variables you wish to pass and then call it from your Gosub. -> https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_SHARED Greetings, Max Am 23.11.2016 um 13:06 schrieb Jonathan H: > Related to > http://lists.digium.com/pipermail/asterisk-users/2016-November/290384.html, > at the moment I'm passing one variable via DIAL. > > Now I'd like to pass a whole bunch, and my idea was to rather than > having a great string of > > b(synctest3b^setVar^1(something)^2(more things)^3(etc)) > > and then get them with ARG1..ARGn etc, I could bundle the whole lot > into a HASH and then unbundle them at the called channel. > > Passing the HASH as a var isn't working (I wasn't expecting it to!) > but is there any other way of doing this, or is it setVar for each > one? > signature.asc Description: OpenPGP digital signature -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users