Tuesday 25 September 2012

Nortel BCM <-> Asterisk

Nortel BCM <-> Asterisk

I've recently been working on linking our Nortel BCM 400 and Nortel BCM 50s to an Asterisk server to allow SIP DIDs and SIP trunks.


When the BCM sends calls to Asterisk it specifies the context in the call.  This code will remove it.

Contents of /var/lib/asterisk/agi-bin/bcm-fix.pl


#!/usr/bin/perl
#
# Strip extra data out of BCM calls to allow them to work with Asterisk.
#
#

use Asterisk::AGI;
my $AGI = new Asterisk::AGI;

$SIG{HUP} = "IGNORE";

my $destination = $ARGV[0];
$destination =~ s/;phone-context.*//g;

$AGI->exec('Dial','Local/' . $destination . '@from-internal');
exit(0);




Custom context for inbound BCM calls:


[from-internal-bcm]
exten => _.phone-context.,1,AGI(bcm-fix.pl,${EXTEN})
include => from-internal