在248方面就上在论坛上的等级一样,我是新手上路,有些问题我实在是琢磨不透,故发此贴,期待达人相助!
关于 context,国家标准里翻译的是 关联。
场景:A 呼叫 B。
刚开始我一直将关联理解为 把A端和 B端连接起来,A和B之间的“那根线”就是关联,后来我发现我错了,因为在看消息流的时候我蓦然发现原来A端的ContextID和B端的ContextID不一样!
这就是说我以前的理解是错误的,否则A端的ContextID和B端的ContextID应该是一样的。
那现在我只能理解成,关联是把A端的半永久性终端和RTP流终端连接起来了。
但是我看了相关的标准,觉得他们写的实在是没有办法不让你理解成 关联是把A和B连接起来了!
下面是我从RFC3015上copy的。
The maximum number of Terminations in aContext is a MG property. Media gateways that offer only point-to-pointconnectivity might allow at most two Terminations per Context. Media gatewaysthat support multipoint conferences might allow three or more terminations perContext.
3. The MGC programs a Termination in the NULL context. The
terminationId is A4444, the streamId is 1, the requestId in the
Events descriptor is 2222. The mId is the identifier of the sender
of this message, in this case, it is the IP address and port
[123.123.123.4]:55555. Mode for this stream is set to SendReceive.
"al" is the analog line supervision package.
The dialplan script could have been loaded into the MG previously.
Its function would be to wait for the OffHook, turn on dialtone and
start collecting DTMF digits. However in this example, we use the
digit map, which is put into place after the offhook is detected
(step 5 below).
Note that the embedded EventsDescriptor could have been used to
combine steps 3 and 4 with steps 8 and 9, eliminating steps 6 and 7.
5. A similar exchange happens between MG2 and the MGC, resulting in
an idle Termination called A5555.
The following builds upon the previously shown conditions. It
illustrates the transactions from the Media Gateway Controller and
originating Media Gateway (MG1) to get the originating Termination
(A4444) through the stages of digit collection required to initiate a
connection to the terminating Media Gateway (MG2).
6. MG1 detects an offhook event from User 1 and reports it to the
Media Gateway Controller via the Notify Command.
10. Next, digits are accumulated by MG1 as they are dialed by User 1.
Dialtone is stopped upon detection of the first digit. When an
appropriate match is made of collected digits against the currently
programmed Dialplan for A4444, another Notify is sent to the Media
Gateway Controller.
12. The controller then analyses the digits and determines that a
connection needs to be made from MG1 to MG2. Both the TDM termination
A4444, and an RTP termination are added to a new context in MG1. Mode
is ReceiveOnly since Remote descriptor values are not yet specified.
Preferred codecs are in the MGC's preferred order of choice.
nt/jit=40 ; in ms
},
Local {
v=0
c=IN IP4 $
m=audio $ RTP/AVP 4
a=ptime:30
v=0
c=IN IP4 $
m=audio $ RTP/AVP 0
}
}
}
}
}
}
NOTE - The MGC states its preferred parameter values as a series of
sdp blocks in Local. The MG fills in the Local Descriptor in the
Reply.
13. MG1 acknowledges the new Termination and fills in the Local IP
address and UDP port. It also makes a choice for the codec based on
the MGC preferences in Local. MG1 sets the RTP port to 2222.
MEGACO/1 [124.124.124.222]:55555
Reply = 10003 {
Context = 2000 {
Add = A4444,
Add=A4445{
Media {
Stream = 1 {
Local {
v=0
c=IN IP4 124.124.124.222
m=audio 2222 RTP/AVP 4
a=ptime:30
a=recvonly
} ; RTP profile for G.723 is 4
}
}
}
}
}
14. The MGC will now associate A5555 with a new Context on MG2, and
establish an RTP Stream (i.e, A5556 will be assigned), SendReceive
connection through to the originating user, User 1. The MGC also sets
ring on A5555.
17. The two gateways are now connected and User 1 hears the RingBack.
The MG2 now waits until User2 picks up the receiver and then the
two-way call is established.
22. The MGC now sends both MGs a Subtract to take down the call. Only
the subtracts to MG2 are shown here. Each termination has its own set
of statistics that it gathers. An MGC may not need to request both to
be returned. A5555 is a physical termination, and A5556 is an RTP
termination.
MEGACO/1 [125.125.125.111]:55555
Reply = 50009 {
Context = 5000 {
Subtract = A5555 {
Statistics {
nt/os=45123, ; Octets Sent
nt/dur=40 ; in seconds
}
},
Subtract = A5556 {
Statistics {
rtp/ps=1245, ; packets sent
nt/os=62345, ; octets sent
rtp/pr=780, ; packets received
nt/or=45123, ; octets received
rtp/pl=10, ; % packets lost
rtp/jit=27,
rtp/delay=48 ; average latency
}
}
}
}
23. The MGC now sets up both MG1 and MG2 to be ready to detect the
next off-hook event. See step 1. Note that this could be the default
state of a termination in the null context, and if this were the
case, no message need be sent from the MGC to the MG. Once a
termination returns to the null context, it goes back to the default
termination values for that termination.