2008年4月15日 星期二

GVIM --- 指令

GVIM

[u]
動作還原
若不小心下錯指令,可以利用這個指令還原。
[K]
函式查詢
若您在 VIM 中撰寫 C/C++ 程式,可以在 C/C++ 標準函式厙提供的函式名字上按「K」,便可以呼叫出 man page 查詢該函式的用法
[=]
自動程式縮排對齊
若您在 VIM 中撰寫 C/C++ 程式,可以利用「gg」指令將游標移到視窗最上方、利用「v」切換到選取模式、再用「G」將游標移到檔案尾端 (即達到全選的功能),最後按「=」,VIM 便會幫你的程式做自動對齊
[ctrl]+[r]
動作重做
若不小心還原錯了,可以利用這個指令重做。

dd
將該行文字刪除
此項指令可與指令 p (貼上)配合使用
而變成是「剪下」的功能
dw
刪除該單字
cc
將該行文字改變
當輸入此指令時,游標所在該行會被刪除,並自動進入「輸入模式」
cw
改變該單字
當輸入此指令時,該單字在游標之後的字元會被刪除,並自動進入「輸入模式」

yy
將該行文字複製
指令 Y 有相同的功能
[p]
將所剪下或複製的文字貼上

[/]字串
向下搜尋字串
下達此命令之後,若文件中包含該「字串」,則文件中所有「字串」的背景顏色會被置換成較鮮明的顏色,在下達完搜尋指令之後,還可以透過「n」和「N」指令作進一步控制。
[n] 跳到下一個「字串」所在地
[N] 跳到上一個「字串」所在地
另外,把游標停在想要搜尋的字串上,按下「*」也可以達到向下搜尋的效果。


[k]
向上移動游標一個字元
也就是方向鍵的「↑」
[j]
向下移動游標一個字元
也就是方向鍵的「↓」
[h]向左移動游標一個字元
也就是方向鍵的「←」
[l]向右移動游標一個字元
也就是方向鍵的「→」

若想跳出輸入模式,則鍵入即可回到命令模式。
[i]在游標左方進入輸入模式
[I]
在游標所在行的行首進入輸入模式
[a]
在游標右方進入輸入模式
[A]在游標所在行的行尾進入輸入模式
[o](小寫英文字母 o)
在游標下一行另起新行,並進入輸入模式
[O](大寫英文字母 o)
在游標上一行另起新行,並進入輸入模式

2008年4月8日 星期二

SIP Intro --- SDP

SDP

RFC2327裡的會用到的ㄧ些重要資訊。


以下原文取自RFC3264
RFC 2543 [10] specified that placing a user on hold was complished by setting the connection address to 0.0.0.0. Its usage for putting a call on hold is no longer recommended, since it doesn’t allow for RTCP to be used with held streams, doesn’t work with IPv6, and breaks with connection oriented media. However, it can be useful in an initial offer when the offerer knows it wants to use a particular set of media streams and formats, but doesn’t know the addresses and ports at the time of the offer. Of course, when used, the port number MUST NOT be zero, which would specify that the stream has been disabled. An agent MUST be capable of receiving SDP with a connection address of 0.0.0.0, in which case it means that neither RTP nor RTCP should be sent to the peer.

SIP Intro --- Audio Codecs

Codecs

音訊編解碼標準

PCMU(G.711U)
類型:Audio
制定者:ITU-T
所需頻寬:64Kbps(90.4)
特性:PCMU和PCMA都能提供較好的語音品質,但是它們佔用的頻寬較高,需要64kbps。
優點:語音品質優
缺點:佔用的頻寬較高
應用領域:voip
版稅方式:Free
備註:PCMU and PCMA都能夠達到CD音質,但是它們消耗的頻寬也最多(64kbps)。如果網路頻寬比較低,可以選用低比特速率的編碼方法,如G.723或G.729,這兩種編碼的方法也能達到傳統長途電話的音質,但是需要很少的頻寬(G723需要5.3/6.3kbps,G729需要8kbps)。如果頻寬足夠並且需要更好的語音品質,就使用PCMU 和 PCMA,甚至可以使用寬頻的編碼方法G722(64kbps),這可以提供有高保真度的音質。
                                                                                                            


SIP Intro --- SDP (Offer/Answer)

SDP (Offer/Answer)

資料來源RFC3264




SDP Indicating Capabilities
v=0
o=carol 28908764872 28908764872 IN IP4 100.3.6.6
s=-
t=0 0
c=IN IP4 192.0.2.4
m=audio 0 RTP/AVP 0 1 3
a=rtpmap:0 PCMU/8000
a=rtpmap:1 1016/8000
a=rtpmap:3 GSM/8000
m=video 0 RTP/AVP 31 34
a=rtpmap:31 H261/90000
a=rtpmap:34 H263/90000



Assume that the caller, Alice, has included the following description
in her offer.
v=0
o=alice 2890844526 2890844526 IN IP4 host.anywhere.com
s=
c=IN IP4 host.anywhere.com
t=0 0
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000
m=video 51372 RTP/AVP 31
a=rtpmap:31 H261/90000
m=video 53000 RTP/AVP 32
a=rtpmap:32 MPV/90000



he returns the SDP below as the answer
v=0
o=bob 2890844730 2890844730 IN IP4 host.example.com
s=
c=IN IP4 host.example.com
t=0 0
m=audio 49920 RTP/AVP 0
a=rtpmap:0 PCMU/8000
m=video 0 RTP/AVP 31
m=video 53000 RTP/AVP 32
a=rtpmap:32 MPV/90000



Bob decides to change the port.
v=0
o=bob 2890844730 2890844731 IN IP4 host.example.com
s=
c=IN IP4 host.example.com
t=0 0
m=audio 65422 RTP/AVP 0
a=rtpmap:0 PCMU/8000
m=video 0 RTP/AVP 31
m=video 53000 RTP/AVP 32
a=rtpmap:32 MPV/90000
m=audio 51434 RTP/AVP 110
a=rtpmap:110 telephone-events/8000
a=recvonly



Alice accepts the additional media stream, and so generates the following answer:
v=0
o=alice 2890844526 2890844527 IN IP4 host.anywhere.com
s=
c=IN IP4 host.anywhere.com
t=0 0
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000
m=video 0 RTP/AVP 31
a=rtpmap:31 H261/90000
m=video 53000 RTP/AVP 32
a=rtpmap:32 MPV/90000
m=audio 53122 RTP/AVP 110
a=rtpmap:110 telephone-events/8000
a=sendonly



One of N Codec Selection

The initial offer from Alice to Bob indicates a single audio stream with the three audio codecs that are available in the DSP.
v=0
o=alice 2890844526 2890844526 IN IP4 host.anywhere.com
s=
c=IN IP4 host.anywhere.com
t=0 0
m=audio 62986 RTP/AVP 0 4 18
a=rtpmap:0 PCMU/8000
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=inactive



Bob can support dynamic switching between PCMU and G.723. So, he sends the following answer
v=0
o=bob 2890844730 2890844731 IN IP4 host.example.com
s=
c=IN IP4 host.example.com
t=0 0
m=audio 54344 RTP/AVP 0 4
a=rtpmap:0 PCMU/8000
a=rtpmap:4 G723/8000
a=inactive



Alice can then select any one of these two codecs.
v=0
o=alice 2890844526 2890844527 IN IP4 host.anywhere.com
s=
c=IN IP4 host.anywhere.com
t=0 0
m=audio 62986 RTP/AVP 4
a=rtpmap:4 G723/8000
a=sendrecv



Bob accepts the single codec
v=0
o=bob 2890844730 2890844732 IN IP4 host.example.com
s=
c=IN IP4 host.example.com
t=0 0
m=audio 54344 RTP/AVP 4
a=rtpmap:4 G723/8000
a=sendrecv

2008年4月2日 星期三

DTMF Tone Generator (Free Software)

D

TMF tone generator software (free)


NCH Tone Generator (Free Software)

這個軟體是免費的,除非要有進階功能才需要付費,而且還額外提供ㄧ些處理音頻訊號的PLUGIN下載使用。

使用此工具在依照我之前有一篇介紹的DTMF tone的說明,就可以自己產生DTMF Tone了!!!

可以去NCH官網查看~

以下是轉貼自他的官網簡介~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Typical Applications

Generation of test tones in radio and other studios for the alignment of levels.
Calibration and testing of audio equipment or speakers.
Tuning music instruments as an accurate reference tone.
Demonstration of audio principles to students.
Acoustics testing and equalisation.
Quality control and testing of sound cards.
White noise generator
Audio band signalling.
Hearing tests (under suitable medical supervision).

Features

Sine wave, square wave, triangular waveform, saw tooth waveform, impulse, white noise and pink noise.
Supports frequencies from 1Hz to 22kHz bandwidth (subject to sound card).
Multiple simultaneous tones (1 to 16 tones can be created at the same time) (useful to create harmonics).
Mono or separate stereo operation (ideal to create dual tones or 'beats').
Tone Sweeps (Log or Linear).
Plays tone or saves as wav file.


2008年3月31日 星期一

SIP Intro --- Standard Subscriber Line Tones

Line tones

取自E.182這個doc


E.182定義了標準會用到的Tones如下:

Dial tone: The exchange is ready to receive address information.

PABX internal dial tone: The PABX is ready to receive address information.

Special dial tone: Same as dial tone, but the caller’s line is subject to a specific condition, such as call diversion or a voice mail is available (e.g., "stutter dial tone").

Second dial tone: The network has accepted the address information, but additional information is required.

Ring: This named signal event causes the recipient to generate an alerting signal ("ring"). The actual tone or other indication used to render this named event is left up to the receiver. (This differs from the ringing tone, below, heard by the caller

Ringing tone: The call has been placed to the callee and a calling signal (ringing) is being transmitted to the callee. This tone is also called "ringback".

Special ringing tone: A special service, such as call forwarding or call waiting, is active at the called number.

Busy tone: The called telephone number is busy.

Congestion tone: Facilities necessary for the call are temporarily unavailable.

Calling card service tone: The calling card service tone consists of 60 ms of the sum of 941 Hz and 1477 Hz tones (DTMF ’#’), followed by 940 ms of 350 Hz and 440 Hz (U.S. dial tone), decaying exponentially with a time constant of 200 ms.

Special information tone: The callee cannot be reached, but the reason is neither "busy" nor "congestion". This tone should be used before all call failure announcements, for the benefit of automatic equipment.

Comfort tone: The call is being processed. This tone may be used during long post-dial delays, e.g., in international connections.

Hold tone: The caller has been placed on hold.

Record tone: The caller has been connected to an automatic answering device and is requested to begin speaking.

Caller waiting tone: The called station is busy, but has call waiting service.

Pay tone: The caller, at a payphone, is reminded to deposit additional coins.

Positive indication tone: The supplementary service has been activated.

Negative indication tone: The supplementary service could not be activated.

Off-hook warning tone: The caller has left the instrument off-hook for an extended period of time.


Call waiting tone: Another party wants to reach the subscriber.

Warning tone: The call is being recorded. This tone is not required in all jurisdictions.

Intrusion tone: The call is being monitored, e.g., by an operator.

CPE alerting signal: A tone used to alert a device to an arriving in-band FSK data transmission. A CPE alerting signal is a combined 2130 and 2750 Hz tone, both with tolerances of 0.5% and a duration of 80 to. 80 ms. The CPE alerting signal is used with ADSI services and Call Waiting ID services [14].

Payphone recognition tone: The person making the call or being called is using a payphone (and thus it is ill-advised to allow collect calls to such a person).


另外也定義Event與其encode

Event                     encoding (decimal)
_____________________________________________
Off Hook                                 64
On Hook                                  65
Dial tone                                66
PABX internal dial tone                  67
Special dial tone                        68
Second dial tone                         69
Ringing tone                             70
Special ringing tone                     71
Busy tone                                72
Congestion tone                          73
Special information tone                 74
Comfort tone                             75
Hold tone                                76
Record tone                              77
Caller waiting tone                      78
Call waiting tone                        79
Pay tone                                 80
Positive indication tone                 81
Negative indication tone                 82
Warning tone                             83
Intrusion tone                           84
Calling card service tone                85
Payphone recognition tone                86
CPE alerting signal (CAS)                87
Off-hook warning tone                    88
Ring                                     89


後續會做說明補充...

SIP Intro --- DTMF (轉貼&精簡)

DTMF (Dual Tone Multi-Frequency)
本文參考來源以及RFC2833


DTMF(Dual Tone Multi-Frequency)signaling,逐漸在全世界範圍內使用在按鍵式電話機上,因其提供更高的撥號速率,迅速取代了傳統轉盤式電話機使用的撥號脈衝信令。在VOIP中,DTMF仍是發揮著重要的作用。

一個DTMF信號由兩個頻率的音訊信號疊加構成。這兩個音訊信號的頻率來自兩組預分配的頻率組:行頻組或列頻組。每一對這樣的音訊信號唯一表示一個數位或符號。產生DTMF信號,就是利用兩個不同頻率的正弦波疊加以後形成的波形,解碼時則採用改進的Goertzel演算法,從頻域搜索兩個正弦波的存在。


1209 Hz   1336 Hz     1477 Hz    1633 Hz
ABC        DEF
697 Hz     1          2          3         A
GHI        JKL        MNO
770 Hz     4          5          6         B
PRS        TUV        WXY
852 Hz     7          8          9         C
oper
941 Hz     *          0          #         D


DTMF在VOIP中的解決方案
由於在IP網中的通信傳輸是採packet switch而不是傳統領域中的circuit switch以及IP網的不穩定的特性,DTMF在VOIP中應用的解決方案和傳統有所不同,並且暫時還未統一,有多種解決方案。主要有下列幾種:

1.用SIP的INFO方法攜帶DTMF信號

2.在RTP媒體傳輸中攜帶DTMF信號(此種又有In band與Out of band之分)

3.動態生成DTMF音訊信號



關於DTMF信號的時間間隔,CCITT對DTMF信號規定的指標是,傳送/接收率為每秒10個數字,即每個數字100ms。代表數字的音頻信號必須持續至少45ms,但不超過55ms。100ms內其他時間為靜音,以便區別連續的兩個按鍵信號。


Goertzel演算法
DTMF解碼即是在輸入信號中搜索出有效的行頻和列頻。計算數位信號的頻譜可以採用DFT及其快速演算法FFT,而在實現DTMF解碼時,採用Goertzel演算法要比FFT更快。通過FFT可以計算得到信號所有譜線,瞭解信號整個頻域資訊,而對於DTMF信號只用關心其8個行頻/列頻及其二次諧波資訊即可(二次諧波的資訊用於將DTMF信號與聲音信號區別開)。此時Goertzel演算法能更加快速的在輸入信號中提取頻譜資訊。

Discrete Fourier Transform (DFT)
Fast Fourier Transform (FFT)

2008年3月27日 星期四

SIP Intro --- REFER method

REFER method

講到這個method,就開始有點複雜了!

因為要有以前講過的觀念,然後加上REFER與Subscrib的概念。整個例子的流程會很大、Msg的量也會增加很多! 但是,又因為有了之前的基礎,因此可以省略很多個Msg的說明,所以我就可以把整個REFER這個例子的流程簡化了很多!

首先,REFER是用在CALL Transfer上面。以下就來說明一個例子吧,假設有A,B,C三個人,A打給B,然後HOLD B,再打給C,然後把B轉接給C。最後B與C結束通訊。

A INVITE B
A HOLD B
A INVITE C
A HOLD C
A REFER B TO C
B INVITE C
C BYE A
A BYE B
...
C BYE B (or B BYE C)

而CALL Transfer又不只一種形式,其中有兩種較為常見,一種是Attended transfer,另一種為Blind transfer。前者為轉接者(發REFER的UA),在接通兩方電話後,再做Transfer,上面的例子就是Attended transfer。而後者為先接通一方電話,再發送REFER要求對方去CALL第三方。

在此先不探討CALL Transfer的方式,我將focus在REFER這個method的使用,以及其相關概念。

下面的CALL flow是一個在Dialog外的REFER,因此其To不會有tag。而在Dialog外或內也何差異?主要差異在於在Dialog內的REFER不會有Fork的產生,但在Dialog外的REFER則允許有Fork的產生。Fork有分支的意思,在此先簡單瞭解一下,當一個Event package允許使用Fork時,就會產生數個SUBSCRIBE requests,因而就能產生multiple subscriptions,就如同分支一樣,所以才稱之為Fork。(SUBSCRIBE概念會在另一篇說明)

先來看這個session外REFER的例子。再看後面的例子的時候,可以注意一下幾個Header fields的值~

Call-ID:
CSeq:
Event:
Subscription-State:

以下是在A與B建立好通訊之後的情況


Agent A             Agent B
|                        |
|       F1 REFER         |
|----------------------->|
|    F2 202 Accepted     |
|<-----------------------|
|       F3 NOTIFY        |
|<-----------------------|
|       F4 200 OK        |
|----------------------->|
|                        |
|                        |
|                        |------->
|                        | (whatever)
|                        |<------
|                        |
|      F5 NOTIFY         |
|<-----------------------|
|      F6 200 OK         |
|----------------------->|
|                        |
|                        |


Message One (F1)
REFER sip:b@atlanta.example.com SIP/2.0
Via: SIP/2.0/UDP agenta.atlanta.example.com;branch=z9hG4bK2293940223
To:
From: ;tag=193402342
Call-ID: 898234234@agenta.atlanta.example.com
CSeq: 93809823 REFER
Max-Forwards: 70
Refer-To: (whatever URI)
Contact: sip:a@atlanta.example.com
Content-Length: 0


Message Two (F2)
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP agenta.atlanta.example.com;branch=z9hG4bK2293940223
To: ;tag=4992881234
From: ;tag=193402342
Call-ID: 898234234@agenta.atlanta.example.com
CSeq: 93809823 REFER
Contact: sip:b@atlanta.example.com
Content-Length: 0


Message Three (F3)
NOTIFY sip:a@atlanta.example.com SIP/2.0
Via: SIP/2.0/UDP agentb.atlanta.example.com;branch=z9hG4bK9922ef992-25
To: ;tag=193402342
From: ;tag=4992881234
Call-ID: 898234234@agenta.atlanta.example.com
CSeq: 1993402 NOTIFY
Max-Forwards: 70
Event: refer
Subscription-State: active;expires=(depends on Refer-To URI)
Contact: sip:b@atlanta.example.com
Content-Type: message/sipfrag;version=2.0
Content-Length: 20
SIP/2.0 100 Trying


Message Four (F4)
SIP/2.0 200 OK
Via: SIP/2.0/UDP agentb.atlanta.example.com;branch=z9hG4bK9922ef992-25
To: ;tag=193402342
From: ;tag=4992881234
Call-ID: 898234234@agenta.atlanta.example.com
CSeq: 1993402 NOTIFY
Contact: sip:a@atlanta.example.com
Content-Length: 0


Message Five (F5)
NOTIFY sip:a@atlanta.example.com SIP/2.0
Via: SIP/2.0/UDP agentb.atlanta.example.com;branch=z9hG4bK9323394234
To: ;tag=193402342
From: ;tag=4992881234
Call-ID: 898234234@agenta.atlanta.example.com
CSeq: 1993403 NOTIFY
Max-Forwards: 70
Event: refer
Subscription-State: terminated;reason=noresource
Contact: sip:b@atlanta.example.com
Content-Type: message/sipfrag;version=2.0
Content-Length: 16
SIP/2.0 200 OK


Message Six (F6)
SIP/2.0 200 OK
Via: SIP/2.0/UDP agentb.atlanta.example.com;branch=z9hG4bK9323394234
To: ;tag=193402342
From: ;tag=4992881234
Call-ID: 898234234@agenta.atlanta.example.com
CSeq: 1993403 NOTIFY
Contact: sip:a@atlanta.example.com
Content-Length: 0



以下為接續上面的例子,情況為在A在現有的Dialog裡,發送第二次REFER。(第一次REFER是在Dialog外)


Agent A               Agent B
|                        |
|       F7 REFER         |
|----------------------->|
|    F8 202 Accepted     |
|<-----------------------|
|       F9 NOTIFY        |
|<-----------------------|
|      F10 200 OK        |
|----------------------->|
|                        |------->
|                        | (something different)
|                        |<------
|                        |
|       F11 NOTIFY       |
|<-----------------------|
|       F12 200 OK       |
|----------------------->|
|                        |
|                        |


Message Seven (F7)
REFER sip:b@atlanta.example.com SIP/2.0
Via: SIP/2.0/UDP agenta.atlanta.example.com;branch=z9hG4bK9390399231
To: ;tag=4992881234
From: ;tag=193402342
Call-ID: 898234234@agenta.atlanta.example.com
CSeq: 93809824 REFER
Max-Forwards: 70
Refer-To: (some different URI)
Contact: sip:a@atlanta.example.com
Content-Length: 0


Message Eight (F8)
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP agenta.atlanta.example.com;branch=z9hG4bK9390399231
To: ;tag=4992881234
From: ;tag=193402342
Call-ID: 898234234@agenta.atlanta.example.com
CSeq: 93809824 REFER
Contact: sip:b@atlanta.example.com
Content-Length: 0


Message Nine (F9)
NOTIFY sip:a@atlanta.example.com SIP/2.0
Via: SIP/2.0/UDP agentb.atlanta.example.com;branch=z9hG4bK9320394238995
To: ;tag=193402342
From: ;tag=4992881234
Call-ID: 898234234@agenta.atlanta.example.com
CSeq: 1993404 NOTIFY
Max-Forwards: 70
Event: refer;id=93809824
Subscription-State: active;expires=(depends on Refer-To URI)
Contact: sip:b@atlanta.example.com
Content-Type: message/sipfrag;version=2.0
Content-Length: 20
SIP/2.0 100 Trying


Message Ten (F10)
SIP/2.0 200 OK
Via: SIP/2.0/UDP agentb.atlanta.example.com;branch=z9hG4bK9320394238995
To: ;tag=193402342
From: ;tag=4992881234
Call-ID: 898234234@agenta.atlanta.example.com
CSeq: 1993404 NOTIFY
Contact: sip:a@atlanta.example.com
Content-Length: 0


Message Eleven (F11)
NOTIFY sip:a@atlanta.example.com SIP/2.0
Via: SIP/2.0/UDP agentb.atlanta.example.com;branch=z9hG4bK2994a93eb-fe
To: ;tag=193402342
From: ;tag=4992881234
Call-ID: 898234234@agenta.atlanta.example.com
CSeq: 1993405 NOTIFY
Max-Forwards: 70
Event: refer;id=93809824
Subscription-State: terminated;reason=noresource
Contact: sip:b@atlanta.example.com
Content-Type: message/sipfrag;version=2.0
Content-Length: 16
SIP/2.0 200 OK


Message Twelve (F12)
SIP/2.0 200 OK
Via: SIP/2.0/UDP agentb.atlanta.example.com;branch=z9hG4bK2994a93eb-fe
To: ;tag=193402342
From: ;tag=4992881234
Call-ID: 898234234@agenta.atlanta.example.com
CSeq: 1993405 NOTIFY
Contact: sip:a@atlanta.example.com
Content-Length: 0

2008年3月26日 星期三

SIP Intro --- CANCEL method

CANCEL method的介紹

本節將會介紹CANCEL這個method,因為最近有focus這部分。

這個例子之前有說過

Alice                     Bob
|                        |
|       INVITE F1        |
|----------------------->|
|    180 Ringing F2      |
|<-----------------------|
|                        |
|       200 OK F3        |
|<-----------------------|
|         ACK F4         |
|----------------------->|
|   Both Way RTP Media   |
|<======================>|
|                        |
|         BYE F5         |
|<-----------------------|
|       200 OK F6        |
|----------------------->|
|                        |


我將以這個為基礎,說明CANCEL這個method的用法。首先,CANCEL的用途在於取消掉某一個REQUEST(就如這個例子的INVITE),而使用時有一個前提,就是要在RESPONSE之前送出,也就是說如果已經收到RESPONSE(2XX),則不能送CANCEL了,只能送BYE。而且要接收到Provisional response後才能送CANCEL。

OK,有了傳送的條件後,再來說CANCEL要有什麼內容限制。Request-URI、Call-ID、To、CSeq的數字部分、From(也包含了其tags)必須要跟要取消掉的REQUEST的內容一致,還有Via裡只能有一個值,這個值只能是打算要取消掉的REQUEST的Via中第一筆數據。這個內容限制就是用來找出妳要CANCEL的REQUEST(transaction)。如果沒有符合以上內容,則收到CANCEL的User Agent無法找到對應的transaction(call),UA就會回覆一個481 Call/Transaction does not exist。

符合有了以上的規範,才能正確的cancel掉妳想要cancel的request,UA就會回覆一個487 Request terminated!

成功CANCEL就會如下

Alice                      Bob
|                           |
|         INVITE F1         |
|-------------------------->|
|      180 Ringing F2       |
|<--------------------------|
|         CANCEL F3         |
|-------------------------->|
| 487 Request terminated F4 |
|<--------------------------|
|           ACK F5          |
|-------------------------->|



不成功的會像下面這樣子

Alice                         Bob
|                           |
|         INVITE F1         |
|-------------------------->|
|      180 Ringing F2       |
|<--------------------------|
|         CANCEL F3         |
|-------------------------->|
|   481 Call not exist F4   |(Call/Transaction 
|<--------------------------|  does not exist)
|           ACK F5          |
|-------------------------->|


以下是用Etherea抓的INVITE與CANCEL,可以參考對照一下。



搜尋此網誌