[Asterisk-Users] Dial using URI(web) or using FORM(web)
Colin Anderson
ColinA at landmarkmasterbuilder.com
Wed Jul 27 14:24:24 MST 2005
I am currently doing this in IIS/ASP, you can modify to your tastes.
Prerequisites are SAMBA on the Asterisk server, a temp folder shared out in
Samba that the anonymous IIS user has rights to, and a WATCH statement in
/etc/rc.d/rc.local that will execute a batch file that chmod's the .CALL
file so that it has rights to the file and moves it from the temp directory
to the /var/spool/asterisk/outgoing directory every 2s:
<%
PhoneNumber=Request.Querystring("PhoneNumber") 'Can use request.form if
posting a form
Context=request.querystring("Context") 'or hardcode a context
Extension=request.querystring("Extension") 'Extension to terminate the call
to once the guy picks up
PhonePrefix=Left(PhoneNumber,3) 'Determine the prefix
If PhonePrefix="780" then 'My CLEC will not complete calls with a local area
code, so strip out
NumberToCall=Right(PhoneNumber,7)
Else
NumberToCall= "1" & PhoneNumber 'if it's not local, append a 1 in front of
it for LD
End If
Randomize
set fs = CreateObject("Scripting.FileSystemObject")
set file = fs.CreateTextFile("\\<MyAsteriskServerIP>\outgoing\" & int(Rnd *
1000) & ".call", true, false)
file.WriteLine("Channel: ZAP/g0/" & NumberToCall) 'Pick a line from
group 0
file.WriteLine("SetVar: CALLINGPARTY=" & NumberToCall) 'Set variable so
Asterisk can present the CallerID to the extension, reference as
SetCallerID(${CALLINGPARTY}) in the context of the extension's phone
file.WriteLine("CallerID: <MyCallerIDIWantToPresent>")
file.WriteLine("MaxRetries: 2")
file.WriteLine("RetryTime: 60")
file.WriteLine("WaitTime: 60")
file.WriteLine("Context: " & Context)
file.WriteLine("Extension: " & Extension)
file.WriteLine("Priority: 1")
file.Close
response.write "Call in progress, please wait..." 'or insert whatever HTML
you want or response.redirect to whatever target page you want
%>
This file gets href'd as something like
"http://foo.com/call.asp?PhoneNumber=1115551212&Context=from-pstn&Extension=
1000"
Works like a hot damn. hth.
More information about the asterisk-users
mailing list