?
Solved

How do I configure BLF in Asterisk to hint a phone is in use to other phones on outbound calls?

Posted on 2009-12-21
23
Medium Priority
?
3,742 Views
Last Modified: 2013-11-12
I've configured BLF in Asterisk with Grandstream GXP2000 phones to light up when a phone receives a call using a subscribecontext in sip.conf but I'm having trouble figuring out how to indicate the phone that made the call is also in use.

With this code, a phone receives a call, it's indicator lights up as expected.  But if a phone makes an outbound call to another extension, the *calling* phone's indicator isn't lighting up.  Must have something to do with that's phones extension not being dialed on an outbound call to indicate the hint?
extensions.conf
[BLF_Group_1]
exten => 103,hint,SIP/phone3
exten => 102,hint,SIP/phone2
exten => 107,hint,SIP/phone7
exten => 105,hint,SIP/phone5
exten => 106,hint,SIP/phone6

Open in new window

0
Comment
Question by:chrisvz94
  • 12
  • 6
  • 5
23 Comments
 
LVL 7

Expert Comment

by:nauliv
ID: 26109435
I have seen the same problem on Asterisk 1.4 & Asterisk 1.6.0 ... The presence is not updated by Asterisk when a SIP user is initiating a call... Which version are you using Chris ?
0
 
LVL 19

Expert Comment

by:feptias
ID: 26112006
Try adding this line to the peer definition of the monitored phone in sip.conf:
call-limit=4

I always find it is necessary to add that if you want extension status to properly update for BLF subscriptions. The CLI command "core show hints" is also very useful for checking what Asterisk knows about the state of each device (and to see how many devices have subscribed to watch the status).
0
 
LVL 7

Expert Comment

by:nauliv
ID: 26116601
Feptias: you are correct in the sense that call-limit is important if you want the BLF feature to work at all. But the problem here is that asterisk only send a SIP-Notify when a SIP device is RINGING/BUSY, but not when a SIP device initiates a call...

However, it'd be interesting to find out if the behavior works with a call-limit=1 ... I'm going to test this.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 19

Expert Comment

by:feptias
ID: 26118596
It works ok on my FreePBX system, but maybe there is extra code added to FreePBX to update the extension status when it is making a call. If I get time later today I will try it on a raw Asterisk server.
0
 
LVL 19

Expert Comment

by:feptias
ID: 26119548
I just tried it with raw Asterisk (version 1.6.1.6) and it works perfectly on that too. If I make a call from an extension to another device - dahdi or SIP - then Asterisk sends a NOTIFY to all subscribing phones as soon as I finish dialling. My subscribing phone is a Grandstream GXP2000 and the BLF lamp comes on for the whole duration of the call - it works like a dream.

If I set sip debug to watch the SIP messages sent to the Grandstream phone then I see a NOTIFY with some xml in the body of the message telling the Grandstream that the calling extension has changed state:
<state>confirmed</state>

The only possibilities I can think of that might explain your problems are:
1. Is the username the same as the device name for your IP phones? i.e. when you run the CLI command "sip show peers" does the first column look like this:
Name/username
4002/4002
4003/4003
4004/4004

2. Is the firmware on the Grandstream GXP phone very old? My phone has firmware version 1.1.6.16

3. Have you included the line subscribecontext=BLF_Group_1 in the sip.conf peer definitions for the subscribing phones?
0
 

Author Comment

by:chrisvz94
ID: 26119915
Thanks everyone for the help so far.  I have not put debugging on in SIP yet to see if the notify comes on for the calling phone....

Feptias, my only difference is that I'm running raw Asterisk version 1.4.26.2.

My Grandstream phones have version 1.2.1.4.  Sip Show Peers has the same username/devicename but it's different than the UserID on the BLF....that's probably my problem....I'll make that change quick and see if it makes a difference.
0
 
LVL 19

Expert Comment

by:feptias
ID: 26120320
It is the hints that really count, not the setting on the phone's BLF keys. For example:
[BLF_Group_1]
exten => 103,hint,SIP/103
exten => 102,hint,SIP/102
etc.

For the BLF key on the phone you would set User ID to 103 and this would match the first hint, which is monitoring the state of device SIP/103. I am unsure what state it was monitoring before when you had it set to "103,hint,SIP/phone3".

The parameter at the end of the hint line should be "SIP/" followed by the peer name as shown in the list of peers using the CLI command "SIP show peers".
0
 
LVL 7

Assisted Solution

by:nauliv
nauliv earned 200 total points
ID: 26120421
feptias, chris:  I tried to replicate the issue on a raw Asterisk 1.6.0.17:

3 SIP devices:
SIP/801
SIP/804
SIP/807

sip.conf template:

[basic](!)
        call-limit=4
        canreinvite=no
        dtmfmode=rfc2833
        type=friend
        canreinvite=no
        host=dynamic
        context=phones
        subscribecontext=phones

sip show peers:

807/807                    192.168.1.156  D          5060     Unmonitored
801/801                    192.168.1.153  D          5060     Unmonitored
804/804                    192.168.1.154  D          5060     Unmonitored


Hints:

exten => *8801,hint,SIP/801
exten => *8804,hint,SIP/804
exten => *8807,hint,SIP/807

On the phones:

SIP/801 watching/subscribe to *8804 and *8807
SIP/804 watching/subscribe to *8801 and *8807
SIP/807 watching/subscribe to *8801 and *8804
 
Here are the different tests I ran:

  • Dial from SIP/804 to SIP/807. 807 picks up and then hang up.
   -- Called 807
  == Extension Changed *8807[phones] new state Ringing for Notify User 801
  == Extension Changed *8807[phones] new state Ringing for Notify User 804
    -- SIP/807 is ringing
    -- SIP/807 answered SIP/804
  == Extension Changed *8807[phones] new state InUse for Notify User 801
  == Extension Changed *8807[phones] new state InUse for Notify User 804
  == Extension Changed *8807[phones] new state Idle for Notify User 801
  == Extension Changed *8807[phones] new state Idle for Notify User 804

Notice how all the notifications are only about 807 (callee) status, but not about 804 (caller) status. This is the same problem as chris is describing: the only notification sent by Asterisk is for the person called. It does not notify subscribers about the fact that 804 is also busy.
  • Other way around: dial from SIP/807 to SIP/804. 804 picks up and then hang up.
   -- Executing [804@phones:2] Dial("SIP/807-a5e33d9c", "SIP/804") in new stack
    -- Called 804
  == Extension Changed *8804[phones] new state Ringing for Notify User 801
  == Extension Changed *8804[phones] new state Ringing for Notify User 807
    -- SIP/804 is ringing
    -- SIP/804 answered SIP/807
  == Extension Changed *8804[phones] new state InUse for Notify User 801
  == Extension Changed *8804[phones] new state InUse for Notify User 807
  == Extension Changed *8804[phones] new state Idle for Notify User 801
  == Extension Changed *8804[phones] new state Idle for Notify User 807

Notice how again all the notifications are only about 804 (callee) status, but nothing about 807 (caller) status.

  • Dial from SIP/804 to an IAX trunk
Not a single "new state" is generated by Asterisk, and therfore not showing that SIP/804 is in use to any other phone.


=====================================================

I'm starting to think it is something due to the Asterisk version, or maybe another config file.
Here is how my sip_notify.conf looks like btw:

[polycom-check-cfg]
Event=>check-sync
Content-Length=>0

; Untested
[sipura-check-cfg]
Event=>resync
Content-Length=>0

; Untested
[grandstream-check-cfg]
Event=>sys-control

; Untested
[cisco-check-cfg]
Event=>check-sync
Content-Length=>0

; Tested
[snom-check-cfg]
Event=>check-sync\;reboot=false
Content-Length=>0

; Tested
[aastra-check-cfg]
Event=>check-sync
Content-Length=>0

; Tested
[aastra-xml]
Event=>aastra-xml
Content-Length=>0


0
 
LVL 19

Expert Comment

by:feptias
ID: 26136979
Have you tried with hints that do not have * as the first character. Asterisk has some "hidden" bugs when it is parsing URI's that start with * so it would be worth testing.
0
 

Author Comment

by:chrisvz94
ID: 26137210
Thanks, Feptias.  My hints do not have the * in front of them.  My results still show that only the called phone gets the notification of inuse.
0
 
LVL 19

Expert Comment

by:feptias
ID: 26139787
The * in front always was a long shot, but I'm struggling to think of an explanation.

I think the problem is related to Asterisk's way of categorising devices and users. When you define a peer in sip.conf, it can be set as "type=peer", "type=user" or "type=friend". The documentation in sip.conf says:
; type = user        a device that authenticates to us by "from" field to place calls
; type = peer        a device we place calls to or that calls us and we match by host
; type = friend two configurations (peer+user) in one

There is also a parameter in sip.conf (at least in the 1.6.1 version) called "counteronpeer" and the documentation in sip.conf for that is:
; Apply call counting on peers only. This will improve status notification when you are using type=friend
; Inbound calls, that really apply to the user part of a friend will now be added to and compared with
; the peer counter instead of applying two call counters, one for the peer and one for the user.

Somehow Asterisk is able to regard the status of a user as being separate from that of the device they are using. This separation is linked to the direction of the call - inbound or outbound. There may be an important difference between 1.6.1 and 1.6.0, but I suspect it is a difference between your configs and mine. Could one of you try changing "type=friend" to "type=peer" on the peer definitions in sip.conf, then restart Asterisk and see if the status notifications change for outbound calls. Also can you post back here the relevant parts of the output for these CLI commands:
sip show peers
sip show users (erase or overwrite any password information from this output)
core show hints
sip show inuse

Those last two commands would be of interest when there is a call in progress and when idle.

By the way, have you added anything to the file /etc/asterisk/users.conf?
0
 
LVL 19

Expert Comment

by:feptias
ID: 26152808
I checked the settings on one of my customer's Asterisk installations that is running version 1.6.0. The parameter "counteronpeer" is available in 1.6.0 and I had set it to:
   counteronpeer = yes
in the general section of sip.conf. My memory is a little hazy on that installation as it was done some time ago, but I think I had problems getting the BLF keys to indicate correct status and that the counteronpeer parameter solved those problems. You should try it.

Also, the CLI command "sip show inuse" sometimes shows a list of users and peers and sometimes it only shows a list of peers. I get the following results on the systems I have access to:
1. Raw Asterisk version 1.6.0 shows users and peers
2. FreePBX appliance running version 1.4.24 shows users and peers
3. Raw Asterisk system running version 1.6.1 only shows peers.

I bet that on your systems it will show both users and peers - I am sure this is the key to your BLF status problem. However, I am not sure if it is settings in the config files or differences in Asterisk versions that causes users and peers to be treated as separate entities.
0
 
LVL 7

Expert Comment

by:nauliv
ID: 26178402
feptias,

great finding!.... type=peercounteronpeer = yes did it on our test platform. it's working fine now on the 1.6 . well I should add that it actually it works well on the local network, but for the phone on remote locations, we see a lot of lights that don't turn off... I guess it's either packet loss, NAT issues, or bug...

chris, should we try this on the 1.4 ? which version are you on ?

0
 
LVL 19

Expert Comment

by:feptias
ID: 26178524
nauliv, do you have qualify=yes set for those remote phones?
0
 

Author Comment

by:chrisvz94
ID: 26179932
I am on version 1.4.26.2.  I will try to set my types as peers but did not see counteronpeer available as a SIP option...will do some research and testing today.
0
 

Author Comment

by:chrisvz94
ID: 26180005
I may have to use "limitonpeer" with version 1.4.....
0
 
LVL 19

Accepted Solution

by:
feptias earned 1800 total points
ID: 26180455
Yes, I think the parameter is "limitonpeer=yes" for version 1.4.x. The following is from a sample sip.conf file generated on a 1.4 Asterisk:

limitonpeers = yes            ; Apply call limits on peers only. This will improve
; status notification when you are using type=friend
0
 
LVL 19

Expert Comment

by:feptias
ID: 26180468
hmm. Just noticed - is it limitonpeer OR limitonpeers. I'm not sure, but you should see a warning when you load the sip.conf file if you are using the wrong one.
0
 
LVL 19

Expert Comment

by:feptias
ID: 26180478
0
 
LVL 7

Expert Comment

by:nauliv
ID: 26196395
feptias:

I have qualify=no for phones on the local network, and qualify=yes for those outside going through internet. And it works on both. Now I'm quite uncertain about the signification of a SOLID vs BLINKING led... I see both behaviors when a conversation occurs: [Clock icon with blinking led], and [Wrong way icon with solid led].

But it definitely change status on incoming/ring as well as outbound-calling events!

0
 

Author Closing Comment

by:chrisvz94
ID: 31668620
Limitonpeers=yes and type=peer in each sip.conf entry fixed this issue.
0
 
LVL 19

Expert Comment

by:feptias
ID: 26197998
nauliv, I am sure you already know this, but for clarification the use of qualify=yes would only help to keep the connection open through NAT and is not directly related to hints, subscriptions or BLF status.

The interpretation of status events by an IP phone will vary from one make of phone to another. The original question was about Grandstream GXP2000 phones, but it sounds like you have something else. I have several different makes of IP phone here for testing (including Grandstream GXP2000), but I don't recognise your description of icons. What phone are you using?

You may need to research status notifications for your make and model of phone. There is quite a lot of info on the voip-info.org wiki. You could start at this page and follow links or do searches to find the info you need:
http://www.voip-info.org/wiki/view/Asterisk+presence
0
 
LVL 7

Expert Comment

by:nauliv
ID: 26198162
feptias:

Absolutely. And that's why the phones on the local network do not have a qualify (no nat) and those going through the internet do have a qualify (they nat).

The phones I'm testing with are all Polycom's (IP550, IP650). It's true each phone will handle the events differently based on the manufacturer's programming. I'm going to try and find out what documentation Polycom has on that, and post my findings on voip-info's wiki.
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So you think no one can listen in on your VOIP conversations, eh? Well... if you haven't setup Secure Real Time Transport (SRTP), your voice communications can be hacked into by just about anyone! First, let's talk about the intended audience for…
Almost all Internet protocol telephones have built-in switches at the back that allow you to connect your personal computer to one port and use the other port to connect your phone to to a Cisco switch.   Why we need to connect the PC to the pho…
Integration Management Part 2
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question