Hi Shehan,

change_timers will change the timers settings for incoming sessions at the SMSC level, from then on, every ESME binding to your SMSC will have the new timers.  I'm not sure how you would handle that, since you would need to call change_timers before an ESME binds to your system... this means you need to know in advance which ESME is about to bind, and change the timers appropriately.  It seems a complicated guess :-)

What I was suggesting on previous email was something like the following:

a)  Add handle_accept to the gen_smsc behaviour interface.
 
behaviour_info(callbacks) ->
    [{init, 1},
     {handle_bind, 3},
     {handle_operation, 3},
     {handle_unbind, 3},
     {handle_listen_error, 1},
     {handle_accept, 2},           %% Add this callback
     {handle_call, 3},
     {handle_cast, 2},
     {handle_info, 2},
     {terminate, 2},
     {code_change, 3}];


b) Call handle_accept from gen_smsc:handle_call/3


handle_call({accept, Socket}, _From, S) ->
    pack((S#state.mod):handle_accept(Socket, S#state.mod_state), S);

c) Define the function handle_accept/2 in your smsc callback module

%% @spec handle_accept(Socket, State) -> Result
%%     Socket = socket()
%%     State = term()
%%     Result = {ok, Pid} | {error, Reason}
%%
%% @doc <tt>Pid</tt> is the pid() of the newly created session.
handle_accept(Socket, S) ->
    Timers = get_timers(Socket, S),
    gen_smsc:session_accept(self(), Socket, Timers).


d) Define session_accept/3 in gen_smsc

session_accept(SmscRef, Socket, Timers) ->
    case gen_smsc_session:start(SmscRef, ?MODULE, Socket, Timers) of
        {ok, Session} ->
            gen_tcp:controlling_process(Socket, Session),
            {ok, Session};
        SessionError ->
            SessionError
    end.

Hope this helps a bit more.  Please be warned, I didn't try to compile or test this code.  It might not work.  Take it just as a quick guideline.

Kind regards,

Enrique

On 10/5/06, shehan <shehan@wavenet.lk> wrote:
Hi Enrique,
Tx for the reply. Your assumptions are absolutely correct.
I am writing below methods.
change_timers(ServerRef, TimeVal) ->
    gen_server:call(ServerRef, {change_timers, TimeVal}).


handle_call({change_timers, EnquireVal}, From, S) ->
        #state{timers = Timers} = S,
        NewTimer = #timers{session_init_time =
Timers#timers.session_init_time,
         enquire_link_time = EnquireVal,
         inactivity_time   = Timers#timers.inactivity_time,
         response_time     = Timers#timers.response_time},
        NewState = S#state{timers = NewTimer},
        {reply, ok, NewState}.

& call as gen_smsc:change_timers(Server_name, Enquire_link_dur_value).

Am I correct??

When I run this , enquire link time duration changed. But it is effected
to whole. Not for particular ESME.

Regards,
Shehan

-----Original Message-----
From: mpquique@gmail.com [mailto:mpquique@gmail.com] On Behalf Of
Enrique Marcote
Sent: Wednesday, October 04, 2006 3:52 AM
To: shehan
Cc: oserl-questions@lists.sourceforge.net
Subject: Re: [Oserl-questions] Enquire link time period

Hi Shehan,

I assume your application was built on top of gen_smsc.erl, right?

What you want to do is to accept incoming ESME sessions and set
different timers, depending on the other peer's IP.  Is that correct?

Currently there is no support for that in oserl.  To be honest, never
thought of that need until now.  This means you will need to adapt
oserl yourself to fit your needs.  Shouldn't be hard though.

You might want to take a look at the clause:

handle_call({accept, Socket}, _From, S) ->
        {reply, gen_smsc_session:start(self(), ?MODULE, Socket,
S#state.timers), S};

in gen_smsc.erl.  I would define another callback to the gen_smsc
(handle_accept maybe?) and call it from there.  This callback would
give the control to your callback module letting you add the settings
you want before starting the session.  You could even transfer the
entire responsibility of starting the session to that callback (it
would be up to the callback module to start the session or not).

Hope this helps,

Cheers,

Enrique

On 10/2/06, shehan <shehan@wavenet.lk> wrote:
>
>
>
>
> Hi Enrique
>
> I want to change enquire_link time constant to parameter. For example,
if
> ESME1 connect to smpp server(develop top of oserl), it has 10 sec time
> period between two enquire links. If ESME2 connected to smpp server it
> should have 60 sec time period between two enquire links & If ESME2
> connected it has infinite(disable enquire link) time period between
two
> enquire links.
>
>
>
> How to change oserl source for achieving above purpose?? Pls help to
do
> that??
>
>
>
> Regards,
>
> Shehan
>
------------------------------------------------------------------------
-
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
share your
> opinions on IT & business topics through brief surveys -- and earn
cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
>
> _______________________________________________
> Oserl-questions mailing list
> Oserl-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oserl-questions
>
>
>


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Oserl-questions mailing list
Oserl-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oserl-questions