<%
language=_vbscript_ 'ASP
page
PhoneNumber=Request.Querystring("PhoneNumber") 'Get the number to call on the first leg of the call
PhoneNumber=Request.Querystring("PhoneNumber") 'Get the number to call on the first leg of the call
PhoneNumber2=Request.Querystring("PhoneNumber2") 'Get the number to terminate the call
to
Context=request.querystring("Context") 'Get the context to execute on the Asterisk box
Extension=request.querystring("Extension") 'Optional, start from a particular extension, otherwise pass the 's' extension
PhonePrefix=Left(PhoneNumber,3) 'Grab out the first 3 digits of the NAMA number to determine if it's local or LD
Context=request.querystring("Context") 'Get the context to execute on the Asterisk box
Extension=request.querystring("Extension") 'Optional, start from a particular extension, otherwise pass the 's' extension
PhonePrefix=Left(PhoneNumber,3) 'Grab out the first 3 digits of the NAMA number to determine if it's local or LD
'from the perspective of the Asterisk box
If PhonePrefix="780" then 'If it's a local call, then
NumberToCall=Right(PhoneNumber,7) 'Return the rightmost 7 digits
Else
NumberToCall= "1" & PhoneNumber 'It's a LD call, so append 1 to the NAMA number
End If
Randomize 'We create a pseudo-random number for the .call file filename
set fs = CreateObject("Scripting.FileSystemObject")
set file = fs.CreateTextFile("\\192.168.1.46\outgoing\" & int(Rnd * 1000) & ".call", true, false) 'Dump the call file to a SAMBA share on the Asterisk box.
If PhonePrefix="780" then 'If it's a local call, then
NumberToCall=Right(PhoneNumber,7) 'Return the rightmost 7 digits
Else
NumberToCall= "1" & PhoneNumber 'It's a LD call, so append 1 to the NAMA number
End If
Randomize 'We create a pseudo-random number for the .call file filename
set fs = CreateObject("Scripting.FileSystemObject")
set file = fs.CreateTextFile("\\192.168.1.46\outgoing\" & int(Rnd * 1000) & ".call", true, false) 'Dump the call file to a SAMBA share on the Asterisk box.
'A looping script running on the Asterisk
box looks for any .call files, and if it finds one, moves the .call file to
/var/spool/asterisk/outgoing
'You can do this in PHP with an SCP
command instead
file.WriteLine("Channel: ZAP/g0/" & NumberToCall)
file.WriteLine("SetVar: CALLEDPARTY=" & PhoneNumber2)
file.WriteLine("CallerID: 18888988884") 'Set your caller ID where appropriate
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 'Finish up and unlock the file for the looping script to pick up
response.write "&OK=1" 'Response.write a variable back to Flash indicating the call was placed successfully. Otherwise you could
file.WriteLine("Channel: ZAP/g0/" & NumberToCall)
file.WriteLine("SetVar: CALLEDPARTY=" & PhoneNumber2)
file.WriteLine("CallerID: 18888988884") 'Set your caller ID where appropriate
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 'Finish up and unlock the file for the looping script to pick up
response.write "&OK=1" 'Response.write a variable back to Flash indicating the call was placed successfully. Otherwise you could
'write back some HTML saying "Your call was executed
correctly" or some such.
%>
%>
URL to
dial:
[MyContext] 'In Asterisk 1.0.X, this context is executed AFTER the
calling party picks up the phone, which is what we want.
exten
=> s,1,Dial(ZAP/g0/${CALLEDPARTY},40,T)
hth
-----Original Message-----
From: Aloi, Christopher [mailto:[EMAIL PROTECTED]
Sent: Friday, February 17, 2006 11:16 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: RE: [Asterisk-Users] A unique 'click to call' project - Could usesome adviceThanks Colin!Makes sense; I will work on this later today.If you can, sending the example would be great.Thanks,-- -- --
Christopher T. Aloi
USA Datanet - Technical Support Engineer
318 South Clinton Street
Syracuse, NY 13202
C: (315) 569 4033
O: (315) 579 7074
E: [EMAIL PROTECTED]
-- -- --
From: Colin Anderson [mailto:[EMAIL PROTECTED]
Sent: Friday, February 17, 2006 12:36 PM
To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
Subject: RE: [Asterisk-Users] A unique 'click to call' project - Could usesome adviceSame as before but instead of SIP as the origination channel you pass ZAP/g0/XXXXXXXXXXX (the DID of the agent) to your .call file. In fact, this is exactly how the www.landmarkhomes.ca script works (it calls the guy who entered his phone number in the website, when he picks up, it calls the salesperson's cell number and the two are bridged together)The drawback is, of course, that it uses 2 ZAP channels to bridge the call together, but this isn't a problem I guess for you since you seem to have ZAP channels coming out of your yinyang.I have an implementation in Active Server Pages (we are a MS shop) that I can send you - it's suprisingly simple - but it could be easily modified for PHP or what have you.-----Original Message-----
From: Aloi, Christopher [mailto:[EMAIL PROTECTED]
Sent: Friday, February 17, 2006 9:56 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: RE: [Asterisk-Users] A unique 'click to call' project - Could usesome adviceColin,Thanks for your assistance.Reading over your advice I seem to still be a bit confused.My agents are not on the Asterisk server; it appears in your advice that my the call will travel this path:WWW interface --> agent enters their DID, platform to use, and termination DID --> AST calls agent --> Agent calls termination DIDIf my agents are not on the Asterisk server (believe me, I wish there were) :) how will this work?I need a way to pass both the desired termination DID and the origination DID.Maybe I missed something....Thanks,-- -- --
Christopher T. Aloi
USA Datanet - Technical Support Engineer
318 South Clinton Street
Syracuse, NY 13202
C: (315) 569 4033
O: (315) 579 7074
E: [EMAIL PROTECTED]
-- -- --
From: Colin Anderson [mailto:[EMAIL PROTECTED]
Sent: Friday, February 17, 2006 10:42 AM
To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
Subject: RE: [Asterisk-Users] A unique 'click to call' project - Could usesome adviceYou create a context in your dialplan that accepts the DID to call as a variable using the SetVar: syntax in your .call file. You then set up the context to call your agent, and when they pick up, the context takes the variable you set in your .call file as the dialstring argument for a subsequent Dial(). Once the DID picks up, the calls are bridged together. Whatever web scripting language you use writes the .call file, and you use POSTed arguments or querystrings:You can see this in action at www.landmarkhomes.ca - click on any of the pretty buttons that say "Call us now"However, I have noticed that * 1.2.x will not wait for the caller to pick up before executing the rest of the directives in the context - it keeps executing regardless of the calling party's pickup status. Using * 1.0.x the context will wait for the caller to pick up before placing the call to the callee (i.e. executing the rest of the directives in the context).call file (shortened to relevant)Channel: SIP/XXXX (if you are using SIP phones)SetVar: DID=XXXXXXXXXXXContext: MyContext[MyContext]exten => s,1,Dial(ZAP/g0/${DID})hth-----Original Message-----
From: Aloi, Christopher [mailto:[EMAIL PROTECTED]
Sent: Friday, February 17, 2006 8:07 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [Asterisk-Users] A unique 'click to call' project - Could use some adviceHello List,I work for an IP communication provider in upstate NY as the engineer assisting our technical support team.We provide a number of different Telco systems to residential subscribers; and in an effort to more effectively trouble shoot termination problems I came up with the idea of creating a click to call system that will allow our agents to effortlessly place test calls.On a daily basis we place numerous (50-100) 'test' calls to various locations in the US; these 'test' calls are routed using one of three different phone systems:1) The PSTN2) Broadband phone platform one3) Broadband phone platform twoI have an Asterisk server configured that can terminate out three platforms listed above.Our support agents are behind a Televantage ACD using D-TermSeries E NEC phones.Each agent has a DID and are permitted to receive inbound calls on that DID.Here is my goal:Create a web application that will allow the agent to enter the following information into a form:1) The agents DID2) The platform the agent wishes to terminate a test call through (either 1,2,3 above)3) The number the agent wishes to terminate toMy thought is this form will generate a .call file in /var/spool/asterisk/outgoing that will then ring the agents station, pause, and terminate to the selected DID using the selected platform. I also thought about interacting directly with the AGI.I can successfully generate the .call files, and ring a station on the Asterisk server - the problem is the agents are not on the Asterisk server.Is there a way to use Asterisk to initiate these test calls?Is it possible to create a forwarding context to handle this?Any thoughts?Thanks for the help!Cheers,-- -- --
Christopher T. Aloi
USA Datanet - Technical Support Engineer
318 South Clinton Street
Syracuse, NY 13202
C: (315) 569 4033
O: (315) 579 7074
E: [EMAIL PROTECTED]
-- -- --
_______________________________________________ --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
