About | Lab | Neigborhood | Most popular | Help us

Panoramisk / The VoIP druid 

Intercom call to multiple phones

It could sometimes be useful to be able to send a vocal message to a group of phone with the intercom feature. Most IP phones on the market support this feature which allows a call to be automatically answered and its content pushed to the speaker.
What we propose in this article is a solution to distribute a live message to a specific phone group. Such solutions are available on the net but since we haven’t found a complete functional one, we have built our own one on top of an Asterisk 1.4, the conference application and an automatic dialler written as an AGI.

Intercom

First, an intercom call is used to push message to a specific location represented by a phone, this call doesn’t require a human intervention since the phone switch it automatically to its speaker mode. In order to implement this feature in an IP phone, the solution is based on a specific SIP header added in the INVITE message. Whenever the IP phone is configured to evaluate this field1 it accepts automatically the call. Generally the intercom call is presented to the user by a specific ring in order to capture his attention and the microphone is automatically turned off (see also Volontary bug in some SIP IP phones?).

But the intercom feature is not normalized, thus all phones are using something slightly different, it will be important to change the sent message with regards to the IP phone that will get it. The information should be available in manufacturer documentation but is most of the time not easy to find.

Conference bridge

Asterisk is integrating a high value application with its conference bridge one, called MeetMe. This application, using the Zap modules, allows a call to have more than two extremities, it mixes voice and send the mixed flow to each phone.

The solution used in our implementation is to bridge the message call to a bridge with all IP phones that should play the message in intercom mode. In order to limit noise, the talker is unique and can only talk and all intercom phones are in listen mode.

Proposed solution

We are using a dedicated conference room in our solution (the 99) since we would like to have an authentication phase for the speaker. This could be changed towards dynamic rooms if authentication is done outside or simply suppressed. If more than one intercom group would be required, multiple rooms will be provisioned.

First the call from the talker is executing an AGI script that will insert all intercom phones in the room, then the talker is pushed to the conference room itself and asked for authentication. The AGI script should push any phone selected in the conference room and in intercom mode, no authentication is required and no action from user behind each phone. Since more than one phone can be selected, the AGI will create as much calls between the phone and the conference room as required. This will be done by creating a .call file and use the outgoing spool feature of Asterisk.

Sources

Conference room

; for intercom
conf => 99,1234 

Here the room is static and protected by a code that should only be shared with people authorized to push a message, the configuration is stored in meetme.conf.

Getting the call

A specific extension is added in our dial plan for the intercom call, it simply is here to redirect the call to a specific context called meet-talker. In extensions.conf we have:

exten => 635,1,Goto(meet-talker,s,1)

meet-talker context has been created to be able to handle the call closure. Effectively, since using a conference room, when the talker close the call the room should be closed and any intercom phone disconnected automatically.

[meet-talker]
exten => s,1,AGI(push_to_meetintercom,SIP/15,SIP/30)
exten => s,2,Answer()
exten => s,3,MeetMe(99,tq)
exten => h,1,MeetMeAdmin(99,K) 

First we start the AGI script, passing it the list of phone to put in the intercom group, then the talked is directed to the conference room 99 in talk mode only. At the end of the call (h extension), all participants are suppressed from the room with the K option of the MeetMeAdmin command.

The AGI call script

Here written in Perl it doesn’t require anything else but the interpreter. The content of the script is detailed by section:

#!/usr/bin/perl                                                                                                                       

my $outgoingDir  = '/var/spool/asterisk/outgoing';

my %sipHeadersIntercom = (
  "Aastra 5xi" => "Alert-Info: info=alert-autoanswer",
  "Polycom"    => "Alert-Info: Auto Answer",
                          );

my %phones = (
          "SIP/15" => {
              sip => $sipHeadersIntercom{"Polycom"},
              wait => 1,
          },
          "SIP/30" => {
              sip => $sipHeadersIntercom{"Aastra 5xi"},
              wait => 1,
          }
          );
 


First we defined each specific SIP message header that should be sent to IP phone in order to start the intercom mode. Each vendor has its own implementation, thus message are different per phone type, here we have included an Aastra and a Polycom, you will have to continue this table if required.

The second table is a hashed one with any IP phone we have in the installation and that could receive an intercom call. For each extension we have defined the phone type, linked to the first table, and a waiting parameter, expressed in second and which will be used by the dial plan in order to throttle calls2.

foreach my $exten (@ARGV) {
    createCall($exten);
}

sub createCall {
    my ($exten) = @_;
    my $id = $exten;
    $id =~ s/\///g;
    my $file = "$outgoingDir/$$-$id";
    open(CALL, ">>$file" );

    print CALL << "EOF";
Channel: Local/start@meet-and-page
MaxRetries: 1
Retry: 0
RetryTime: 1
Context: meet-and-page
Extension: call
Priority: 1
SetVar: TOCALL=$exten
SetVar: HEADER=$phones{$exten}->{sip}
SetVar: WAIT=$phones{$exten}->{wait}
EOF
;
    close(CALL);
}

Next we start the process. Each phone extension passed as a parameter to the AGI script is used to create a .call file by the function createCall. If a lot of phones are used we could maybe change the approach towards a data base oriented one.


createCall function is creating the .call file which will connect the IP phone in intercom mode and the conference room. The way .call file is working is simple: first a call is created by Asterisk to the Channel one and when this one answers the call, connect it to the Context/Extension/Priority one. We should take care of having the first extremity answering the call automatically, this is why we direct the call to the conference bridge. The Local/start@meet-and-page is used to connect the conference room directly.

The second extremity of the call should target the IP phone but the call requires the specific SIP header in order to toggle the phone in intercom mode. We decided to use a context in the dial plan to perform this action, thus passing back from the AGI the required information in specific variables: TOCALL is the IP phone extension and HEADER is the SIP header to add for the intercom mode.


Each .call file is saved in the spool directory and will be interpreted by Asterisk automatically, nothing special is required for this part.

Intercom call in the dial plan

Now that the .call file is created, we need to build the specific dial plan parts. Here is the one handling the conference room call and the IP phone call:

[meet-and-page]
exten => start,1,Answer()
exten => start,n,MeetMe(99,mql,1234)
exten => start,n,Hangup

exten => call,1,SIPAddHeader(${HEADER})
exten => call,2,Wait(${WAIT})
exten => call,3,Dial(${TOCALL},2)
exten => call,4,Hangup() 

The start part is the first to be called and target the MeetMe application, here executed in listen mode and passing the access code automatically.

The call part is targeting the IP phone. First we need to add the SIP header specific to the called phone, then dus a simple Dial() command to place the intercom call. This part is using the variables set by the AGI script.

Conclusion

Here is a simple approach of an intercom call pushed to a set of IP phones, you would probably have to adapt this to your own usage and need. But it demonstrates that Asterisk is a very good solution to specific user requirements with only out of the box application and small dial plan adaptation.


  1. some are doing this by default, some don’t []
  2. we have seen some phones blocking the intercom if message was sent too fast []
Posted by: Alexandre Chauvin-Hameau, on 09/11/2007
Trackback | Popularity: 32%
tagged , , , , , , and
AddThis Social Bookmark Button
UselessNothing newInformativeLearned a lotAmazingly helpful
Loading ... Loading ...

See also

And why not

Leave a comment

© 2010 Panoramisk | Creative Commons License wordpress logo