Megaco woes with ServiceChangeReason = ReasonToken EQUAL VALUE
Micael Karlberg
micael.karlberg@REDACTED
Thu Feb 6 09:36:22 CET 2003
Yes, this was the change we had in mind.
/BMK
Peter-Henry Mander writes:
> Hi Micael,
>
> I have a "solution" which I believe fits the standard wrt.
> serviceChangeReason. I've modified:
>
> otp_src_R8B-2/lib/megaco/src/text/megaco_text_gen.hrl
>
> with a change to enc_serviceChangeReason/2 thus:
>
> enc_serviceChangeReason({reason, Val}, State) ->
> case Val of
> asn1_NOVALUE ->
> [];
> [List] when list(List) ->
> [
> ?ReasonToken,
> ?EQUAL,
> %%enc_Value(List, State) %%%%%%% replace this ...
> enc_QUOTED_STRING(List,State) %% ... with this.
> ]
> end.
>
> Now the Service Change always uses a quoted string for
> serviceChangeReason, as described in the IETF ABNF file comment.
>
> Pete.
>
>
> Peter-Henry Mander wrote:
> > Hi Micael,
> >
> > Yes, this is what I expect too. Allow me to elaborate. Below is the
> > function I
> > use to issue the service change, with a small modification to match the
> > Reason
> > field in your example:
> >
> > service_change(ConnHandle, Method, Reason) ->
> > megaco:call(
> > ConnHandle,
> > [#'ActionRequest'{
> > contextId = ?megaco_null_context_id,
> > commandRequests = [
> > #'CommandRequest'{
> > command = {
> > serviceChangeReq,
> > #'ServiceChangeRequest'{
> > terminationID = [?megaco_root_termination_id],
> > serviceChangeParms = #'ServiceChangeParm'{
> > serviceChangeMethod = Method,
> > serviceChangeReason = ["901 mg cold boot"], %%%
> > mod here
> > serviceChangeVersion = 2
> > }}}}]}],
> > []
> > ).
> >
> > This produces the following message. The serviceChangeReason field
> > format has
> > quotes, similar to your example:
> >
> > MEGACO/1 [10.1.0.200]:2944
> > Transaction = 1 {
> > Context = - {
> > ServiceChange = root {
> > Services {
> > Method = Restart,
> > Version = 2,
> > Reason = "901 mg cold boot"
> > }
> > }
> > }
> > }
> >
> > But if I modify the serviceChangeReason to be a safeChar string, containing
> > digits only, thus:
> >
> > service_change(ConnHandle, Method, Reason) ->
> > megaco:call(
> > ConnHandle,
> > [#'ActionRequest'{
> > contextId = ?megaco_null_context_id,
> > commandRequests = [
> > #'CommandRequest'{
> > command = {
> > serviceChangeReq,
> > #'ServiceChangeRequest'{
> > terminationID = [?megaco_root_termination_id],
> > serviceChangeParms = #'ServiceChangeParm'{
> > serviceChangeMethod = Method,
> > serviceChangeReason = ["901"], %% using safeChar
> > serviceChangeVersion = 2
> > }}}}]}],
> > []
> > ).
> >
> > I get the following result where 901 appears without quotes:
> >
> > MEGACO/1 [10.1.0.200]:2944
> > Transaction = 1 {
> > Context = - {
> > ServiceChange = root {
> > Services {
> > Method = Restart,
> > Version = 2,
> > Reason = 901
> > }
> > }
> > }
> > }
> >
> > So I conjecture that if you change line 32 from ["901 mg col boot"] to
> > ["901"]
> > you too will have a similar result. I think that the comment in the ABNF
> > suggests that even a safeChar string should be formatted with quotes.
> >
> > <rant importance=low>
> > I humbly believe that the comment about serviceChangeReason should have
> > been rewritten as a rule in the IETF's ABNF file to avoid ambiguity, and
> > that Note 1 in Annex B.2 has allowed the IETF to be less than rigourous
> > with their own ABNF code.
> > </rant>
> >
> > Pete.
> >
> > P.s. I modified line 9 in your listing 'cos Mozilla didn't like copying the
> > binary string in ip4Address.
> >
> > Micael Karlberg wrote:
> > 1 Hi,
> > 2
> > 3 I would like to see your erlang message, because when I try,
> > 4 it works just fine. Here's an example:
> > 5
> > 6 Erlang megaco (service change) message
> > 7 {'MegacoMessage',asn1_NOVALUE,
> > 8 {'Message',1,
> > 9 {ip4Address,{'IP4Address',"********",asn1_NOVALUE}},
> > 10 {transactions,
> > 11 [{transactionRequest,
> > 12 {'TransactionRequest',
> > 13 9998,
> > 14 [{'ActionRequest',
> > 15 0,
> > 16 asn1_NOVALUE,
> > 17 asn1_NOVALUE,
> > 18 [{'CommandRequest',
> > 19 {serviceChangeReq,
> > 20 {'ServiceChangeRequest',
> > 21 [{megaco_term_id,
> > 22 false,
> > 23 ["root"]}],
> > 24 {'ServiceChangeParm',
> > 25 restart,
> > 26 {portNumber,
> > 27 55555},
> > 28 asn1_NOVALUE,
> > 29 {'ServiceChangeProfile',
> > 30 "resgw",
> > 31 1},
> > 32 ["901 mg col boot"],
> > 33 asn1_NOVALUE,
> > 34 asn1_NOVALUE,
> > 35 asn1_NOVALUE,
> > 36 asn1_NOVALUE}}},
> > 37 asn1_NOVALUE,
> > 38 asn1_NOVALUE}]}]}}]}}}
> > 39
> > 40 And this is what it looks like pretty-encoded:
> > 41
> > 42 MEGACO/1 [124.124.124.222]
> > 43 Transaction = 9998 {
> > 44 Context = - {
> > 45 ServiceChange = root {
> > 46 Services {
> > 47 Method = Restart,
> > 48 ServiceChangeAddress = 55555,
> > 49 Profile = resgw/1,
> > 50 Reason = "901 mg col boot"
> > 51 }
> > 52 }
> > 53 }
> > 54 }
> > 55
> > 56 And this is what it looks like compact-encoded:
> > 57
> > 58 !/1 [124.124.124.222]
> > 59 T=9998{C=-{SC=root{SV{MT=RS,AD=55555,PF=resgw/1,RE="901 mg col
> > boot"}}}}
> > 60
> > 61
> > 62 Regards,
> > 63 /BMK
> > 64
> > 65 Peter-Henry Mander writes:
> > 66 > Good evening Erlang Megaco gurus,
> > 67 >
> > 68 > I have a question concerning the interpretation of the
> > 69 > serviceChangeReason ABNF description (versions one and two *), which
> > 70 > quotes (**):
> > 71 >
> > 72 > ; A serviceChangeReason consists of a numeric reason code
> > 73 > ; and an optional text description.
> > 74 > ; A serviceChangeReason MUST be encoded using the quotedString
> > 75 > ; form of VALUE.
> > 76 > ; The quotedString SHALL contain a decimal reason code,
> > 77 > ; optionally followed by a single space character and a
> > 78 > ; textual description string.
> > 79 >
> > 80 > serviceChangeReason = ReasonToken EQUAL VALUE
> > 81 >
> > 82 > ... and a little further down we have (***):
> > 83 >
> > 84 > VALUE = quotedString / 1*(SafeChar)
> > 85 >
> > 86 > The Erlang Megaco implementation follows the VALUE spec, not the
> > 87 > quotedString requirement as described in the comment. i.e.
> > 88 >
> > 89 > MEGACO/1 [10.1.0.200]:2944
> > 90 > Transaction = 1 {
> > 91 > Context = - {
> > 92 > ServiceChange = root {
> > 93 > Services {
> > 94 > Method = Restart,
> > 95 > Version = 2,
> > 96 > Reason = 901 <------- 1*(SafeChar)
> > 97 > }
> > 98 > }
> > 99 > }
> > 100 > }
> > 101 >
> > 102 > -OR-
> > 103 >
> > 104 > MEGACO/1 [10.1.0.200]:2944
> > 105 > Transaction = 1 {
> > 106 > Context = - {
> > 107 > ServiceChange = root {
> > 108 > Services {
> > 109 > Method = Restart,
> > 110 > Version = 2,
> > 111 > Reason = "901 Cold Boot" <------- quotedString
> > 112 > }
> > 113 > }
> > 114 > }
> > 115 > }
> > 116 >
> > 117 > But if the comments are followed to the letter (and I understood
> > 118 > correctly) the Reason should be quoted every time, thus:
> > 119 >
> > 120 > MEGACO/1 [10.1.0.200]:2944
> > 121 > Transaction = 1 {
> > 122 > Context = - {
> > 123 > ServiceChange = root {
> > 124 > Services {
> > 125 > Method = Restart,
> > 126 > Version = 2,
> > 127 > Reason = "901" <------- quotedString even when
> > 128 > 1*(SafeChar) matches.
> > 129 > }
> > 130 > }
> > 131 > }
> > 132 > }
> > 133 >
> > 134 > Erlang Megaco is technically correct if the ABNF is stripped of
> > comments
> > 135 > (which is what happens when building the Erlang Megaco stack from the
> > 136 > spec, the ABNF/ASN.1 compiler won't read comments, or am I
> > 137 > underestimating Erlang? :-). It looks as if those knowledgable
> > fellows
> > 138 > of the IETF should have specified:
> > 139 >
> > 140 > serviceChangeReason = ReasonToken EQUAL quotedString (instead of
> > VALUE)
> > 141 >
> > 142 > Am I correct? How do I force Erlang Megaco to _always_ send
> > 143 > quotedString, not just when there are unSafeChars in the string?
> > Is it
> > 144 > strictly necessary to enforce quotedString?
> > 145 >
> > 146 > Help!
> > 147 >
> > 148 > Pete.
> > 149 >
> > 150 > * Versions 1.03 as in draft-ietf-megaco-3015corr-03.txt and 2.03
> > as in
> > 151 > draft-ietf-megaco-h248v2-03.txt
> > 152 >
> > 153 > ** line 6557 in v1.03 and line 7275 in v2.03
> > 154 >
> > 155 > *** line 6623 in v1.03 and 7531in v2.03
> > 156 >
> >
> >
> >
> >
> >
>
>
--
Micael Karlberg Ericsson AB, Älvsjö Sweden
Tel: +46 8 727 5668 EAB/UHK/KD - OTP Product Development
ECN: 851 5668 Mail: micael.karlberg@REDACTED
Fax: +46 8 727 5775
More information about the erlang-questions
mailing list