Decoding dtmf signal in android. Easy device control by phone or DTMF decoder. In order for an android application to be called from another application, you can use explicit and implicit Intents. The explicit Intention states that

  • 10.02.2022

Send your good work in the knowledge base is simple. Use the form below

Students, graduate students, young scientists who use the knowledge base in their studies and work will be very grateful to you.

Posted on http://www.allbest.ru/

Introduction

The development of scientific and technological progress in the world contributed to the widespread rapid spread of cellular communications at the beginning of the 21st century, this is due to the need to be constantly in the field of access, in places where fixed telephone communication is impossible.

Thanks to the downward trend in prices on the market, almost every citizen of Russia has access to his own personal mobile phone.

Many telecom operators provide cellular services. Thanks to the development of Internet technologies, IP telephony has become popular, which has a number of advantages over conventional cellular telephony, for example, a conversation protected from eavesdropping or recording a conversation on a server, the use of short numbers, and communication without the involvement of providers.

There are several ways to communicate between the VoIP server and the mobile phone. One of the most obvious is the Internet connection, which usually has to be paid for by the mobile operator, which does not particularly benefit from making Internet connection for VoIP cheaper than their own telephony services. Therefore, prices for a tariff with stable Internet, which is necessary for calls via IP telephony, may be overstated.

There is a way to communicate with a VoIP server, which is commonly called callback, when the server is told which number to call, and the server calls the subscriber back, connecting with the number the subscriber is calling. This number can be transmitted via the Internet, SMS or tone dialing (DTMF).

It is not always possible to send SMS or use the Internet, especially if the subscriber is roaming. Often, the only communication method available is a "traditional" cellular call. There is a way through which you can communicate with the VoIP server via a cellular call; for this, DTMF Callback is used according to the following algorithm:

1. Subscriber "A" calls the telephony server number

Figure 1. Step 1

2. Telephony server disconnects

Figure 2. Step 2

3. The telephony server calls back subscriber "A" and waits for an answer

Figure 3 Step 3

4. Subscriber "A" answers the call

Figure 4. Step 4

5. In tone dialing, subscriber "A" dials the number of subscriber "B"

Figure 5. Step 5

6. The server initiates a call to subscriber "B"

Figure 6. Step 6

7. After initialization, the server connects the connection of subscriber "A" and subscriber "B". Subscriber "A" already hears dialing to subscriber "B".

Figure 7. Step 7

Subscriber "B" answers the call. Both users can exchange voice messages.

Figure 8. Step 8

As a result, subscriber "A" and subscriber "B" make an incoming call, and they can communicate with each other through the telephony server.

There is a Callthrough method, which, unlike Callback, does not require the server to call back to subscriber "A", but in connection with this, subscriber "A" pays for the outgoing call.

Basis for development

The main disadvantage of callback initialization using DTMF is that subscriber "A" needs to manually dial the number of subscriber "B" after the server called him back. In the call log on the phone of subscriber “A”, outgoing calls remain the number that he dialed, that is, the server number, and in incoming calls, the number of the callback that called him back. This information for the user is uninformative. The telephony server can be configured so that subscriber "A" is called back by a callback from different numbers. This means that the user will have a large number of unfamiliar numbers in the call log. This information is redundant and should be hidden from the subscriber. Often, callback services do without direct DTMF access, but use an Internet connection, SMS or a special SIM card.

Purpose of development

Develop a working prototype of an application that will facilitate the use of the DTMF callback telephony function on android devices.

Survey and analytical part

cellular

Cellular communication - wireless communication, the access zones of which are divided into hexagonal cells similar to honeycombs. One such access area is provided by the base station. The plurality of such base stations that make up cell areas is called a cellular network, and the devices that use the cellular network are called cellular phones. In a cellular network, each cell uses a different set of frequencies from neighboring cells to avoid interference and to ensure guaranteed throughput for each cell.

Cellular network features:

· Using multiple base stations provides more options than using one large transmitter. Each cell can be assigned multiple frequencies corresponding to the base station. A group of frequencies can be reused if adjacent cells use different frequencies.

Figure 9. Frequency reuse scheme (F1-F4 - frequencies)

· Mobile devices use less power to communicate with the tower, so how a less powerful signal is required to find her due to the closer location of the communication tower

· Larger coverage area than a single terrestrial transmitter, so additional cell towers can be added to areas with poor coverage, where the signal does not reach well due to interference.

When arranging cells, it is best to avoid overlapping cell zones; there should be no empty space between cells. Therefore, the geometric shape of the cover can be shapes such as triangles, squares or hexagons. The shape of the coverage from the antennas is most similar to a hexagon.

The devices that manage signals and route them from one cell phone to another are called automatic telephone exchanges (PBXs). At the moment, almost all PBXs are electronic.

Dialer (dialer) - part of the interface of the telephone set, which allows you to transfer the number of the telephone set with which the PBX should connect. For a long time, pulsed dialers were used, which formed pulses, where each digit corresponded to its own number of pulses. There was a disk with 10 holes on the telephone set. The principle of connecting to the PBX was as follows:

On the telephone, the disk scrolls from the point with the specified number, which winds up the spring. When the disk is released, the spring begins to unbend, the disk begins to move in the opposite direction. The impulse set corresponds to the closing and opening of the telephone line. Pauses are made between a set of pulses to distinguish a set of one character from another. This dialing method is quite inconvenient, the subscriber has to take the disk several times and wait until it returns to its place. Subsequently, an impulse push-button set appeared, which eliminated this drawback.

At the moment, a two-tone multi-frequency signal (Dual Tone Multi-Frequency, DTMF) is used to dial a number. DTMF can be used for internal telephone network commands. In DTMF, the transmitted digit is encoded by a signal obtained by summing two sinusoidal voltages of a certain frequency. Two groups of four frequencies of the audio range are used in each.

Table 1. Correspondence of frequencies and symbols for DTMF dialing

Direct Inward System Access (DISA) -- a direct access function, the ability for a subscriber to gain access to the management of a telephone exchange or a telephony server via DTMF signals from a telephone.

Overview of the cellular market

Revenues of companies providing cellular communications in Russia are growing, as evidenced by their reports. The same reports show that a large share of revenues comes from mobile communications. It is in the interests of both the ordinary private user and the corporate player to reduce the cost of mobile communications. One of the ways is to analyze the services used for the month and choose the most suitable tariff from the mobile operator.

The mobile communication market in Moscow consists of three players, the distribution of which can be seen on:

Diagram 1: distribution of major players in the cellular market

Comparison local rates in Moscow

Three major players in the Moscow market have similar package rates that can be compared. For example, tariffs of the “Smart” class for MTS, “All Inclusive” for Megafon and “All for” for Beeline. These tariffs offer a package of options and a subscription fee for them. Let's compare similarly priced tariffs from these classes. Service packages may include SMS, MMS, Internet and other services, but in this analysis they are not taken into account, since we are interested in the price of the call. For the same reason, there is no detailed description of the nuances of tariffs, if they do not directly affect the price, however, you can see that the quality of communication in different areas of the area can vary greatly among operators. There is also no need to calculate the cost of calls if the monthly tariff limit is exceeded, since the person who controls the costs will choose the right tariff for himself, however, it is worth noting that the price after exceeding the limit can be quite high. It is worth noting that incoming calls within Russia for all three package groups are free.

The minimum price is the package tariffs "Smart mini" - 200 ?, "All inclusive XS" - 199 ? and "All for 200" - 200 ?. There are some features for calls within the operator's network. In "Smart mini" and "All Inclusive XS" calls throughout Russia, and in "All for 200" only in Moscow and the Moscow Region. Prices are as of May 15, 2015.

Table 3. Minimum package rates

As can be seen from the table, the tariff options are very similar. Calls within the network are the cheapest. It is more expensive for subscribers of other operators to call, especially outside the Moscow region.

Although this rate is not intended for calls to other countries, a person may need to call outside their own country, so it is worth considering international rates for calls to other countries.

Table 4. Minimum package rates (calls abroad)

CIS, rubles per minute

24 Also for the Republic of Crimea and the city of Sevastopol

Europe, rubles per minute

Other countries, rubles per minute

USA, rubles per minute

Canada, rubles per minute

Australia and Oceania, rubles per minute

Asia, rubles per minute

CIS within the network, rubles per minute

North and Central America (without the USA and Canada), rubles per minute

As can be seen from the table, the rates for calls to other countries are already quite different. Beeline provides an opportunity to call Beeline numbers in other countries at a low cost. Megafon has more price differences for different countries, while MTS, on the contrary, has a single price for Europe and a single price for all other countries.

Table 5. Small package tariffs

As in the case of the minimum package rates, the conditions are very similar, but the price is already different.

The prices for calls to other countries for MTS packages for “Smart” packages do not differ, as for Megafon for “All Inclusive” packages, but for Beeline in “All For” packages, prices for abroad are slightly different:

· In the “All for 400” tariff: the conditions “All for 200” + the first 10 minutes a day cost 5 ?, if you call to the CIS countries, Crimea and Sevastopol.

· In the tariff "All for 600": conditions "All for 400" + the first 10 minutes per day cost 7 ?, if calling to Azerbaijan, Belarus and Moldova

· In the tariff "All for 900": conditions "All for 600" + the first 10 minutes per day cost 5 ?, if calling to Europe, USA and Moldova

· In the tariff "All for 1500": conditions "All for 900" + to the Maldives, Madagascar, Burundi, North Korea, Papua New Guinea, Seychelles, Somalia, Tokelau, Tunisia one minute costs 55 ?

Table 6. Average package rates

With equal local rates, the price of calls to other operators in Russia at Megafon is 3.3 times cheaper.

Table 7. Tariff packages are above average

With equal local tariffs, the price of calls to other operators in Russia at MTS is 3.3 times cheaper.

Table 8. Large tariff packages

These local tariffs have almost the same conditions.

Output

Package rates are very profitable if you use them for calls within the network. Competing operators prices are kept at about the same level. For an ordinary subscriber who speaks for 20-60 minutes a day, such tariffs are suitable. If a person needs to talk more than 120 minutes a day, then he will have to take more expensive tariff packages from 1500 to 2500, which is already quite expensive.

International roaming has its own conditions, which differ from each other. This roaming is expensive for all three operators, a thirty-minute conversation can exceed the cost of a service package. If the subscriber has to call to other countries, then you should choose a different tariff.

Tariffs for calls to other countries

Tariffs for calls to other countries were conditionally divided into three groups:

1. Tariffs for relatives and friends of tourists

2. Tariffs for migrants

3. Tariffs for businessmen

Tariffs for relatives and friends of tourists

For comparison, according to the tariffs for relatives and friends of tourists, five popular resort destinations were taken ::

1. Spain

Calls to such destinations are considered only for calls to a cell phone, since a tourist is unlikely to sit near a landline phone for the entire trip.

MTS has a tariff option "Favorable international calls". The subscription fee per month is 50?. Calls to these five destinations will cost 10 rubles per minute. The tariff option is compatible with other tariffs, such as "Smart".

Beeline has a tariff "Welcome". The cost of switching to this tariff is 150 ?, there is no monthly subscription fee for the tariff, but there is a daily fee of 4.45 ? for the options included in the tariff. The cost of calls to Turkey is 6 ? in a minute. Unfortunately, there is no information on other of the five tourist countries. On the pricing page:

http://moskva.beeline.ru/customers/products/mobile/tariffs/details/dobro-pozhalovat/

Figure 10. Screenshot of the area from the Beeline tariff page "Welcome"

The transition to which redirects to the address:

http://moskva.beeline.ru/customers/products/mobile/roaming/roaming-new/

In the page interface, contains three hyperlinks.

Figure 11. Interface of the "Roaming, long-distance and international communication" page

"Roaming when traveling around the world", "Roaming when traveling around Russia" and "Calls from home to other cities and countries". Obviously, prices for calls to other countries should be on the third hyperlink. The page at this link provides an interface for querying the Beeline server for information.

Figure 12. Screenshot from the page "Calls from home to other cities and countries" after the request "Cyprus" at the rate "Welcome"

If you check the price, for example, for Cyprus, then instead of the prices for Cyprus, the general conditions of the tariff will be indicated. There will be no separate conditions for Cyprus. In the paragraph "Calls to other countries" there is a hyperlink called "According to tariffs for international calls" with the address:

http://moskva.beeline.ru/customers/products/mobile/roaming/

For which this information is not available, as shown earlier.

It is difficult to conclude whether the information is intentionally hidden, or if it is an interface design error. At the moment, I have not received any sane explanations from Beeline representatives, so I consider it impossible to compare Beeline tariffs in the absence of official information.

Megafon for calls to other countries offers the option "Call to all countries" For the first 30 days, a fee of 60 ? is charged, then a daily fee of 2 ? in a day. Calls to Italy, Spain, Cyprus and Greece cost 6? per minute, and to Turkey 8? in a minute.

Tariffs for migrants

In the tariffs for migrants, prices for the CIS countries and neighboring countries are considered.

MTS in the "Favorable international calls" option provides calls to the CIS (except Azerbaijan and Belarus) at a price of 15 ? per minute and to Azerbaijan and Belarus at a price of 20? in a minute.

Beeline has special conditions for Tajikistan in the "Welcome" tariff. For calls to Beeline numbers 1 minute - 7 ?, subsequent minutes 1 ?. For calls to Beeline numbers of Armenia, Kazakhstan, Kyrgyzstan and Kyivstar numbers of Ukraine - 2.5? in a minute. For calls to other numbers in Tajikistan, Armenia, Ukraine, Kazakhstan, Kyrgyzstan, as well as any numbers in Turkmenistan - 7 ? in a minute. A call to Azerbaijan and Belarus costs 13? in a minute. To numbers of Uzbekistan Beeline - 3? per minute, the remaining 4? in a minute.

In the "Call all countries" option, calls from Megafon to Azerbaijan and Belarus cost 15 ? per minute, to Ukraine - 10? per minute, Armenia, Kazakhstan and Kyrgyzstan - 8 ? per minute, in Tajikistan and Turkmenistan - 6 ? per minute, to Uzbekistan - 5 ? in a minute. Megafon also has a special option "Tajikistan +" for Tajikistan. The first minute of the conversation costs 7?, until the 20th minute the minute costs 1?, and from the 21st minute it costs 7?.

Tariffs for businessmen

A businessman may have a need to communicate with any of the countries. The purpose of this review is to compare the price level for different tariffs, and not to create a complete price comparison for all countries, so 5 countries were chosen where a businessman could call.

3. Germany

5. UK

MTS in the "Favorable international calls" option provides calls to China for 1.5 ? per minute, US 5 ? per minute, Germany and Great Britain 10 ? per minute, to Japan at 25 ? in a minute.

Beeline's "Welcome" tariff offers calls to China for 2 ? in a minute.

Megafon in the "Call all countries" option provides calls to China for 1? per minute, US 4? per minute, Germany at 6? per minute, Great Britain at 11 ? per minute, to Japan at 9? in a minute.

Output

For the considered tourist destinations, the most profitable option is from Megafon "Call all countries". Data on Beeline is not enough.

In the areas considered for migrants, the prices of Beeline and Megafon compete, MTS is the most expensive.

In the areas considered for businessmen, the prices of MTS and Megafon compete, there is not enough data on Beeline.

Roaming

Many operators provide roaming services when it is possible to go with the SIM card of their operator to the network of another operator. There is long-distance and international roaming. Long-distance roaming may be needed if the subscriber is traveling by train. Such a subscriber can quickly change position on the map, so he cannot purchase a local SIM card from a local operator for each point through which he travels.

International roaming is usually more expensive than long distance roaming.

For international roaming, MTS offers the Zero Without Borders service. The subscription fee for this service is 60 ? in a day. For some destinations, incoming calls may be free for the first 10 minutes, but after the limit of 200 minutes per month is used up, each incoming minute will cost 25? in a minute.

For Greece, Germany and Turkey, it will be more profitable to use the Free Travel service. The subscription fee is 100? in a day. The service offers 60 minutes per day for incoming and outgoing calls to Russian numbers.

Table 9. Price for "Zero Without Borders" by tourist destinations

Most likely, it will not be difficult for migrants to acquire local tariffs, so this direction will not be considered separately for the CIS countries.

It is important for businessmen to always be in touch, on the same number, so they are unlikely to agree to change the SIM card to a local one.

Figure 13. Price for Zero Without Borders by business line

Germany

Great Britain

Incoming calls (first 10 minutes), rubles per minute

Incoming calls (from 11 minutes), rubles per minute

Outgoing calls to Russian numbers (1 minute and starting from 6 minutes), rubles per minute

Outgoing calls to Russian numbers (from 2 to 5 minutes), rubles per minute

Outgoing calls to host country numbers, rubles per minute

Outgoing calls to numbers of other countries, rubles per minute

For international roaming, Beeline provides the My Planet service. The cost of connecting the service is 25 ?. For all tourist destinations, incoming calls cost 15 ? per minute, outgoing to any country and within the host country 25 ? in a minute. The same prices for the near abroad and the previously mentioned areas for business, with the exception of Japan, for which incoming 19 ? per minute, and outgoing 49 per minute.

For international roaming, Megafon provides two options: "All the World" and "Around the World". "The whole world" offers 30 minutes a day of free incoming calls at a monthly fee of 39 ? in knocks. "Around the World" connects for 15 ? and has a daily subscription fee of 9?. Incoming and outgoing calls within Europe and the CIS, Turkey, Abkhazia and South Ossetia cost 6 ? per minute, for Japan 9 ? per minute, for the USA and China 36 ? in a minute. For calls to Russia, Megafon uses Callback.

Output

International roaming, unlike other tariffs, may have a paid incoming call, prices can reach 200 ? in a minute.

Market Review VoIP communications

In addition to cellular operators, there are operators that provide Voice over IP (VoIP) telephony services. The main difference of this connection is the use of the Internet to connect subscribers. Some companies offer various VoIP services, often the connection of two or more subscribers of one VoIP company via the Internet is free. Such services are provided by Skype, Hangouts, Viber products.

VoIP can communicate not only over the Internet, but also over the cellular network. For this, GSM-VoIP gateways are used. For the VoIP server, you can configure Least Cost Routing - automatic selection of the route for the call depending on the number. The server itself chooses the most favorable tariff for accessing the network, and therefore, the cost of communication falls.

VoIP prices may depend on the exchange rate or be indicated in another currency, for comparison, all prices will be converted into rubles at the exchange rate as of May 26, 2015 indicated on the website of the Central Bank of the Russian Federation. The exchange rate for this date:

Table 10. Exchange rate as of May 26, 2015

Skype offers the following rates for calls to Cypriot cell phone numbers:

Table 12. Skype prices for calls to Cyprus

Skype offers the following rates for calls to Turkish cell phone numbers:

Table 13. Skype prices for calls to Turkey

Skype offers the following rates for calls to US cell phones and landlines:

Table 14. Skype prices for calls to the USA

Skype offers the following rates for calls to cell phone numbers in Japan:

Table 15. Skype prices for calls to Japan

Skype offers the following rates for calls to cell phones and landlines in China:

Table 16. Skype prices for calls to China

According to the considered tariffs for Skype, we can conclude that they can be more profitable than similar tariffs for the three leaders in cellular communications.

Viber

Viber Out offers the following rates:

Table 17. Viber Out Pricing

A VoIP server can be installed on a regular computer, so VoIP solutions are often used within companies to communicate with customers or for intranet communication. This connection can be controlled by the system administrator. He can set up the security of communication and record conversations. The server can be configured with DISA so that calling clients can enter commands in DTMF mode that the virtual PBX will accept. You can also configure a gateway for such a server, which will allow you to call and receive a cellular signal.

Output

Using VoIP can cut communication costs, especially where there is free and stable internet. With VoIP, you don't have to worry about roaming. Tariffs for VoIP are not as complicated as those of cellular operators.

Telephony callback overview

In practice, Internet communication has a limited coverage area, and the Internet service itself costs money. At the same time, VoIP prices remain attractive.

If there is a connection over the Internet, but it is unstable, then the Callback service comes to the rescue. The number where the subscriber wants to call is sent to the VoIP server, and the server already calls the subscriber back via a cellular channel, after that it starts dialing to another subscriber and connects these two subscribers. If it is not possible to use the Internet, you can send an SMS to the number of the VoIP server with the number of the subscriber "B" who is called by the subscriber "A". There are also SIM-cards that have the necessary parameters for Callback telephony. These operators save money by using VoIP, so their rates are cheaper.

Such services are provided by MTS. The code *137* is added to the subscriber's number, and # at the end. After sending the request, there is an incoming call, if you answer it, the connection with the subscriber sent in the request will begin. The cost of a call back depends on the country of residence of the subscriber.

Megafon also provides such services: a callback can occur during normal dialing if the service "Around the World" is activated.

There is another way to transfer the number of subscriber "B" from subscriber "A" to the server - using a DTMF signal. This method is good because any modern phone can generate DTMF signals, and incoming calls are free for many operators.

Since any phone with the Android operating system can generate DTMF signals, this method is the most versatile, it requires a minimum connection of additional services and does not require a SIM card. It is this method that owners of their own VoIP servers can use to connect subscribers.

Analysis of programs whose functionality can be used to facilitate the use of the Callback function

direct implementation applications for DTMF Callback without reference to the operator are difficult to find.

There are implementations of functions that can be useful when using DTMF Callback.

One of these implementations is most often called a prefixer. These programs catch an incoming or outgoing call and add the so-called prefix or suffix to it, that is, they complete the phone number before or after the number, this kind of number is obtained: prefix xxxxxxxxx suffix , where x is any symbol of the number.

The task of these programs in the Callback implementation will be to add a DTMF signal after a certain event.

Prefixer

The closest to solving this problem is Prefixer from 253°Below. This program contains rules in which you can configure:

c. Program work schedule

d. The number that will be recorded in the call log

e. Numbers on which the rule will work

As follows from the program interface, rules can be configured for both incoming and outgoing calls. That is, the program should add a number when an incoming call arrives. In theory, if you send in the suffix “,” for a pause or “;” to wait for a dial tone, you can send a DISA number.

Figure 14. Screenshot of prefixer " but

For outgoing calls, the program really adds prefix and suffix, but for incoming calls, contrary to the configured rules, it does not add anything. That is, in practice it cannot be used for DTMF Callback communication, but it can be used to implement Callback from MTS.

There is a way to type a certain character or group of characters on the keyboard. Most often, programs with such functionality are used to expand the functions of the keyboard or the Android control interface. So that the subscriber does not enter the entire number from memory when the Callback server called him back, he can use emulation of pressing the number. In this case, the phone will send DTMF signals, as if the user entered them himself. There are quite a lot of programs with this functionality.

gamekeyboard

To test this possibility, the Gamekeyboard from Locnet was used. Root rights are required to use the program. This program contains macros in which you can write down what characters will be entered with what interval. You can customize the size and position on the screen of the virtual button that will activate the macro. It is quite difficult to create a macro for this program from the phone, so its scope is limited to a small number of favorite numbers. This program supports profiles, so it is theoretically possible to develop an application that will create a macro for the dialed number and associate with a button. This solution will allow the subscriber not to store the subscriber's number in memory and not to dial the entire number. However, additional actions from the user are still required.

Root rights - rights to access all functions of UNIX systems. Since Android is a UNIX-like operating system, root rights are also provided in it, however, phone manufacturers often restrict access to them. The manufacturer can programmatically complicate obtaining root rights, make a ban on flashing. The manufacturer may provide a tool for obtaining root rights, but with a disclaimer of guarantees by the user who received root rights. Despite this, it happens that the only way to implement some functionality is to have root access.

Output

Most solutions for DTMF Callback are tied to the use of a specific operator. While there are software tools that make it easy to use DTMF Callback, there is no comprehensive solution that specifically addresses this issue. It is beneficial for owners of their own servers to provide VoIP communication to use the DTMF method.

Technological part

Analysis of development tools for Android

The main language for writing custom applications for Android is Java. The programming interface (API) for working with Android functions involves the use of Java. To build applications written in Java for Android, use the Build Tools from the Android Software Sevelopment Kit (SDK). There is a way to write applications in C/C++ to make applications run faster. For this, the Native Development Kit is used. There is a C# development solution called Xamarin that allows you to create cross-platform applications. For Python development on Android, you can use one of several solutions listed in the table:

Table 18. Comparison of python implementations for Android

Python for Android

Android scripting

Python on a chip

The kivy framework allows you to create cross-platform applications. It can be linked with python for Android. Then it becomes possible to write cross-platform applications that will run on Android. There is also a wrapper for calling Java classes from the Android API called PyJNIus .

Solutions such as kivy or Xamarin have advantages if the application is developed not only for Android, but also for other platforms. However, when using Android-specific features, you must use the Android API. This does not give advantages for the task, since Android has its own specifics with the operation of telephone functions.

Facilities for Android development - SDK Tools

The main Android development toolkit is included in the SDK Tools package. This package includes tools for working with virtual devices. Android Virtual Device Manager (AVD) are designed to run and configure emulators. In order to create an emulator, a system image is used. Such images can be downloaded in the graphical or console interface of the Android SDK Manager program. In the Android SDK Manager interface, for one version of Android, you can select multiple images that will emulate different devices.

Figure 15. Screenshot of the Android SDK Manager GUI

One important tool is the Android Debug Bridge (adb), a program designed for debugging Android devices. Adb is run from the command line and controlled through the console interface. Adb works with different devices connected to the computer:

Devices connected via USB

Wi-Fi connected devices

Emulated Devices

adb allows:

install or remove applications from the device

work with the device's command shell

work with packet manager

launch Intent

work with LogCat

The SDK includes a large set of tools that are somehow integrated into development environments, for example, Build Tools are included in Eclipse or Android Studio.

Integrated Development Environment android studio

At the moment, the official integrated development environment (IDE) for Android is Android Studio. This IDE is based on IntelliJ IDEA by JetBrains and includes a number of features:

· Gradle scripts to build apk

Build variants and generate many apk

Code Templates

Layer editor (layouts)

Application signing

Built-in support for Google Cloud Platform and the ability to integrate Google Cloud Messaging and App Engine

Android Studio allows you to install built applications in parallel on several devices connected via adb.

Android Studio supports version control systems.

The source code editor in Android Studio has a number of features that make development easier:

word completion

Help for bugs in the code

Syntax highlighting for java and xml files

automatic import from the Android library if a class from it is used

greying out variables that have not been used

commenting lines of code

jumping through different files of the project in search of the selected word

Android Studio is a powerful tool that is recommended for Android development, so the decision was made to use it in development.

telephony callback android programming

Overview of the Python programming language

Python is a high-level language that combines several programming paradigms such as:

· Object oriented programming. Everything in python is an object: strings, classes, numbers, etc. If, for example, we take the number "1" and add the number "2" to it:

then the __add__ method will actually be called on object 1, which will receive an Integer type, so the following entry will give the same result:

· Dynamic typing. The type is set automatically during program execution. The advantage of this type of typing is the ease of writing programs and the rapid development of this method by the programmer. In python, you can specify the type yourself. Using the "type" function, you can find out the type of an object. With the help of the "int" and "float" functions, you can change the type. So you can represent the number 1 as a string with the value 1 or as a floating point number. Example:

>>> b = str(1)

>>> c = float(1)

If you check the type of variables, then "a" will have "int", "b" will have "str", and "c" will have "float"

>>> printtype(a)

>>>printtype(b)

>>>printtype(c)

Strong typing. Python is commonly referred to as a strongly typed object language.

· Functional programming. In python, you can use recursions, lazy evaluation and higher order functions

· Imperative programming. Python supports the procedural programming method, in python you can use modules.

Python is considered to be a fairly simple language and is the most popular college language in the US.

Python code is executed line by line, so often an error in the code can be noticed only after executing this line. Programs created with python for android take a long time to start.

To run such an application, the technical means must be a communication device with the following characteristics:

· The device must have 10 MB of free memory in the internal memory to install the application and store its data.

The device must have the following software:

a. Android 2.2 and above

b. OpenGL ES 2.0

The requirements for internal memory are due to the fact that the installed application will contain python for android and kivy. Python for android requires OpenGL ES 2.0, which is available in Android since version 2.2.

Programming language overview Java

Java is an object-oriented programming language. With the help of a compiler, the Java source code is converted into a byte code that contains a set of instructions for a Java machine. This approach provides platform independence. In the case of Android Java development, Dalvik is the machine. Using such a machine can greatly reduce productivity.

The concept of Java in terms of object orientation is similar to python: “Java has a special superclass Object and all classes are its subclasses. Therefore, a reference variable of class Object can refer to an object of any other class.

Java has a flexible access control system, which is set by class modifiers private, public, protected, or the absence of a modifier:

Table 19. Modifiers and Access in Java

Development of an interface for simplified use of the telephony function callback

The simplest interface for the user is the standard interface of his system. The call algorithm when using the Callback function should not differ from the usual call initialization algorithm.

The interface of such a program should help implement the following functions:

1. Call back

o Launching the application when initiating a call from the contact book (Contacts)

o Initiating a call to the telephony server

o Receiving a call from a telephony server

o Determining that a link has been established

o Analysis of DTMF signals from the server

o DTMF signal transmission during a call

2. Working with history

o Ability to delete information from the call history system log

o Ability to add information to the system call history log

3. Settings

o Enable/disable profile

o Ability to choose a profile

o Ability to customize profile

o Ability to add a profile

o Ability to delete a profile

4. Profiles

o Ability to change server number

o Ability to set a white list of server numbers

o Ability to specify the time to wait for a callback from the server

o Ability to specify the interval between the sent DTMF signal

The application algorithm with such functions is as follows:

The user opens the app for the first time and creates a profile. In the profile, the user specifies the telephony server number. The user enters into the white list those numbers from which the telephony server will call him back. The user specifies the waiting time in the settings. If there is no call back from the server, the user will be able to continue using telephony without turning off the applications manually.

After setting up the application, the user can call the subscriber from the contact book. At this time, the application selection menu will appear, with which you can make calls. If the user selects DTMF Callback, then the contact number will be stored by the application, and the application itself will initiate a call to the server. When the server disconnects and calls back, the application will answer the call and dial the saved number in tone dialing, after which the user will need to wait for the connection with the called subscriber.

After the end of the conversation, the call log should contain the number of the subscriber whom the user called. The calculation of the conversation time should start from the moment of dialing.

Development of a prototype that demonstrates the possibilities for simplifying the use of the Callback function

Based on their real capabilities and zero experience in developing under Android, the minimum requirements for a prototype have been developed:

1. The prototype must run on all modern Android devices from Android 2.1 to Android 5.1

2. The prototype should make it easier to dial the subscriber's number when the telephony server calls back

3. When calling the subscriber's number through the prototype, the call must be initiated to the telephony server number and at the same time remember the number the subscriber called

Initializing a call to a specified number

The first stage of development was writing an application that can make a call to the number specified in the application code. This method, when the values ​​of variables are hard-coded in the code, and not taken from external sources, is called hard coding. This method is used specifically to quickly test the application so that you do not have to dial the number every time.

It was decided to write in the python programming language, since I have experience writing in this language. To implement it, it was necessary to connect the Java class android.intent.action.CALL from the Android API. The purpose of this application is to test whether the application can call any subscriber. This function is needed so that after a call by the subscriber "A" to the number of the subscriber "B", a call to the number of the telephony server starts. After the implementation of this function, it became clear that, despite my experience, writing applications for python pops up a lot of non-obvious problems, and as a result, the finished application takes too long to load, which is quite critical for telephony. It also became obvious that it would be very difficult to understand the API without knowledge of the Java programming language. Since an understanding of the Java programming language was still required, and the final result in Java gave advantages, it was decided to rewrite the function for Java using Android Studio. Here is the code of the final function under Java:

public void Call(View view) (

mNumberTextView.setText("Call to " + tel.getText() + " Initialized");

String toDial = "tel:" + tel.getText().toString();

startActivity(new Intent(Intent.ACTION_CALL, Uri.parse(toDial)));

Receiving a number from the contact book

In order for an android application to be called from another application, you can use explicit and implicit Intents. An explicit Intent specifies which class it should call:

intent intent_about = new Intent(MainActivity.this, AboutActivity.class);

startActivity(intent_about);

The AboutActivity.class activity is written in Android.Manifest.xml, so the system knows which activity to launch.

In the implicit Intent, instead of the class to be launched, the action to which the system should react is indicated. In the standard contact book (Contacts) in android, when called from it, the action ACTION_CALL_PRIVELEGED occurs. The "tel:" number is passed to this action. For example, we can use adb to call this action by writing:

adb -e shell am start -a android.intent.action.CALL_PRIVILEGED -d tel:911

Where 100 is the number where the phone will ring. If you write the command

adb shell am start -a android.intent.action.CALL -d tel:911

In this case, there will be no call, since there will be no privileges to call such a number. Depending on the need, different applications can use different actions. If no emergency calls are expected, then ACTION_CALL will be used. This is more common for calls from a browser or application with a contact number.

On some firmware, an alternative application can be used as a contact book. The source code of this application itself may be closed. If in such applications the call is initiated somehow differently, then guessing through which Intent the call is initiated can be difficult. In this case, you can install an alternative contact book from Google Play or other trusted sources.

In order for the program to intercept the implicit Intent, you need to add intent-filter to AndroidManifest.xml:

Since you need to take only the number from the contact book, “tel” is indicated in the scheme.

The Android operating system will now prompt you to call the app each time an ACTION_CALL or ACTION_CALL_PRIVILEGED Intent is called.

In order for the application to use the number that was in “tel”, we need to use the getData () method in the class we need:

floating window with button

There is a library called StandOut with which you can create a floating window. The library is open source and has examples. This library is distributed under the free MIT license. This license allows you to freely redistribute the software that contains this library. The library is supplied as is, the authors are not responsible for the harm it may cause.

Features of this library:

· Providing your own VIEW. Easy integration.

Floating window decorators:

1. floating window title

2. button that minimizes the floating window

3. button that closes the floating window

4. button to resize the window

Minimized window can be restored

Creation of windows of different types

Windows can be moved

When testing examples from this library, it was found that floating windows can be on top of all windows, including during a call. This feature can be used to create a button that will dial the desired number in the dialer during a call.

In order to create a window, you need to write a class that will be an extension of the StandOutWindow class:

public class FloatingButton extends StandOutWindow(

public void createAndAttachView(int id, FrameLayout frame) (

LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);

View view = inflater.inflate(R.layout.floating_button, frame, true);

And in res/layouts there is a layer with a description of the interface of this window floating_button.xml.

Floating window button

Similar Documents

    Architecture and history of the Android operating system. Java programming language. Choosing a tool for implementing an Android application. Software implementation of the Android application. Conducting testing of the developed software.

    term paper, added 01/18/2017

    Overview of Android mobile OS. Choice of tools and technologies. Designing a GUI prototype. Characteristics and description of the user interface. Database design and development. Define the list of required permissions.

    term paper, added 09/13/2017

    An overview of existing popular weather viewers for Android OS. Operating systems of modern smartphones. Key features of Android, Java technology. Development of the software part, choice of language, description of the algorithm, its logical structure.

    term paper, added 04/16/2014

    Implementation of telephony over an IP network using a set of protocols and equipment. Development of a dynamic call routing subsystem for a billing and management system in an IP telephony network. Basic requirements for a graphical user interface.

    thesis, added 11/08/2015

    Development of applications for smartphones on the Android OS for the network of pharmacies "Pharmacy". Android operating system architecture. Application architecture and implementation. Its functionality. Description of the mobile application. Calculation of the cost of creating a product.

    thesis, added 06/17/2017

    Characteristics of the Android operating system used for mobile phones. Creating an Android project in the Eclipse development environment. The general structure and functions of the manifest file. Android application components. Markup methods.

    term paper, added 11/15/2012

    General scheme of the Android application. Development of a learning application for the Android operating system, the purpose of which is the development of speech through the pronunciation of tongue twisters. Description of the components of the developed application, its testing.

    thesis, added 02/04/2016

    Basic concepts of IP telephony and types of structure of IP telephony networks. Cisco Systems voice gateways for IP-telephony. IP IVR as a means of automatic call answering. The advantages of building a distributed Contact Center, the architecture of its construction.

    thesis, added 04/21/2016

    General characteristics of the Android operating system. Development of an application based on the creation of a file manager. Using the application to access files stored in "cloud storage" on the Internet. Software cost calculation.

    thesis, added 04/03/2015

    Development of software for the Android platform version 2.3: information application for fans of the football team, with the ability to view events, statistics and other information about the team and its success. Listing JsonDataManager.java.

Hello.
Do you want to control something on a cell phone, and even without any abstruse microcontrollers? If yes, welcome under cat.

Recently, there have been several reviews of GSM modules on Muska, such as SIM800, using which you can control anything over a cellular network. But the trouble is, they all require connecting to a microcontroller, writing firmware and other things that are difficult for an uninitiated person. The other extreme is: “and I soldered the relay to the vibration motor of the phone, everything works for me” :)) This is also possible, but do not be surprised if your greenhouse will try to water the pump with water from a frozen well, after the SMS message “With the New Year!" from unknown sender
In general, I decided to fill the gap between these two solutions, and offer my own.

Today we will talk about a DTMF signal decoder, or, in a simple way, a tone signal.
The curious can read
The technology is quite outdated, but is still supported by all phones.
Actually, it is tone dialing that you use when you call some institution, and the answering machine tells you: “if you know the subscriber's number, press“ 1 ”, if you want to know about our new offers, press“ 2 "and so on. By pressing the button with the desired number on the phone, you send a signal of a certain tone over the voice channel. Each character on the phone keypad has its own “melody”. It is this sound that the DTMF decoder decodes, turning it into signals at its outputs.


The board is assembled on a microcircuit, powered by 5 volts and has the following outputs: Q1-Q4-discrete outputs, StQ/StQ inverted-outputs that are triggered every time the signal is recognized correctly. Audio IN if you don't want to use the soldered 3.5mm jack. GND/VCC supply, 5 volts.
Outputs Q1-Q4 operate according to the table:

For example, now I have two middle LEDs on the board, the outputs Q2 and Q3 have worked, we look at the table - this corresponds to the “6” key pressed. If I press the "1" key, then the output Q1 will work, if "2", then Q2. If "3", then the outputs Q1 and Q2 will "light up" at the same time. Etc.
In general, this is a 4-bit code. If you decrypt it with a special microcircuit, you can get 16 outputs.
By the way, Ali sells a board already with a decoder, but it costs more. An option for the advanced is to connect all this to the microcontroller, I did this, you can even set a password - I called, dialed the password, got access to control ...
But this is no longer within the scope of my article, because. At the beginning of the article, I promised that everything would be simple.

And so, we take the KT815 transistor, a 1.1 kΩ resistor, or so, a 12 V relay, and an LM7805 stabilizer. The remaining parts (protective diode 1N4007 on the relay coil, yellow ceramic capacitors 0.1 microfarads and electrolytic capacitors 1000 microfarads) are desirable, but it works without them. A tweeter is connected to the relay as a load.
I won’t draw a diagram, the installation is hinged, everything can be seen in the photo:


On the other hand:


The total power supply of the structure is 12 V, because this is required by the relay, but for the board it is reduced by the stabilizer to 5 V.
We connect the 3.5 mm jack on the board with a cord to the headphone output of the phone, set up auto-pickup of the handset and you're done. Now, if you call the phone connected to the board, wait until the handset is off, press "1", the relay will work, the buzzer will start beeping. If you press "2", everything will turn off. By the way, no matter what you plan to control, I would recommend leaving the buzzer. This is convenient, because you can hear it on the phone, and in this way you can get some kind of feedback: you called, you hear a beep, which means the load is on :)

Made a short video showing how it all works.

I plan to buy +128 Add to favourites Liked the review +72 +169

Radio controlled models use RF circuits that have limited operating range, limited frequency range, and problems matching with controllers. Using a mobile phone to control the model avoids these drawbacks. When using a mobile phone, the model can be controlled throughout the operator's coverage area and work with external devices without problems.

While the appearance and capabilities of a model can vary greatly, all models have a mechanical part and a part that drives the model. Model management includes three stages: command reception, processing and execution. As a rule, commands are given by external sensors, the microcontroller is engaged in processing, and motors are used for execution.

Overview

In this machine, two mobile phones are used for control - one is in your hands as a remote control, the other is installed on the model as a receiver. A call is received from your phone to the phone of the model, and when you press the keys during the call, a multi-frequency signal is received from the mobile phone. This signal is called Dual-Tone Multi-Frequency (DTMF).
Using the MT8870 DTMF decoder, DTMF is decoded into binary code, which is processed by the ATmega16 microcontroller, and then commands the motor driver.

As you can see, this model is quite simple and does not require the construction of complex transmitters.
DTMF signal is used for dialing a phone number or voice auto answer.
The signal consists of two sinusoidal signals of a fixed frequency, and is easily decoded to binary code and vice versa. To encode a character into a DTMF signal, two sinusoidal signals must be added together. For example, if you need to transmit the number 5, then the frequency of one signal will be 1336 Hz, and the other 770 Hz, and we will receive this signal on the second phone.

Circuit Description

The block diagram shows how the device works. Its main components are DTMF decoder, microcontroller and motor driver.

The MT8870 chip is used as a DTMF decoder. It uses digital signal recognition methods and outputs a signal to 4 pins. It also does not require pre-filtering of the input signal. When an input signal is applied to PIN2 (B-), the decoded signal is output at pins Q1(pin11) to (pin14).

The ATmega16 is an 8-bit CMOS microcontroller based on the advanced AVR RISC architecture with low power consumption. It has 16KB programmable flash, 512B EEPROM, 1KB SRAM, 32 I/O lines, and 32 registers. From the microcontroller pins PD0 - PD3 and PD7, a signal is sent to the outputs IN1 - IN4 and EN1-EN2 of the L293d motor driver. Switch S1 is used for manual reset.

Program

The microcontroller is programmed using WIN AVR. If you don't know how to do this, take a look, everything is described in detail there. The source and hex file are attached to the article. If WinAVR is installed, then there should be no problems with opening.

Work

In order to control the model, you must call the model's mobile phone from any phone. When the machine has automatically answered, press the following keys:
2 - move forward.
4 - turn left.
8 - movement in the opposite direction.
6 - turn right.
5 - stop.

Item List:
DTMF decoder MT8870 - 1.
Microcontroller Atmega16 - 1.
L293d engine driver - 1.
OU Cd7004 - 1.
Diode 1N4007 - 1.
Resistor 100 kOhm - 2.
Resistor 10 kOhm - 5.
Resistor 330 kOhm - 1.
Capacitor 0.47uF - 1.
Capacitor 0.1uF - 1.
Capacitor 22pF - 4.
Quartz 3.57 MHz - 1.
Quartz 12 MHz - 1.
Momentary button - 1.
Motors (6V, 50 rpm) - 2 or 4 for all-wheel drive.
Battery 6V - 1.
Wheels - 4.
Mobile phone - 2.
Speakerphone (hands - free) - 1.

You must secure the phone to the chassis. The phone is connected to the robot via a hands-free headset.

hands-free connection
I used hands-free with a mini jack connector.

You can download the source code of the program and firmware below

List of radio elements

Designation Type Denomination Quantity NoteShopMy notepad
IC1 DTMF decoderMT88701 To notepad
IC2 MK AVR 8-bit

ATmega16

1 To notepad
IC3 Electric motor driverL293D1 To notepad
IC4 buffer ICs, drivers

SN74LS04

1 To notepad
D1 rectifier diode

1N4007

1 To notepad
C1 Capacitor0.47uF1 To notepad
C2, C3, C5, C6 Capacitor22 pF4 To notepad
C4 Capacitor0.1uF1 To notepad
R1, R2 Resistor

100 kOhm

2 To notepad
R3 Resistor

330 kOhm

1 To notepad
R4-R8 Resistor

10 kOhm

5 To notepad
XTAL1 Quartz resonator3.57 MHz1 To notepad
XTAL2 Quartz resonator12 MHz1

DTMF (Dual-Tone MultiFrequency) is the tone generated when the phone buttons are pressed.
DTMF is widely used in the operation of answering machines (IVR), for various interactive systems. As applied to VoIP, when working with various codecs, DTMF requires quite close attention, so its operation must be clearly understood.

By default, the Gateway sends DTMF in the RTP stream ( in-band), this works fine when using the codec high bit rate G.711, i.e. if the voice stream is not compressed.
The main problem with DTMF occurs when using compression algorithms such as the G.729 codec. The fact is that when compressed, the quality of the head stream noticeably deteriorates, and although this almost does not affect the ability of subscribers to understand each other, the DTMF tone is no longer clear enough and is perceived incorrectly.

This problem is solved with DTMF Relay, in which DTMF signals are transported separately from the RTP stream, or out-of-band.

Let's look at a few examples.


The figure shows the connection diagram of telephony through the H.323 gateway.

On the PSTN section, DTMF is sent in-band, i.e. there is not even the concept of DTMF Relay, since it is an analog line.

DTMF relay becomes necessary only in the VoIP section, where it is possible to use compression methods.
You can also say that:
- in-band DTMF relay will go inside the RTP stream, i.e. in the figure along the red RTP line.
- out-of-band DTMF relay will go along with signaling, i.e. along the green lines in the figure.

On the plots phone-CUCM And CUCM-H.323Gateway different signaling is used, which means different DTMF relay methods. SCCP messages containing DTMF in their encoding come from the phone side, signaling along with DTMF comes from H.245 messages from the H.323 gateway side.
CUCM in our case acts as a DTMF Forwarder between different types of signaling.

Location on phone-CUCM we will only be able to out-of-band because the SCCP phone does not support in-band.
Location on CUCM-H.323Gateway Possible methods are in-band, and out-of-band. In this case, in the case of an SCCP phone, to enable in-band will need to use MTP.

You also need to understand that the DTMF settings for H.323 Trunk are the settings for this trunk to work with Dial-peer on a physical H.323 Gateway.

Depending on the signaling protocol (H.323, SIP, MGCP, SCCP), there are different methods for implementing DTMF Relay. In any case, Call Manager CUCM initially tries to uncopy a method that is common to all. If no general method was found, an attempt is made to use MTP.

H.323 DTMF Support

Cisco Gateways supports the following DTMF Relay methods:

  • Cisco proprietary: - in-band DTMF relay. DTMF is sent in the same RTP stream as the voice, but the DTMF tones are encoded slightly differently, allowing them to be successfully distinguished and received on the other side. DTMF samples are identified as RTP payload type 121. The method only works if there is Cisco equipment on both sides, and the same method
  • H.245 Alphanumeric:-Out-of-band DTMF relay. Separates DTMF from the RTP stream and sends them through H.245 User Input Indication messages. This method does not send tone length: it is always assumed that the length of the tone is 500msec.
    In this example, we clicked on "5".

    Debug: debug h245 asn1

  • H.245 Signal:-Out-of-band DTMF relay. This method is capable of sending a tone length ( tone length).

    Debug: debug h245 asn1

  • NTE:- in-band DTMF relay. Works like Cisco proprietary, DTMF is sent on the same RTP stream as voice, using RTP payload type. Another payload does not allow DTMF samples to be compressed. Unlike Cisco proprietary, NTE uses the RFC 2833 standard.

    Debug: debug h245 asn1

The following commands are available on a Cisco router:

Router(config-dial-peer)#dtmf-relay ? cisco-rtp Cisco Proprietary RTP h245-alphanumeric DTMF Relay via H245 Alphanumeric IE h245-signal DTMF Relay via H245 Signal IE rtp-nte RTP Named Telephone Event RFC 2833 router(config-dial-peer)#

Best practice:
On dialpire, it is best to issue commands like this:

Dial-peer voice 3000 voip description Long calls destination-pattern ... session target ipv4:192.168.0.11 dtmf-relay h245-signal h245-alphanumeric cisco-rtp rtp-nte codec g711ulaw no vad

In this case, both parties can negotiate the appropriate dtmf-relay method between themselves.

To determine the selected DTMF relay method:
show call active voice

Router#show call active voice ........... PeerAddress=5001 ........... tx_DtmfRelay=rtp-nte

Thus, CUCM automatically checks which DTMF method is suitable for both parties.
Regarding the H.323 Gateway in CUCM, there are no DTMF settings. CUCM accepts the setting of the other party.

MGCP DTMF Support

The following DTMF Relay methods are available for MGCP:

  • Cisco proprietary: DTMF is sent in the same RTP stream as the voice, but the DTMF tones are encoded slightly differently, allowing them to be successfully distinguished and received on the other side. DTMF samples are identified as RTP payload type 121. The method works only if both sides have Cisco equipment and a similar method is selected (nothing is negotiated).
  • NSE: NSE is essentially a Cisco Proprietary NTE. The method works only if both sides have Cisco equipment and a similar method is selected (nothing is negotiated).
  • NTE: in turn, it can work in two modes:
    - Gateway-controlled mode (NTE GW): Gateways negotiate DTMF with each other on their own by exchanging capability information in SDP messages. This process is transparent to the Call Agent. At the same time, both gateways have MGCP running and both are connected to the same CUCM.
    - Call agent-controlled mode (NTE CA): The negotiation uses the Call Agent, i.e. acts on behalf of the MGCP gateway (SDP messages are sent to the Agent). This mode can be used when the second gateway is not an MGCP-Gateway. After negotiation, the Call Agent instructs the gateway about the RTP-NTE values ​​received from the other side.
  • out-of-band: Tones are sent to the CUCM using MGCP messages, i.e. outside the RTP stream (Out-of-band). The CUCM in turn receives the DTMF and transmits it to the other side.

MGCP uses DTMF relay only for low-rate codecs (G729, iLBC, GSM, etc). For bit-rate codecs G711 DTMF will be sent in-band.

In the case of MGCP, we can choose whether the DTMF settings will be dictated by the Call Agent (CUCM) or whether those set on the Gateway will be used.
Let's go to CUCM: Device > Gateway, select the appropriate MGCP Gateway.
We are interested in the section Type of DTMF Relay.

When choosing Current GW Config, the setting on the gateway will be used.
On the IOS Gateway, we can set DTMF with the following command:

Router(config)#mgcp dtmf-relay voip codec all mode ? cisco Set mgcp dtmf-relay mode to be cisco disabled Set mgcp dtmf-relay mode to be disabled nse Set mgcp dtmf-relay mode to be nse nte-ca Set mgcp dtmf-relay mode to be nte-ca nte-gw Set mgcp dtmf -relay mode to be nte-gw out-of-band Set mgcp dtmf-relay mode to be out-of-band

If we expose another choice on CUCM, for example cisco, the corresponding command above will be entered by the automaton (MGCP mechanisms).

A bug was noticed with MGCP:

CSCta69407 Bug Details(When using any type of inband DTMF signaling (RTP-NTE, NSE, or Cisco Proprietary) DSP"s aren"t turning off OOB dtmf signaling using mgcp packets. There fore duplicate digits will be seen on the terminating GW as one coming from rtp and other coming from CUCM)

workaround: Use mgcp dtmf-relay type out-of-band.

SIP DTMF Support

SIP sends DTMF by default in-band, but we can use the following options:

  • RTP-NTE (NTE or RFC 2833) - in-band DTMF relay. Which uses Named Telephony Event (NTE) RTP voice packets to carry DTMF information. In this case, SDP is used for negotiation between nodes of the value payload type=NTE. Although formally this in-band, but in reality the tone in the audio stream will not be heard, since the NTE packets are not voice
    RTP-NTE does not work with SCCP phones because SCCP phones only use out-of-band DTMF relay. For this reason, MTP must be used in conjunction with RTP-NTE.
  • SIP INFO - out-of-band(OOB) DTMF relay. DTMF information is sent in SIP INFO messages. Those. if the gateway receives an INFO message, it emits the appropriate tone.
  • SIP NOTIFY - out-of-band(OOB) DTMF relay. or is it also called NOTIFY-based out-of-band DTMF relay. This type of DTMF relay uses NOTIFY to transmit tones. This method is compatible with SCCP phones and can also be used with analog phones connected to the FXS ports on the gateway.
  • KPML - out-of-band(OOB) DTMF relay. When using the Key Press Markup Language, the SIP phone sends the number digit-by-digit. This method is similar to SIP NOTIFY, with the only difference that it gives each digit separately.
router(config-dial-peer)#session protocol sipv2 router(config-dial-peer)#dtmf-relay ? cisco-rtp Cisco Proprietary RTP h245-alphanumeric DTMF Relay via H245 Alphanumeric IE h245-signal DTMF Relay via H245 Signal IE rtp-nte RTP Named Telephone Event RFC 2833 sip-kpml DTMF Relay via KPML over SIP SUBCRIBE/NOTIFY sip-notify DTMF Relay via SIP NOTIFY messages router(config-dial-peer)#

Here we see several methods available, with only
- RTP-NTE (NTE or RFC 2833);
- SIP NOTIFY;
- SIP-KPML.