[Home]

Summary:ASTERISK-07143: No ringing state notification
Reporter:Marcus Graf (graffiti)Labels:
Date Opened:2006-06-10 08:35:05Date Closed:2006-08-25 14:28:19
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Subscriptions
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk-blf.txt
Description:I've spent some nights now trying to get ringing notification working. I've read several messages that it works fine for some people and studied their configuration examples but I always get the following effects.

In the docs "type=friend" is explained as a combination of peer and user. But for SUBSCRIBE/NOTIFY there seems to be a large difference:

If I configure the phones as type=friend notification doesn't work at all. (The phone gets *only one* single notify immediately after subscription.) The state inside asterisk seems to be never updated. E.g. if I call extension 101 from extension 103 nothing happens. While extension 101 is ringing "show hints" displays the state of both phones as idle and there is no notification sent to the third phone.

asterisk*CLI> show hints
-= Registered Asterisk Dial Plan Hints =-
1000 : SIP/1000 State:Idle Watchers 1
103 : SIP/mobile State:Idle Watchers 1
101 : SIP/marcus State:Idle Watchers 1

With type=peer it works better - but not perfect.

First with call-limit=1

-= Registered Asterisk Dial Plan Hints =-
1000 : SIP/1000 State:Idle Watchers 1
103 : SIP/mobile State:Busy Watchers 1
101 : SIP/marcus State:Busy Watchers 1

And with call-limit=2:

-= Registered Asterisk Dial Plan Hints =-
1000 : SIP/1000 State:Idle Watchers 1
103 : SIP/mobile State:InUse Watchers 1
101 : SIP/marcus State:InUse Watchers 1

In both cases the notifies are sent and the corresponding LEDs on the third phone are on. I think this is correct for the state shown by Asterisk - but the question is: Why does Asterisk refuses to indicate a ringing state?

I've also set notifyringing=yes for all phones but it doesn't change anything.

Just to be sure I've checked with "sip debug peer 1000" and found no NOTIFY messages from asterisk indicating a ringing state.

During the tests I've reduced my configuration files to a minimum. See attached file.

Maybe I've overlooked something really trivial...

Ciao
Marcus


****** ADDITIONAL INFORMATION ******

System:
SuSE Linux 10.0
Asterisk 1.2.7.1 and 1.2.8
Zaptel 1.2.6
Libpri 1.2.3
spandsp-0.0.2pre25
mISDN
Comments:By: Olle Johansson (oej) 2006-06-12 10:13:08

Run "sip show inuse" to see the states. Subscriptions are to peers and peers are used for outbound calls. Notifyringing is only a global setting in the general section of sip.conf

By: Marcus Graf (graffiti) 2006-06-12 15:54:00

In the meantime I've updated to 1.2.9.1. No change.

Just to clarify - I dont't talk about registration, the problem is a missing notifications for state "early"

1. The phone with extension 1000 subscribes for notifications concerning extension 101

-------------------------------------------------------------------------

<-- SIP read from 192.168.172.235:5060:
SUBSCRIBE sip:101@192.168.172.11;user=phone SIP/2.0
Via: SIP/2.0/UDP 192.168.172.235:5060;branch=z9hG4bKbb897e31b8da9530
From: <sip:1000@192.168.172.11>;tag=0a646e4efb2d2f0e
To: <sip:101@192.168.172.11;user=phone>
Contact: <sip:1000@192.168.172.235:5060>
Authorization: Digest username="1000", realm="asterisk", algorithm=MD5, uri="sip:101@192.168.172.11;user=p", nonce="77bddcbd", response="efbf6808e2d357cf0d439cc88e4bba7a"
Call-ID: 2566e8c3f5ac1a4c@192.168.172.235
CSeq: 1102 SUBSCRIBE
User-Agent: Grandstream GXP2000 1.1.0.13
Max-Forwards: 70
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK
Event: dialog
Expires: 900
Accept: application/dialog-info+xml
Content-Length: 0


--- (15 headers 0 lines)---
Found peer '1000'
Looking for 101 in default (domain 192.168.172.11)
Scheduling destruction of call '2566e8c3f5ac1a4c@192.168.172.235' in 910000 ms
Transmitting (no NAT) to 192.168.172.235:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.172.235:5060;branch=z9hG4bKbb897e31b8da9530;received=192.168.172.235
From: <sip:1000@192.168.172.11>;tag=0a646e4efb2d2f0e
To: <sip:101@192.168.172.11;user=phone>;tag=as441b2fe8
Call-ID: 2566e8c3f5ac1a4c@192.168.172.235
CSeq: 1102 SUBSCRIBE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Expires: 900
Contact: <sip:101@192.168.172.11>;expires=900
Content-Length: 0


---
Reliably Transmitting (no NAT) to 192.168.172.235:5060:
NOTIFY sip:1000@192.168.172.11 SIP/2.0
Via: SIP/2.0/UDP 192.168.172.11:5060;branch=z9hG4bK3bfc5b8e
From: <sip:101@192.168.172.11;user=phone>;tag=as441b2fe8
To: <sip:1000@192.168.172.11>;tag=0a646e4efb2d2f0e
Contact: <sip:101@192.168.172.11>
Call-ID: 2566e8c3f5ac1a4c@192.168.172.235
CSeq: 102 NOTIFY
User-Agent: Asterisk PBX
Max-Forwards: 70
Event: dialog
Content-Type: application/dialog-info+xml
Subscription-State: active
Content-Length: 205

<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="0" state="full" entity="sip:101@192.168.172.11">
<dialog id="101">
<state>terminated</state>
</dialog>
</dialog-info>

-------------------------------------------------------------------------

If the phones are configureas as "type=friend" in sip.conf this is the only notification that is ever send. The state shown by "show hints" is always idle.

If the phone is set to "type=peer" there are further notifications.

This is the first thing that is not clear to me. Following the docs the type friend should combine user and peer. So why are notifications sent to a peer but not to a friend?


2. If I call phone 101 - i.e. phone 101 is ringing - Asterisk sends a notifications to phone 1000:

-------------------------------------------------------------------------
Reliably Transmitting (no NAT) to 192.168.172.235:5060:
NOTIFY sip:1000@192.168.172.235:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.172.11:5060;branch=z9hG4bK4ba14774
From: <sip:101@192.168.172.11;user=phone>;tag=as441b2fe8
To: <sip:1000@192.168.172.11>;tag=0a646e4efb2d2f0e
Contact: <sip:101@192.168.172.11>
Call-ID: 2566e8c3f5ac1a4c@192.168.172.235
CSeq: 103 NOTIFY
User-Agent: Asterisk PBX
Max-Forwards: 70
Event: dialog
Content-Type: application/dialog-info+xml
Subscription-State: active
Content-Length: 204

<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="1" state="full" entity="sip:101@192.168.172.11">
<dialog id="101">
<state>confirmed</state>
</dialog>
</dialog-info>
-------------------------------------------------------------------------

The phone is only *ringing* but asterisk sends state "confirmed". IMHO this should be state "early". (global_notifyringing is true, see below)

If I pick up phone 101 there is no notification sent. There is no distinction between "phone is being called" and "phone is busy/in use"

After hangup Asterisk sends the "terminated" notification:

-------------------------------------------------------------------------
Reliably Transmitting (no NAT) to 192.168.172.235:5060:
NOTIFY sip:1000@192.168.172.235:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.172.11:5060;branch=z9hG4bK1ae02d12
From: <sip:101@192.168.172.11;user=phone>;tag=as441b2fe8
To: <sip:1000@192.168.172.11>;tag=0a646e4efb2d2f0e
Contact: <sip:101@192.168.172.11>
Call-ID: 2566e8c3f5ac1a4c@192.168.172.235
CSeq: 104 NOTIFY
User-Agent: Asterisk PBX
Max-Forwards: 70
Event: dialog
Content-Type: application/dialog-info+xml
Subscription-State: active
Content-Length: 205

<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="2" state="full" entity="sip:101@192.168.172.11">
<dialog id="101">
<state>terminated</state>
</dialog>
</dialog-info>

-------------------------------------------------------------------------

"sip show settings" says:

Global Signalling Settings:
---------------------------
...
 Notify ringing state:   Yes

But Asterisk does not send a ringing state to the phones.

According to RFC 3261 section 12 I would expect an notification with state "early".

C is not "my" language but let's have a look at the function "transmit_state_notify" (chan_sip.c starting at line 5047)

...
       switch (state) {
       case (AST_EXTENSION_RINGING | AST_EXTENSION_INUSE):
               if (global_notifyringing)
                       statestring = "early";
               else
                       statestring = "confirmed";
               local_state = NOTIFY_INUSE;
               pidfstate = "busy";
               pidfnote = "Ringing";
               break;
       case AST_EXTENSION_RINGING:
               statestring = "early";
               local_state = NOTIFY_INUSE;
               pidfstate = "busy";
               pidfnote = "Ringing";
               break;
...

It looks to me that there is a clear distinction between "Ringing" and "On the phone". If global_notifyringing is true the state "early" should be sent.

But I dont't see why this does not happen :-(

Ciao
Marcus

By: Serge Vecher (serge-v) 2006-06-12 19:45:12

Marcus: please always attach long logs as attachments. Thanks.

By: Olle Johansson (oej) 2006-06-27 11:46:02

did you run "sip show inuse" to see whether the status is set? Also, "show hints" is good for debugging.

By: Serge Vecher (serge-v) 2006-08-25 14:28:18

no response from the reporter. If you are able to reproduce with latest Asterisk release, please reopen only when you are ready to provide debugging information requested.