自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
可视语音信箱
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android 6.0 (Marshmallow) 实现了集成到拨号器的可视语音信箱 (VVM) 支持,从而使兼容的运营商 VVM 服务能够通过最少的配置接入拨号器。通过可视语音信箱,用户无需拨号便可轻松查收语音信息。用户可以在类似于收件箱的界面中查看信息列表,按任何顺序收听信息,并可根据需要删除信息。
Android 7.0 已将下列配置参数添加到可视语音信箱:
- 通过
KEY_VVM_PREFETCH_BOOLEAN
控制语音信息的预提取 - 通过
KEY_VVM_CELLULAR_DATA_REQUIRED_BOOLEAN
控制是否需要移动数据网络连接 - 语音信息转录内容的提取
- 语音信箱配额的提取
本文概述了可视语音信箱的功能、运营商与之进行集成的方式,以及实现方面的一些相关细节。
可视语音信箱 (VVM) 客户端
Android 6.0 及更高版本中包含一个 OMTP VVM 客户端。如果配置正确的话,该客户端会连接到运营商的 VVM 服务器,并在 Android 开源项目 (AOSP) 拨号器中填入 VVM 消息。VVM 客户端会执行以下操作:
- 处理用于激活/停用/查询服务状态的短信,以及处理用于将订阅者邮箱中的事件通知设备的短信
- 将信箱与 IMAP 服务器同步
- 当用户选择收听语音邮件时下载这类邮件
- 提取语音邮件转录内容
- 提取语音信箱配额的详细信息(信箱总容量和占用容量)
- 集成到拨号器以实现用户功能(例如:回拨、查看未读邮件、删除邮件等)
与 VVM 客户端进行集成
实现
运营商必须提供实施 OMTP VVM 规范的可视语音信箱服务器。AOSP VVM 客户端当前的实现支持核心功能(查看/删除语音信息、下载/同步/收听语音信息),但没有实现其他的 TUI 功能(密码更改、语音信箱问候语、语言)。目前,我们仅支持 OMTP 版本 1.1,并且没有对 IMAP 身份验证进行加密。
为了支持转录,运营商必须支持 OMTP 1.3 规范第 2.1.3 项所规定的转录附件格式(MIME 类型 plain/text)。
注意:服务器发送到设备的短信(例如:STATUS 或 SYNC)必须为数据短信。
配置
为了让运营商能与 VVM 服务集成,运营商必须向平台提供 OMTP 客户端可以使用的配置详情。这些参数包括:
- 短信的目标号码和端口号
- 运营商提供的可视语音信箱应用的软件包名称(如有提供),以便在安装该软件包后,可以停用平台实现
这些值通过 Carrier Config API 提供。利用在 Android 6.0 中推出的这项功能,应用可将与电话相关的配置动态提供给需要该配置的各种平台组件。尤其需要注意的是,以下键必须定义值:
KEY_VVM_DESTINATION_NUMBER_STRING
KEY_VVM_PORT_NUMBER_INT
KEY_VVM_TYPE_STRING
KEY_CARRIER_VVM_PACKAGE_NAME_STRING
KEY_VVM_PREFETCH_BOOLEAN
KEY_VVM_CELLULAR_DATA_REQUIRED_BOOLEAN
如需了解详情,请参阅运营商配置。
实现
OMTP VVM 客户端是在 packages/services/Telephony
中实现的,具体而言是在 src/com/android/phone/vvm/
内
设置
- VVM 客户端会监听
TelephonyIntents#ACTION_SIM_STATE_CHANGED
或 CarrierConfigManager#ACTION_CARRIER_CONFIG_CHANGED
。 - 当添加了具有合适的运营商配置值(
KEY_VVM_TYPE_STRING
设置为 TelephonyManager.VVM_TYPE_OMTP
或 TelephonyManager.VVM_TYPE_CVVM
)的 SIM 卡后,VVM 客户端会向 KEY_VVM_DESTINATION_NUMBER_STRING
中指定的值发送 ACTIVATE 短信。 - 服务器启用可视语音信箱服务,并通过 STATUS SMA 发送 OMTP 凭据。当 VVM 客户端收到 STATUS 短信后,就会注册语音邮件来源,并在设备上显示语音信箱标签页。
- OMTP 凭据保存到本地,并且设备开始执行完全同步(如下所述)。
正在同步
VVM 客户端可以通过多种方式与运营商服务器进行同步,反之亦然。
- 初次下载时会触发完全同步。VVM 客户端提取语音信息的元数据,例如日期和时间、发件号码、时长、语音信息转录内容(如果有)以及音频数据(如果
KEY_VVM_PREFETCH_BOOLEAN
为 true)。完全同步可由以下操作触发:- 插入新的 SIM 卡
- 重启设备
- 重新使用服务
- 收到
VoicemailContract.ACTION_SYNC_VOICEMAIL
广播
- 当用户与语音信箱进行互动以查看或删除语音信息时,就会触发上传同步。上传同步会导致服务器更改其数据,以匹配设备上的数据。例如,如果用户查看语音信息,则相应信息会在服务器中标为已读;如果用户删除语音信息,则相应信息会从服务器中删除。
- 当 VVM 客户端收到来自运营商的“MBU”(信箱更新)SYNC 短信时,就会触发下载同步。SYNC 短信包含新信息的元数据,以便该信息可以存储在语音信箱内容提供程序中。
注意:每次同步时,系统都会检索语音信箱收件箱配额值。
下载语音信息
当用户按下“播放”来收听语音信息时,相应的音频文件便会下载下来。如果用户选择收听语音信息,拨号器便可以广播语音信箱客户端收到的 VoicemailContract.ACTION_FETCH_VOICEMAIL
、开始下载内容,并更新平台语音信箱 content provider 中录制的内容。
停用 VVM
用户互动、取出有效 SIM 卡或者被运营商 VVM 应用所取代都会导致 VVM 服务遭到停用或禁用。“停用”意味着本地设备不再显示可视语音信箱。“禁用”意味着为订阅者关闭该服务。用户互动会禁用服务,取出 SIM 卡会暂时停用服务(因为该服务已不再存在),而被运营商 VVM 所取代则会停用 AOSP VVM 客户端。
用户互动
用户可以手动启用或停用可视语音信箱。如果用户停用可视语音信箱,会同时禁用相应服务。当用户停用可视语音信箱时,系统会发送 DEACTIVATE 短信,在本地取消注册语音信箱来源,并且语音信箱标签将会消失。如果用户重新启用可视化语音信箱,相应的服务也将重新激活。
取出 SIM 卡
如果设备的 SIM 卡状态 (ACTION_SIM_STATE_CHANGED
) 或运营商配置值 (ACTION_CARRIER_CONFIG_CHANGED
) 发生变化,并且给定 SIM 卡的有效配置不再存在,那么语音邮箱来源会在本地取消注册,而且语音信箱标签页也会消失。如果更换了 SIM 卡,VVM 将被重新启用。
被运营商 VVM 所取代
运营商可视语音信箱应用(如果已安装在设备上)可以停用 AOSP VVM 客户端。这可通过检查是否安装了名称与 KEY_CARRIER_VVM_PACKAGE_NAME_STRING
参数相符的软件包来实现。
仍可通过用户互动启用 VVM 客户端。
测试
自 Android 4.0 以来,就有一组现有的 CTS 测试用于 VoicemailProvider API。借助 VoicemailProvider API,应用可以在平台中插入/查询/删除语音信息。这些 API 与 VVM 用来添加/删除语音信息的 API 相同,这样一来,任何拨号器应用都可以在界面中显示这些语音信息。
如需测试您的配置应用是否在正确地传递 OMTP 配置,您可以使用以下工具来测试代码:
- 包含有效证书签名的 SIM 卡
- 搭载 Android 6.0 且具备未修改版 AOSP 手机框架的设备
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Visual voicemail\n\nAndroid 6.0 (Marshmallow) brought an implementation of visual voicemail (VVM)\nsupport integrated into the Dialer, allowing compatible carrier VVM services to\nhook into the Dialer with minimal configuration. Visual voicemail lets users\neasily check voicemail without making any phone calls. Users can view a list of\nmessages in an inbox-like interface, listen to them in any order, and can\ndelete them as desired.\n\nAndroid 7.0 added the following configuration parameters to visual voicemail:\n\n- Prefetching of voicemails controlled by `KEY_VVM_PREFETCH_BOOLEAN`\n- Control of whether a cellular data connection is required by `KEY_VVM_CELLULAR_DATA_REQUIRED_BOOLEAN`\n- Fetching of voicemail transcriptions\n- Fetching of voicemail quota\n\nThis page gives an overview of what is provided, how carriers can integrate\nwith it, and some details of the implementation.\n\nVisual voicemail (VVM) client\n-----------------------------\n\nAndroid 6.0 and above includes a OMTP VVM client, which (when provided with the correct\nconfiguration) connects to carrier VVM servers and populates VVM\nmessages within the Android Open Source Project (AOSP) Dialer. The VVM client:\n\n- Handles the SMS messages used to activate/deactivate/query status of the service and the SMS messages used to notify the device of events in the subscriber's mailbox\n- Syncs the mailbox with the IMAP server\n- Downloads the voicemails when the user chooses to listen to them\n- Fetches voicemail transcriptions\n- Fetches details of voicemail quota (total mailbox size and occupied size)\n- Integrates into the Dialer for user functionality such as calling back, viewing unread messages, deleting messages, etc.\n\nIntegrate with the VVM client\n-----------------------------\n\n### Implementation\n\nThe carrier must provide a visual voicemail server implementing the\n[OMTP\nVVM specifications](http://www.gsma.com/newsroom/wp-content/uploads/2012/07/OMTP_VVM_Specification_1_3.pdf). The current implementation of the AOSP VVM client supports the core\nfeatures (read/delete voicemails, download/sync/listen) but the additional TUI\nfeatures (password change, voicemail greeting, languages) are not implemented.\nAt this time, we only support OMTP version 1.1 and do not use encryption for\nIMAP authentication.\n\nTo support transcriptions, carriers must support the transcription attachment\nformat (MIME type plain/text) specified in the OMTP 1.3 spec, item 2.1.3.\n\n**Note:** Server-originated SMS messages to the device\n(e.g. STATUS or SYNC) must be data SMS messages.\n\n### Configuration\n\nIn order for a carrier to integrate with the VVM service, the carrier must\nprovide configuration details to the platform that the OMTP client can use.\nThese parameters are:\n\n- Destination number and port number for SMS\n- The package name of the carrier-provided visual voicemail app (if one is provided), so that the platform implementation can be disabled if that package is installed\n\nThese values are provided through the\n[Carrier Config API](https://developer.android.com/reference/android/telephony/CarrierConfigManager.html).\nThis functionality, launched in Android 6.0, lets an app\ndynamically provide telephony-related configuration to the various platform\ncomponents that need it. In particular the following keys must have values\ndefined:\n\n- `KEY_VVM_DESTINATION_NUMBER_STRING`\n- `KEY_VVM_PORT_NUMBER_INT`\n- `KEY_VVM_TYPE_STRING`\n- `KEY_CARRIER_VVM_PACKAGE_NAME_STRING`\n- `KEY_VVM_PREFETCH_BOOLEAN`\n- `KEY_VVM_CELLULAR_DATA_REQUIRED_BOOLEAN`\n\nSee [Carrier configuration](/docs/core/connect/carrier)\nfor details.\n\nImplementation\n--------------\n\nThe OMTP VVM client is implemented within `packages/services/Telephony`,\nin particular within `src/com/android/phone/vvm/`\n\n### Setup\n\n1. The VVM client listens for `TelephonyIntents#ACTION_SIM_STATE_CHANGED` or `CarrierConfigManager#ACTION_CARRIER_CONFIG_CHANGED`.\n2. When a SIM is added that has the right Carrier Config values (`KEY_VVM_TYPE_STRING` set to `TelephonyManager.VVM_TYPE_OMTP` or `TelephonyManager.VVM_TYPE_CVVM`), the VVM client sends an ACTIVATE SMS to the value specified in `KEY_VVM_DESTINATION_NUMBER_STRING`.\n3. The server activates the visual voicemail service and sends the OMTP credentials through STATUS SMA. When the VVM client receives the STATUS SMS, it registers the voicemail source and displays the voicemail tab on the device.\n4. The OMTP credentials are saved locally and the device begins a full sync, as described below.\n\n### Syncing\n\nThere are a variety of ways that the VVM client can sync with the carrier\nserver and vice versa.\n\n- **Full syncs** occur upon initial download. The VVM client fetches voicemail metadata like date and time; origin number; duration; voicemail transcriptions, if available; and audio data if `KEY_VVM_PREFETCH_BOOLEAN` is True. Full syncs can be triggered by:\n - Inserting a new SIM\n - Rebooting the device\n - Coming back in service\n - Receiving the `VoicemailContract.ACTION_SYNC_VOICEMAIL` broadcast\n- **Upload sync** happens when a user interacts with a voicemail to read or delete it. Upload syncs result in the server changing its data to match the data on the device. For example, if the user reads a voicemail, it's marked as read on the server; if a user deletes a voicemail, it's deleted on the server.\n- **Download sync** occurs when the VVM client receives a \"MBU\" (mailbox update) SYNC SMS from the carrier. A SYNC message contains the metadata for a new message so that it can be stored in the voicemail content provider.\n\n**Note:** The voicemail inbox quota values are\nretrieved during every sync.\n\n### Voicemail download\n\nWhen a user presses play to listen to a voicemail, the corresponding audio file\nis downloaded. If the user chooses to listen to the voicemail, the Dialer can\nbroadcast `VoicemailContract.ACTION_FETCH_VOICEMAIL`, which the\nvoicemail client receives, initiate the download of the\ncontent, and update the record in the platform voicemail content provider.\n\n### Disable VVM\n\nThe VVM service can be disabled or deactivated by user interaction, removal of\na valid SIM, or replacement by a carrier VVM app. *Disabled* means that the\nlocal device no longer displays visual voicemail. *Deactivated* means that\nthe service is turned off for the subscriber. User interaction can\ndeactivate the service, SIM removal temporarily disables the service because\nit's no longer present, and carrier VVM replacement disables the AOSP VVM client.\n\n#### User interaction\n\nThe user may manually enable or disable visual voicemail. If a user disables\nvisual voicemail, they are also deactivating their service. When they disable\nvisual voicemail, a DEACTIVATE SMS is sent, the voicemail source is\nunregistered locally, and voicemail tab disappears. If they re-enable visual\nvoicemail, their service is reactivated as well.\n\n#### SIM removal\n\nIf there are changes to the device's SIM state (`ACTION_SIM_STATE_CHANGED`)\nor Carrier Config values (`ACTION_CARRIER_CONFIG_CHANGED`), and\na valid configuration for the given SIM no longer exists, then the\nvoicemail source is unregistered locally and the voicemail tab disappears. If\nthe SIM is replaced, VVM is re-enabled.\n\n#### Replaced by carrier VVM\n\nA carrier visual voicemail app, if installed on the device, can disable the\nAOSP VVM client. This is achieved by checking if a package with a name\nmatching the `KEY_CARRIER_VVM_PACKAGE_NAME_STRING` parameter is installed.\n\nThe VVM client can still be enabled through user interaction.\n\nTesting\n-------\n\nThere is an existing (since Android 4.0) set of CTS tests for the\nVoicemailProvider APIs that allow an app to insert/query/delete voicemails into\nthe platform. These are the same APIs that VVM uses to add/delete voicemails so\nthat any Dialer app can display them in the UI.\n\nTo test your configuration app is passing the OMTP configuration\ncorrectly you can test your code with:\n\n- A SIM containing a valid certificate signature\n- A device running Android 6.0 with an unmodified version of the AOSP phone framework"]]