Avatar of pzabel
pzabel

asked on 

Asterisk IVR scripting to capture key presses

I've been searching around but can't find a good example.  I'm currently writing an IVR script in the dialplan to capture key presses.  Can anyone provide a simple example of how I would capture key presses from the caller and store the digit string into a variable?

My current script is below...I am using the AGI function to call a C script that resides on my server which accepts a variable as an argument.  Ideally, I would like the digits that our captured from the caller to be stored in this variable called 'optcode', which I can then pass that variable to my script when I call it with AGI.  The script is pretty linear and simple right now, but I'm just trying to get the basics done first as I am pretty new to this.  Thanks!
exten =>	s,1,Answer()
exten =>	s,2,Wait(2)
exten =>	s,3,BackGround(greeting)
exten =>	s,4,Wait(2)
------------CAPTURE KEY PRESS CODE WOULD GO HERE, STORE TO VARIABLE NAMED 'optcode'
exten =>	s,5,AGI(/home/scripts/data.out|optcode)
exten =>	s,6,Wait(2)
exten =>	s,7,Hangup()

Open in new window

IP TelephonyVoice Over IP

Avatar of undefined
Last Comment
Ron Malmstead
ASKER CERTIFIED SOLUTION
Avatar of Ron Malmstead
Ron Malmstead
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Voice Over IP
Voice Over IP

Voice over IP (VoIP) is a methodology and group of technologies for the delivery of voice communications and multimedia sessions over Internet Protocol (IP) networks, such as the Internet. Other terms commonly associated with VoIP are IP telephony, Internet telephony, broadband telephony, and broadband phone service. The term specifically refers to the provisioning of communications services (voice, fax, SMS, voice-messaging) over the public Internet, rather than via the public switched telephone network (PSTN). Examples of the VoIP protocols are H.323, Media Gateway Control Protocol (MGCP), Session Initiation Protocol (SIP), H.248 (also known as Media Gateway Control (Megaco)), Real-time Transport Protocol (RTP), Real-time Transport Control Protocol (RTCP), Secure Real-time Transport Protocol (SRTP), Session Description Protocol (SDP), and Inter-Asterisk eXchange (IAX).

9K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo