<div dir="ltr"><div><div><div><div>Hello,<br><br></div>Sorry, I still have some problems with sending CCR/CCA messages.  I didn't quite get how to configure multiple diameter applications though it seems clear when I read the diameter protocol.<br>
<br></div>Based on the sample diameter code, I made the following changes, diameter_gen_base_rfc4006_cc is the dictionary generated with rfc4006_cc.dia:<br></div>$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Client $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$<br>
<br>-define(SVC_NAME,     ?MODULE).<br>-define(APP_ALIAS,    ?MODULE).<br>-define(CALLBACK_MOD, client_cb).<br>-define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc).<br><br>-define(L, atom_to_list).<br><br>-define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".<a href="http://example.com">example.com</a>"},<br>
                        {'Origin-Realm', "<a href="http://example.com">example.com</a>"},<br>                        {'Vendor-Id', 0},<br>                        {'Product-Name', "Client"},<br>
                        {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]},<br>                        {application, [{alias, ?APP_ALIAS},<br>                                       {dictionary, ?DIAMETER_DICT_CCRA},<br>
                                       {module, ?CALLBACK_MOD}]}]).<br><br><br><br></div><div>$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Server $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$<br>   <br>-define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc).<br>
<br>init(State) -><br>    SvcName = ?MODULE,<br>    SvcOpts = [{'Origin-Host', atom_to_list(SvcName) ++ ".<a href="http://example.com">example.com</a>"},<br>                {'Origin-Realm', "<a href="http://example.com">example.com</a>"},<br>
                {'Vendor-Id', 193},<br>                {'Product-Name', "Server"},<br>                {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]},<br>                {application, [{alias, ?MODULE},<br>
                               {dictionary, ?DIAMETER_DICT_CCRA},<br>                               {module, server_cb}]}],<br>    TransportOpts = [{transport_module, diameter_tcp},<br>                        {transport_config, [{reuseaddr, true},<br>
                        {ip, {127,0,0,1}}, {port, 3868}]}],<br>    diameter:start(),<br>    diameter:start_service(SvcName, SvcOpts),<br>    diameter:add_transport(SvcName, {listen, TransportOpts}),<br>    erlang:display("Set up diameter server completed!"),<br>
    {ok, State}.<br></div><div><br><div><div><br><br></div><div>I changed the callbacks client_cb and server_cb to handle CCR/CCA messages.<br><br><br></div><div>However, I got the following errors "app_not_configured". It seems the configuration for applications is incorrect. How should I configure the service properly? My understanding is I want to reuse CER/CEA as default authorization application, but the erlang diameter doesn't explain how to do it. Or my understanding is incorrect at all.<br>
<br>=ERROR REPORT==== 20-Mar-2013::21:40:50 ===<br>** Generic server <0.3841.0> terminating <br>** Last message in was {diameter,<br>                           {recv,<br>                               <<1,0,0,124,128,0,1,1,0,0,0,0,101,222,1,72,<br>
                                 101,222,1,72,0,0,1,8,64,0,0,26,99,108,105,<br>                                 101,110,116,46,101,120,97,109,112,108,101,<br>                                 46,99,111,109,0,0,0,0,1,40,64,0,0,19,101,<br>
                                 120,97,109,112,108,101,46,99,111,109,0,0,0,<br>                                 1,1,64,0,0,14,0,1,127,0,0,1,0,0,0,0,1,10,64,<br>                                 0,0,12,0,0,0,193,0,0,1,13,0,0,0,14,67,108,<br>
                                 105,101,110,116,0,0,0,0,1,2,64,0,0,12,0,0,0,<br>                                 0>>}}<br>** When Server state == {state,recv_CER,accept,<0.3840.0>,<0.3842.0>,<br>                            diameter_gen_base_rfc3588,<br>
                            {diameter_service,<0.50.0>,<br>                                {diameter_caps,"<a href="http://server.example.com">server.example.com</a>",<br>                                    "<a href="http://example.com">example.com</a>",<br>
                                    [{127,0,0,1}],<br>                                    193,"Server",[],[],<br>                                    [0],<br>                                    [],[],[],[],[]},<br>
                                [{diameter_app,server,<br>                                     diameter_gen_base_rfc4006_cc,<br>                                     [server_cb],<br>                                     server,4,false,<br>
                                     [{answer_errors,report},<br>                                      {request_errors,answer_3xxx}]}]},<br>                            false,exit}<br>** Reason for termination == <br>** {{badmatch,{error,{app_not_configured,0}}},<br>
    [{diameter_peer_fsm,recv_CER,2,<br>                        [{file,"src/diameter_peer_fsm.erl"},{line,849}]},<br>     {diameter_peer_fsm,build_answer,3,<br>                        [{file,"src/diameter_peer_fsm.erl"},{line,680}]},<br>
     {diameter_peer_fsm,send_answer,3,<br>                        [{file,"src/diameter_peer_fsm.erl"},{line,647}]},<br>     {diameter_peer_fsm,handle_info,2,<br>                        [{file,"src/diameter_peer_fsm.erl"},{line,292}]},<br>
     {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,607}]},<br>     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}<br><br><br></div><div>Could you give me some hints on this issue? The erlang debugger is not easy to use and call stack information is hard to read (when I show the trace window, all the buttons for step/next/continue become invisible). The diameter guidance explains the concept but no clear steps about configuration. <br>
<br><br></div><div>Many thanks!<br><br></div><div>Samuel<br></div></div></div><div class="gmail_extra"><br><br><br><div class="gmail_quote">On Tue, Mar 12, 2013 at 12:10 PM, S X <span dir="ltr"><<a href="mailto:erlangprogram@gmail.com" target="_blank">erlangprogram@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello, Anders & Andre,<br><br></div><div>Thanks a lot for your quick responses and suggestions, which help me start to exploring Erlang world ^_^<br>
<br></div><div>I was able to generate based on the file rfc4006_cc.dia under the diameter/examples/dict folders. And understand a bit why and how Erlang diameter protocol dictionaries are organized and maintained.<br>
<br></div><div>Many thanks and talk to you later!<br><br></div><div>Samuel<br></div></div><div class=""><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 12, 2013 at 7:44 AM, Anders Svensson <span dir="ltr"><<a href="mailto:anders.otp@gmail.com" target="_blank">anders.otp@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Btw, there's an RFC 4006 dictionary (and a few more) under<br>
diameter/examples/dict in the repo.<br>
<br>
/Anders, Erlang/OTP<br>
<div><div><br>
On Tue, Mar 12, 2013 at 10:32 AM, André Graf <<a href="mailto:andre.graf@erl.io" target="_blank">andre.graf@erl.io</a>> wrote:<br>
> Hello S(?)<br>
><br>
> You have to come up with your own .dia file if the message types are<br>
> not covered in the .dia files provided by Erlang. Your own .dia file<br>
> will typically include the  '@inherits diameter_gen_base_rfc3588'<br>
> clause which imports the basic avp's from rfc3588. You then have to<br>
> provide the missing avp's for your CCR/CCA message types, and also<br>
> define these messages. Thanks to the format of a .dia file it is<br>
> pretty much copy-pasting from the rfc4006. Once your .dia file is<br>
> ready, you use diameterc to generate the .erl and .hrl file.<br>
><br>
> Hope that helped!<br>
><br>
> BR/André<br>
><br>
><br>
><br>
> On 12 March 2013 04:58, S X <<a href="mailto:erlangprogram@gmail.com" target="_blank">erlangprogram@gmail.com</a>> wrote:<br>
>> Hello,<br>
>><br>
>> I am new to Erlang and Diameter protocol. Wish someone could provide some<br>
>> suggestions on how to utilize the diameter library properly in Erlang.<br>
>><br>
>> For example, I want to send/receive some Gx messages, like CCR (Credit<br>
>> Control Request), CCA(Credit Control Answer messages. But I notice that<br>
>> there are some predefined messages in erlang diameter library. As my<br>
>> understanding, should use the utility diameterc to generate erlang<br>
>> header/source files based on dia files. There are few dia files under<br>
>> otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, base_rfc3588.dia,<br>
>> relay.dia, base_accounting.dia,  base_rfc6733.dia. Those files don't have<br>
>> the definitions for Gx.<br>
>><br>
>> How should I generate or where can I obtain dia files which have support for<br>
>> CCR/CCA message format? Are the dia files proprietary or manufacturer<br>
>> specific? Can I generate with the 3GPP spec? What are the proper steps?<br>
>><br>
>> Thanks a lot!<br>
>><br>
>> S<br>
>><br>
>><br>
>> _______________________________________________<br>
>> erlang-questions mailing list<br>
>> <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
>><br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>