On 09/02/2011 23:31, Dan Le wrote:
Thanks, we'll certainly give it a try. Could you explain what this patch does exactly?

If no RTP has been sent yet, wouldn't stats->recv be 0, and audio_stream_alive() always return TRUE?

Thanks,
Dan

if stats->recv = 0 like stream->last_packet_count (when audio start or payload change _reset_rtp_alive_info() set last_packet_count to 0 and last_packet_time to "now")

So, if there aren't any packets after timeout+1 seconds become:
!(stats->recv!=stream->last_packet_count) && (ms_time(NULL)-stream->last_packet_time>timeout)
=> return False

Is it OK?

Regards

--Michele



On Wed, Feb 9, 2011 at 12:46 PM, damico <[email protected] <mailto:[email protected]>> wrote:

    Hi Dan,
    try this patch... I write it on the fly (without compiling :) )

    I think it should work. I wrote a patch like this for an old
    linphone version.

    I hope it works and fix your issue.

    Regards

    --Michele

    diff --git a/src/audiostream.c b/src/audiostream.c
    index 45764d4..586db87 100644
    --- a/src/audiostream.c
    +++ b/src/audiostream.c
    @@ -144,27 +144,30 @@ ms_time (time_t *t)
     }
     #endif

    +static void _reset_rtp_alive_info(AudioStream * stream){
    +       stream->last_packet_count=0;
    +       stream->last_packet_time=time(NULL);
    +}
    +
     bool_t audio_stream_alive(AudioStream * stream, int timeout){
            RtpSession *session=stream->session;
            const rtp_stats_t *stats=rtp_session_get_stats(session);
    -       if (stats->recv!=0){
    -               if (stream->evq){
    -                       OrtpEvent *ev=ortp_ev_queue_get(stream->evq);
    -                       if (ev!=NULL){
    -                               if
    (ortp_event_get_type(ev)==ORTP_EVENT_RTCP_PACKET_RECEIVED){
- stream->last_packet_time=ms_time(NULL);
    -                               }
    -                               ortp_event_destroy(ev);
    +       if (stats->recv && stream->evq){
    +               OrtpEvent *ev=ortp_ev_queue_get(stream->evq);
    +               if (ev!=NULL){
    +                       if
    (ortp_event_get_type(ev)==ORTP_EVENT_RTCP_PACKET_RECEIVED){
+ stream->last_packet_time=ms_time(NULL);
                            }
    +                       ortp_event_destroy(ev);
                    }
    -               if (stats->recv!=stream->last_packet_count){
    -                       stream->last_packet_count=stats->recv;
    -                       stream->last_packet_time=ms_time(NULL);
    -               }else{
    -                       if
    (ms_time(NULL)-stream->last_packet_time>timeout){
    -                               /* more than timeout seconds of
    inactivity*/
    -                               return FALSE;
    -                       }
    +       }
    +       if (stats->recv!=stream->last_packet_count){
    +               stream->last_packet_count=stats->recv;
    +               stream->last_packet_time=ms_time(NULL);
    +       }else{
    +               if (ms_time(NULL)-stream->last_packet_time>timeout){
    +                       /* more than timeout seconds of inactivity*/
    +                       return FALSE;
                    }
            }
            return TRUE;
    @@ -206,6 +209,7 @@ static void payload_type_changed(RtpSession
    *session, unsigned long data){
            AudioStream *stream=(AudioStream*)data;
            int pt=rtp_session_get_recv_payload_type(stream->session);
            audio_stream_change_decoder(stream,pt);
    +       _reset_rtp_alive_info(stream);
     }

     int audio_stream_start_full(AudioStream *stream, RtpProfile
    *profile, const char *remip,int remport,
    @@ -379,6 +383,8 @@ int audio_stream_start_full(AudioStream
    *stream, RtpProfile *profile, const char
            ms_ticker_attach(stream->ticker,stream->soundread);
            ms_ticker_attach(stream->ticker,stream->rtprecv);

    +       _reset_rtp_alive_info(stream);
    +
            return 0;

     }



    On 09/02/2011 18:08, Dan Le wrote:
    Thanks for the response Simon.

    The RTP timer seems to work great as long as it has received at
    least one RTP packet for the session to start the timer, but if
    the incoming call silently terminates before RTP has started, the
    call remains up indefinitely, which is why I was looking for a
    SIP session timer solution. Is there anything else I could try?

    Thanks,
    Dan



    On Mon, Feb 7, 2011 at 3:29 PM, Simon Morlat
    <[email protected] <mailto:[email protected]>> wrote:

        Hi Dan,

        Actually what is implemented when use_session_timers=1 is
        accepting SIP
        updates and answering correctly to them, but linphone does
        not send any
        SIP update or reINVITE to check the session is alive.
        However it detects loss of RTP streams, after 30 seconds of RTP
        inactivity (RTP and RTCP), then it hangups the call.

        Simon

        Le mardi 01 février 2011 à 19:43 -0500, Dan Le a écrit :
        > Hi, I'm newly joined to the mailing list, and was hoping
        someone could
        > clarify a few things in linphone.
        >
        >
        > There's scattered reports that SIP Session Timers (RFC
        4028) may be
        > supported in linphone, but attempting to enable it, I can't
        seem to
        > trigger it. I'm using version 3.3.2 of linphone.
        >
        >
        > I've set use_session_timers=1 under [sip] in my linphonerc
        config
        > file, and then dial the linphonec agent; after the call
        connects, I
        > kill the call on the originator side. Linphone appears to
        be still in
        > the call, and I would expect after some time, it would send
        a SIP
        > packet to check if the call exists (and subsequently
        terminating the
        > call when it find it no longer exists), but it doesn't, at
        least not
        > after 5min of waiting.
        >
        >
        > I would be grateful for any insights.
        >
        >
        > Thanks,
        > Dan
        > _______________________________________________
        > Linphone-users mailing list
        > [email protected] <mailto:[email protected]>
        > http://lists.nongnu.org/mailman/listinfo/linphone-users



        _______________________________________________
        Linphone-users mailing list
        [email protected] <mailto:[email protected]>
        http://lists.nongnu.org/mailman/listinfo/linphone-users



    _______________________________________________
    Linphone-users mailing list
    [email protected]  <mailto:[email protected]>
    http://lists.nongnu.org/mailman/listinfo/linphone-users


    _______________________________________________
    Linphone-users mailing list
    [email protected] <mailto:[email protected]>
    http://lists.nongnu.org/mailman/listinfo/linphone-users



_______________________________________________
Linphone-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/linphone-users

_______________________________________________
Linphone-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/linphone-users

Reply via email to