connectivity/bluetooth/api/audio/shell/ccp.html · connectivity/bluetooth/api/audio/shell/ccp.rst 공식 원문 ↗

Zephyr 3.7.0 · Connectivity · Bluetooth · Audio Shell

Call Control Profile shell

GTBS·TBS를 발견하고 call 발신·수락·종료와 server simulation을 실행합니다.

Official pathconnectivity/bluetooth/api/audio/shell/ccp.html
Source fileconnectivity/bluetooth/api/audio/shell/ccp.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

TBS client와 server의 명령·call state 출력 예제 10개입니다.

Client

TBS Client

Server

TBS · GTBS

Examples

10

Calls

Originate · accept · terminate

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 13FDD7553A5B1E6D686FCD602FBC6DF6E74230726B3148A28F1BB5AD3AF4C4BB
Bluetooth: Call Control Profile
###############################

This document describes how to run the call control functionality, both as
a client and as a (telephone bearer service (TBS)) server. Note that in the
examples below, some lines of debug have been removed to make this shorter
and provide a better overview.

Telephone Bearer Service Client
*******************************

The telephone bearer service client will typically exist on a resource
restricted device, such as headphones, but may also exist on e.g. phones or
laptops. The call control client will also thus typically be the advertiser.
The client can control the states of calls on a server using the call control
point.

It is necessary to have :kconfig:option:`CONFIG_BT_TBS_CLIENT_LOG_LEVEL_DBG`
enabled for using the client interactively.

Using the telephone bearer service client
=========================================

When the Bluetooth stack has been initialized (:code:`bt init`),
and a device has been connected, the telephone bearer service client can
discover TBS on the connected device calling :code:`tbs_client discover`, which
will start a discovery for the TBS UUIDs and store the handles, and optionally
subscribe to all notifications (default is to subscribe to all).

Since a server may have multiple TBS instances, most of the tbs_client commands
will take an index (starting from 0) as input. Joining calls require at least 2
call IDs, and all call indexes shall be on the same TBS instance.

A server may also have a GTBS instance, which is an abstraction layer for all
the telephone bearers on the server. If the server has both GTBS and TBS,
the client may subscribe and use either when sending requests if
:code:`BT_TBS_CLIENT_GTBS` is enabled.

.. code-block:: console

   tbs_client --help
   tbs_client - Bluetooth TBS_CLIENT shell commands
   Subcommands:
      discover                       :Discover TBS [subscribe]
      set_signal_reporting_interval  :Set the signal reporting interval
                                       [<{instance_index, gtbs}>] <interval>
      originate                      :Originate a call [<{instance_index, gtbs}>]
                                       <uri>
      terminate                      :terminate a call [<{instance_index, gtbs}>]
                                       <id>
      accept                         :Accept a call [<{instance_index, gtbs}>] <id>
      hold                           :Place a call on hold [<{instance_index,
                                       gtbs}>] <id>
      retrieve                       :Retrieve a held call [<{instance_index,
                                       gtbs}>] <id>
      read_provider_name             :Read the bearer name [<{instance_index,
                                       gtbs}>]
      read_bearer_uci                :Read the bearer UCI [<{instance_index, gtbs}>]
      read_technology                :Read the bearer technology [<{instance_index,
                                       gtbs}>]
      read_uri_list                  :Read the bearer's supported URI list
                                       [<{instance_index, gtbs}>]
      read_signal_strength           :Read the bearer signal strength
                                       [<{instance_index, gtbs}>]
      read_signal_interval           :Read the bearer signal strength reporting
                                       interval [<{instance_index, gtbs}>]
      read_current_calls             :Read the current calls [<{instance_index,
                                       gtbs}>]
      read_ccid                      :Read the CCID [<{instance_index, gtbs}>]
      read_status_flags              :Read the in feature and status value
                                       [<{instance_index, gtbs}>]
      read_uri                       :Read the incoming call target URI
                                       [<{instance_index, gtbs}>]
      read_call_state                :Read the call state [<{instance_index, gtbs}>]
      read_remote_uri                :Read the incoming remote URI
                                       [<{instance_index, gtbs}>]
      read_friendly_name             :Read the friendly name of an incoming call
                                       [<{instance_index, gtbs}>]
      read_optional_opcodes          :Read the optional opcodes [<{instance_index,
                                       gtbs}>]


In the following examples, notifications from GTBS is ignored, unless otherwise
specified.

Example usage
=============

Setup
-----

.. code-block:: console

   uart:~$ bt init
   uart:~$ bt advertise on
   Advertising started

When connected
--------------

Placing a call:

.. code-block:: console

   uart:~$ tbs_client discover
   <dbg> bt_tbs_client.primary_discover_func: Discover complete, found 1 instances (GTBS found)
   <dbg> bt_tbs_client.discover_func: Setup complete for 1 / 1 TBS
   <dbg> bt_tbs_client.discover_func: Setup complete GTBS
   uart:~$ tbs_client originate 0 tel:123
   <dbg> bt_tbs_client.notify_handler: Index 0
   <dbg> bt_tbs_client.current_calls_notify_handler: Call 0x01 is in the dialing state with URI tel:123
   <dbg> bt_tbs_client.call_cp_notify_handler: Status: success for the originate opcode for call 0x00
   <dbg> bt_tbs_client.notify_handler: Index 0
   <dbg> bt_tbs_client.current_calls_notify_handler: Call 0x01 is in the alerting state with URI tel:123
   <call answered by peer device, and status notified by TBS server>
   <dbg> bt_tbs_client.notify_handler: Index 0
   <dbg> bt_tbs_client.current_calls_notify_handler: Call 0x01 is in the active state with URI tel:123

Placing a call on GTBS:

.. code-block:: console

   uart:~$ tbs_client originate 0 tel:123
   <dbg> bt_tbs_client.notify_handler: Index 0
   <dbg> bt_tbs_client.current_calls_notify_handler: Call 0x01 is in the dialing state with URI tel:123
   <dbg> bt_tbs_client.call_cp_notify_handler: Status: success for the originate opcode for call 0x00
   <dbg> bt_tbs_client.notify_handler: Index 0
   <dbg> bt_tbs_client.current_calls_notify_handler: Call 0x01 is in the alerting state with URI tel:123
   <call answered by peer device, and status notified by TBS server>
   <dbg> bt_tbs_client.notify_handler: Index 0
   <dbg> bt_tbs_client.current_calls_notify_handler: Call 0x01 is in the active state with URI tel:123

It is necessary to set an outgoing caller ID before placing a call.

Accepting incoming call from peer device:

.. code-block:: console

   <dbg> bt_tbs_client.incoming_uri_notify_handler: tel:123
   <dbg> bt_tbs_client.in_call_notify_handler: tel:456
   <dbg> bt_tbs_client.friendly_name_notify_handler: Peter
   <dbg> bt_tbs_client.current_calls_notify_handler: Call 0x05 is in the incoming state with URI tel:456
   uart:~$ tbs_client accept 0 5
   <dbg> bt_tbs_client.call_cp_callback_handler: Status: success for the accept opcode for call 0x05
   <dbg> bt_tbs_client.current_calls_notify_handler: Call 0x05 is in the active state with URI tel


Terminate call:

.. code-block:: console

   uart:~$ tbs_client terminate 0 5
   <dbg> bt_tbs_client.termination_reason_notify_handler: ID 0x05, reason 0x06
   <dbg> bt_tbs_client.call_cp_notify_handler: Status: success for the terminate opcode for call 0x05
   <dbg> bt_tbs_client.current_calls_notify_handler:

Telephone Bearer Service (TBS)
******************************
The telephone bearer service is a service that typically resides on devices that
can make calls, including calls from apps such as Skype, e.g. (smart)phones and
PCs.

It is necessary to have :kconfig:option:`CONFIG_BT_TBS_LOG_LEVEL_DBG` enabled
for using the TBS server interactively.

Using the telephone bearer service
==================================
TBS can be controlled locally, or by a remote device (when in a call). For
example a remote device may initiate a call to the device with the TBS server,
or the TBS server may initiate a call to remote device, without a TBS_CLIENT client.
The TBS implementation is capable of fully controlling any call.

.. code-block:: console

   tbs --help
   tbs - Bluetooth TBS shell commands
   Subcommands:
      init                        :Initialize TBS
      authorize                   :Authorize the current connection
      accept                      :Accept call <call_index>
      terminate                   :Terminate call <call_index>
      hold                        :Hold call <call_index>
      retrieve                    :Retrieve call <call_index>
      originate                   :Originate call [<instance_index>] <uri>
      join                        :Join calls <id> <id> [<id> [<id> [...]]]
      incoming                    :Simulate incoming remote call [<{instance_index,
                                    gtbs}>] <local_uri> <remote_uri>
                                    <remote_friendly_name>
      remote_answer               :Simulate remote answer outgoing call <call_index>
      remote_retrieve             :Simulate remote retrieve <call_index>
      remote_terminate            :Simulate remote terminate <call_index>
      remote_hold                 :Simulate remote hold <call_index>
      set_bearer_provider_name    :Set the bearer provider name [<{instance_index,
                                    gtbs}>] <name>
      set_bearer_technology       :Set the bearer technology [<{instance_index,
                                    gtbs}>] <technology>
      set_bearer_signal_strength  :Set the bearer signal strength [<{instance_index,
                                    gtbs}>] <strength>
      set_status_flags            :Set the bearer feature and status value
                                    [<{instance_index, gtbs}>] <feature_and_status>
      set_uri_scheme              :Set the URI prefix list <bearer_idx> <uri1 [uri2
                                    [uri3 [...]]]>
      print_calls                 :Output all calls in the debug log

Example Usage
=============

Setup
-----

.. code-block:: console

   uart:~$ bt init
   uart:~$ bt connect xx:xx:xx:xx:xx:xx public

When connected
--------------

Answering a call for a peer device originated by a client:

.. code-block:: console

   <dbg> bt_tbs.write_call_cp: Index 0: Processing the originate opcode
   <dbg> bt_tbs.originate_call: New call with call index 1
   <dbg> bt_tbs.write_call_cp: Index 0: Processed the originate opcode with status success for call index 1
   uart:~$ tbs remote_answer 1
   TBS succeeded for call_id: 1

Incoming call from a peer device, accepted by client:

.. code-block:: console

   uart:~$ tbs incoming 0 tel:123 tel:456 Peter
   TBS succeeded for call_id: 4
   <dbg> bt_tbs.bt_tbs_remote_incoming: New call with call index 4
   <dbg> bt_tbs.write_call_cp: Index 0: Processed the accept opcode with status success for call index 4

Part 3

한국어 전문 번역

Call Control Profile shell

Call control 기능을 TBS client와 Telephone Bearer Service server 양쪽에서 실행합니다. 공식 예제는 읽기 쉽게 일부 debug line을 생략했습니다.

Telephone Bearer Service Client

Client는 보통 headphone 같은 resource-restricted advertiser에 있지만 phone·laptop에도 있을 수 있습니다. Call Control Point를 써서 server의 call 상태를 제어하며 interactive 사용에는 CONFIG_BT_TBS_CLIENT_LOG_LEVEL_DBG가 필요합니다.

연결 뒤 tbs_client discover는 TBS UUID와 handle을 발견하고 기본적으로 모든 notification을 subscribe합니다. Server가 여러 TBS instance를 가질 수 있어 대부분 명령은 0부터 시작하는 instance index를 받습니다. Call join은 같은 TBS instance의 call ID 두 개 이상이 필요합니다.

GTBS는 server의 모든 telephone bearer를 추상화합니다. Server가 GTBS와 TBS를 모두 제공하고 BT_TBS_CLIENT_GTBS가 활성화되면 어느 쪽을 subscribe하고 request 대상으로 사용할지 선택할 수 있습니다.

tbs_client --help
tbs_client - Bluetooth TBS_CLIENT shell commands
Subcommands:
   discover                       :Discover TBS [subscribe]
   set_signal_reporting_interval  :Set the signal reporting interval
                                    [<{instance_index, gtbs}>] <interval>
   originate                      :Originate a call [<{instance_index, gtbs}>]
                                    <uri>
   terminate                      :terminate a call [<{instance_index, gtbs}>]
                                    <id>
   accept                         :Accept a call [<{instance_index, gtbs}>] <id>
   hold                           :Place a call on hold [<{instance_index,
                                    gtbs}>] <id>
   retrieve                       :Retrieve a held call [<{instance_index,
                                    gtbs}>] <id>
   read_provider_name             :Read the bearer name [<{instance_index,
                                    gtbs}>]
   read_bearer_uci                :Read the bearer UCI [<{instance_index, gtbs}>]
   read_technology                :Read the bearer technology [<{instance_index,
                                    gtbs}>]
   read_uri_list                  :Read the bearer's supported URI list
                                    [<{instance_index, gtbs}>]
   read_signal_strength           :Read the bearer signal strength
                                    [<{instance_index, gtbs}>]
   read_signal_interval           :Read the bearer signal strength reporting
                                    interval [<{instance_index, gtbs}>]
   read_current_calls             :Read the current calls [<{instance_index,
                                    gtbs}>]
   read_ccid                      :Read the CCID [<{instance_index, gtbs}>]
   read_status_flags              :Read the in feature and status value
                                    [<{instance_index, gtbs}>]
   read_uri                       :Read the incoming call target URI
                                    [<{instance_index, gtbs}>]
   read_call_state                :Read the call state [<{instance_index, gtbs}>]
   read_remote_uri                :Read the incoming remote URI
                                    [<{instance_index, gtbs}>]
   read_friendly_name             :Read the friendly name of an incoming call
                                    [<{instance_index, gtbs}>]
   read_optional_opcodes          :Read the optional opcodes [<{instance_index,
                                    gtbs}>]

초기화와 advertising

uart:~$ bt init
uart:~$ bt advertise on
Advertising started

TBS instance에서 call 발신

Discovery 후 tel:123 URI로 call을 만들면 dialing, alerting, active 상태가 notification으로 이어집니다.

uart:~$ tbs_client discover
<dbg> bt_tbs_client.primary_discover_func: Discover complete, found 1 instances (GTBS found)
<dbg> bt_tbs_client.discover_func: Setup complete for 1 / 1 TBS
<dbg> bt_tbs_client.discover_func: Setup complete GTBS
uart:~$ tbs_client originate 0 tel:123
<dbg> bt_tbs_client.notify_handler: Index 0
<dbg> bt_tbs_client.current_calls_notify_handler: Call 0x01 is in the dialing state with URI tel:123
<dbg> bt_tbs_client.call_cp_notify_handler: Status: success for the originate opcode for call 0x00
<dbg> bt_tbs_client.notify_handler: Index 0
<dbg> bt_tbs_client.current_calls_notify_handler: Call 0x01 is in the alerting state with URI tel:123
<call answered by peer device, and status notified by TBS server>
<dbg> bt_tbs_client.notify_handler: Index 0
<dbg> bt_tbs_client.current_calls_notify_handler: Call 0x01 is in the active state with URI tel:123

GTBS에서 call 발신

GTBS를 통해 발신할 때도 같은 상태 전이가 나타납니다. 발신 전 outgoing caller ID를 설정해야 합니다.

uart:~$ tbs_client originate 0 tel:123
<dbg> bt_tbs_client.notify_handler: Index 0
<dbg> bt_tbs_client.current_calls_notify_handler: Call 0x01 is in the dialing state with URI tel:123
<dbg> bt_tbs_client.call_cp_notify_handler: Status: success for the originate opcode for call 0x00
<dbg> bt_tbs_client.notify_handler: Index 0
<dbg> bt_tbs_client.current_calls_notify_handler: Call 0x01 is in the alerting state with URI tel:123
<call answered by peer device, and status notified by TBS server>
<dbg> bt_tbs_client.notify_handler: Index 0
<dbg> bt_tbs_client.current_calls_notify_handler: Call 0x01 is in the active state with URI tel:123

Incoming call 수락

Incoming target URI, remote URI, friendly name과 call ID를 notification으로 받은 뒤 해당 instance와 ID를 accept합니다.

<dbg> bt_tbs_client.incoming_uri_notify_handler: tel:123
<dbg> bt_tbs_client.in_call_notify_handler: tel:456
<dbg> bt_tbs_client.friendly_name_notify_handler: Peter
<dbg> bt_tbs_client.current_calls_notify_handler: Call 0x05 is in the incoming state with URI tel:456
uart:~$ tbs_client accept 0 5
<dbg> bt_tbs_client.call_cp_callback_handler: Status: success for the accept opcode for call 0x05
<dbg> bt_tbs_client.current_calls_notify_handler: Call 0x05 is in the active state with URI tel

Call 종료

uart:~$ tbs_client terminate 0 5
<dbg> bt_tbs_client.termination_reason_notify_handler: ID 0x05, reason 0x06
<dbg> bt_tbs_client.call_cp_notify_handler: Status: success for the terminate opcode for call 0x05
<dbg> bt_tbs_client.current_calls_notify_handler:

Telephone Bearer Service Server

TBS는 일반 전화뿐 아니라 Skype 같은 application call을 제공하는 phone·PC에 위치합니다. Interactive server에는 CONFIG_BT_TBS_LOG_LEVEL_DBG가 필요합니다. Local shell 또는 remote client가 call을 제어할 수 있고 server는 call을 완전히 관리할 수 있습니다.

tbs --help
tbs - Bluetooth TBS shell commands
Subcommands:
   init                        :Initialize TBS
   authorize                   :Authorize the current connection
   accept                      :Accept call <call_index>
   terminate                   :Terminate call <call_index>
   hold                        :Hold call <call_index>
   retrieve                    :Retrieve call <call_index>
   originate                   :Originate call [<instance_index>] <uri>
   join                        :Join calls <id> <id> [<id> [<id> [...]]]
   incoming                    :Simulate incoming remote call [<{instance_index,
                                 gtbs}>] <local_uri> <remote_uri>
                                 <remote_friendly_name>
   remote_answer               :Simulate remote answer outgoing call <call_index>
   remote_retrieve             :Simulate remote retrieve <call_index>
   remote_terminate            :Simulate remote terminate <call_index>
   remote_hold                 :Simulate remote hold <call_index>
   set_bearer_provider_name    :Set the bearer provider name [<{instance_index,
                                 gtbs}>] <name>
   set_bearer_technology       :Set the bearer technology [<{instance_index,
                                 gtbs}>] <technology>
   set_bearer_signal_strength  :Set the bearer signal strength [<{instance_index,
                                 gtbs}>] <strength>
   set_status_flags            :Set the bearer feature and status value
                                 [<{instance_index, gtbs}>] <feature_and_status>
   set_uri_scheme              :Set the URI prefix list <bearer_idx> <uri1 [uri2
                                 [uri3 [...]]]>
   print_calls                 :Output all calls in the debug log

초기화와 연결

uart:~$ bt init
uart:~$ bt connect xx:xx:xx:xx:xx:xx public

Client가 발신한 call을 remote peer가 응답

Client의 originate로 만든 call ID 1이 remote_answer에 의해 active가 됩니다.

<dbg> bt_tbs.write_call_cp: Index 0: Processing the originate opcode
<dbg> bt_tbs.originate_call: New call with call index 1
<dbg> bt_tbs.write_call_cp: Index 0: Processed the originate opcode with status success for call index 1
uart:~$ tbs remote_answer 1
TBS succeeded for call_id: 1

Remote incoming call을 client가 수락

Local URI, remote URI와 friendly name을 가진 incoming call을 생성하고 client의 accept 결과를 server debug에서 확인합니다.

uart:~$ tbs incoming 0 tel:123 tel:456 Peter
TBS succeeded for call_id: 4
<dbg> bt_tbs.bt_tbs_remote_incoming: New call with call index 4
<dbg> bt_tbs.write_call_cp: Index 0: Processed the accept opcode with status success for call index 4

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.