asterisk sip codec协商

正常的codec协商包

<--- SIP read from UDP:192.168.4.18:5067--->

INVITE sip:[email protected] SIP/2.0

Via: SIP/2.0/UDP192.168.4.18:5067;branch=z9hG4bK424774178

From: "300"<sip:[email protected]>;tag=778739804

To: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 2 INVITE

Contact: <sip:[email protected]:5067>

Authorization: Digestusername="300", realm="asterisk",nonce="61bc3751", uri="sip:[email protected]",response="f9668313c2a854c6b5eb670899c79767",algorithm=MD5

Content-Type: application/sdp

Allow: INVITE, INFO, PRACK, ACK, BYE,CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE

Max-Forwards: 70

User-Agent: Yealink SIP-T28P 2.61.0.70

Supported: replaces

Allow-Events:talk,hold,conference,refer,check-sync

Content-Length: 282

 

v=0

o=- 21051 21051 IN IP4 192.168.4.18

s=SDP data

c=IN IP4 192.168.4.18

t=0 0

m=audio 11782 RTP/AVP 18 8 0 101

a=rtpmap:18 G729/8000

a=fmtp:18 annexb=no

a=rtpmap:8 PCMA/8000

a=rtpmap:0 PCMU/8000

a=fmtp:101 0-15

a=rtpmap:101 telephone-event/8000

a=ptime:20

a=sendrecv

 

<------------->

--- (15 headers 14 lines) ---

Sending to 192.168.4.18 : 5067 (no NAT)

Using INVITE request as basis request [email protected]

Found peer '300' for '300' from192.168.4.18:5067

Found RTP audio format 18

Found RTP audio format 8

Found RTP audio format 0

Found RTP audio format 101

Found audio description format G729 for ID18

Found audio description format PCMA for ID8

Found audio description format PCMU for ID0

Found audio description formattelephone-event for ID 101

Capabilities: us - 0x10c (ulaw|alaw|g729), peer - audio=0x10c (ulaw|alaw|g729)/video=0x0(nothing)/text=0x0 (nothing), combined - 0x10c (ulaw|alaw|g729)

Non-codec capabilities (dtmf): us - 0x1(telephone-event), peer - 0x1 (telephone-event), combined - 0x1(telephone-event)

Peer audio RTP is at port192.168.4.18:11782

Looking for 301 in DLPN_DialPlan300 (domain 192.168.4.122)

list_route: hop:<sip:[email protected]:5067>

 

<--- Transmitting (no NAT) to192.168.4.18:5067 --->

SIP/2.0 100 Trying

Via: SIP/2.0/UDP192.168.4.18:5067;branch=z9hG4bK424774178;received=192.168.4.18

From: "300"<sip:[email protected]>;tag=778739804

To: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 2 INVITE

Server: MyPBX

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE,REFER, SUBSCRIBE, NOTIFY, INFO

Supported: replaces, timer

Contact: <sip:[email protected]>

Content-Length: 0

 

<------------>

   -- Executing [301@DLPN_DialPlan300:1]Macro("SIP/300-00000002", "stdexten,301,SIP/301") in newstack

   -- Executing [s@macro-stdexten:1] Set("SIP/300-00000002","IsFromOutside=0") in new stack

   -- Executing [s@macro-stdexten:2] Macro("SIP/300-00000002","realstexten,301,SIP/301,tTkKWwXx") in new stack

   -- Executing [s@macro-realstexten:1] Set("SIP/300-00000002","DYNAMIC_FEATURES=twstart") in new stack

   -- Executing [s@macro-realstexten:2]GotoIf("SIP/300-00000002", "0?Blacklist-Handle,s,1") in newstack

   -- Executing [s@macro-realstexten:3] Set("SIP/300-00000002","TIMEOUT(absolute)=6000") in new stack

Channel will hangup at 2012-10-0516:54:01.274 ???.

   -- Executing [s@macro-realstexten:4] Set("SIP/300-00000002","CKTSETTRANSFER=0") in new stack

   -- Executing [s@macro-realstexten:5] Set("SIP/300-00000002","REALARG1=301") in new stack

   -- Executing [s@macro-realstexten:6]GotoIf("SIP/300-00000002", "0>0?follow-me,1") in newstack

   -- Executing [s@macro-realstexten:7]GotoIf("SIP/300-00000002", "0>0?vm-u,1") in new stack

   -- Executing [s@macro-realstexten:8] Set("SIP/300-00000002","RINGTIME=30") in new stack

   -- Executing [s@macro-realstexten:9]CktStdCall("SIP/300-00000002", "srtpfor,SIP/301,novalue")in new stack

   -- Executing [s@macro-realstexten:10] Set("SIP/300-00000002","_SIPSRTP=0") in new stack

   -- Executing [s@macro-realstexten:11] Dial("SIP/300-00000002","SIP/301,30,tTkKWwXx") in new stack

  ==Using SIP RTP TOS bits 184

  ==Using SIP RTP CoS mark 5

  ==Using SIP VRTP TOS bits 136

  ==Using SIP VRTP CoS mark 4

Audio is at 192.168.4.122 port 10282

Adding codec 0x4 (ulaw) to SDP

Adding codec 0x8 (alaw) to SDP

 

<--- SIP read from UDP:192.168.4.18:5067--->

SIP/2.0 200 OK

Via: SIP/2.0/UDP192.168.4.122:5060;branch=z9hG4bK7e70b194;rport

From: <sip:[email protected]>;tag=as5a4d8aee

To: "300"<sip:[email protected]>;tag=43927923

Call-ID: [email protected]

CSeq: 102 NOTIFY

User-Agent: Yealink SIP-T28P 2.61.0.70

Content-Length: 0

 

<------------->

--- (8 headers 0 lines) ---

SIP Response message for INCOMING dialogNOTIFY arrived

Adding codec 0x100 (g729) to SDP

Adding non-codec 0x1 (telephone-event) toSDP

Reliably Transmitting (no NAT) to192.168.4.26:5066:

INVITE sip:[email protected]:5066 SIP/2.0

Via: SIP/2.0/UDP192.168.4.122:5060;branch=z9hG4bK7ca8a118;rport

Max-Forwards: 70

From: "300"<sip:[email protected]>;tag=as09e7c96d

To: <sip:[email protected]:5066>

Contact: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 102 INVITE

User-Agent: MyPBX

Date: Fri, 05 Oct 2012 07:14:01 GMT

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE,REFER, SUBSCRIBE, NOTIFY, INFO

Supported: replaces, timer

Content-Type: application/sdp

Content-Length: 311

 

v=0

o=root 567018984 567018984 IN IP4 192.168.4.122

s=Asterisk PBX SVN--r2721M

c=IN IP4 192.168.4.122

t=0 0

m=audio 10282 RTP/AVP 0 8 18 101

a=rtpmap:0 PCMU/8000

a=rtpmap:8 PCMA/8000

a=rtpmap:18 G729/8000

a=fmtp:18 annexb=no

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-16

a=ptime:20

a=sendrecv

 

   -- Called 301

 

<--- SIP read from UDP:192.168.4.26:5066--->

SIP/2.0 100 Trying

Via: SIP/2.0/UDP192.168.4.122:5060;branch=z9hG4bK53008412;rport

From: "300"<sip:[email protected]>;tag=as20c8c805

To: <sip:[email protected]:5066>

Call-ID: [email protected]

CSeq: 102 INVITE

User-Agent: Yealink SIP-T28P 2.61.0.80

Content-Length: 0

 

<--- SIP read from UDP:192.168.4.26:5066--->

SIP/2.0 180 Ringing

Via: SIP/2.0/UDP192.168.4.122:5060;branch=z9hG4bK53008412;rport

From: "300"<sip:[email protected]>;tag=as20c8c805

To:<sip:[email protected]:5066>;tag=1545051705

Call-ID: [email protected]

CSeq: 102 INVITE

Contact: <sip:[email protected]:5066>

Allow: INVITE, INFO, PRACK, ACK, BYE,CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE

User-Agent: Yealink SIP-T28P 2.61.0.80

Allow-Events:talk,hold,conference,refer,check-sync

Content-Length: 0

 

<------------->

--- (11 headers 0 lines) ---

   -- SIP/301-00000005 is ringing

 

<--- Transmitting (no NAT) to192.168.4.18:5067 --->

SIP/2.0 180 Ringing

Via: SIP/2.0/UDP192.168.4.18:5067;branch=z9hG4bK948972928;received=192.168.4.18

From: "300"<sip:[email protected]>;tag=397490258

To: <sip:[email protected]>;tag=as64a49174

Call-ID: [email protected]

CSeq: 2 INVITE

Server: MyPBX

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE,REFER, SUBSCRIBE, NOTIFY, INFO

Supported: replaces, timer

Contact: <sip:[email protected]>

Content-Length: 0

 

<--- SIP read from UDP:192.168.4.26:5066--->

SIP/2.0 200 OK

Via: SIP/2.0/UDP192.168.4.122:5060;branch=z9hG4bK53008412;rport

From: "300"<sip:[email protected]>;tag=as20c8c805

To: <sip:[email protected]:5066>;tag=1545051705

Call-ID: [email protected]

CSeq: 102 INVITE

Contact: <sip:[email protected]:5066>

Content-Type: application/sdp

Allow: INVITE, INFO, PRACK, ACK, BYE,CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE

User-Agent: Yealink SIP-T28P 2.61.0.80

Content-Length: 234

 

v=0

o=- 20286 20286 IN IP4 192.168.4.26

s=SDP data

c=IN IP4 192.168.4.26

t=0 0

m=audio 11780 RTP/AVP 18 101

a=rtpmap:18 G729/8000

a=fmtp:18 annexb=no

a=sendrecv

a=ptime:20

a=fmtp:101 0-15

a=rtpmap:101 telephone-event/8000

 

--- (11 headers 12 lines) ---

Found RTP audio format 18

Found RTP audio format 101

Found audio description format G729 for ID18

Found audio description formattelephone-event for ID 101

Capabilities: us - 0x10c (ulaw|alaw|g729), peer - audio=0x100(g729)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0x100 (g729)

Non-codec capabilities (dtmf): us - 0x1(telephone-event), peer - 0x1 (telephone-event), combined - 0x1(telephone-event)

Peer audio RTP is at port 192.168.4.26:11780

   -- g729tolin_new

   -- use count: 1

   -- lintog729_new

   -- use count: 2

list_route: hop:<sip:[email protected]:5066>

set_destination: Parsing<sip:[email protected]:5066> for address/port to send to

set_destination: set destination to192.168.4.26, port 5066

Transmitting (no NAT) to 192.168.4.26:5066:

ACK sip:[email protected]:5066 SIP/2.0

Via: SIP/2.0/UDP192.168.4.122:5060;branch=z9hG4bK66d1d8f7;rport

Max-Forwards: 70

From: "300"<sip:[email protected]>;tag=as20c8c805

To: <sip:[email protected]:5066>;tag=1545051705

Contact: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 102 ACK

User-Agent: MyPBX

Content-Length: 0

 

不支持发起方codec

<--- SIP read from UDP:192.168.4.18:5067--->

INVITE sip:[email protected] SIP/2.0

Via: SIP/2.0/UDP192.168.4.18:5067;branch=z9hG4bK313013269

From: "300"<sip:[email protected]>;tag=296948853

To: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 2 INVITE

Contact: <sip:[email protected]:5067>

Authorization: Digestusername="300", realm="asterisk", nonce="387c28fd",uri="sip:[email protected]", response="d6bec2f58aceb8cf9183efdf75ed7301",algorithm=MD5

Content-Type: application/sdp

Allow: INVITE, INFO, PRACK, ACK, BYE,CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE

Max-Forwards: 70

User-Agent: Yealink SIP-T28P 2.61.0.70

Supported: replaces

Allow-Events:talk,hold,conference,refer,check-sync

Content-Length: 235

 

v=0

o=- 21047 21047 IN IP4 192.168.4.18

s=SDP data

c=IN IP4 192.168.4.18

t=0 0

m=audio 11780 RTP/AVP 8 0 101

a=rtpmap:8 PCMA/8000

a=rtpmap:0 PCMU/8000

a=fmtp:101 0-15

a=rtpmap:101 telephone-event/8000

a=ptime:20

a=sendrecv

 

<------------->

--- (15 headers 12 lines) ---

Sending to 192.168.4.18 : 5067 (no NAT)

Using INVITE request as basis request [email protected]

Found peer '300' for '300' from192.168.4.18:5067

Found RTP audio format 8

Found RTP audio format 0

Found RTP audio format 101

Found audio description format PCMA for ID8

Found audio description format PCMU for ID0

Found audio description formattelephone-event for ID 101

Capabilities: us - 0x100 (g729), peer -audio=0xc (ulaw|alaw)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0x0(nothing)

Non-codec capabilities (dtmf): us - 0x1(telephone-event), peer - 0x1 (telephone-event), combined - 0x1(telephone-event)

[2012-10-05 14:47:38] NOTICE[765]:chan_sip.c:8819 process_sdp: No compatible codecs, not accepting this offer!

 

<--- Reliably Transmitting (no NAT) to192.168.4.18:5067 --->

SIP/2.0 488 Not acceptable here

Via: SIP/2.0/UDP192.168.4.18:5067;branch=z9hG4bK313013269;received=192.168.4.18

From: "300"<sip:[email protected]>;tag=296948853

To:<sip:[email protected]>;tag=as7bd77b6d

Call-ID: [email protected]

CSeq: 2 INVITE

Server: MyPBX

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE,REFER, SUBSCRIBE, NOTIFY, INFO

Supported: replaces, timer

Content-Length: 0

 

 不支持被叫方codec

<--- SIP read from UDP:192.168.4.18:5067--->

INVITE sip:[email protected] SIP/2.0

Via: SIP/2.0/UDP192.168.4.18:5067;branch=z9hG4bK1575142430

From: "300"<sip:[email protected]>;tag=920581371

To: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 2 INVITE

Contact: <sip:[email protected]:5067>

Authorization: Digestusername="300", realm="asterisk", nonce="15ab2d9a",uri="sip:[email protected]", response="a5800d22176648a208ac4c70a04e490b", algorithm=MD5

Content-Type: application/sdp

Allow: INVITE, INFO, PRACK, ACK, BYE,CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE

Max-Forwards: 70

User-Agent: Yealink SIP-T28P 2.61.0.70

Supported: replaces

Allow-Events:talk,hold,conference,refer,check-sync

Content-Length: 306

 

v=0

o=- 21046 21046 IN IP4 192.168.4.18

s=SDP data

c=IN IP4 192.168.4.18

t=0 0

m=audio 11780 RTP/AVP 8 0 9 18 101

a=rtpmap:8 PCMA/8000

a=rtpmap:0 PCMU/8000

a=rtpmap:9 G722/8000

a=rtpmap:18 G729/8000

a=fmtp:18 annexb=no

a=fmtp:101 0-15

a=rtpmap:101 telephone-event/8000

a=ptime:20

a=sendrecv

 

<------------->

--- (15 headers 15 lines) ---

Sending to 192.168.4.18 : 5067 (no NAT)

Using INVITE request as basis request [email protected]

Found peer '300' for '300' from192.168.4.18:5067

Found RTP audio format 8

Found RTP audio format 0

Found RTP audio format 9

Found RTP audio format 18

Found RTP audio format 101

Found audio description format PCMA for ID8

Found audio description format PCMU for ID0

Found audio description format G722 for ID9

Found audio description format G729 for ID18

Found audio description formattelephone-event for ID 101

Capabilities: us - 0xc (ulaw|alaw), peer -audio=0x110c(ulaw|alaw|g729|g722)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0xc(ulaw|alaw)

Non-codec capabilities (dtmf): us - 0x1(telephone-event), peer - 0x1 (telephone-event), combined - 0x1(telephone-event)

Peer audio RTP is at port192.168.4.18:11780

Looking for 301 in DLPN_DialPlan300 (domain 192.168.4.122)

list_route: hop:<sip:[email protected]:5067>

 

<--- Transmitting (no NAT) to192.168.4.18:5067 --->

SIP/2.0 100 Trying

Via: SIP/2.0/UDP192.168.4.18:5067;branch=z9hG4bK1575142430;received=192.168.4.18

From: "300"<sip:[email protected]>;tag=920581371

To: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 2 INVITE

Server: MyPBX

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE,REFER, SUBSCRIBE, NOTIFY, INFO

Supported: replaces, timer

Contact: <sip:[email protected]>

Content-Length: 0

 

<------------>

   -- Executing [301@DLPN_DialPlan300:1] Macro("SIP/300-00000019","stdexten,301,SIP/301") in new stack

   -- Executing [s@macro-stdexten:1] Set("SIP/300-00000019","IsFromOutside=0") in new stack

   -- Executing [s@macro-stdexten:2] Macro("SIP/300-00000019","realstexten,301,SIP/301,tTkKWwXx") in new stack

   -- Executing [s@macro-realstexten:1] Set("SIP/300-00000019","DYNAMIC_FEATURES=twstart") in new stack

   -- Executing [s@macro-realstexten:2]GotoIf("SIP/300-00000019", "0?Blacklist-Handle,s,1") in newstack

   -- Executing [s@macro-realstexten:3] Set("SIP/300-00000019","TIMEOUT(absolute)=6000") in new stack

Channel will hangup at 2012-10-0516:19:21.493 ???.

   -- Executing [s@macro-realstexten:4] Set("SIP/300-00000019","CKTSETTRANSFER=0") in new stack

   -- Executing [s@macro-realstexten:5] Set("SIP/300-00000019","REALARG1=301") in new stack

   -- Executing [s@macro-realstexten:6]GotoIf("SIP/300-00000019", "0>0?follow-me,1") in newstack

   -- Executing [s@macro-realstexten:7]GotoIf("SIP/300-00000019", "0>0?vm-u,1") in new stack

    --Executing [s@macro-realstexten:8] Set("SIP/300-00000019","RINGTIME=30") in new stack

   -- Executing [s@macro-realstexten:9]CktStdCall("SIP/300-00000019", "srtpfor,SIP/301,novalue")in new stack

   -- Executing [s@macro-realstexten:10] Set("SIP/300-00000019","_SIPSRTP=0") in new stack

   -- Executing [s@macro-realstexten:11] Dial("SIP/300-00000019","SIP/301,30,tTkKWwXx") in new stack

  ==Using SIP RTP TOS bits 184

  ==Using SIP RTP CoS mark 5

  ==Using SIP VRTP TOS bits 136

  ==Using SIP VRTP CoS mark 4

Audio is at 192.168.4.122 port 11150

Adding codec 0x4 (ulaw) to SDP

Adding codec 0x8 (alaw) to SDP

Adding codec 0x100 (g729) to SDP

Adding codec 0x1000 (g722) to SDP

Adding non-codec 0x1 (telephone-event) toSDP

Reliably Transmitting (no NAT) to192.168.4.26:5067:

INVITE sip:[email protected]:5067 SIP/2.0

Via: SIP/2.0/UDP192.168.4.122:5060;branch=z9hG4bK516d07fb;rport

Max-Forwards: 70

From: "300"<sip:[email protected]>;tag=as187de9c6

To: <sip:[email protected]:5067>

Contact: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 102 INVITE

User-Agent: MyPBX

Date: Sun, 02 Jan 2000 21:36:04 GMT

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE,REFER, SUBSCRIBE, NOTIFY, INFO

Supported: replaces, timer

Content-Type: application/sdp

Content-Length: 337

 

v=0

o=root 1762416231 1762416231 IN IP4192.168.4.122

s=Asterisk PBX SVN--r2721M

c=IN IP4 192.168.4.122

t=0 0

m=audio 11150 RTP/AVP 0 8 18 9 101

a=rtpmap:0 PCMU/8000

a=rtpmap:8 PCMA/8000

a=rtpmap:18 G729/8000

a=fmtp:18 annexb=no

a=rtpmap:9 G722/8000

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-16

a=ptime:20

a=sendrecv

 

---

   -- Called 301

 

<--- SIP read from UDP:192.168.4.26:5067--->

SIP/2.0 100 Trying

Via: SIP/2.0/UDP192.168.4.122:5060;branch=z9hG4bK516d07fb;rport

From: "300"<sip:[email protected]>;tag=as187de9c6

To: <sip:[email protected]:5067>

Call-ID: [email protected]

CSeq: 102 INVITE

User-Agent: Yealink SIP-T28P 2.61.0.80

Content-Length: 0

 

<--- SIP read from UDP:192.168.4.26:5067--->

SIP/2.0 488 Not Acceptable Here

Via: SIP/2.0/UDP192.168.4.122:5060;branch=z9hG4bK516d07fb;rport

From: "300"<sip:[email protected]>;tag=as187de9c6

To:<sip:[email protected]:5067>;tag=1908231474

Call-ID: [email protected]

CSeq: 102 INVITE

User-Agent: Yealink SIP-T28P 2.61.0.80

Warning: 304 info "No supported mediatype found"

Content-Length: 0

 

<------------->

--- (9 headers 0 lines) ---

Transmitting (no NAT) to 192.168.4.26:5067:

ACK sip:[email protected]:5067 SIP/2.0

Via: SIP/2.0/UDP 192.168.4.122:5060;branch=z9hG4bK516d07fb;rport

Max-Forwards: 70

From: "300"<sip:[email protected]>;tag=as187de9c6

To:<sip:[email protected]:5067>;tag=1908231474

Contact: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 102 ACK

User-Agent: MyPBX

Content-Length: 0

 

  ==Everyone is busy/congested at this time (1:0/1/0)

   -- Executing [s@macro-realstexten:12] Goto("SIP/300-00000019","s-CONGESTION,1") in new stack

   -- Goto (macro-realstexten,s-CONGESTION,1)

   -- Executing [s-CONGESTION@macro-realstexten:1]GotoIf("SIP/300-00000019", "0>0?cktcheck,1") in newstack

   -- Executing [s-CONGESTION@macro-realstexten:2]Goto("SIP/300-00000019", "s-NOANSWER,1") in new stack

   -- Goto (macro-realstexten,s-NOANSWER,1)

    --Executing [s-NOANSWER@macro-realstexten:1] GotoIf("SIP/300-00000019","1>0?follow-me,1:1-out,1") in new stack

   -- Goto (macro-realstexten,follow-me,1)

   -- Executing [follow-me@macro-realstexten:1]GotoIf("SIP/300-00000019", "1>0?vm-u,1") in new stack

   -- Goto (macro-realstexten,vm-u,1)

   -- Executing [vm-u@macro-realstexten:1]GotoIf("SIP/300-00000019", "0?vm-u,2:vm-unavail,1") in newstack

   -- Goto (macro-realstexten,vm-unavail,1)

   -- Executing [vm-unavail@macro-realstexten:1] VoiceMail("SIP/300-00000019","301,u") in new stack

Audio is at 192.168.4.122 port 10002

Adding codec 0x4 (ulaw) to SDP

Adding codec 0x8 (alaw) to SDP

Adding non-codec 0x1 (telephone-event) toSDP

MyPBX*CLI>

<--- Reliably Transmitting (no NAT) to192.168.4.18:5067 --->

SIP/2.0 200 OK

Via: SIP/2.0/UDP192.168.4.18:5067;branch=z9hG4bK1575142430;received=192.168.4.18

From: "300"<sip:[email protected]>;tag=920581371

To:<sip:[email protected]>;tag=as164cf809

Call-ID: [email protected]

CSeq: 2 INVITE

Server: MyPBX

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE,REFER, SUBSCRIBE, NOTIFY, INFO

Supported: replaces, timer

Contact: <sip:[email protected]>

Content-Type: application/sdp

Content-Length: 264

MyPBX*CLI>

v=0

o=root 371020670 371020670 IN IP4 192.168.4.122

s=Asterisk PBX SVN--r2721M

c=IN IP4 192.168.4.122

t=0 0

m=audio 10002 RTP/AVP 0 8 101

a=rtpmap:0 PCMU/8000

a=rtpmap:8 PCMA/8000

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-16

a=ptime:20

a=sendrecv

 

 分机互打协商过程解析

步骤1: MyPBX收到A的SDP后,协商确定A与MyPBX之间的最优编码.

步骤2: MyPBX发送SDP给B时,会把步骤-1协商好的最优编码放置于SDP编码的首位.B根据本地设置,确定B与MyPBX之间的编码.


设置codec的相关函数:

sip_new:

1: 为sip分机创建一个通道.

   /*Set the native formats for audio  andmerge in video */

  tmp->nativeformats = ast_codec_choose(&i->prefs, what, 1) |video | text;

2: 为该通道选择最优编码.

   /*Set the native formats for audio  andmerge in video */

  fmt = ast_best_codec(tmp->nativeformats);

3: 赋值相关成员变量.

   tmp->writeformat = fmt;

  tmp->rawwriteformat = fmt;

  tmp->readformat = fmt;

  tmp->rawreadformat = fmt;


process_sdp:

1. 根据sdp包含的编码信息,设置通道的读写编码格式.

  ast_set_read_format(p->owner, p->owner->readformat);

  ast_set_write_format(p->owner, p->owner->writeformat);

2. 在set_format函数中,根据原始和目标编码的类型,设置编码转换回调结构体.struct ast_trans_pvt;

 

步骤1 过程介绍

MyPBX收到A的SDP后,协商确定A与MyPBX之间的最优编码.

若A与MyPBX之间没有相同的编码支持,MyPBX返回488告知A.呼叫失败.

若A与MyPBX时间有多个相同的编码支持,MyPBX选择最优编码.发SDP包告知A.

编码的优化顺序一般为:ulaw|alaw|g729|g722

首选ulaw/alaw,编解码快,压缩比2:1.

次选g729,没有压缩,但也没有编解码的性能消耗.

再选g722,压缩比高,但编解码性能消耗较多.

 

<--- SIP read from UDP:192.168.4.18:5062--->

INVITE sip:[email protected] SIP/2.0

Via: SIP/2.0/UDP192.168.4.18:5062;branch=z9hG4bK330291957

From: "500"<sip:[email protected]>;tag=1071929271

To: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 1 INVITE

Contact: <sip:[email protected]:5062>

Content-Type: application/sdp

Allow: INVITE, INFO, PRACK, ACK, BYE,CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE

Max-Forwards: 70

User-Agent: Yealink SIP-T28P 2.61.0.70

Supported: replaces

Allow-Events:talk,hold,conference,refer,check-sync

Content-Length: 306

 

v=0

o=- 21137 21137 IN IP4 192.168.4.18

s=SDP data

c=IN IP4 192.168.4.18

t=0 0

m=audio 11784 RTP/AVP 9 18 8 0 101

a=rtpmap:9 G722/8000

a=rtpmap:18 G729/8000

a=fmtp:18 annexb=no

a=rtpmap:8 PCMA/8000

a=rtpmap:0 PCMU/8000

a=fmtp:101 0-15

a=rtpmap:101 telephone-event/8000

a=ptime:20

a=sendrecv

 

<------------->

--- (14 headers 15 lines) ---

  ==Using SIP RTP TOS bits 184

  ==Using SIP RTP CoS mark 5

  ==Using SIP VRTP TOS bits 136

  ==Using SIP VRTP CoS mark 4

Sending to 192.168.4.18 : 5062 (NAT)

Using INVITE request as basis request [email protected]

Found peer '500' for '500' from 192.168.4.18:5062

 

<--- Reliably Transmitting (no NAT) to192.168.4.18:5062 --->

SIP/2.0 401 Unauthorized

Via: SIP/2.0/UDP192.168.4.18:5062;branch=z9hG4bK330291957;received=192.168.4.18

From: "500"<sip:[email protected]>;tag=1071929271

To: <sip:[email protected]>;tag=as6fbd5d05

Call-ID: [email protected]

CSeq: 1 INVITE

Server: MyPBX

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE,REFER, SUBSCRIBE, NOTIFY, INFO

Supported: replaces, timer

WWW-Authenticate: Digest algorithm=MD5,realm="asterisk", nonce="67ce7ca2"

Content-Length: 0

 

<------------->

--- (14 headers 0 lines) ---

Creating new subscription

Sending to 192.168.4.18 : 5062 (no NAT)

Found peer '500' for '500' from192.168.4.18:5062

Looking for 505 in hintcontext (domain 192.168.5.44)

Scheduling destruction of SIP dialog'[email protected]' in 70000 ms (Method: SUBSCRIBE)

 

<--- SIP read from UDP:192.168.4.18:5062--->

INVITE sip:[email protected] SIP/2.0

Via: SIP/2.0/UDP192.168.4.18:5062;branch=z9hG4bK1993271819

From: "500"<sip:[email protected]>;tag=1071929271

To: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 2 INVITE

Contact: <sip:[email protected]:5062>

Authorization: Digestusername="500", realm="asterisk",nonce="67ce7ca2", uri="sip:[email protected]",response="98b37c3e10bb52a4fc7be44746a6689e", algorithm=MD5

Content-Type: application/sdp

Allow: INVITE, INFO, PRACK, ACK, BYE,CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE

Max-Forwards: 70

User-Agent: Yealink SIP-T28P 2.61.0.70

Supported: replaces

Allow-Events: talk,hold,conference,refer,check-sync

Content-Length: 306

 

v=0

o=- 21137 21137 IN IP4 192.168.4.18

s=SDP data

c=IN IP4 192.168.4.18

t=0 0

m=audio 11784 RTP/AVP 9 18 8 0 101

a=rtpmap:9 G722/8000

a=rtpmap:18 G729/8000

a=fmtp:18 annexb=no

a=rtpmap:8 PCMA/8000

a=rtpmap:0 PCMU/8000

a=fmtp:101 0-15

a=rtpmap:101 telephone-event/8000

a=ptime:20

a=sendrecv

 

<------------->

--- (15 headers 15 lines) ---

Sending to 192.168.4.18 : 5062 (no NAT)

Using INVITE request as basis request [email protected]

Found peer '500' for '500' from192.168.4.18:5062

Found RTP audio format 9

Found RTP audio format 18

Found RTP audio format 8

Found RTP audio format 0

Found RTP audio format 101

Found audio description format G722 for ID9

Found audio description format G729 for ID18

Found audio description format PCMA for ID8

Found audio description format PCMU for ID0

Found audio description formattelephone-event for ID 101

[2012-10-08 01:20:41] NOTICE[549]:chan_sip.c:8805 process_sdp: p(17279596)->owner(86299164) Capabilities:

[2012-10-08 01:20:41] NOTICE[549]:chan_sip.c:8806 process_sdp: us       -0x110c (ulaw|alaw|g729|g722)

[2012-10-08 01:20:41] NOTICE[549]:chan_sip.c:8807 process_sdp: peer     -0x110c (ulaw|alaw|g729|g722)

[2012-10-08 01:20:41] NOTICE[549]: chan_sip.c:8808process_sdp: combined - 0x110c(ulaw|alaw|g729|g722)

Non-codec capabilities (dtmf): us - 0x1(telephone-event), peer - 0x1 (telephone-event), combined - 0x1(telephone-event)

Peer audio RTP is at port192.168.4.18:11784

Looking for 505 in DLPN_DialPlan500 (domain 192.168.5.44)

[2012-10-08 01:20:41] NOTICE[549]:chan_sip.c:6964 sip_new: sip_new set owner to chan(68177924 SIP/500-00000014)

list_route: hop:<sip:[email protected]:5062>

 

<--- Transmitting (no NAT) to192.168.4.18:5062 --->

SIP/2.0 100 Trying

Via: SIP/2.0/UDP 192.168.4.18:5062;branch=z9hG4bK1993271819;received=192.168.4.18

From: "500"<sip:[email protected]>;tag=1071929271

To: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 2 INVITE

Server: MyPBX

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE,REFER, SUBSCRIBE, NOTIFY, INFO

Supported: replaces, timer

Contact: <sip:[email protected]>

Content-Length: 0

 

步骤2 过程介绍

MyPBX发送SDP给B时,会把步骤-1协商好的最优编码放置于SDP编码的首位.

若B不支持SDP包中的任一编码,B返回488告知MyPBX.

若B支持SDP包中的任一编码,选择最优编码,返回SDP告知MyPBX.(yealink话机返回的SDP信息中,只包括一个最优编码,而不是支持的所有编码)

 

[2012-10-08 01:20:41] NOTICE[1755]:chan_sip.c:6964 sip_new: sip_new set owner to chan(16494596 SIP/505-00000015)

Audio is at 192.168.5.44 port 11122

Adding codec 0x4 (ulaw) to SDP

Adding codec 0x8 (alaw) to SDP

Adding codec 0x1000 (g722) to SDP

Adding codec 0x100 (g729) to SDP

Adding non-codec 0x1 (telephone-event) toSDP

Reliably Transmitting (no NAT) to192.168.4.135:5064:

INVITE sip:[email protected]:5064 SIP/2.0

Via: SIP/2.0/UDP192.168.5.44:5060;branch=z9hG4bK722c5489;rport

Max-Forwards: 70

From: "500"<sip:[email protected]>;tag=as08bd0ae7

To: <sip:[email protected]:5064>

Contact: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 102 INVITE

User-Agent: MyPBX

Date: Mon, 08 Oct 2012 09:20:41 GMT

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE,REFER, SUBSCRIBE, NOTIFY, INFO

Supported: replaces, timer

Content-Type: application/sdp

Content-Length: 334

 

v=0

o=root 1318995263 1318995263 IN IP4 192.168.5.44

s=Asterisk PBX SVN--r284M

c=IN IP4 192.168.5.44

t=0 0

m=audio 11122 RTP/AVP 0 8 9 18 101

a=rtpmap:0 PCMU/8000

a=rtpmap:8 PCMA/8000

a=rtpmap:9 G722/8000

a=rtpmap:18 G729/8000

a=fmtp:18 annexb=no

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-16

a=ptime:20

a=sendrecv

 

---

   -- Called 505

<--- SIP read from UDP:192.168.4.135:5064--->

SIP/2.0 100 Trying

Via: SIP/2.0/UDP192.168.5.44:5060;branch=z9hG4bK722c5489;rport=5060

From: "500"<sip:[email protected]>;tag=as08bd0ae7

To: <sip:[email protected]:5064>

Call-ID: [email protected]

CSeq: 102 INVITE

User-Agent: Yealink SIP-T26P 6.43.0.3000:15:65:12:0a:13

Content-Length: 0

MyPBX*CLI>

 

<--- SIP read fromUDP:192.168.4.135:5064 --->

SIP/2.0 180 Ringing

Via: SIP/2.0/UDP192.168.5.44:5060;branch=z9hG4bK722c5489;rport=5060

From: "500" <sip:[email protected]>;tag=as08bd0ae7

To:<sip:[email protected]:5064>;tag=1711960062

Call-ID: [email protected]

CSeq: 102 INVITE

Contact: <sip:[email protected]:5064>

User-Agent: Yealink SIP-T26P 6.43.0.3000:15:65:12:0a:13

Allow-Events: talk,hold,conference,refer,check-sync

Content-Length: 0

 

<------------->

--- (10 headers 0 lines) ---

   -- SIP/505-00000015 is ringing

<--- Transmitting (no NAT) to192.168.4.18:5062 --->

SIP/2.0 180 Ringing

Via: SIP/2.0/UDP192.168.4.18:5062;branch=z9hG4bK1993271819;received=192.168.4.18

From: "500"<sip:[email protected]>;tag=1071929271

To: <sip:[email protected]>;tag=as686c9fe2

Call-ID: [email protected]

CSeq: 2 INVITE

Server: MyPBX

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE,REFER, SUBSCRIBE, NOTIFY, INFO

Supported: replaces, timer

Contact: <sip:[email protected]>

Content-Length: 0

 

<--- SIP read fromUDP:192.168.4.135:5064 --->

SIP/2.0 200 OK

Via: SIP/2.0/UDP192.168.5.44:5060;branch=z9hG4bK722c5489;rport=5060

From: "500"<sip:[email protected]>;tag=as08bd0ae7

To:<sip:[email protected]:5064>;tag=1711960062

Call-ID: [email protected]

CSeq: 102 INVITE

Contact: <sip:[email protected]:5064>

Content-Type: application/sdp

Allow: INVITE, INFO, PRACK, ACK, BYE,CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE

User-Agent: Yealink SIP-T26P 6.43.0.3000:15:65:12:0a:13

Content-Length: 213

 

v=0

o=- 20094 20094 IN IP4 192.168.4.135

s=SDP data

c=IN IP4 192.168.4.135

t=0 0

m=audio 11786 RTP/AVP 0 101

a=rtpmap:0 PCMU/8000

a=sendrecv

a=ptime:20

a=fmtp:101 0-15

a=rtpmap:101 telephone-event/8000

 

<------------->

--- (11 headers 11 lines) ---

Found RTP audio format 0

Found RTP audio format 101

Found audio description format PCMU for ID0

Found audio description formattelephone-event for ID 101

[2012-10-08 01:21:05] NOTICE[549]:chan_sip.c:8805 process_sdp: p(17279900)->owner(8253986) Capabilities:

[2012-10-08 01:21:05] NOTICE[549]:chan_sip.c:8806 process_sdp: us       - 0x110c (ulaw|alaw|g729|g722)

[2012-10-08 01:21:05] NOTICE[549]:chan_sip.c:8807 process_sdp: peer     -0x4 (ulaw)

[2012-10-08 01:21:05] NOTICE[549]:chan_sip.c:8808 process_sdp: combined - 0x4 (ulaw)

[2012-10-08 01:21:05] NOTICE[549]:chan_sip.c:8810 process_sdp: owner:SIP/505-00000015 nativeformats:4readformat:4

 writeformat:4

Non-codec capabilities (dtmf): us - 0x1(telephone-event), peer - 0x1 (telephone-event), combined - 0x1(telephone-event)

Peer audio RTP is at port192.168.4.135:11786

[2012-10-08 01:21:05] NOTICE[549]:chan_sip.c:8955 process_sdp: p(87769132)->owner:SIP/505-00000015nativeformats:4 readformat:4

 writeformat:4

list_route: hop:<sip:[email protected]:5064>

set_destination: Parsing<sip:[email protected]:5064> for address/port to send to

set_destination: set destination to192.168.4.135, port 5064

Transmitting (no NAT) to192.168.4.135:5064:

ACK sip:[email protected]:5064 SIP/2.0

Via: SIP/2.0/UDP192.168.5.44:5060;branch=z9hG4bK30190331;rport

Max-Forwards: 70

From: "500" <sip:[email protected]>;tag=as08bd0ae7

To:<sip:[email protected]:5064>;tag=1711960062

Contact: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 102 ACK

User-Agent: MyPBX

Content-Length: 0

猜你喜欢

转载自blog.csdn.net/daitu3201/article/details/80234301
sip