Hi,
i m trying to build smpp server in which i when i reply (using this statement
{reply,{error,?ESME_RINVSYSID,[{system_id,?SYSTEM_ID},{sc_interface_version,Version}]},S#state{rx = [Trx|S#state.rx], tx = [Trx|S#state.tx]}}
from handle_bind()(in server side) function to the esme client,then i m getting error,and the smpp server crashes down,
i received this error
ERROR REPORT==== 10-Jan-2007::12:35:40 ===
** State machine <0.154.0> terminating
** Last event in was {9,
{dict,10,
16,
16,
8,
80,
48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
{{[],
[],
[[sequence_number|1]],
[[command_status|0]],
[[command_id|9],
[system_id,49,54,52,53,54],
[password,112,121,114,111]],
[[system_type],[address_range]],
[],
[],
[],
[[addr_npi|1]],
[],
[],
[],
[],
[[interface_version|52],[addr_ton|1]],
[]}}}}
** When State == open
** Data == {state,<0.112.0>,
gen_smsc,
0,
#Port<0.209>,
56,
0,
undefined,
180000,
undefined,
60000,
undefined,
infinity,
undefined,
60000}
** Reason for termination =
** {error,15}
i have tried with invalid system id, but server should not crash down.
plese suggest me ......so that i can send the error code in better ways to ESME
with out getting system crash.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It would help if you could send me the code on both sides, server and client, in case you are writing both using OSERL, which is my impression. Please also remember that the test_smsc and echo_esme samples provided in the examples directory are just toy examples. A real system should handle crashes and session errors carefully.
For the moment let me say that the response you a sending to handle_bind is perfectly OK. That's the way to return an error code to the other side. It should work. You may wonder though why you want to save the Trx session in the state (since it is not really bound) instead of closing it once you send the INVALID SYSTEM ID response (maybe by issuing a proc_lib:spawn_link(fun() -> gen_smsc:session_stop(Trx) end) before the return value).
Regards,
Quique
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I believe there is a bug in pdu_syntax.erl. A constant that should have been 16#80000000 was actually 16#800000000 (extra zero), which meant that the test in the code below (and also in unpack) always was true, leading to errors when returning non-zero status code and response messages (i.e. with CmdId > 16#80000000):
pack(PduDict, Type) ->
PackBody =
fun (CommandId, CommandStatus, Dict) when CommandStatus == 0;
CommandId < 16#80000000 -> %% THIS WAS 16#800000000
pack_body(Dict, Type#pdu.stds_types, Type#pdu.tlvs_types);
(_CommandId, _CommandStatus, _Dict) ->
% Ignore Body on erroneous responses
{ok, <<>>}
end,
Status = dict:fetch(command_status, PduDict),
SeqNum = dict:fetch(sequence_number, PduDict),
DictResp = dict:fetch(command_id, PduDict),
case DictResp of
CmdId when CmdId == Type#pdu.command_id ->
case PackBody(CmdId, Status, PduDict) of
{ok, Body} ->
Len = size(Body) + 16,
{ok, <<Len:32,CmdId:32,Status:32,SeqNum:32,Body/binary>>};
{error, Error} ->
{error, CmdId, Error, SeqNum}
end;
Other ->
{error, Other, ?ESME_RINVCMDID, SeqNum}
end.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was using the last release of OSERL, Release 1.1. I have the latest CVS code but I am not using it because I was not sure if it was stable. Is it stable and working well? if so I will use it.
Thanks!
Ed
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
i m trying to build smpp server in which i when i reply (using this statement
{reply,{error,?ESME_RINVSYSID,[{system_id,?SYSTEM_ID},{sc_interface_version,Version}]},S#state{rx = [Trx|S#state.rx], tx = [Trx|S#state.tx]}}
from handle_bind()(in server side) function to the esme client,then i m getting error,and the smpp server crashes down,
i received this error
ERROR REPORT==== 10-Jan-2007::12:35:40 ===
** State machine <0.154.0> terminating
** Last event in was {9,
{dict,10,
16,
16,
8,
80,
48,
{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
{{[],
[],
[[sequence_number|1]],
[[command_status|0]],
[[command_id|9],
[system_id,49,54,52,53,54],
[password,112,121,114,111]],
[[system_type],[address_range]],
[],
[],
[],
[[addr_npi|1]],
[],
[],
[],
[],
[[interface_version|52],[addr_ton|1]],
[]}}}}
** When State == open
** Data == {state,<0.112.0>,
gen_smsc,
0,
#Port<0.209>,
56,
0,
undefined,
180000,
undefined,
60000,
undefined,
infinity,
undefined,
60000}
** Reason for termination =
** {error,15}
i have tried with invalid system id, but server should not crash down.
plese suggest me ......so that i can send the error code in better ways to ESME
with out getting system crash.
Hi,
It would help if you could send me the code on both sides, server and client, in case you are writing both using OSERL, which is my impression. Please also remember that the test_smsc and echo_esme samples provided in the examples directory are just toy examples. A real system should handle crashes and session errors carefully.
For the moment let me say that the response you a sending to handle_bind is perfectly OK. That's the way to return an error code to the other side. It should work. You may wonder though why you want to save the Trx session in the state (since it is not really bound) instead of closing it once you send the INVALID SYSTEM ID response (maybe by issuing a proc_lib:spawn_link(fun() -> gen_smsc:session_stop(Trx) end) before the return value).
Regards,
Quique
I believe there is a bug in pdu_syntax.erl. A constant that should have been 16#80000000 was actually 16#800000000 (extra zero), which meant that the test in the code below (and also in unpack) always was true, leading to errors when returning non-zero status code and response messages (i.e. with CmdId > 16#80000000):
pack(PduDict, Type) ->
PackBody =
fun (CommandId, CommandStatus, Dict) when CommandStatus == 0;
CommandId < 16#80000000 -> %% THIS WAS 16#800000000
pack_body(Dict, Type#pdu.stds_types, Type#pdu.tlvs_types);
(_CommandId, _CommandStatus, _Dict) ->
% Ignore Body on erroneous responses
{ok, <<>>}
end,
Status = dict:fetch(command_status, PduDict),
SeqNum = dict:fetch(sequence_number, PduDict),
DictResp = dict:fetch(command_id, PduDict),
case DictResp of
CmdId when CmdId == Type#pdu.command_id ->
case PackBody(CmdId, Status, PduDict) of
{ok, Body} ->
Len = size(Body) + 16,
{ok, <<Len:32,CmdId:32,Status:32,SeqNum:32,Body/binary>>};
{error, Error} ->
{error, CmdId, Error, SeqNum}
end;
Other ->
{error, Other, ?ESME_RINVCMDID, SeqNum}
end.
Which version are You using?
There is no CommandId < 16#80000000 in the CVS versions.
/Anders
I was using the last release of OSERL, Release 1.1. I have the latest CVS code but I am not using it because I was not sure if it was stable. Is it stable and working well? if so I will use it.
Thanks!
Ed
Yes please, use the code from the CVS. It does not include major changes, only some minor bug fixes (like the one you mention) and a few improvements.
Regards,
Quique