ASN.1 decoding problems with H.323

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ASN.1 decoding problems with H.323

Bruce Fitzsimons-2
Hello again,

I am having problems with the ASN.1 per decoding in R7B. If you are familiar
with H323 then this is specifically when the endpointAlias field of the
Gatekeeper contains an E164 alias. It works fine with H323 aliases, but
consistently fails if there is an E164 (telephone number). This is from
several different clients on the sending side, so I don't believe that the
source encoding is faulty.

If someone could give me an hints on debugging the ASN.1 decoding it would
be appreciated. I'm going to start reverse-engineering what its doing
internally...

The decoding failed with reason {function_clause,
                                    [{asn1rt_per_v1,getbit1,[{0,[]}]},
                                     {asn1rt_per_v1,getbits,3},
                                     {asn1rt_per_v1,chars_decode2,5},
                                     {'H323-MESSAGES',dec_AliasAddress,2},
                                     {'H323-MESSAGES',

dec_GatekeeperRequest_endpointAlias_components,
                                         4},

{'H323-MESSAGES',dec_GatekeeperRequest,2},
                                     {'H323-MESSAGES',dec_RasMessage,2},
                                     {asn1rt,decode,3}|
                                     more]}

Cheers,
Bruce

PS Is there any plans for a per_bin option?



Reply | Threaded
Open this post in threaded view
|

ASN.1 decoding problems with H.323

Bertil Karlsson-2
Bruce Fitzsimons wrote:

>
> Hello again,
>
> I am having problems with the ASN.1 per decoding in R7B. If you are familiar
> with H323 then this is specifically when the endpointAlias field of the
> Gatekeeper contains an E164 alias. It works fine with H323 aliases, but
> consistently fails if there is an E164 (telephone number). This is from
> several different clients on the sending side, so I don't believe that the
> source encoding is faulty.
>
> If someone could give me an hints on debugging the ASN.1 decoding it would
> be appreciated. I'm going to start reverse-engineering what its doing
> internally...
>
> The decoding failed with reason {function_clause,
>                                     [{asn1rt_per_v1,getbit1,[{0,[]}]},
>                                      {asn1rt_per_v1,getbits,3},
>                                      {asn1rt_per_v1,chars_decode2,5},
>                                      {'H323-MESSAGES',dec_AliasAddress,2},
>                                      {'H323-MESSAGES',
>
> dec_GatekeeperRequest_endpointAlias_components,
>                                          4},
>
> {'H323-MESSAGES',dec_GatekeeperRequest,2},
>                                      {'H323-MESSAGES',dec_RasMessage,2},
>                                      {asn1rt,decode,3}|
>                                      more]}
Hello,

I did the following in R7B, and it seems to work fine:
> erlc -bper H323-MESSAGES.asn
> erl
Erlang (BEAM) emulator version 5.0.2.4 [threads]

Eshell V5.0.2.4  (abort with ^G)
1> GR =
{'GatekeeperRequest',11111,{1,2,3},asn1_NOVALUE,{'TransportAddress',{ipAddress,[[17,13,19,20],5555]}},{'EndpointType',asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,true,false},asn1_NOVALUE,asn1_NOVALUE,[{e164,[35,48,49,50,51,52,53,54,55,56,57,42,44]}],asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}.
{'GatekeeperRequest',11111,
                     {1,2,3},
                     asn1_NOVALUE,
                   
{'TransportAddress',{ipAddress,[[17,13,19,20],5555]}},
                     {'EndpointType',asn1_NOVALUE,
                                     asn1_NOVALUE,
                                     asn1_NOVALUE,
                                     asn1_NOVALUE,
                                     asn1_NOVALUE,
                                     asn1_NOVALUE,
                                     true,
                                     false},
                     asn1_NOVALUE,
                     asn1_NOVALUE,
                     [{e164,"#0123456789*,"}],
                     asn1_NOVALUE,
                     asn1_NOVALUE,
                     asn1_NOVALUE,
                     asn1_NOVALUE,
                     asn1_NOVALUE,
                     asn1_NOVALUE,
                     asn1_NOVALUE}
2> asn1rt:encode('H323-MESSAGES','GatekeeperRequest',GR).
{ok,[8,43,102,2,42,3,0,17,13,19,20,21,179,1,0,1,6,0,3,69,103,137,171,193,32]}
3>
asn1rt:decode('H323-MESSAGES','GatekeeperRequest',[8,43,102,2,42,3,0,17,13,19,20,21,179,1,0,1,6,0,3,69,103,137,171,193,32]).
{ok,{'GatekeeperRequest',11111,
                         {1,2,3},
                         asn1_NOVALUE,
                         {ipAddress,{'TransportAddress_ipAddress',
                                        [17,13,19,20],
                                        5555}},
                         {'EndpointType',
                             asn1_NOVALUE,
                             asn1_NOVALUE,
                             asn1_NOVALUE,
                             asn1_NOVALUE,
                             asn1_NOVALUE,
                             asn1_NOVALUE,
                             true,
                             false},
                         asn1_NOVALUE,
                         asn1_NOVALUE,
                         [{e164,"#0123456789*,"}],
                         asn1_NOVALUE,
                         asn1_NOVALUE,
                         asn1_NOVALUE,
                         asn1_NOVALUE,
                         asn1_NOVALUE,
                         asn1_NOVALUE,
                         asn1_NOVALUE}}

Maybe is not my encoding values enough realistic?

I have not done any tests on an unpatched R7B. The version I have used
includes an update of the ASN.1 compiler, which will be released as open
source in about a week. If you have an Erlang licens it is available for
download.


> PS Is there any plans for a per_bin option?
Yes, we are developing a verion that uses the bit syntax. The plan is to
include it in R8.

Regards,
Bertil

--
  ------------------------
  Bertil Karlsson

  Ericsson Utvecklings AB
  Box 1505
  SE-125 25 ?lvsj?
  SWEDEN

  Phone: +46 8 727 3927
  ------------------------


Reply | Threaded
Open this post in threaded view
|

ASN.1 decoding problems with H.323

Bruce Fitzsimons-2
Hi Bertil, thanks for the reply

> Maybe is not my encoding values enough realistic?
Your example is fine. Thanks for the effort, I should have done the same in
my original email.

> I have not done any tests on an unpatched R7B. The version I have used
> includes an update of the ASN.1 compiler, which will be released as open
> source in about a week. If you have an Erlang licens it is available for
> download.

My version seems to encode okay, but the decode (using your values) fails in
the same way as documented in my previous mail:

(gk)5>
asn1rt:decode('H323-MESSAGES','GatekeeperRequest',[8,43,102,2,42,3,0,17,13,1
9,20,21,179,1,0,1,6,0,3,69,103,137,171,193,32]).
{error,{function_clause,[{asn1rt_per_v1,getbit1,[{0,[]}]},
                         {asn1rt_per_v1,getbits,3},
                         {asn1rt_per_v1,chars_decode2,5},
                         {'H323-MESSAGES',dec_AliasAddress,2},
                         {'H323-MESSAGES',
                             dec_GatekeeperRequest_endpointAlias_components,
                             4},
                         {'H323-MESSAGES',dec_GatekeeperRequest,2},
                         {asn1rt,decode,3},
                         {erl_eval,expr,3}|
                         more]}}

So it seems the original R7B-2 decoder had some problems, and I'm going to
stop spelunking the code as its already been fixed :-)

> PS Is there any plans for a per_bin option?
> Yes, we are developing a version that uses the bit syntax. The plan is to
> include it in R8.

Great. More speed would be nice :-)

Thanks again for your response Bertil, at least I know that it can work - I
will be waiting anxiously for the next release.

Cheers,
Bruce