hack megaco_text_parser.yrl

Hakan Mattsson <>
Wed Mar 10 17:17:30 CET 2004


On Wed, 10 Mar 2004, Carlos Rodríguez Alcalá Villagra wrote:

Carlos> Thanks for the answer, but it didn't work...

Sorry, I thought of the wrong zero (ascii 48 instead of ascii 0).

What do you think of the raw solution below?

It is an alternate Megaco encoder module that you could use instead
of megaco_compact_text_encoder. (I have not tested it either...)

/Håkan

-module(audio_codes_wrapper).
-behaviour(megaco_encoder).
-export([encode_message/2, decode_message/2]).

encode_message(Config, Msg) ->
    megaco_compact_text_encoder:encode_message(Config, Msg).

decode_message(Config, Bin) when binary(Bin) ->
    Size = size(Bin) - 1,
    case Bin of
	<<Bin2:Size/binary, 0>> ->
	    %% Strip trailing null
	    decode_message(Config, Bin2);
	_ ->
	    megaco_compact_text_encoder:decode_message(Config, Bin)
    end.


This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.

E-mail including attachments is susceptible to data corruption, interruption, unauthorized amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof.




More information about the erlang-questions mailing list