[MRCPv2 Protocol Introduction] SIP Session Example

MRCPv2 is the abbreviation of Media Resource Control Protocol Version 2 (MRCPv2). This article translates Section 4.3. SIP Session Example of RFC6787

4.3. SIP Session Example

This first example demonstrates the power of using SIP to route to the appropriate resource. In the example, notice that a request to the domain voice server service is used in the INVITE to [email protected]. The SIP routing mechanism in the domain finds the real server [email protected], which returns in a 200 OK. Note that "cmid" is defined in Section 4.4.

This example swap adds a resource control channel to the compositor. Since synthesizers also generate audio streams, this interaction also creates a receive-only Real-Time Protocol (RTP) [RFC3550] media session to which the server sends audio. SIP dialogs with media sources/sinks are independent of MRCP and are therefore not shown.

Example: Add Synthesizer Control Channel

C->S:

          INVITE sip:[email protected] SIP/2.0
          Via:SIP/2.0/TCP client.atlanta.example.com:5060;
           branch=z9hG4bK74bf1
          Max-Forwards:6
          To:MediaServer <sip:[email protected]>
          From:sarvi <sip:[email protected]>;tag=1928301774
          Call-ID:a84b4c76e66710
          CSeq:314161 INVITE
          Contact:<sip:[email protected]>
          Content-Type:application/sdp
          Content-Length:...

          v=0
          o=sarvi 2890844526 2890844526 IN IP4 192.0.2.12
          s=-
          c=IN IP4 192.0.2.12
          t=0 0
          m=application 9 TCP/MRCPv2 1   # 这里制定了MRCP协议
          a=setup:active                 # 客户端发起,active
          a=connection:new               # 是一个新的链接
          a=resource:speechsynth         # 资源是 语音合成
          a=cmid:1
          m=audio 49170 RTP/AVP 0
          a=rtpmap:0 pcmu/8000
          a=recvonly                   #注意 语音合成, 客户端是只收语音流
          a=mid:1

S->C:

          SIP/2.0 200 OK
          Via:SIP/2.0/TCP client.atlanta.example.com:5060;
           branch=z9hG4bK74bf1;received=192.0.32.10
          To:MediaServer <sip:[email protected]>;tag=62784
          From:sarvi <sip:[email protected]>;tag=1928301774
          Call-ID:a84b4c76e66710
          CSeq:314161 INVITE
          Contact:<sip:[email protected]>
          Content-Type:application/sdp
          Content-Length:...

          v=0
          o=- 2890842808 2890842808 IN IP4 192.0.2.11
          s=-
          c=IN IP4 192.0.2.11
          t=0 0
          m=application 32416 TCP/MRCPv2 1
          a=setup:passive   # 服务端接受,passive
          a=connection:new
          a=channel:32AECB234338@speechsynth   # 服务端生成一个channel
          a=cmid:1
          m=audio 48260 RTP/AVP 0
          a=rtpmap:0 pcmu/8000
          a=sendonly     #注意 语音合成, 服务端是只发语音流
          a=mid:1

C->S:

          ACK sip:[email protected] SIP/2.0
          Via:SIP/2.0/TCP client.atlanta.example.com:5060;
           branch=z9hG4bK74bf2
          Max-Forwards:6
          To:MediaServer <sip:[email protected]>;tag=62784
          From:Sarvi <sip:[email protected]>;tag=1928301774
          Call-ID:a84b4c76e66710
          CSeq:314161 ACK
          Content-Length:0

Example: Add Recognizer

C->S:

          INVITE sip:[email protected] SIP/2.0
          Via:SIP/2.0/TCP client.atlanta.example.com:5060;
           branch=z9hG4bK74bf3
          Max-Forwards:6
          To:MediaServer <sip:[email protected]>;tag=62784
          From:sarvi <sip:[email protected]>;tag=1928301774
          Call-ID:a84b4c76e66710
          CSeq:314162 INVITE
          Contact:<sip:[email protected]>
          Content-Type:application/sdp
          Content-Length:...

          v=0
          o=sarvi 2890844526 2890844527 IN IP4 192.0.2.12
          s=-
          c=IN IP4 192.0.2.12
          t=0 0
          m=application 9 TCP/MRCPv2 1
          a=setup:active
          a=connection:existing  # 注意这里的状态是existing,不再是new
          a=resource:speechsynth 
          a=cmid:1
          m=audio 49170 RTP/AVP 0 96
          a=rtpmap:0 pcmu/8000
          a=rtpmap:96 telephone-event/8000
          a=fmtp:96 0-15
          a=sendrecv   #注意 改成了收发同时
          a=mid:1
          m=application 9 TCP/MRCPv2 1
          a=setup:active
          a=connection:existing
          a=resource:speechrecog   # 添加一个新的
          a=cmid:1

S->C:

          SIP/2.0 200 OK
          Via:SIP/2.0/TCP client.atlanta.example.com:5060;
           branch=z9hG4bK74bf3;received=192.0.32.10
          To:MediaServer <sip:[email protected]>;tag=62784
          From:sarvi <sip:[email protected]>;tag=1928301774
          Call-ID:a84b4c76e66710
          CSeq:314162 INVITE
          Contact:<sip:[email protected]>
          Content-Type:application/sdp
          Content-Length:...

          v=0
          o=- 2890842808 2890842809 IN IP4 192.0.2.11
          s=-
          c=IN IP4 192.0.2.11
          t=0 0
          m=application 32416 TCP/MRCPv2 1
          a=setup:passive
          a=connection:existing
          a=channel:32AECB234338@speechsynth
          a=cmid:1
          m=audio 48260 RTP/AVP 0 96
          a=rtpmap:0 pcmu/8000
          a=rtpmap:96 telephone-event/8000
          a=fmtp:96 0-15
          a=sendrecv
          a=mid:1
          m=application 32416 TCP/MRCPv2 1
          a=setup:passive
          a=connection:existing
          a=channel:32AECB234338@speechrecog   # 新增加的语音识别channel
          a=cmid:1

C->S:

          ACK sip:[email protected] SIP/2.0
          Via:SIP/2.0/TCP client.atlanta.example.com:5060;
           branch=z9hG4bK74bf4
          Max-Forwards:6
          To:MediaServer <sip:[email protected]>;tag=62784
          From:Sarvi <sip:[email protected]>;tag=1928301774
          Call-ID:a84b4c76e66710
          CSeq:314162 ACK
          Content-Length:0

This example continues from the diagram above and allocates an additional resource control channel to the recognizer.
Since the recognizer needs to receive the audio stream for recognition, this interaction also updates the audio stream to sendrecv , making it a bi-directional RTP media session.


Example: Deallocate Recognizer

C->S:

          INVITE sip:[email protected] SIP/2.0
          Via:SIP/2.0/TCP client.atlanta.example.com:5060;
           branch=z9hG4bK74bf5
          Max-Forwards:6
          To:MediaServer <sip:[email protected]>;tag=62784
          From:sarvi <sip:[email protected]>;tag=1928301774
          Call-ID:a84b4c76e66710
          CSeq:314163 INVITE
          Contact:<sip:[email protected]>
          Content-Type:application/sdp
          Content-Length:...

          v=0
          o=sarvi 2890844526 2890844528 IN IP4 192.0.2.12
          s=-
          c=IN IP4 192.0.2.12
          t=0 0
          m=application 9 TCP/MRCPv2 1
          a=resource:speechsynth
          a=cmid:1
          m=audio 49170 RTP/AVP 0
          a=rtpmap:0 pcmu/8000
          a=recvonly
          a=mid:1
          m=application 0 TCP/MRCPv2 1
          a=resource:speechrecog
          a=cmid:1

S->C:

          SIP/2.0 200 OK
          Via:SIP/2.0/TCP client.atlanta.example.com:5060;
           branch=z9hG4bK74bf5;received=192.0.32.10
          To:MediaServer <sip:[email protected]>;tag=62784
          From:sarvi <sip:[email protected]>;tag=1928301774
          Call-ID:a84b4c76e66710
          CSeq:314163 INVITE
          Contact:<sip:[email protected]>
          Content-Type:application/sdp
          Content-Length:...

          v=0
          o=- 2890842808 2890842810 IN IP4 192.0.2.11
          s=-
          c=IN IP4 192.0.2.11
          t=0 0
          m=application 32416 TCP/MRCPv2 1
          a=channel:32AECB234338@speechsynth
          a=cmid:1
          m=audio 48260 RTP/AVP 0
          a=rtpmap:0 pcmu/8000
          a=sendonly
          a=mid:1
          m=application 0 TCP/MRCPv2 1
          a=channel:32AECB234338@speechrecog
          a=cmid:1

C->S:

          ACK sip:[email protected] SIP/2.0
          Via:SIP/2.0/TCP client.atlanta.example.com:5060;
           branch=z9hG4bK74bf6
          Max-Forwards:6
          To:MediaServer <sip:[email protected]>;tag=62784
          From:Sarvi <sip:[email protected]>;tag=1928301774
          Call-ID:a84b4c76e66710
          CSeq:314163 ACK
          Content-Length:0

This example continues from the figure above and unassigns the recognizer channel. Since the recognizer no longer needs to receive the audio stream, this interaction also updates the RTP media session to recvonly .

Guess you like

Origin blog.csdn.net/mimiduck/article/details/128266891
sip