[Asterisk-Users] Re: Setting up calls through the manager interface
Tony Mountifield
tony at softins.clara.co.uk
Sat Jun 4 02:35:33 MST 2005
In article <8357030.1117828274649.JavaMail.adm-moff at moffice11.nsc.no>,
Bjorn <bok2 at online.no> wrote:
> -=-=-=-=-=-
>
> Hello all!
>
> I am currently making a script which is supposed to set up a call on request from a user,
> say, through a web page, for support issues etc. I am new into both asterisk and php, but I
> am working my way through the path as good as I can.
>
> Basically, what I would want to do, is to give the user the possibility to initiate a call
> by clicking a button. I?ve seen a cgi-alternative for this, but I would prefer it in PHP,
> furthermore, extend the functionality of this a bit:
>
> Imagine, the user clicks a button to initiate a call. The script is called and establish a
> connection to the manager interface. So far so good.
>
> The script will first call a support representative on the inside, and, when answered, it
> will proceed with calling the customer. If there was only one support representative, this
> could easily have been accomplished by executing the following:
>
> action: originate
> context: local
> exten: 555-4343
> priority: 1
> channel: SIP/1234
>
> ? where channel would be the support rep.?s number. However, when there?s more than one,
> you?d prefer to have the calls routed to whoever is available. This is nicely fixed in the
> queue system, where the support representatives can log on and off, the calls goes to first
> available representative etc. I suppose two alternatives would be the most common ones here,
> to have the phone ring at all available channels within a ?support group? at the same time,
> or have the call distributed randomly and (preferably) transferred to another agent if it
> turns out there was no answer at the first representative.
>
> I tried to achieve this by the following:
>
>
> action: originate
> context: local
> exten: 555-4343
> priority: 1
> channel: SIP/1234
> channel: SIP/2345
No, you need to use the "Local" channel type. So as not to confuse
between labels I'll use a different name for the contexts. So in
extensions.conf you might have something like this:
[internal]
exten => _1XXX,1,Dial(SIP/${EXTEN})
exten => _1XXX,2,NoOp(DIALSTATUS=${DIALSTATUS})
exten => _1XXX,3,Hangup
[external]
exten => _X.,1,Dial(SIP/${EXTEN}@provider)
exten => _X.,2,NoOp(DIALSTATUS=${DIALSTATUS})
exten => _X.,3,Hangup
Then if you wanted to dial your internal extension of 1234 and
when answered connect them to the outside number 0123456789,
through the manager API you do the following:
Action: Originate
Channel: Local/1234 at internal
Context: external
Exten: 0123456789
Priority: 1
See http://www.voip-info.org/wiki-Asterisk+Local+channels for more info.
Cheers
Tony
--
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org
More information about the asterisk-users
mailing list