Asterisk DTMF Read digits and dial.

Posted on 2009-04-20
Medium Priority
Last Modified: 2013-12-21
I need to create a listener for asterisk.  Basically, only during an active call, the agent can transfer to a predefined number by pressing * or # or any
DTMF tone.

Basically if during a call the agent presses * it will transfer them to a specific number i have predefined.

What i have so far is in the code box.

I would assume it would be something like :
exten => 10,1,Read(digit,,1)
exten => if digit is * then dial (SIP/context/number)

i just dont know the syntax.
exten => 100,1,Read(digit,,1)
exten => 100,2,Dial(${digit})

Open in new window

Question by:THEROMPSTER2000
  • 2
  • 2

Expert Comment

ID: 24194465
MAybe something like this :

exten => 10,1,Answer()
exten => 10,n,Read(DIALEDDIGIT||1)
exten => 10,n,GotoIf("${DIALEDDIGIT}" = "*"?dialmy,1)

exten => dialmy,1,Dial(SIP/context/number)
LVL 19

Accepted Solution

feptias earned 2000 total points
ID: 24212843
You want this to work "during an active call". Does that mean that Asterisk has already connected the two parties (caller and called) together? If so, then you must look at features.conf:

You have two choices:
1. Use blind transfer or attended transfer in the [featuremap] section along with pre-setting the variable __TRANSFER_CONTEXT so that you can define the steps you want it to execute in the dial plan when they press the transfer key
2. Use [applicationmap]

You must also look at the t option in the Dial command that initially establishes the original call.

As for the correct steps/commands to use in the TRANSFER_CONTEXT section, you will have to experiment to see what is right. Possibly the Dial command will do what is required. There is also a transfer command, but I have never used it:

You will be able to see what is happening in the dial plan script if you go to the Asterisk CLI and type "core set verbose 3". You can also add Noop lines to your dial plan to help you trace through the steps that it is executing and to inspect the values of variables. First, get Asterisk to respond to the key press during the call by setting a value in features.conf and adding option t to your original Dial command. Then set the TRANSFER_CONTEXT and check it is going into this context, finally work on finding the right steps to put within that context to give you the required result.

Author Comment

ID: 24216719
Ok this is what i have in features.conf

transferdigittimeout => 6

how can i do what you mean with the transfer_context, where would i do that?
LVL 19

Expert Comment

ID: 24216946
First, you would need to create a new context in the dial plan. Call it, say, [mytransfers]

Then you would set the transfer_context in a step just before the Dial command that sets up the original call. For example:
exten => 123,n,Set(__TRANSFER_CONTEXT=mytransfers)
exten => 123,n,Dial(...,t)

While the call is active, the execution of the steps in your dial plan is effectively paused, waiting for the Dial command to complete (i.e. it won't return from the Dial command and execute more steps if the call has been established successfully). However, if a caller presses ## or *2 your dial plan should resume execution in the context [mytransfers]. If you want the trigger to be a single key press then edit the blindxfer or atxfer parameters in features.conf.

Author Closing Comment

ID: 31572219
Thank you very much your answer guided me in the right direction.

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Zaptel people (www.zaptel.com) got kind of annoyed with the fact that they were getting bombarded with searches for the zaptel driver system for Asterisk (not to mention they own the trademark on zaptel). So, they kindly requested that Digium ch…
Article by: user_n
How Sip Phone (User Agent) works and communicates with sip servers 1.  There is a sip server and a sip registrar.  The sip server and sip registrar can be one server or two different servers. The sip registrar is the server on which it is record…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month17 days, 12 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question