[erlang-questions] Please help with MediaDescriptor using Erlang MEGACO

Ludmila Neitman <>
Thu Apr 24 07:53:35 CEST 2008


Hi,

I would like to use Erlang MEGACO stack for the MG emulation in our 
testing environment.
I've been playing with it for about 2 weeks and can compose simple 
messages and send them between MGC and MG (I am using simple example 
provided within the megaco library as a framework). The version I am 
working with is OTP-R12B-2, megaco-3.7.4.

However, I am stuck with the composing a MediaDescriptor within an 
AddReq. It looks like there is a problem with _decompose_StreamParms_ 
function clause.
Could you please point to what is wrong with the following code:

add_req((ConnHandle, Version) ->
   
TermID = {megaco_term_id, false, [[$r, $1], [$1, $0,  $1], [$1]]},

PPV = #'PropertyParm'{name= "v",  value = [["0\r\r"]]},
PPC = #'PropertyParm'{name= "c",  value = ["IN\s\tIP4\s\t10.70.80.50\r\n"]},
PPM = #'PropertyParm'{name= "m", value= 
["audio\s\t4444\s\tRTP\/AVP\s\t0\r\n"]},

PropertyParmGroup = [PPV, PPC, PPM],
RemoteDesc = #'LocalRemoteDescriptor'{propGrps = [PropertyParmGroup]},

StreamParms = #'StreamParms'{remoteDescriptor=RemoteDesc},

MediaDesc = #'MediaDescriptor'{streams={oneStream,SP1}},

AMMR = #'AmmRequest'{terminationID = [TermID],
                                          descriptors = 
[{mediaDescriptor, MediaDesc},
                                                                
{eventsDescriptor, EventsDesc}]},
CR = #'CommandRequest'{command = {addReq, AMMR}},
   
AR = #'ActionRequest'{contextId = ?megaco_choose_context_id,
                                     commandRequests = [CR]},

case megaco:cast(ConnHandle, [AR], [{protocol_version, Version}]) of
    {error, Reason} ->
        d("start -> cast failed, Error: ~n~p Reason: ~n~p", [error, 
Reason]);
    _ ->
        ok
    end.

Also, as simple MediaDescriptor as the one containing only 
LocalControlDescriptor with a SendMode =recvOnly, does not work...:
... 
 LCD1   = #'LocalControlDescriptor'{streamMode=recvOnly},
 SP1    =    #'StreamParms'{localControlDescriptor=LCD1},
 MediaDesc = #'MediaDescriptor'{streams={oneStream,SP1}},
....

I get the following error when I try to run it:

error Reason:
{megaco_pretty_text_encoder,
 [[],
  {'MegacoMessage',asn1_NOVALUE,
   {'Message',3,
    {deviceName,"controller"},
    {transactions,
     [{transactionRequest,
       {'TransactionRequest',1,
        [{'ActionRequest',4294967294,asn1_NOVALUE,asn1_NOVALUE,
          [{'CommandRequest',
            {addReq,
             {'AmmRequest',
              [{megaco_term_id,false,["r1","101","1"]}],
              [{mediaDescriptor,
                {'MediaDescriptor',asn1_NOVALUE,
                 {oneStream,
                  {'StreamDescriptor',1,
                   {'StreamParms',asn1_NOVALUE,asn1_NOVALUE,
                    {'LocalRemoteDescriptor',
                     [[{'PropertyParm',"v",["0\r\r"],asn1_NOVALUE},
                       {'PropertyParm',"c",
                        ["IN \tIP4 \t10.70.80.50\r\r"],
                        asn1_NOVALUE},
                       {'PropertyParm',"m",
                        ["audio \t4444 \tRTP/AVP \t0\r\r"],
                        asn1_NOVALUE}]]}}}}}},
               {eventsDescriptor,
                {'EventsDescriptor',1,
                 [{'RequestedEvent',
                   ["al/of"],
                   asn1_NOVALUE,asn1_NOVALUE,
                   
[{'EventParameter',"strict",["exact"],asn1_NOVALUE}]}]}}]}},
            asn1_NOVALUE,asn1_NOVALUE}]}]}}]}}}],
 {function_clause,
  [{megaco_pretty_text_encoder_v3,decompose_StreamParms,
    [{'StreamDescriptor',1,
      {'StreamParms',asn1_NOVALUE,asn1_NOVALUE,
       {'LocalRemoteDescriptor',
        [[{'PropertyParm',"v",["0\r\r"],asn1_NOVALUE},
          {'PropertyParm',"c",
           ["IN \tIP4 \t10.70.80.50\r\r"],
           asn1_NOVALUE},
          {'PropertyParm',"m",
           ["audio \t4444 \tRTP/AVP \t0\r\r"],
           asn1_NOVALUE}]]}}}]},
   {megaco_pretty_text_encoder_v3,enc_MediaDescriptor,2},
   {megaco_pretty_text_encoder_v3,do_enc_list,5},
   {megaco_pretty_text_encoder_v3,enc_list,4},
   {megaco_pretty_text_encoder_v3,enc_AmmRequest,2},
   {megaco_pretty_text_encoder_v3,enc_Command,2},
   {megaco_pretty_text_encoder_v3,enc_CommandRequest,2},
   {megaco_pretty_text_encoder_v3,do_enc_list,5}]}}

In addition, I tried to put the PropertyParms in the following way:
...
CI = #megaco_sdp_c{ connection_addr="224.2.17.12" },
ML= #megaco_sdp_m{ media="audio",
                                       port=6003, 
                                       num_ports=1,
                                       transport="RTP/AVP", 
                                       fmt_list = ["8", "0"]  },

 PropertyParmGroup = [CI, ML],
...
But, it seems to me that the problem is even before coming to these params.

Thank you,
Ludmila




More information about the erlang-questions mailing list