⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 megaco_call_flow_test.erl

📁 OTP是开放电信平台的简称
💻 ERL
📖 第 1 页 / 共 5 页
字号:
%%----------------------------------------------------------------------msg5a() ->    msg5a(?MGC_MID).msg5a(Mid) ->    msg3(Mid, ?A4444).msg5b() ->    msg5b(?MG2_MID).msg5b(Mid) ->    msg4(Mid, ?A5555).%%----------------------------------------------------------------------%% A.1.2 Collecting Originator Digits and Initiating Termination%%%% 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.%%%% MG1 to MGC:%% MEGACO/1 [124.124.124.222]:55555%% Transaction = 10000 {%%    Context = - {%%        Notify = A4444 {ObservedEvents =2222 {%%          19990729T22000000:al/of}}%%    }%% }%%----------------------------------------------------------------------msg6() ->    msg6(?MG1_MID).msg6(Mid) ->    TimeStamp = #'TimeNotation'{date = "19990729",                                time = "22000000"},    Event = #'ObservedEvent'{eventName = "al/of",                             timeNotation = TimeStamp,                             eventParList = []},    Desc = #'ObservedEventsDescriptor'{requestId = 2222,                                       observedEventLst = [Event]},    NotifyReq = #'NotifyRequest'{terminationID = [#megaco_term_id{id = ?A4444}],                                 observedEventsDescriptor = Desc},    CmdReq = #'CommandRequest'{command = {notifyReq, NotifyReq}},    request(Mid, 10000, ?megaco_null_context_id, [CmdReq]).%%----------------------------------------------------------------------%% 7. And the Notify is acknowledged.%%%% MGC to MG1:%% MEGACO/1 [123.123.123.4]:55555%% Reply = 10000 {%%     Context = - {Notify = A4444}%% }%%----------------------------------------------------------------------msg7() ->    msg7(?MGC_MID).msg7(Mid) ->    Reply = #'NotifyReply'{terminationID = [#megaco_term_id{id = ?A4444}]},    reply(Mid, 10000, ?megaco_null_context_id, [{notifyReply, Reply}]).%%----------------------------------------------------------------------%% 8. The MGC Modifies the termination to play dial tone, and to look for%%    digits now. There is also an embedded event to stop dialtone upon%%    detection of the first digit. dd is the DTMF Detection package, and%%    ce is the completion event.%%----------------------------------------------------------------------%% BUGBUG: Example missing in spec%%----------------------------------------------------------------------%% 9.%%%% MGC to MG1:%% MEGACO/1 [123.123.123.4]:55555%% Transaction = 10001 {%%     Context = - {%%         Modify = A4444 {%%             Events = 2223 {%%                 al/on, dd/ce {DigitMap=Dialplan0}%%             },%%             Signals {cg/dt},%%             DigitMap= Dialplan0{%% (0S| 00S|[1-7]xLxx|8Lxxxxxxx|#xxxxxxx|*xx|9L1xxxxxxxxxx|9L011x.S)}%%         }%%     }%% }%%----------------------------------------------------------------------msg9() ->    msg9(?MGC_MID).msg9(Mid) ->    Name = "dialplan00",    Body = "(0s| 00s|[1-7]xlxx|8lxxxxxxx|#xxxxxxx|*xx|9l1xxxxxxxxxx|9l011x.s)",    Value = #'DigitMapValue'{digitMapBody = Body},    On = #'RequestedEvent'{pkgdName = "al/on", evParList = []},    Action = #'RequestedActions'{eventDM = {digitMapName, Name}},    Ce = #'RequestedEvent'{pkgdName = "dd/ce",                           eventAction = Action,                           evParList = []},    EventsDesc = #'EventsDescriptor'{requestID = 2223,                                     eventList = [On, Ce]},    Signal = #'Signal'{signalName = "cg/rt", sigParList = []},    DigMapDesc = #'DigitMapDescriptor'{digitMapName = Name,                                       digitMapValue = Value},    AmmReq = #'AmmRequest'{terminationID = [#megaco_term_id{id = ?A4444}],                           descriptors = [{eventsDescriptor, EventsDesc},                                          {signalsDescriptor, [{signal, Signal}]},                                          {digitMapDescriptor, DigMapDesc}]},    CmdReq = #'CommandRequest'{command = {modReq, AmmReq}},    request(Mid, 10001, ?megaco_null_context_id, [CmdReq]).%%----------------------------------------------------------------------%% 10. And the Modify is acknowledged.%%%% MG1 to MGC:%% MEGACO/1 [124.124.124.222]:55555%% Reply = 10001 {%%     Context = - {Modify = A4444}%% }%%----------------------------------------------------------------------msg10() ->    msg10(?MG1_MID).msg10(Mid) ->    Reply = #'AmmsReply'{terminationID = [#megaco_term_id{id = ?A4444}]},    reply(Mid, 10001, ?megaco_null_context_id, [{modReply, Reply}]).%%----------------------------------------------------------------------%% 11. Next, digits are accumulated by MG1 as they are dialed by User 1.%%     Dialtone is stopped upon detection of the first digit, using the%%     embedded event in step 8. 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.%%%% MG1 to MGC:%% MEGACO/1 [124.124.124.222]:55555%% Transaction = 10002 {%%    Context = - {%%        Notify = A4444 {ObservedEvents =2223 {%%          19990729T22010001:dd/ce{ds="916135551212"}}}%%    }%% }%%----------------------------------------------------------------------msg11() ->    msg11(?MG1_MID).msg11(Mid) ->    TimeStamp = #'TimeNotation'{date = "19990729",                                time = "22010001"},    Parm = #'EventParameter'{eventParameterName = "ds",                             value = ["916135551212"]},    %% BUGBUG: Quoted string or safe char?    Event = #'ObservedEvent'{eventName = "dd/ce",                             timeNotation = TimeStamp,                             eventParList = [Parm]},    Desc = #'ObservedEventsDescriptor'{requestId = 2223,                                       observedEventLst = [Event]},    NotifyReq = #'NotifyRequest'{terminationID = [#megaco_term_id{id = ?A4444}],                                 observedEventsDescriptor = Desc},    CmdReq = #'CommandRequest'{command = {notifyReq, NotifyReq}},    request(Mid, 10002, ?megaco_null_context_id, [CmdReq]).%%----------------------------------------------------------------------%% 12. And the Notify is acknowledged.%%%% MGC to MG1:%% MEGACO/1 [123.123.123.4]:55555%% Reply = 10002 {%%     Context = - {Notify = A4444}%% }%%----------------------------------------------------------------------msg12() ->    msg12(?MGC_MID).msg12(Mid) ->    Reply = #'NotifyReply'{terminationID = [#megaco_term_id{id = ?A4444}]},    reply(Mid, 10002, ?megaco_null_context_id, [{notifyReply, Reply}]).%%----------------------------------------------------------------------%% 13. 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.%%%% MGC to MG1:%% MEGACO/1 [123.123.123.4]:55555%% Transaction = 10003 {%%     Context = $ {%%        Add = A4444,%%        Add = $ {%%            Media {%%              Stream = 1 {%%                   LocalControl {%%                       Mode = ReceiveOnly,%%%%                       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 prefrred parameter values as a series of%% sdp blocks in Local. The MG fills in the Local Descriptor in the%% Reply.%%----------------------------------------------------------------------msg13() ->    msg13(?MGC_MID).msg13(Mid) ->    AmmReq = #'AmmRequest'{terminationID = [#megaco_term_id{id = ?A4444}],                           descriptors    = []},    CmdReq = #'CommandRequest'{command = {addReq, AmmReq}},    Jit = ?PP("nt/jit", "40"),    LCD = #'LocalControlDescriptor'{streamMode = recvOnly,                                    propertyParms = [Jit]},    V = ?PP("v", "0"),    C = ?PP("c", "IN IP4 $ "),    M = ?PP("m", "audio $ RTP/AVP 4"),    A = ?PP("a", "ptime:30"),    V2 = ?PP("v", "0"),    C2 = ?PP("c", "IN IP4 $ "),    M2 = ?PP("m", "audio $ RTP/AVP 0"),    LD = #'LocalRemoteDescriptor'{propGrps = [[V, C, M, A], [V2, C2, M2]]},    Parms = #'StreamParms'{localControlDescriptor = LCD,                           localDescriptor = LD},    StreamDesc = #'StreamDescriptor'{streamID = 1,                                     streamParms = Parms},    MediaDesc = #'MediaDescriptor'{streams = {multiStream, [StreamDesc]}},    ChooseTid = #megaco_term_id{contains_wildcards = true,                                id = [[?megaco_choose]]},    AmmReq2 = #'AmmRequest'{terminationID = [ChooseTid],                            descriptors   = [{mediaDescriptor, MediaDesc}]},    CmdReq2 = #'CommandRequest'{command = {addReq, AmmReq2}},    request(Mid, 10003, ?megaco_choose_context_id, [CmdReq, CmdReq2]).%%----------------------------------------------------------------------%% 14. 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%%              }%%          }%%       }%%    }%% }%%----------------------------------------------------------------------msg14() ->    msg14(?MG1_MID).msg14(Mid) ->    V = ?PP("v", "0"),    C = ?PP("c", "IN IP4 124.124.124.222"),    M = ?PP("m", "audio 2222 RTP/AVP 4"),    A = ?PP("a", "a=ptime:30"),    A2= ?PP("a", "recvonly"),    LD = #'LocalRemoteDescriptor'{propGrps = [[V, C, M, A, A2]]},    Parms = #'StreamParms'{localDescriptor = LD},    StreamDesc = #'StreamDescriptor'{streamID = 1,                                     streamParms = Parms},    MediaDesc = #'MediaDescriptor'{streams = {multiStream, [StreamDesc]}},    Reply = #'AmmsReply'{terminationID = [#megaco_term_id{id = ?A4444}]},    Reply2 = #'AmmsReply'{terminationID = [#megaco_term_id{id = ?A4445}],                          terminationAudit = [{mediaDescriptor, MediaDesc}]},    reply(Mid, 10003, 2000, [{addReply, Reply}, {addReply, Reply2}]).%%----------------------------------------------------------------------%% 15. 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.%%%% MGC to MG2:%% MEGACO/1 [123.123.123.4]:55555%% Transaction = 50003 {%%     Context = $ {%%        Add = A5555  { Media {%%             Stream = 1 {%%                  LocalControl {Mode = SendReceive} }},%%             Signals {al/ri}%%             },%%        Add  = $ {Media {%%             Stream = 1 {%%                  LocalControl {%%                     Mode = SendReceive,%%                     nt/jit=40 ; in ms%%                  },%%                  Local {%% v=0%% c=IN IP4 $%% m=audio $ RTP/AVP 4%% a=ptime:30%%                  },%%                  Remote {%% v=0%% c=IN IP4 124.124.124.222%% m=audio 2222 RTP/AVP 4%% a=ptime:30%%                  } ; RTP profile for G.723 is 4%%              }%%           }%%       }%%    }%% }%%----------------------------------------------------------------------msg15() ->    msg15(?MGC_MID).msg15(Mid) ->    LCD = #'LocalControlDescriptor'{streamMode = sendRecv,                                    propertyParms = []},    Parms = #'StreamParms'{localControlDescriptor = LCD},    StreamDesc = #'StreamDescriptor'{streamID = 1,                                     streamParms = Parms},    MediaDesc = #'MediaDescriptor'{streams = {multiStream, [StreamDesc]}},    Signal = #'Signal'{signalName = "al/ri",                       sigParList = []},    AmmReq = #'AmmRequest'{terminationID = [#megaco_term_id{id = ?A5555}],                           descriptors   = [{mediaDescriptor, MediaDesc},                                            {signalsDescriptor, [{signal, Signal}]}]},    CmdReq = #'CommandRequest'{command = {addReq, AmmReq}},

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -