Re: [asterisk-users] SIP Disconnects from Network - Asterisk Does not hangup

2010-02-28 Thread Olle E. Johansson

27 feb 2010 kl. 08.26 skrev Olle E. Johansson:

> 
> 26 feb 2010 kl. 22.02 skrev JT:
> 
>> Hmmm I agree that altering sip.conf with the RTP timeouts are somewhat 
>> of a band-aid to the issue.  But in my observations there is one clear 
>> indicator that I am shocked is not used.
>> 
>> When I have done this test - pulling the network cable on a device during a 
>> call - Asterisk actually reports that the SIP device has become unreachable 
>> within seconds of the device's removal.
>> 
>> Now one would think, just like a regular phone company, if one device became 
>> unresponsive (unreachable), the call would be automatically dropped.  Like 
>> unplugging from a POTS while on a call.
>> 
>> So why would Asterisk not use the following logic:  
>> Is Device reachable?
>> Yes - Do nothing
>> 
>> No - Close all calls bridged to device
>> 
>> Seems that would solve the issue quickly and cleanly... perhaps with the RTP 
>> timeout being an additional measure of safety
>> 
>> Is this an issue present in the latest version of Asterisk?  My hope was it 
>> was simply an older bug, fixed at some later trunk.
> 
> 
> If there's a reason to send SIP messages during the call and they fail, the 
> call WILL be hung up.
> Reading the 1.4 RTP source code, I don't think we're checking the return 
> codes of the network writes.
> Now,  that can be very tricky. For a call with NAT, we will have to send 
> packets that fail until we receive something from the other end. I am just 
> brainstorming here, but we could have a flag set when we've received RTp 
> packets from the other end and from that moment start reacting on the result 
> codes of the sendto() call. If it's indicating network issues, we could 
> possibly have an option to tear the call down after a certain amount of 
> failures.
> 
> And no, I can't explain why someone hasn't thought of that. I think it would 
> be a good addition.

And after a few hours of hacking I know more. If the incoming channel dies, 
there will be no attempts at sending, so we won't have any network issues at 
all. The RTP channel in Asterisk is clocked on incoming media. The RTP timeouts 
we have today is the only solution for normally bridged calls.

The p2p rtp bridge behaves a bit differently and I think I found a bug in it, 
so I will have to investigate that part a bit more.

Now, we could hang up calls based on device status if needed. I have part of 
that code in the peerfailover branch.

/O
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] SIP Disconnects from Network - Asterisk Does not hangup

2010-02-26 Thread Olle E. Johansson

26 feb 2010 kl. 22.02 skrev JT:

> Hmmm I agree that altering sip.conf with the RTP timeouts are somewhat of 
> a band-aid to the issue.  But in my observations there is one clear indicator 
> that I am shocked is not used.
> 
> When I have done this test - pulling the network cable on a device during a 
> call - Asterisk actually reports that the SIP device has become unreachable 
> within seconds of the device's removal.
> 
> Now one would think, just like a regular phone company, if one device became 
> unresponsive (unreachable), the call would be automatically dropped.  Like 
> unplugging from a POTS while on a call.
> 
> So why would Asterisk not use the following logic:  
> Is Device reachable?
> Yes - Do nothing
> 
> No - Close all calls bridged to device
> 
> Seems that would solve the issue quickly and cleanly... perhaps with the RTP 
> timeout being an additional measure of safety
> 
> Is this an issue present in the latest version of Asterisk?  My hope was it 
> was simply an older bug, fixed at some later trunk.


If there's a reason to send SIP messages during the call and they fail, the 
call WILL be hung up.
Reading the 1.4 RTP source code, I don't think we're checking the return codes 
of the network writes.
Now,  that can be very tricky. For a call with NAT, we will have to send 
packets that fail until we receive something from the other end. I am just 
brainstorming here, but we could have a flag set when we've received RTp 
packets from the other end and from that moment start reacting on the result 
codes of the sendto() call. If it's indicating network issues, we could 
possibly have an option to tear the call down after a certain amount of 
failures.

And no, I can't explain why someone hasn't thought of that. I think it would be 
a good addition.

/O





-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] SIP Disconnects from Network - Asterisk Does not hangup

2010-02-26 Thread JT
Hmmm I agree that altering sip.conf with the RTP timeouts are somewhat
of a band-aid to the issue.  But in my observations there is one clear
indicator that I am shocked is not used.

When I have done this test - pulling the network cable on a device during a
call - Asterisk actually reports that the SIP device has become unreachable
within seconds of the device's removal.

Now one would think, just like a regular phone company, if one device became
unresponsive (unreachable), the call would be automatically dropped.  Like
unplugging from a POTS while on a call.

So why would Asterisk not use the following logic:
Is Device reachable?
Yes - Do nothing

No - Close all calls bridged to device

Seems that would solve the issue quickly and cleanly... perhaps with the RTP
timeout being an additional measure of safety

Is this an issue present in the latest version of Asterisk?  My hope was it
was simply an older bug, fixed at some later trunk.
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] SIP Disconnects from Network - Asterisk Does not hangup

2010-02-23 Thread Leonja Cerebro
Hello,
worst aspect is that - if SIP clients do not have such a timeout, and in
that case if killing an asterisk and to start it up again -
so it is nothing to do with this asterisk timeout.

Regards,

On 23 February 2010 08:44, Olle E. Johansson  wrote:

>
> 23 feb 2010 kl. 01.47 skrev Kirill 'Big K' Katsnelson:
>
> > On 100222 1313, JT wrote:
> >> When a SIP device dials another SIP device...Asterisk connects the calls
> and
> >> displays the channel information.
> >> If one of those SIP devices hangs up, Asterisk receives the hangup
> notice
> >> and disconnects the call/channel.
> >> However - what does Asterisk do when the network cable is unplugged from
> one
> >> of the SIP devices...?!
> >
> > Jared already mentioned SIP session timers, which are supported starting
> with 1.6. Here's my experience. While I am running 1.6, the software stack
> that is used for agent softphone (PJSIP) does not support the session
> timers. If the softphone crashes in a call, the call would get stuck exactly
> as you describe.
> >
> > I am working around this problem by setting rtp timeouts in sip.conf:
> >
> > [general]
> > rtptimeout=10
> > rtpholdtimeout=300
> >
> > This means that if RTP flow stops while the agent is in the call, the
> call will be disconnected in 10 seconds. If the call was put on hold by the
> agent, it will be disconnected in 300 seconds. Your timeouts may vary.
> >
> > The caveat here is that it is perfectly normal NOT to transmit any RTP
> data in case of long silence.
> Not in Asterisk - we do not really support silence suppression. The
> recommendation is to turn it off on the phones.
>
> > This is why the SIP timers were introduced in the first place: there is
> no correct way to detect when the client is going away, as no activity is a
> good session state.
> >
> > I am able to get away with the small timeout because I set the PJSIP
> client to always transmit RTP, by turning off voice activity detection
> feature (VAD). If you want to support that feature, set rtptimeout as high
> as for how long you allow absolute silence on the line without disconnecting
> it.
>
> Just to complete this discussion - we also have the absolute timeout that
> is a lifesaver in many cases. If you set this to a time that's larger than
> the normal calls, Asterisk will hang up the call. I very often set it to two
> hours, just to make sure that if anything strange happens, all calls will be
> cancelled out at some point.
>
> /O
> --
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
We never did too much talking anyway
So don't think twice, it's all right
--
There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] SIP Disconnects from Network - Asterisk Does not hangup

2010-02-22 Thread Olle E. Johansson

23 feb 2010 kl. 01.47 skrev Kirill 'Big K' Katsnelson:

> On 100222 1313, JT wrote:
>> When a SIP device dials another SIP device...Asterisk connects the calls and
>> displays the channel information.
>> If one of those SIP devices hangs up, Asterisk receives the hangup notice
>> and disconnects the call/channel.
>> However - what does Asterisk do when the network cable is unplugged from one
>> of the SIP devices...?!
> 
> Jared already mentioned SIP session timers, which are supported starting with 
> 1.6. Here's my experience. While I am running 1.6, the software stack that is 
> used for agent softphone (PJSIP) does not support the session timers. If the 
> softphone crashes in a call, the call would get stuck exactly as you describe.
> 
> I am working around this problem by setting rtp timeouts in sip.conf:
> 
> [general]
> rtptimeout=10
> rtpholdtimeout=300
> 
> This means that if RTP flow stops while the agent is in the call, the call 
> will be disconnected in 10 seconds. If the call was put on hold by the agent, 
> it will be disconnected in 300 seconds. Your timeouts may vary.
> 
> The caveat here is that it is perfectly normal NOT to transmit any RTP data 
> in case of long silence.
Not in Asterisk - we do not really support silence suppression. The 
recommendation is to turn it off on the phones.

> This is why the SIP timers were introduced in the first place: there is no 
> correct way to detect when the client is going away, as no activity is a good 
> session state.
> 
> I am able to get away with the small timeout because I set the PJSIP client 
> to always transmit RTP, by turning off voice activity detection feature 
> (VAD). If you want to support that feature, set rtptimeout as high as for how 
> long you allow absolute silence on the line without disconnecting it.

Just to complete this discussion - we also have the absolute timeout that is a 
lifesaver in many cases. If you set this to a time that's larger than the 
normal calls, Asterisk will hang up the call. I very often set it to two hours, 
just to make sure that if anything strange happens, all calls will be cancelled 
out at some point.

/O
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] SIP Disconnects from Network - Asterisk Does not hangup

2010-02-22 Thread Olle E. Johansson

23 feb 2010 kl. 03.18 skrev Kevin P. Fleming:

> Kirill 'Big K' Katsnelson wrote:
> 
>> The caveat here is that it is perfectly normal NOT to transmit any RTP
>> data in case of long silence. This is why the SIP timers were introduced
>> in the first place: there is no correct way to detect when the client is
>> going away, as no activity is a good session state.
> 
> That's only true when Asterisk tells the other endpoint that it is
> allowed to use voice activity detection and silence suppression, which
> at this point it does not do. In spite of that, there are many endpoints
> that do it anyway, which then causes strange problems on calls,
> including calls getting dropped if an RTP timeout is in use.
Well, the headers we use are note really standardized, at least I could not 
find them.
In the RTP rfc's it's perfectly legal to just have gaps in the timestamps and 
stop
sending. However, as both me and Kevin stated, Asterisk does not support it.
On most phones, you can disable silence suppression in the configuration.

/O
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] SIP Disconnects from Network - Asterisk Does not hangup

2010-02-22 Thread Kirill 'Big K' Katsnelson

On 100222 1818, Kevin P. Fleming wrote:

Kirill 'Big K' Katsnelson wrote:


The caveat here is that it is perfectly normal NOT to transmit any RTP
data in case of long silence. This is why the SIP timers were introduced
in the first place: there is no correct way to detect when the client is
going away, as no activity is a good session state.


That's only true when Asterisk tells the other endpoint that it is
allowed to use voice activity detection and silence suppression, which
at this point it does not do. In spite of that, there are many endpoints
that do it anyway, 


Oh yes, I've seen these problems first person, mostly manifesting 
themselves as dropped syllables after a period of silence if not 
complete loss of a call, but I assumed it was not a negotiated option 
but rather left to unilateral decision of an endpoint. Thank you for the 
correction!


 -kkm


smime.p7s
Description: S/MIME Cryptographic Signature
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] SIP Disconnects from Network - Asterisk Does not hangup

2010-02-22 Thread Kevin P. Fleming
Kirill 'Big K' Katsnelson wrote:

> The caveat here is that it is perfectly normal NOT to transmit any RTP
> data in case of long silence. This is why the SIP timers were introduced
> in the first place: there is no correct way to detect when the client is
> going away, as no activity is a good session state.

That's only true when Asterisk tells the other endpoint that it is
allowed to use voice activity detection and silence suppression, which
at this point it does not do. In spite of that, there are many endpoints
that do it anyway, which then causes strange problems on calls,
including calls getting dropped if an RTP timeout is in use.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kflem...@digium.com
Check us out at www.digium.com & www.asterisk.org

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] SIP Disconnects from Network - Asterisk Does not hangup

2010-02-22 Thread Kirill 'Big K' Katsnelson

On 100222 1313, JT wrote:

When a SIP device dials another SIP device...Asterisk connects the calls and
displays the channel information.
If one of those SIP devices hangs up, Asterisk receives the hangup notice
and disconnects the call/channel.


However - what does Asterisk do when the network cable is unplugged from one
of the SIP devices...?!


Jared already mentioned SIP session timers, which are supported starting 
with 1.6. Here's my experience. While I am running 1.6, the software 
stack that is used for agent softphone (PJSIP) does not support the 
session timers. If the softphone crashes in a call, the call would get 
stuck exactly as you describe.


I am working around this problem by setting rtp timeouts in sip.conf:

[general]
rtptimeout=10
rtpholdtimeout=300

This means that if RTP flow stops while the agent is in the call, the 
call will be disconnected in 10 seconds. If the call was put on hold by 
the agent, it will be disconnected in 300 seconds. Your timeouts may vary.


The caveat here is that it is perfectly normal NOT to transmit any RTP 
data in case of long silence. This is why the SIP timers were introduced 
in the first place: there is no correct way to detect when the client is 
going away, as no activity is a good session state.


I am able to get away with the small timeout because I set the PJSIP 
client to always transmit RTP, by turning off voice activity detection 
feature (VAD). If you want to support that feature, set rtptimeout as 
high as for how long you allow absolute silence on the line without 
disconnecting it.


I do not know if these settings are available in 1.2 though.

 -kkm


smime.p7s
Description: S/MIME Cryptographic Signature
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] SIP Disconnects from Network - Asterisk Does not hangup

2010-02-22 Thread Jared Smith
On Mon, 2010-02-22 at 16:13 -0500, JT wrote:
> Is this something that is fixed in an update?  (Currently running 1.2)

Yes... modern versions of Asterisk support SIP session timers.  (If I
remember correctly, Asterisk 1.2 could tear down a call based on lack of
RTP data, but I never found it worked well enough in my tests to warrant
its use.)

--
Jared Smith
Digium, Inc.


-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users