[Asterisk-Dev] Using an additional modem to get CallerID information
Conroy, Lawrence (SMTP)
lwc at roke.co.uk
Sun Feb 1 07:09:48 MST 2004
SOre point; I have one, but Caller-ID doesn't work in the UK (we don't
DO bellcore over here), so it's no f*ing use.
Not all of us live in the U.S of A - hard to believe, but true.
atb,
Lawrence
On 31 Jan 2004, at 5:41 pm, Brian West wrote:
> Now thats an ugly hack. Why not just get an X100P :P
>
> bkw
>
>
> On Sat, 31 Jan 2004, Jonathan McHarg wrote:
>
>> There are two stages in the process of getting callerID information
>> from a
>> standard modem, to be used in Asterisk. The first stage is actually
>> capturing the information from the modem, the second stage is
>> importing the
>> captured data into Asterisk.
>>
>> Capturing the caller ID details from the modem
>>
>> I will presume at this stage, that you have a modem that supports
>> caller ID
>> and it is installed and configured to work with your Linux box.
>>
>> Here is my first script that reads the details in...
>>
>> #!/usr/bin/perl
>> $PortName = "/dev/ttyn00";
>> $PortObj = open(MODEM,$PortName) || die "Can't open $PortName: $!\n";
>> while (1==1) {
>> local $/ = "\n";
>> while ($line=<MODEM>) {
>> chomp;
>> if ($line =~ s/NMBR = //) {
>> open(OUTFILE, ">/usr/src/myperl/callerid.txt") or die "Can't
>> open
>> callerid.txt: $!";
>> print OUTFILE "$line";
>> close OUTFILE;
>> };
>> }
>> }
>>
>> depending on your setup, you'll need to amend the $portName variable
>> to
>> point to the port that you've installed the modem on. You also may
>> want to
>> change the path that the callerid.txt file is written to.
>>
>> Once the script is written, used the chmod A+X callerid.pl to change
>> the
>> mode so that the program can be executed.
>>
>> Finally run the program with & parameter, to spawn the program as a
>> new
>> process.
>>
>>
>> Using the callerid.txt file in Asterisk
>>
>> Once the callerid.pl file has captured the callerid data, the number
>> needs
>> to be loaded into asterisk. This is done using AGI functions within
>> asterisk.
>>
>> Firstly create a perl script as follows.
>>
>> #!/usr/bin/perl
>> open(INFILE, "/usr/src/myperl/callerid.txt") or die "cannot open
>> file";
>> if ($callerID=<INFILE>) {
>> print "SET CALLERID $callerID"};
>> close INFILE;
>>
>> once created, this script should be placed in the AGI directory.
>>
>> Finally add a line to your extensions.conf file to call this script,
>> an
>> example line would be.
>>
>> Exten=>_.,1,agi,getcallerid.pl
>>
>> Hopefully, this should now leave you with CID working !!
>>
> _______________________________________________
> Asterisk-Dev mailing list
> Asterisk-Dev at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-dev
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
>
--
Registered Office: Roke Manor Research Ltd, Siemens House, Oldbury, Bracknell,
Berkshire. RG12 8FZ
The information contained in this e-mail and any attachments is confidential to
Roke Manor Research Ltd and must not be passed to any third party without
permission. This communication is for information only and shall not create or
change any contractual relationship.
More information about the asterisk-dev
mailing list