Arne Morten Johansen
2006-Feb-08 06:37 UTC
[Asterisk-Users] GotoIf number exists in file. How can i do this?
Hi there. I currently have a GotoIf statement that goes to a special extension priority if the CID match with one of the numbers in my "list" of CIDs. The way I've done it now is by multiple OR operators. There must be a better way. Anyone got some suggestions? This is basicly what I want. "If CID Exists in $File, goto s,10". So when I want to add a new CID I just add a new line in a txt file. Thanks, Arne Morten Johansen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060208/c2092955/attachment.htm
Morgan Gilroy
2006-Feb-08 07:28 UTC
[Asterisk-Users] GotoIf number exists in file. How can i do this?
It will probably be easier to write an AGI script to do this, I cant think of anything in the dialplan to do this. -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Arne Morten Johansen Sent: 08 February 2006 13:38 To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: [Asterisk-Users] GotoIf number exists in file. How can i do this? Hi there. I currently have a GotoIf statement that goes to a special extension priority if the CID match with one of the numbers in my "list" of CIDs. The way I've done it now is by multiple OR operators. There must be a better way. Anyone got some suggestions? This is basicly what I want. "If CID Exists in $File, goto s,10". So when I want to add a new CID I just add a new line in a txt file. Thanks, Arne Morten Johansen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060208/4260813f/attachment.htm
Time Bandit
2006-Feb-08 07:39 UTC
[Asterisk-Users] GotoIf number exists in file. How can i do this?
> I currently have a GotoIf statement that goes to a special extension > priority if the CID match with one of the numbers in my "list" of CIDs. The > way I've done it now is by multiple OR operators. There must be a better > way. Anyone got some suggestions? > > > > This is basicly what I want. "If CID Exists in $File, goto s,10". So when I > want to add a new CID I just add a new line in a txt file.I would do it like this : - In your dialplan, call an AGI and pass it the CID - In this AGI, check if this CID is in your list (the list could be in the AGI itself, in a separate text file or, my preferred way, in a table) - This AGI would set a variable (ex.: IS_IN_FILE) to 0 if not found or 1 if found - In your dialplan, right after calling the AGI, put a GotoIf(${IS_IN_FILE} = 1?10) hth
Morgan Gilroy
2006-Feb-08 08:08 UTC
[Asterisk-Users] GotoIf number exists in file. How can i do this?
The quickest way to do this would be Print "SETVAR INFILE TRUE\n"; But your better off looking at one of the PHP AGI interface scripts on voip-info and doing.. $AGI->SetVar('INFILE','TRUE'); -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Arne Morten Johansen Sent: 08 February 2006 14:50 To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: SV: [Asterisk-Users] GotoIf number exists in file. How can i do this? Oh. So how can I do this? If I write something in PHP, how do I make it output to an Asterisk variabel? I need to set a variable in asterisk to TRUE or FALSE based on the result of the PHP-script. ________________________________ Fra: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] P? vegne av Morgan Gilroy Sendt: 8. februar 2006 15:28 Til: Asterisk Users Mailing List - Non-Commercial Discussion Emne: RE: [Asterisk-Users] GotoIf number exists in file. How can i do this? It will probably be easier to write an AGI script to do this, I cant think of anything in the dialplan to do this. -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Arne Morten Johansen Sent: 08 February 2006 13:38 To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: [Asterisk-Users] GotoIf number exists in file. How can i do this? Hi there. I currently have a GotoIf statement that goes to a special extension priority if the CID match with one of the numbers in my "list" of CIDs. The way I've done it now is by multiple OR operators. There must be a better way. Anyone got some suggestions? This is basicly what I want. "If CID Exists in $File, goto s,10". So when I want to add a new CID I just add a new line in a txt file. Thanks, Arne Morten Johansen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060208/393e6198/attachment.htm
Conrad Wood
2006-Feb-10 13:07 UTC
[Asterisk-Users] GotoIf number exists in file. How can i do this?
On Wed, 2006-02-08 at 14:37 +0100, Arne Morten Johansen wrote:> Hi there. > > > > I currently have a GotoIf statement that goes to a special > extension priority if the CID match with one of the numbers in > my ?list? of CIDs. The way I?ve done it now is by multiple OR > operators. There must be a better way. Anyone got some > suggestions? > > > > This is basicly what I want. ?If CID Exists in $File, goto > s,10?. So when I want to add a new CID I just add a new line > in a txt file. > > >Or, maybe you can use the existence of a file rather then the content of it? exten => s,1,System(test -e /var/lib/asterisk/callerids/${CALLERID}) exten => s,2,NoOp("Normal caller") exten => s,102,NoOp("special caller") this way you can add callerids by simply touch /var/lib/asterisk/callerids/<phonenumber> does that help? Conrad