Hi Tony.
Thanks for the reply. I just started to mock it up, and realised that still has
a problem. My followme table in MySQL looked like this:
+----+-----------+--------+----------+--------+------+------+---------+---------+--------+---------+---------+------------+
| id | callednum | cidnum | priority | weight | app | tech | forward | options
| server | context | alt_ext | soundstep |
+----+-----------+--------+----------+--------+------+------+---------+---------+--------+---------+---------+------------+
| 1 | 3254100 | | 1 | 1 | Dial | SIP | 3254101 | 10|tr
| NULL | NULL | NULL | tt-weasels |
| 2 | 3254100 | | 1 | 1 | Dial | SIP | 3254102 | 10|tr
| NULL | NULL | NULL | tt-weasels |
+----+-----------+--------+----------+--------+------+------+---------+---------+--------+---------+---------+------------+
2 rows in set (0.03 sec)
Using AGI fully, this allowed me to completely customise everything, including
the application to call. Asterisk extensions.conf won't let you put a
variable name in place of an application command, I don't believe.
exten => 3254000,1,$VAR_APP($VAR_TECH/$VAR_FORWARD....)
... won't work.
-----Original Message-----
From: Tony Mountifield [mailto:tony@softins.clara.co.uk]
Sent: Friday, January 13, 2006 10:37 AM
To: asterisk-users@lists.digium.com
Subject: [Asterisk-Users] Re: FastAGI Command Execution
In article <645FEC31A18FE54A8721500CDD55A7B602C15309@mail.oneeighty.com>,
Douglas Garstang <dgarstang@oneeighty.com> wrote:> Tony,
>
> It isn't that simple. I was trying to implemt findme/followme
functionality. A user dials a
> number, and then the agi looks up that dialled extension in MySQL. For that
extension, there
> is a list of numbers to try in sequence. Any step in the sequence could
even involve
> dialling multiple numbers at the same time.
>
> If extensions.conf calls out to a Fast AGI script to retrieve the first
number to dial, and
> then the Fast AGI script sets certain variables before returning control to
extensions.conf
> to actually perform the dial, that might work for the first number, but I
can't think of any
> way for the state to be maintained, such that if all this was in a loop in
extensions.conf,
> on the next call to the Fast AGI script, it could remember it's state
and retrieve the next
> number in the list.
>
> Oh if only it where simple!
If I understand you correctly, I don't think you need a loop, if you are
prepared to accept a maximum possible length of the sequence. You could
just have the AGI set a channel variable for each step in the sequence,
where that channel variable can contain either a single extension to
dial (e.g. SIP/2001 or Zap/g1/15152221234 or Local/15152221234@foo) or
a set of numbers to dial together (e.g. SIP/2001&SIP/2004).
You would then have a dialplan something like this:
[incoming]
exten => _X.,1,FastAGI(whatever|${EXTEN})
exten => _X.,2,GotoIf($[ "${NUMA}" = "" ]?notfound,1)
exten => _X.,3,Dial(${NUMA})
exten => _X.,4,GotoIf($[ "${NUMB}" = "" ]?notfound,1)
exten => _X.,5,Dial(${NUMB})
exten => _X.,6,GotoIf($[ "${NUMC}" = "" ]?notfound,1)
exten => _X.,7,Dial(${NUMC})
exten => _X.,8,GotoIf($[ "${NUMD}" = "" ]?notfound,1)
exten => _X.,9,Dial(${NUMD})
exten => _X.,10,GotoIf($[ "${NUME}" = "" ]?notfound,1)
exten => _X.,11,Dial(${NUME})
exten => _X.,12,Goto(notfound,1)
exten => notfound,1,Playback(im-sorry-i-cannot-locate-the-person-you-called)
exten => notfound,2,Hangup
So if three steps were found in the database, the AGI just sets NUMA, NUMB and
NUMC. If it reaches step 8, it jumps to "notfound" because NUMD is not
set.
Your dialplan can have as many possible steps as you want, it's not
expensive.
Cheers
Tony
--
Tony Mountifield
Work: tony@softins.co.uk - http://www.softins.co.uk
Play: tony@mountifield.org - http://tony.mountifield.org
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --
Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users